@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * It uses caching to reduce time for xml parsing .. |
436 | 436 | * @param string $layout |
437 | 437 | * @param object $info |
438 | - * @param string $layoutType (P : PC, M : Mobile) |
|
438 | + * @param string $layout_type (P : PC, M : Mobile) |
|
439 | 439 | * @return object info of layout |
440 | 440 | */ |
441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P") |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | /** |
738 | 738 | * Return a list of images which are uploaded on the layout setting page |
739 | 739 | * @param int $layout_srl |
740 | - * @return array image list in layout |
|
740 | + * @return string[] image list in layout |
|
741 | 741 | */ |
742 | 742 | function getUserLayoutImageList($layout_srl) |
743 | 743 | { |
@@ -892,7 +892,6 @@ discard block |
||
892 | 892 | |
893 | 893 | /** |
894 | 894 | * layout cache |
895 | - * @param int $layout_srl |
|
896 | 895 | * @param string $lang_type |
897 | 896 | * @return string |
898 | 897 | */ |
@@ -972,7 +971,7 @@ discard block |
||
972 | 971 | /** |
973 | 972 | * Temp file list for User Layout |
974 | 973 | * @param int $layout_srl |
975 | - * @return array temp files info |
|
974 | + * @return string[] temp files info |
|
976 | 975 | */ |
977 | 976 | function getUserLayoutTempFileList($layout_srl) |
978 | 977 | { |
@@ -986,7 +985,7 @@ discard block |
||
986 | 985 | /** |
987 | 986 | * Saved file list for User Layout |
988 | 987 | * @param int $layout_srl |
989 | - * @return array files info |
|
988 | + * @return string[] files info |
|
990 | 989 | */ |
991 | 990 | function getUserLayoutFileList($layout_srl) |
992 | 991 | { |
@@ -92,16 +92,14 @@ discard block |
||
92 | 92 | if(count($token) == 2) |
93 | 93 | { |
94 | 94 | $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); |
95 | - } |
|
96 | - else |
|
95 | + } else |
|
97 | 96 | { |
98 | 97 | $thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); |
99 | 98 | } |
100 | 99 | if(is_readable($thumbnailPath)) |
101 | 100 | { |
102 | 101 | $val->thumbnail = $thumbnailPath; |
103 | - } |
|
104 | - else |
|
102 | + } else |
|
105 | 103 | { |
106 | 104 | $val->thumbnail = sprintf('./modules/layout/tpl/img/noThumbnail.png'); |
107 | 105 | } |
@@ -140,8 +138,7 @@ discard block |
||
140 | 138 | if($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
141 | 139 | { |
142 | 140 | $instanceList[] = $iInfo->layout; |
143 | - } |
|
144 | - else |
|
141 | + } else |
|
145 | 142 | { |
146 | 143 | unset($output->data[$no]); |
147 | 144 | } |
@@ -176,8 +173,7 @@ discard block |
||
176 | 173 | $oLayoutAdminController->insertLayout($insertArgs); |
177 | 174 | $isCreateInstance = TRUE; |
178 | 175 | } |
179 | - } |
|
180 | - else |
|
176 | + } else |
|
181 | 177 | { |
182 | 178 | // Get downloaded name list have no instance |
183 | 179 | $noInstanceList = array_diff($downloadedList, $instanceList); |
@@ -230,8 +226,7 @@ discard block |
||
230 | 226 | { |
231 | 227 | $pathPrefix = _XE_PATH_ . 'layouts/'; |
232 | 228 | $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s'; |
233 | - } |
|
234 | - else |
|
229 | + } else |
|
235 | 230 | { |
236 | 231 | $pathPrefix = _XE_PATH_ . 'm.layouts/'; |
237 | 232 | $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s'; |
@@ -241,8 +236,7 @@ discard block |
||
241 | 236 | { |
242 | 237 | list($themeName, $layoutName) = explode('|@|', $layout); |
243 | 238 | $path = sprintf($themePathFormat, $themeName, $layoutName); |
244 | - } |
|
245 | - else |
|
239 | + } else |
|
246 | 240 | { |
247 | 241 | $path = $pathPrefix . $layout; |
248 | 242 | } |
@@ -262,7 +256,9 @@ discard block |
||
262 | 256 | $args = new stdClass(); |
263 | 257 | $args->layout_srl = $layout_srl; |
264 | 258 | $output = executeQuery('layout.getLayout', $args); |
265 | - if(!$output->data) return; |
|
259 | + if(!$output->data) { |
|
260 | + return; |
|
261 | + } |
|
266 | 262 | |
267 | 263 | // Return xml file informaton after listing up the layout and extra_vars |
268 | 264 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); |
@@ -295,20 +291,19 @@ discard block |
||
295 | 291 | if(count($layout_parse) > 1) |
296 | 292 | { |
297 | 293 | $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; |
298 | - } |
|
299 | - else if($layout_name == 'faceoff') |
|
294 | + } else if($layout_name == 'faceoff') |
|
300 | 295 | { |
301 | 296 | $class_path = './modules/layout/faceoff/'; |
302 | - } |
|
303 | - else if($layout_type == "M") |
|
297 | + } else if($layout_type == "M") |
|
304 | 298 | { |
305 | 299 | $class_path = sprintf("./m.layouts/%s/", $layout_name); |
306 | - } |
|
307 | - else |
|
300 | + } else |
|
308 | 301 | { |
309 | 302 | $class_path = sprintf('./layouts/%s/', $layout_name); |
310 | 303 | } |
311 | - if(is_dir($class_path)) return $class_path; |
|
304 | + if(is_dir($class_path)) { |
|
305 | + return $class_path; |
|
306 | + } |
|
312 | 307 | return ""; |
313 | 308 | } |
314 | 309 | |
@@ -321,12 +316,16 @@ discard block |
||
321 | 316 | */ |
322 | 317 | function getDownloadedLayoutList($layout_type = "P", $withAutoinstallInfo = false) |
323 | 318 | { |
324 | - if ($withAutoinstallInfo) $oAutoinstallModel = getModel('autoinstall'); |
|
319 | + if ($withAutoinstallInfo) { |
|
320 | + $oAutoinstallModel = getModel('autoinstall'); |
|
321 | + } |
|
325 | 322 | |
326 | 323 | // Get a list of downloaded layout and installed layout |
327 | 324 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type); |
328 | 325 | $searched_count = count($searched_list); |
329 | - if(!$searched_count) return; |
|
326 | + if(!$searched_count) { |
|
327 | + return; |
|
328 | + } |
|
330 | 329 | |
331 | 330 | // natcasesort($searched_list); |
332 | 331 | // Return information for looping searched list of layouts |
@@ -414,17 +413,20 @@ discard block |
||
414 | 413 | { |
415 | 414 | $directory = './m.layouts'; |
416 | 415 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES'; |
417 | - } |
|
418 | - else |
|
416 | + } else |
|
419 | 417 | { |
420 | 418 | $directory = './layouts'; |
421 | 419 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; |
422 | 420 | } |
423 | 421 | |
424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
422 | + if($GLOBALS[$globalValueKey]) { |
|
423 | + return $GLOBALS[$globalValueKey]; |
|
424 | + } |
|
425 | 425 | |
426 | 426 | $searchedList = FileHandler::readDir($directory); |
427 | - if (!$searchedList) $searchedList = array(); |
|
427 | + if (!$searchedList) { |
|
428 | + $searchedList = array(); |
|
429 | + } |
|
428 | 430 | $GLOBALS[$globalValueKey] = $searchedList; |
429 | 431 | |
430 | 432 | return $searchedList; |
@@ -456,11 +458,17 @@ discard block |
||
456 | 458 | } |
457 | 459 | |
458 | 460 | // Get a path of the requested module. Return if not exists. |
459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
460 | - if(!is_dir($layout_path)) return; |
|
461 | + if(!$layout_path) { |
|
462 | + $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
463 | + } |
|
464 | + if(!is_dir($layout_path)) { |
|
465 | + return; |
|
466 | + } |
|
461 | 467 | |
462 | 468 | // Read the xml file for module skin information |
463 | - if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
469 | + if(!$xml_file) { |
|
470 | + $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
471 | + } |
|
464 | 472 | if(!file_exists($xml_file)) |
465 | 473 | { |
466 | 474 | $layout_info = new stdClass; |
@@ -479,8 +487,7 @@ discard block |
||
479 | 487 | if(!$layout_srl) |
480 | 488 | { |
481 | 489 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); |
482 | - } |
|
483 | - else |
|
490 | + } else |
|
484 | 491 | { |
485 | 492 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType()); |
486 | 493 | } |
@@ -511,10 +518,15 @@ discard block |
||
511 | 518 | $oXmlParser = new XmlParser(); |
512 | 519 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
513 | 520 | |
514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
521 | + if($tmp_xml_obj->layout) { |
|
522 | + $xml_obj = $tmp_xml_obj->layout; |
|
523 | + } elseif($tmp_xml_obj->skin) { |
|
524 | + $xml_obj = $tmp_xml_obj->skin; |
|
525 | + } |
|
516 | 526 | |
517 | - if(!$xml_obj) return; |
|
527 | + if(!$xml_obj) { |
|
528 | + return; |
|
529 | + } |
|
518 | 530 | |
519 | 531 | $buff = array(); |
520 | 532 | $buff[] = '$layout_info = new stdClass;'; |
@@ -540,8 +552,11 @@ discard block |
||
540 | 552 | $buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); |
541 | 553 | |
542 | 554 | // Author information |
543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
544 | - else $author_list = $xml_obj->author; |
|
555 | + if(!is_array($xml_obj->author)) { |
|
556 | + $author_list[] = $xml_obj->author; |
|
557 | + } else { |
|
558 | + $author_list = $xml_obj->author; |
|
559 | + } |
|
545 | 560 | |
546 | 561 | $buff[] = '$layout_info->author = array();'; |
547 | 562 | for($i=0, $c=count($author_list); $i<$c; $i++) |
@@ -554,8 +569,12 @@ discard block |
||
554 | 569 | |
555 | 570 | // Extra vars (user defined variables to use in a template) |
556 | 571 | $extra_var_groups = $xml_obj->extra_vars->group; |
557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
572 | + if(!$extra_var_groups) { |
|
573 | + $extra_var_groups = $xml_obj->extra_vars; |
|
574 | + } |
|
575 | + if(!is_array($extra_var_groups)) { |
|
576 | + $extra_var_groups = array($extra_var_groups); |
|
577 | + } |
|
559 | 578 | |
560 | 579 | $buff[] = '$layout_info->extra_var = new stdClass;'; |
561 | 580 | $extra_var_count = 0; |
@@ -564,7 +583,9 @@ discard block |
||
564 | 583 | $extra_vars = $group->var; |
565 | 584 | if($extra_vars) |
566 | 585 | { |
567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
586 | + if(!is_array($extra_vars)) { |
|
587 | + $extra_vars = array($extra_vars); |
|
588 | + } |
|
568 | 589 | |
569 | 590 | $count = count($extra_vars); |
570 | 591 | $extra_var_count += $count; |
@@ -583,8 +604,12 @@ discard block |
||
583 | 604 | $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
584 | 605 | |
585 | 606 | $options = $var->options; |
586 | - if(!$options) continue; |
|
587 | - if(!is_array($options)) $options = array($options); |
|
607 | + if(!$options) { |
|
608 | + continue; |
|
609 | + } |
|
610 | + if(!is_array($options)) { |
|
611 | + $options = array($options); |
|
612 | + } |
|
588 | 613 | |
589 | 614 | $buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); |
590 | 615 | $options_count = count($options); |
@@ -616,7 +641,9 @@ discard block |
||
616 | 641 | if($xml_obj->menus->menu) |
617 | 642 | { |
618 | 643 | $menus = $xml_obj->menus->menu; |
619 | - if(!is_array($menus)) $menus = array($menus); |
|
644 | + if(!is_array($menus)) { |
|
645 | + $menus = array($menus); |
|
646 | + } |
|
620 | 647 | |
621 | 648 | $menu_count = count($menus); |
622 | 649 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
@@ -624,7 +651,9 @@ discard block |
||
624 | 651 | for($i=0;$i<$menu_count;$i++) |
625 | 652 | { |
626 | 653 | $name = $menus[$i]->attrs->name; |
627 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
654 | + if($menus[$i]->attrs->default == "true") { |
|
655 | + $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
656 | + } |
|
628 | 657 | $buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); |
629 | 658 | $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); |
630 | 659 | $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
@@ -635,8 +664,7 @@ discard block |
||
635 | 664 | $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
636 | 665 | } |
637 | 666 | } |
638 | - } |
|
639 | - else |
|
667 | + } else |
|
640 | 668 | { |
641 | 669 | // Layout title, version and other information |
642 | 670 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -655,14 +683,20 @@ discard block |
||
655 | 683 | $buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); |
656 | 684 | // Extra vars (user defined variables to use in a template) |
657 | 685 | $extra_var_groups = $xml_obj->extra_vars->group; |
658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
686 | + if(!$extra_var_groups) { |
|
687 | + $extra_var_groups = $xml_obj->extra_vars; |
|
688 | + } |
|
689 | + if(!is_array($extra_var_groups)) { |
|
690 | + $extra_var_groups = array($extra_var_groups); |
|
691 | + } |
|
660 | 692 | foreach($extra_var_groups as $group) |
661 | 693 | { |
662 | 694 | $extra_vars = $group->var; |
663 | 695 | if($extra_vars) |
664 | 696 | { |
665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
697 | + if(!is_array($extra_vars)) { |
|
698 | + $extra_vars = array($extra_vars); |
|
699 | + } |
|
666 | 700 | |
667 | 701 | $extra_var_count = count($extra_vars); |
668 | 702 | |
@@ -680,9 +714,13 @@ discard block |
||
680 | 714 | $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
681 | 715 | |
682 | 716 | $options = $var->options; |
683 | - if(!$options) continue; |
|
717 | + if(!$options) { |
|
718 | + continue; |
|
719 | + } |
|
684 | 720 | |
685 | - if(!is_array($options)) $options = array($options); |
|
721 | + if(!is_array($options)) { |
|
722 | + $options = array($options); |
|
723 | + } |
|
686 | 724 | $options_count = count($options); |
687 | 725 | for($j=0;$j<$options_count;$j++) |
688 | 726 | { |
@@ -695,14 +733,18 @@ discard block |
||
695 | 733 | if($xml_obj->menus->menu) |
696 | 734 | { |
697 | 735 | $menus = $xml_obj->menus->menu; |
698 | - if(!is_array($menus)) $menus = array($menus); |
|
736 | + if(!is_array($menus)) { |
|
737 | + $menus = array($menus); |
|
738 | + } |
|
699 | 739 | |
700 | 740 | $menu_count = count($menus); |
701 | 741 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
702 | 742 | for($i=0;$i<$menu_count;$i++) |
703 | 743 | { |
704 | 744 | $name = $menus[$i]->attrs->name; |
705 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
745 | + if($menus[$i]->attrs->default == "true") { |
|
746 | + $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
747 | + } |
|
706 | 748 | $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); |
707 | 749 | $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
708 | 750 | $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); |
@@ -724,7 +766,9 @@ discard block |
||
724 | 766 | } |
725 | 767 | |
726 | 768 | FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); |
727 | - if(FileHandler::exists($cache_file)) include($cache_file); |
|
769 | + if(FileHandler::exists($cache_file)) { |
|
770 | + include($cache_file); |
|
771 | + } |
|
728 | 772 | |
729 | 773 | if(!$layout_info->title) |
730 | 774 | { |
@@ -798,7 +842,9 @@ discard block |
||
798 | 842 | */ |
799 | 843 | function getUserLayoutFaceOffCss($layout_srl) |
800 | 844 | { |
801 | - if($this->useUserLayoutTemp == 'temp') return; |
|
845 | + if($this->useUserLayoutTemp == 'temp') { |
|
846 | + return; |
|
847 | + } |
|
802 | 848 | return $this->_getUserLayoutFaceOffCss($layout_srl); |
803 | 849 | } |
804 | 850 | |
@@ -833,7 +879,9 @@ discard block |
||
833 | 879 | if($this->useUserLayoutTemp == 'temp') |
834 | 880 | { |
835 | 881 | $temp = $this->getUserLayoutTempHtml($layout_srl); |
836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp); |
|
882 | + if(FileHandler::exists($temp) === FALSE) { |
|
883 | + FileHandler::copyFile($src,$temp); |
|
884 | + } |
|
837 | 885 | return $temp; |
838 | 886 | } |
839 | 887 | |
@@ -861,7 +909,9 @@ discard block |
||
861 | 909 | if($this->useUserLayoutTemp == 'temp') |
862 | 910 | { |
863 | 911 | $temp = $this->getUserLayoutTempIni($layout_srl); |
864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp); |
|
912 | + if(!file_exists(FileHandler::getRealPath($temp))) { |
|
913 | + FileHandler::copyFile($src,$temp); |
|
914 | + } |
|
865 | 915 | return $temp; |
866 | 916 | } |
867 | 917 | |
@@ -901,8 +951,7 @@ discard block |
||
901 | 951 | if($layout_type=='P') |
902 | 952 | { |
903 | 953 | return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
904 | - } |
|
905 | - else |
|
954 | + } else |
|
906 | 955 | { |
907 | 956 | return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
908 | 957 | } |
@@ -1020,11 +1069,16 @@ discard block |
||
1020 | 1069 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); |
1021 | 1070 | // CSS generated in the layout manager |
1022 | 1071 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); |
1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
1072 | + if($faceoff_layout_css) { |
|
1073 | + Context::addCSSFile($faceoff_layout_css); |
|
1074 | + } |
|
1024 | 1075 | // CSS output for the widget |
1025 | 1076 | Context::loadFile($this->module_path.'/tpl/css/widget.css', true); |
1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1027 | - else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1077 | + if($layout_info->extra_var->colorset->value == 'black') { |
|
1078 | + Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1079 | + } else { |
|
1080 | + Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1081 | + } |
|
1028 | 1082 | // Different page displayed upon user's permission |
1029 | 1083 | $logged_info = Context::get('logged_info'); |
1030 | 1084 | // Display edit button for faceoff layout |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | * @param array $columnList |
32 | 32 | * @return array layout lists in site |
33 | 33 | */ |
34 | - function getLayoutList($site_srl = 0, $layout_type="P", $columnList = array()) |
|
34 | + function getLayoutList($site_srl = 0, $layout_type = "P", $columnList = array()) |
|
35 | 35 | { |
36 | - if(!$site_srl) |
|
36 | + if (!$site_srl) |
|
37 | 37 | { |
38 | 38 | $site_module_info = Context::get('site_module_info'); |
39 | - $site_srl = (int)$site_module_info->site_srl; |
|
39 | + $site_srl = (int) $site_module_info->site_srl; |
|
40 | 40 | } |
41 | 41 | $args = new stdClass(); |
42 | 42 | $args->site_srl = $site_srl; |
43 | 43 | $args->layout_type = $layout_type; |
44 | 44 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
45 | 45 | |
46 | - foreach($output->data as $no => &$val) |
|
46 | + foreach ($output->data as $no => &$val) |
|
47 | 47 | { |
48 | - if(!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
48 | + if (!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
49 | 49 | { |
50 | 50 | unset($output->data[$no]); |
51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $oLayoutAdminModel = getAdminModel('layout'); |
55 | 55 | $siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl); |
56 | - if($siteDefaultLayoutSrl) |
|
56 | + if ($siteDefaultLayoutSrl) |
|
57 | 57 | { |
58 | 58 | $siteDefaultLayoutInfo = $this->getlayout($siteDefaultLayoutSrl); |
59 | 59 | $newLayout = sprintf('%s, %s', $siteDefaultLayoutInfo->title, $siteDefaultLayoutInfo->layout); |
@@ -80,24 +80,24 @@ discard block |
||
80 | 80 | $layoutList = $this->getLayoutInstanceList($siteSrl, $layoutType); |
81 | 81 | $thumbs = array(); |
82 | 82 | |
83 | - foreach($layoutList as $key => $val) |
|
83 | + foreach ($layoutList as $key => $val) |
|
84 | 84 | { |
85 | - if($thumbs[$val->layouts]) |
|
85 | + if ($thumbs[$val->layouts]) |
|
86 | 86 | { |
87 | 87 | $val->thumbnail = $thumbs[$val->layouts]; |
88 | 88 | continue; |
89 | 89 | } |
90 | 90 | |
91 | 91 | $token = explode('|@|', $val->layout); |
92 | - if(count($token) == 2) |
|
92 | + if (count($token) == 2) |
|
93 | 93 | { |
94 | - $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); |
|
94 | + $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png', $token[0], $token[1]); |
|
95 | 95 | } |
96 | 96 | else |
97 | 97 | { |
98 | - $thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); |
|
98 | + $thumbnailPath = sprintf('./layouts/%s/thumbnail.png', $val->layout); |
|
99 | 99 | } |
100 | - if(is_readable($thumbnailPath)) |
|
100 | + if (is_readable($thumbnailPath)) |
|
101 | 101 | { |
102 | 102 | $val->thumbnail = $thumbnailPath; |
103 | 103 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if (!$siteSrl) |
124 | 124 | { |
125 | 125 | $siteModuleInfo = Context::get('site_module_info'); |
126 | - $siteSrl = (int)$siteModuleInfo->site_srl; |
|
126 | + $siteSrl = (int) $siteModuleInfo->site_srl; |
|
127 | 127 | } |
128 | 128 | $args = new stdClass(); |
129 | 129 | $args->site_srl = $siteSrl; |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | |
134 | 134 | // Create instance name list |
135 | 135 | $instanceList = array(); |
136 | - if(is_array($output->data)) |
|
136 | + if (is_array($output->data)) |
|
137 | 137 | { |
138 | - foreach($output->data as $no => $iInfo) |
|
138 | + foreach ($output->data as $no => $iInfo) |
|
139 | 139 | { |
140 | - if($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
140 | + if ($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
141 | 141 | { |
142 | 142 | $instanceList[] = $iInfo->layout; |
143 | 143 | } |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | $downloadedList = array(); |
153 | 153 | $titleList = array(); |
154 | 154 | $_downloadedList = $this->getDownloadedLayoutList($layoutType); |
155 | - if(is_array($_downloadedList)) |
|
155 | + if (is_array($_downloadedList)) |
|
156 | 156 | { |
157 | - foreach($_downloadedList as $dLayoutInfo) |
|
157 | + foreach ($_downloadedList as $dLayoutInfo) |
|
158 | 158 | { |
159 | 159 | $downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout; |
160 | 160 | $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - if($layout) |
|
164 | + if ($layout) |
|
165 | 165 | { |
166 | - if(count($instanceList) < 1 && $downloadedList[$layout]) |
|
166 | + if (count($instanceList) < 1 && $downloadedList[$layout]) |
|
167 | 167 | { |
168 | 168 | $insertArgs = new stdClass(); |
169 | 169 | $insertArgs->site_srl = $siteSrl; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | // Get downloaded name list have no instance |
183 | 183 | $noInstanceList = array_diff($downloadedList, $instanceList); |
184 | - foreach($noInstanceList as $layoutName) |
|
184 | + foreach ($noInstanceList as $layoutName) |
|
185 | 185 | { |
186 | 186 | $insertArgs = new stdClass(); |
187 | 187 | $insertArgs->site_srl = $siteSrl; |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | // If create layout instance, reload instance list |
200 | - if($isCreateInstance) |
|
200 | + if ($isCreateInstance) |
|
201 | 201 | { |
202 | 202 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
203 | 203 | |
204 | - if(is_array($output->data)) |
|
204 | + if (is_array($output->data)) |
|
205 | 205 | { |
206 | - foreach($output->data as $no => $iInfo) |
|
206 | + foreach ($output->data as $no => $iInfo) |
|
207 | 207 | { |
208 | - if(!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
208 | + if (!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
209 | 209 | { |
210 | 210 | unset($output->data[$no]); |
211 | 211 | } |
@@ -226,28 +226,28 @@ discard block |
||
226 | 226 | function isExistsLayoutFile($layout, $layoutType) |
227 | 227 | { |
228 | 228 | //TODO If remove a support themes, remove this codes also. |
229 | - if($layoutType == 'P') |
|
229 | + if ($layoutType == 'P') |
|
230 | 230 | { |
231 | - $pathPrefix = _XE_PATH_ . 'layouts/'; |
|
232 | - $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s'; |
|
231 | + $pathPrefix = _XE_PATH_.'layouts/'; |
|
232 | + $themePathFormat = _XE_PATH_.'themes/%s/layouts/%s'; |
|
233 | 233 | } |
234 | 234 | else |
235 | 235 | { |
236 | - $pathPrefix = _XE_PATH_ . 'm.layouts/'; |
|
237 | - $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s'; |
|
236 | + $pathPrefix = _XE_PATH_.'m.layouts/'; |
|
237 | + $themePathFormat = _XE_PATH_.'themes/%s/m.layouts/%s'; |
|
238 | 238 | } |
239 | 239 | |
240 | - if(strpos($layout, '|@|') !== FALSE) |
|
240 | + if (strpos($layout, '|@|') !== FALSE) |
|
241 | 241 | { |
242 | 242 | list($themeName, $layoutName) = explode('|@|', $layout); |
243 | 243 | $path = sprintf($themePathFormat, $themeName, $layoutName); |
244 | 244 | } |
245 | 245 | else |
246 | 246 | { |
247 | - $path = $pathPrefix . $layout; |
|
247 | + $path = $pathPrefix.$layout; |
|
248 | 248 | } |
249 | 249 | |
250 | - return is_readable($path . '/layout.html'); |
|
250 | + return is_readable($path.'/layout.html'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $args = new stdClass(); |
263 | 263 | $args->layout_srl = $layout_srl; |
264 | 264 | $output = executeQuery('layout.getLayout', $args); |
265 | - if(!$output->data) return; |
|
265 | + if (!$output->data) return; |
|
266 | 266 | |
267 | 267 | // Return xml file informaton after listing up the layout and extra_vars |
268 | 268 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $args = new stdClass(); |
276 | 276 | $args->layout_srl = $layout_srl; |
277 | 277 | $output = executeQuery('layout.getLayout', $args, $columnList); |
278 | - if(!$output->toBool()) |
|
278 | + if (!$output->toBool()) |
|
279 | 279 | { |
280 | 280 | return; |
281 | 281 | } |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | function getLayoutPath($layout_name = "", $layout_type = "P") |
293 | 293 | { |
294 | 294 | $layout_parse = explode('|@|', $layout_name); |
295 | - if(count($layout_parse) > 1) |
|
295 | + if (count($layout_parse) > 1) |
|
296 | 296 | { |
297 | 297 | $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; |
298 | 298 | } |
299 | - else if($layout_name == 'faceoff') |
|
299 | + else if ($layout_name == 'faceoff') |
|
300 | 300 | { |
301 | 301 | $class_path = './modules/layout/faceoff/'; |
302 | 302 | } |
303 | - else if($layout_type == "M") |
|
303 | + else if ($layout_type == "M") |
|
304 | 304 | { |
305 | 305 | $class_path = sprintf("./m.layouts/%s/", $layout_name); |
306 | 306 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | $class_path = sprintf('./layouts/%s/', $layout_name); |
310 | 310 | } |
311 | - if(is_dir($class_path)) return $class_path; |
|
311 | + if (is_dir($class_path)) return $class_path; |
|
312 | 312 | return ""; |
313 | 313 | } |
314 | 314 | |
@@ -326,24 +326,24 @@ discard block |
||
326 | 326 | // Get a list of downloaded layout and installed layout |
327 | 327 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type); |
328 | 328 | $searched_count = count($searched_list); |
329 | - if(!$searched_count) return; |
|
329 | + if (!$searched_count) return; |
|
330 | 330 | |
331 | 331 | // natcasesort($searched_list); |
332 | 332 | // Return information for looping searched list of layouts |
333 | 333 | $list = array(); |
334 | - for($i=0;$i<$searched_count;$i++) |
|
334 | + for ($i = 0; $i < $searched_count; $i++) |
|
335 | 335 | { |
336 | 336 | // Name of the layout |
337 | 337 | $layout = $searched_list[$i]; |
338 | 338 | // Get information of the layout |
339 | 339 | $layout_info = $this->getLayoutInfo($layout, null, $layout_type); |
340 | 340 | |
341 | - if(!$layout_info) |
|
341 | + if (!$layout_info) |
|
342 | 342 | { |
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
346 | - if($withAutoinstallInfo) |
|
346 | + if ($withAutoinstallInfo) |
|
347 | 347 | { |
348 | 348 | // get easyinstall remove url |
349 | 349 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($layout_info->path); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $layout_info->need_update = $package[$packageSrl]->need_update; |
355 | 355 | |
356 | 356 | // get easyinstall update url |
357 | - if($layout_info->need_update) |
|
357 | + if ($layout_info->need_update) |
|
358 | 358 | { |
359 | 359 | $layout_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl); |
360 | 360 | } |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function sortLayoutByTitle($a, $b) |
373 | 373 | { |
374 | - if(!$a->title) |
|
374 | + if (!$a->title) |
|
375 | 375 | { |
376 | 376 | $a->title = $a->layout; |
377 | 377 | } |
378 | 378 | |
379 | - if(!$b->title) |
|
379 | + if (!$b->title) |
|
380 | 380 | { |
381 | 381 | $b->title = $b->layout; |
382 | 382 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $aTitle = strtolower($a->title); |
385 | 385 | $bTitle = strtolower($b->title); |
386 | 386 | |
387 | - if($aTitle == $bTitle) |
|
387 | + if ($aTitle == $bTitle) |
|
388 | 388 | { |
389 | 389 | return 0; |
390 | 390 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | function _getInstalledLayoutDirectories($layoutType = 'P') |
412 | 412 | { |
413 | - if($layoutType == 'M') |
|
413 | + if ($layoutType == 'M') |
|
414 | 414 | { |
415 | 415 | $directory = './m.layouts'; |
416 | 416 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES'; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; |
422 | 422 | } |
423 | 423 | |
424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
424 | + if ($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
425 | 425 | |
426 | 426 | $searchedList = FileHandler::readDir($directory); |
427 | 427 | if (!$searchedList) $searchedList = array(); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | */ |
441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P") |
442 | 442 | { |
443 | - if($info) |
|
443 | + if ($info) |
|
444 | 444 | { |
445 | 445 | $layout_title = $info->title; |
446 | 446 | $layout = $info->layout; |
@@ -448,35 +448,35 @@ discard block |
||
448 | 448 | $site_srl = $info->site_srl; |
449 | 449 | $vars = unserialize($info->extra_vars); |
450 | 450 | |
451 | - if($info->module_srl) |
|
451 | + if ($info->module_srl) |
|
452 | 452 | { |
453 | - $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/','',$info->layout_path); |
|
453 | + $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/', '', $info->layout_path); |
|
454 | 454 | $xml_file = sprintf('%sskin.xml', $layout_path); |
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
458 | 458 | // Get a path of the requested module. Return if not exists. |
459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
460 | - if(!is_dir($layout_path)) return; |
|
459 | + if (!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
460 | + if (!is_dir($layout_path)) return; |
|
461 | 461 | |
462 | 462 | // Read the xml file for module skin information |
463 | - if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
464 | - if(!file_exists($xml_file)) |
|
463 | + if (!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
464 | + if (!file_exists($xml_file)) |
|
465 | 465 | { |
466 | 466 | $layout_info = new stdClass; |
467 | 467 | $layout_info->title = $layout; |
468 | 468 | $layout_info->layout = $layout; |
469 | 469 | $layout_info->path = $layout_path; |
470 | 470 | $layout_info->layout_title = $layout_title; |
471 | - if(!$layout_info->layout_type) |
|
471 | + if (!$layout_info->layout_type) |
|
472 | 472 | { |
473 | - $layout_info->layout_type = $layout_type; |
|
473 | + $layout_info->layout_type = $layout_type; |
|
474 | 474 | } |
475 | 475 | return $layout_info; |
476 | 476 | } |
477 | 477 | |
478 | 478 | // Include the cache file if it is valid and then return $layout_info variable |
479 | - if(!$layout_srl) |
|
479 | + if (!$layout_srl) |
|
480 | 480 | { |
481 | 481 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); |
482 | 482 | } |
@@ -485,22 +485,22 @@ discard block |
||
485 | 485 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType()); |
486 | 486 | } |
487 | 487 | |
488 | - if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) |
|
488 | + if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
489 | 489 | { |
490 | 490 | include($cache_file); |
491 | 491 | |
492 | - if($layout_info->extra_var && $vars) |
|
492 | + if ($layout_info->extra_var && $vars) |
|
493 | 493 | { |
494 | - foreach($vars as $key => $value) |
|
494 | + foreach ($vars as $key => $value) |
|
495 | 495 | { |
496 | - if(!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
496 | + if (!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
497 | 497 | { |
498 | 498 | $layout_info->{$key} = $value; |
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | - if(!$layout_info->title) |
|
503 | + if (!$layout_info->title) |
|
504 | 504 | { |
505 | 505 | $layout_info->title = $layout; |
506 | 506 | } |
@@ -511,16 +511,16 @@ discard block |
||
511 | 511 | $oXmlParser = new XmlParser(); |
512 | 512 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
513 | 513 | |
514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
514 | + if ($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
515 | + elseif ($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
516 | 516 | |
517 | - if(!$xml_obj) return; |
|
517 | + if (!$xml_obj) return; |
|
518 | 518 | |
519 | 519 | $buff = array(); |
520 | 520 | $buff[] = '$layout_info = new stdClass;'; |
521 | 521 | $buff[] = sprintf('$layout_info->site_srl = "%s";', $site_srl); |
522 | 522 | |
523 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
523 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
524 | 524 | { |
525 | 525 | // Layout title, version and other information |
526 | 526 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -540,11 +540,11 @@ discard block |
||
540 | 540 | $buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); |
541 | 541 | |
542 | 542 | // Author information |
543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
543 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
544 | 544 | else $author_list = $xml_obj->author; |
545 | 545 | |
546 | 546 | $buff[] = '$layout_info->author = array();'; |
547 | - for($i=0, $c=count($author_list); $i<$c; $i++) |
|
547 | + for ($i = 0, $c = count($author_list); $i < $c; $i++) |
|
548 | 548 | { |
549 | 549 | $buff[] = sprintf('$layout_info->author[%d] = new stdClass;', $i); |
550 | 550 | $buff[] = sprintf('$layout_info->author[%d]->name = "%s";', $i, $author_list[$i]->name->body); |
@@ -554,22 +554,22 @@ discard block |
||
554 | 554 | |
555 | 555 | // Extra vars (user defined variables to use in a template) |
556 | 556 | $extra_var_groups = $xml_obj->extra_vars->group; |
557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
557 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
558 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
559 | 559 | |
560 | 560 | $buff[] = '$layout_info->extra_var = new stdClass;'; |
561 | 561 | $extra_var_count = 0; |
562 | - foreach($extra_var_groups as $group) |
|
562 | + foreach ($extra_var_groups as $group) |
|
563 | 563 | { |
564 | 564 | $extra_vars = $group->var; |
565 | - if($extra_vars) |
|
565 | + if ($extra_vars) |
|
566 | 566 | { |
567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
567 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
568 | 568 | |
569 | 569 | $count = count($extra_vars); |
570 | 570 | $extra_var_count += $count; |
571 | 571 | |
572 | - for($i=0;$i<$count;$i++) |
|
572 | + for ($i = 0; $i < $count; $i++) |
|
573 | 573 | { |
574 | 574 | unset($var, $options); |
575 | 575 | $var = $extra_vars[$i]; |
@@ -580,26 +580,26 @@ discard block |
||
580 | 580 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
581 | 581 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
582 | 582 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
583 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
583 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
584 | 584 | |
585 | 585 | $options = $var->options; |
586 | - if(!$options) continue; |
|
587 | - if(!is_array($options)) $options = array($options); |
|
586 | + if (!$options) continue; |
|
587 | + if (!is_array($options)) $options = array($options); |
|
588 | 588 | |
589 | 589 | $buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); |
590 | 590 | $options_count = count($options); |
591 | 591 | $thumbnail_exist = false; |
592 | - for($j=0; $j < $options_count; $j++) |
|
592 | + for ($j = 0; $j < $options_count; $j++) |
|
593 | 593 | { |
594 | 594 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"] = new stdClass;', $var->attrs->name, $options[$j]->attrs->value); |
595 | 595 | $thumbnail = $options[$j]->attrs->src; |
596 | - if($thumbnail) |
|
596 | + if ($thumbnail) |
|
597 | 597 | { |
598 | 598 | $thumbnail = $layout_path.$thumbnail; |
599 | - if(file_exists($thumbnail)) |
|
599 | + if (file_exists($thumbnail)) |
|
600 | 600 | { |
601 | 601 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->thumbnail = "%s";', $var->attrs->name, $options[$j]->attrs->value, $thumbnail); |
602 | - if(!$thumbnail_exist) |
|
602 | + if (!$thumbnail_exist) |
|
603 | 603 | { |
604 | 604 | $buff[] = sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name); |
605 | 605 | $thumbnail_exist = true; |
@@ -613,26 +613,26 @@ discard block |
||
613 | 613 | } |
614 | 614 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
615 | 615 | // Menu |
616 | - if($xml_obj->menus->menu) |
|
616 | + if ($xml_obj->menus->menu) |
|
617 | 617 | { |
618 | 618 | $menus = $xml_obj->menus->menu; |
619 | - if(!is_array($menus)) $menus = array($menus); |
|
619 | + if (!is_array($menus)) $menus = array($menus); |
|
620 | 620 | |
621 | 621 | $menu_count = count($menus); |
622 | 622 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
623 | 623 | $buff[] = '$layout_info->menu = new stdClass;'; |
624 | - for($i=0;$i<$menu_count;$i++) |
|
624 | + for ($i = 0; $i < $menu_count; $i++) |
|
625 | 625 | { |
626 | 626 | $name = $menus[$i]->attrs->name; |
627 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
627 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
628 | 628 | $buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); |
629 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); |
|
630 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
631 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->attrs->maxdepth); |
|
629 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $menus[$i]->attrs->name); |
|
630 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
631 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->attrs->maxdepth); |
|
632 | 632 | |
633 | 633 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
634 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
635 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
634 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
635 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | } |
@@ -655,19 +655,19 @@ discard block |
||
655 | 655 | $buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); |
656 | 656 | // Extra vars (user defined variables to use in a template) |
657 | 657 | $extra_var_groups = $xml_obj->extra_vars->group; |
658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
660 | - foreach($extra_var_groups as $group) |
|
658 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
659 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
660 | + foreach ($extra_var_groups as $group) |
|
661 | 661 | { |
662 | 662 | $extra_vars = $group->var; |
663 | - if($extra_vars) |
|
663 | + if ($extra_vars) |
|
664 | 664 | { |
665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
665 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
666 | 666 | |
667 | 667 | $extra_var_count = count($extra_vars); |
668 | 668 | |
669 | 669 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
670 | - for($i=0;$i<$extra_var_count;$i++) |
|
670 | + for ($i = 0; $i < $extra_var_count; $i++) |
|
671 | 671 | { |
672 | 672 | unset($var, $options); |
673 | 673 | $var = $extra_vars[$i]; |
@@ -677,14 +677,14 @@ discard block |
||
677 | 677 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
678 | 678 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
679 | 679 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
680 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
680 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
681 | 681 | |
682 | 682 | $options = $var->options; |
683 | - if(!$options) continue; |
|
683 | + if (!$options) continue; |
|
684 | 684 | |
685 | - if(!is_array($options)) $options = array($options); |
|
685 | + if (!is_array($options)) $options = array($options); |
|
686 | 686 | $options_count = count($options); |
687 | - for($j=0;$j<$options_count;$j++) |
|
687 | + for ($j = 0; $j < $options_count; $j++) |
|
688 | 688 | { |
689 | 689 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->value->body, $options[$j]->title->body); |
690 | 690 | } |
@@ -692,23 +692,23 @@ discard block |
||
692 | 692 | } |
693 | 693 | } |
694 | 694 | // Menu |
695 | - if($xml_obj->menus->menu) |
|
695 | + if ($xml_obj->menus->menu) |
|
696 | 696 | { |
697 | 697 | $menus = $xml_obj->menus->menu; |
698 | - if(!is_array($menus)) $menus = array($menus); |
|
698 | + if (!is_array($menus)) $menus = array($menus); |
|
699 | 699 | |
700 | 700 | $menu_count = count($menus); |
701 | 701 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
702 | - for($i=0;$i<$menu_count;$i++) |
|
702 | + for ($i = 0; $i < $menu_count; $i++) |
|
703 | 703 | { |
704 | 704 | $name = $menus[$i]->attrs->name; |
705 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
706 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); |
|
707 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
708 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); |
|
705 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
706 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $name); |
|
707 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
708 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->maxdepth->body); |
|
709 | 709 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
710 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
711 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
710 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
711 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
712 | 712 | } |
713 | 713 | } |
714 | 714 | } |
@@ -718,15 +718,15 @@ discard block |
||
718 | 718 | $layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl); |
719 | 719 | $header_script = trim($layout_config->header_script); |
720 | 720 | |
721 | - if($header_script) |
|
721 | + if ($header_script) |
|
722 | 722 | { |
723 | - $buff[] = sprintf(' $layout_info->header_script = "%s"; ', str_replace(array('$','"'),array('\$','\\"'),$header_script)); |
|
723 | + $buff[] = sprintf(' $layout_info->header_script = "%s"; ', str_replace(array('$', '"'), array('\$', '\\"'), $header_script)); |
|
724 | 724 | } |
725 | 725 | |
726 | - FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); |
|
727 | - if(FileHandler::exists($cache_file)) include($cache_file); |
|
726 | + FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); '.join(PHP_EOL, $buff)); |
|
727 | + if (FileHandler::exists($cache_file)) include($cache_file); |
|
728 | 728 | |
729 | - if(!$layout_info->title) |
|
729 | + if (!$layout_info->title) |
|
730 | 730 | { |
731 | 731 | $layout_info->title = $layout; |
732 | 732 | } |
@@ -750,12 +750,12 @@ discard block |
||
750 | 750 | * @param string $layout_name |
751 | 751 | * @return array |
752 | 752 | */ |
753 | - function getUserLayoutIniConfig($layout_srl, $layout_name=null) |
|
753 | + function getUserLayoutIniConfig($layout_srl, $layout_name = null) |
|
754 | 754 | { |
755 | 755 | $file = $this->getUserLayoutIni($layout_srl); |
756 | - if($layout_name && FileHandler::exists($file) === FALSE) |
|
756 | + if ($layout_name && FileHandler::exists($file) === FALSE) |
|
757 | 757 | { |
758 | - FileHandler::copyFile($this->getDefaultLayoutIni($layout_name),$this->getUserLayoutIni($layout_srl)); |
|
758 | + FileHandler::copyFile($this->getDefaultLayoutIni($layout_name), $this->getUserLayoutIni($layout_srl)); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | return FileHandler::readIniFile($file); |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | */ |
769 | 769 | function getUserLayoutPath($layout_srl) |
770 | 770 | { |
771 | - return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl,3)); |
|
771 | + return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl, 3)); |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | /** |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function getUserLayoutImagePath($layout_srl) |
780 | 780 | { |
781 | - return $this->getUserLayoutPath($layout_srl). 'images/'; |
|
781 | + return $this->getUserLayoutPath($layout_srl).'images/'; |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | function getUserLayoutCss($layout_srl) |
790 | 790 | { |
791 | - return $this->getUserLayoutPath($layout_srl). 'layout.css'; |
|
791 | + return $this->getUserLayoutPath($layout_srl).'layout.css'; |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | */ |
799 | 799 | function getUserLayoutFaceOffCss($layout_srl) |
800 | 800 | { |
801 | - if($this->useUserLayoutTemp == 'temp') return; |
|
801 | + if ($this->useUserLayoutTemp == 'temp') return; |
|
802 | 802 | return $this->_getUserLayoutFaceOffCss($layout_srl); |
803 | 803 | } |
804 | 804 | |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | */ |
810 | 810 | function _getUserLayoutFaceOffCss($layout_srl) |
811 | 811 | { |
812 | - return $this->getUserLayoutPath($layout_srl). 'faceoff.css'; |
|
812 | + return $this->getUserLayoutPath($layout_srl).'faceoff.css'; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | */ |
820 | 820 | function getUserLayoutTempFaceOffCss($layout_srl) |
821 | 821 | { |
822 | - return $this->getUserLayoutPath($layout_srl). 'tmp.faceoff.css'; |
|
822 | + return $this->getUserLayoutPath($layout_srl).'tmp.faceoff.css'; |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | /** |
@@ -829,11 +829,11 @@ discard block |
||
829 | 829 | */ |
830 | 830 | function getUserLayoutHtml($layout_srl) |
831 | 831 | { |
832 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.html'; |
|
833 | - if($this->useUserLayoutTemp == 'temp') |
|
832 | + $src = $this->getUserLayoutPath($layout_srl).'layout.html'; |
|
833 | + if ($this->useUserLayoutTemp == 'temp') |
|
834 | 834 | { |
835 | 835 | $temp = $this->getUserLayoutTempHtml($layout_srl); |
836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp); |
|
836 | + if (FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src, $temp); |
|
837 | 837 | return $temp; |
838 | 838 | } |
839 | 839 | |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | */ |
848 | 848 | function getUserLayoutTempHtml($layout_srl) |
849 | 849 | { |
850 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.html'; |
|
850 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.html'; |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | /** |
@@ -857,11 +857,11 @@ discard block |
||
857 | 857 | */ |
858 | 858 | function getUserLayoutIni($layout_srl) |
859 | 859 | { |
860 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.ini'; |
|
861 | - if($this->useUserLayoutTemp == 'temp') |
|
860 | + $src = $this->getUserLayoutPath($layout_srl).'layout.ini'; |
|
861 | + if ($this->useUserLayoutTemp == 'temp') |
|
862 | 862 | { |
863 | 863 | $temp = $this->getUserLayoutTempIni($layout_srl); |
864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp); |
|
864 | + if (!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src, $temp); |
|
865 | 865 | return $temp; |
866 | 866 | } |
867 | 867 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | function getUserLayoutTempIni($layout_srl) |
877 | 877 | { |
878 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.ini'; |
|
878 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.ini'; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | /** |
@@ -885,9 +885,9 @@ discard block |
||
885 | 885 | * @param string $lang_type |
886 | 886 | * @return string |
887 | 887 | */ |
888 | - function getUserLayoutCache($layout_srl,$lang_type) |
|
888 | + function getUserLayoutCache($layout_srl, $lang_type) |
|
889 | 889 | { |
890 | - return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php"; |
|
890 | + return $this->getUserLayoutPath($layout_srl)."{$lang_type}.cache.php"; |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | /** |
@@ -896,15 +896,15 @@ discard block |
||
896 | 896 | * @param string $lang_type |
897 | 897 | * @return string |
898 | 898 | */ |
899 | - function getLayoutCache($layout_name,$lang_type,$layout_type='P') |
|
899 | + function getLayoutCache($layout_name, $lang_type, $layout_type = 'P') |
|
900 | 900 | { |
901 | - if($layout_type=='P') |
|
901 | + if ($layout_type == 'P') |
|
902 | 902 | { |
903 | - return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
903 | + return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
904 | 904 | } |
905 | 905 | else |
906 | 906 | { |
907 | - return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
907 | + return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
908 | 908 | } |
909 | 909 | } |
910 | 910 | |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | */ |
916 | 916 | function getDefaultLayoutIni($layout_name) |
917 | 917 | { |
918 | - return $this->getDefaultLayoutPath($layout_name). 'layout.ini'; |
|
918 | + return $this->getDefaultLayoutPath($layout_name).'layout.ini'; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | */ |
926 | 926 | function getDefaultLayoutHtml($layout_name) |
927 | 927 | { |
928 | - return $this->getDefaultLayoutPath($layout_name). 'layout.html'; |
|
928 | + return $this->getDefaultLayoutPath($layout_name).'layout.html'; |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | /** |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function getDefaultLayoutCss($layout_name) |
937 | 937 | { |
938 | - return $this->getDefaultLayoutPath($layout_name). 'css/layout.css'; |
|
938 | + return $this->getDefaultLayoutPath($layout_name).'css/layout.css'; |
|
939 | 939 | } |
940 | 940 | |
941 | 941 | /** |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | * @param string $flag (default 'temp') |
965 | 965 | * @return void |
966 | 966 | */ |
967 | - function setUseUserLayoutTemp($flag='temp') |
|
967 | + function setUseUserLayoutTemp($flag = 'temp') |
|
968 | 968 | { |
969 | 969 | $this->useUserLayoutTemp = $flag; |
970 | 970 | } |
@@ -998,11 +998,11 @@ discard block |
||
998 | 998 | ); |
999 | 999 | |
1000 | 1000 | $image_path = $this->getUserLayoutImagePath($layout_srl); |
1001 | - $image_list = FileHandler::readDir($image_path,'/(.*(?:jpg|jpeg|gif|bmp|png)$)/i'); |
|
1001 | + $image_list = FileHandler::readDir($image_path, '/(.*(?:jpg|jpeg|gif|bmp|png)$)/i'); |
|
1002 | 1002 | |
1003 | - foreach($image_list as $image) |
|
1003 | + foreach ($image_list as $image) |
|
1004 | 1004 | { |
1005 | - $file_list[] = 'images/' . $image; |
|
1005 | + $file_list[] = 'images/'.$image; |
|
1006 | 1006 | } |
1007 | 1007 | return $file_list; |
1008 | 1008 | } |
@@ -1020,20 +1020,20 @@ discard block |
||
1020 | 1020 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); |
1021 | 1021 | // CSS generated in the layout manager |
1022 | 1022 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); |
1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
1023 | + if ($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
1024 | 1024 | // CSS output for the widget |
1025 | 1025 | Context::loadFile($this->module_path.'/tpl/css/widget.css', true); |
1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1026 | + if ($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1027 | 1027 | else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
1028 | 1028 | // Different page displayed upon user's permission |
1029 | 1029 | $logged_info = Context::get('logged_info'); |
1030 | 1030 | // Display edit button for faceoff layout |
1031 | - if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1031 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1032 | 1032 | { |
1033 | - Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); |
|
1033 | + Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); |
|
1034 | 1034 | } |
1035 | 1035 | // Display menu when editing the faceOff page |
1036 | - if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1036 | + if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1037 | 1037 | { |
1038 | 1038 | $oTemplate = &TemplateHandler::getInstance(); |
1039 | 1039 | Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu')); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * Arrange Contents |
26 | 26 | * |
27 | - * @param array $content_list |
|
27 | + * @param string $content_list |
|
28 | 28 | * |
29 | 29 | * @return array |
30 | 30 | */ |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Arrange Contents |
43 | 43 | * |
44 | - * @param array $content_list |
|
44 | + * @param array $content |
|
45 | 45 | * |
46 | 46 | * @return array |
47 | 47 | */ |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | function dispSavedDocumentList(&$oModule) |
18 | 18 | { |
19 | 19 | $document_list = $this->arrangeContentList(Context::get('document_list')); |
20 | - $oModule->add('document_list',$document_list); |
|
21 | - $oModule->add('page_navigation',Context::get('page_navigation')); |
|
20 | + $oModule->add('document_list', $document_list); |
|
21 | + $oModule->add('page_navigation', Context::get('page_navigation')); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | function arrangeContentList($content_list) |
32 | 32 | { |
33 | 33 | $output = array(); |
34 | - if(count($content_list)) |
|
34 | + if (count($content_list)) |
|
35 | 35 | { |
36 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
36 | + foreach ($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
37 | 37 | } |
38 | 38 | return $output; |
39 | 39 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | function arrangeContent($content) |
49 | 49 | { |
50 | 50 | $output = null; |
51 | - if($content) |
|
51 | + if ($content) |
|
52 | 52 | { |
53 | - $output= $content->gets('document_srl','category_srl','nick_name','user_id','user_name','title','content','tags','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status'); |
|
53 | + $output = $content->gets('document_srl', 'category_srl', 'nick_name', 'user_id', 'user_name', 'title', 'content', 'tags', 'voted_count', 'blamed_count', 'comment_count', 'regdate', 'last_update', 'extra_vars', 'status'); |
|
54 | 54 | } |
55 | 55 | return $output; |
56 | 56 | } |
@@ -33,7 +33,9 @@ |
||
33 | 33 | $output = array(); |
34 | 34 | if(count($content_list)) |
35 | 35 | { |
36 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
36 | + foreach($content_list as $key => $val) { |
|
37 | + $output[] = $this->arrangeContent($val); |
|
38 | + } |
|
37 | 39 | } |
38 | 40 | return $output; |
39 | 41 | } |
@@ -297,6 +297,7 @@ |
||
297 | 297 | |
298 | 298 | /** |
299 | 299 | * @brief Return member information with member_srl |
300 | + * @param string $member_srl |
|
300 | 301 | */ |
301 | 302 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
302 | 303 | { |
@@ -45,32 +45,68 @@ discard block |
||
45 | 45 | foreach($config->signupForm AS $key=>$value) |
46 | 46 | { |
47 | 47 | $config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title; |
48 | - if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
49 | - if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
48 | + if($config->signupForm[$key]->isPublic != 'N') { |
|
49 | + $config->signupForm[$key]->isPublic = 'Y'; |
|
50 | + } |
|
51 | + if($value->name == 'find_account_question') { |
|
52 | + $config->signupForm[$key]->isPublic = 'N'; |
|
53 | + } |
|
50 | 54 | } |
51 | 55 | |
52 | 56 | // Get terms of user |
53 | 57 | $config->agreement = memberModel::_getAgreement(); |
54 | 58 | |
55 | - if(!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
56 | - if(!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
57 | - if(!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
58 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
59 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
60 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
61 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
62 | - if(!$config->skin) $config->skin = 'default'; |
|
63 | - if(!$config->colorset) $config->colorset = 'white'; |
|
64 | - if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
65 | - if(!$config->group_image_mark) $config->group_image_mark = "N"; |
|
59 | + if(!$config->webmaster_name) { |
|
60 | + $config->webmaster_name = 'webmaster'; |
|
61 | + } |
|
62 | + if(!$config->image_name_max_width) { |
|
63 | + $config->image_name_max_width = 90; |
|
64 | + } |
|
65 | + if(!$config->image_name_max_height) { |
|
66 | + $config->image_name_max_height = 20; |
|
67 | + } |
|
68 | + if(!$config->image_mark_max_width) { |
|
69 | + $config->image_mark_max_width = 20; |
|
70 | + } |
|
71 | + if(!$config->image_mark_max_height) { |
|
72 | + $config->image_mark_max_height = 20; |
|
73 | + } |
|
74 | + if(!$config->profile_image_max_width) { |
|
75 | + $config->profile_image_max_width = 90; |
|
76 | + } |
|
77 | + if(!$config->profile_image_max_height) { |
|
78 | + $config->profile_image_max_height = 90; |
|
79 | + } |
|
80 | + if(!$config->skin) { |
|
81 | + $config->skin = 'default'; |
|
82 | + } |
|
83 | + if(!$config->colorset) { |
|
84 | + $config->colorset = 'white'; |
|
85 | + } |
|
86 | + if(!$config->editor_skin || $config->editor_skin == 'default') { |
|
87 | + $config->editor_skin = 'ckeditor'; |
|
88 | + } |
|
89 | + if(!$config->group_image_mark) { |
|
90 | + $config->group_image_mark = "N"; |
|
91 | + } |
|
66 | 92 | |
67 | - if(!$config->identifier) $config->identifier = 'user_id'; |
|
93 | + if(!$config->identifier) { |
|
94 | + $config->identifier = 'user_id'; |
|
95 | + } |
|
68 | 96 | |
69 | - if(!$config->max_error_count) $config->max_error_count = 10; |
|
70 | - if(!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
97 | + if(!$config->max_error_count) { |
|
98 | + $config->max_error_count = 10; |
|
99 | + } |
|
100 | + if(!$config->max_error_count_time) { |
|
101 | + $config->max_error_count_time = 300; |
|
102 | + } |
|
71 | 103 | |
72 | - if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
73 | - if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
104 | + if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') { |
|
105 | + $config->signature_editor_skin = 'ckeditor'; |
|
106 | + } |
|
107 | + if(!$config->sel_editor_colorset) { |
|
108 | + $config->sel_editor_colorset = 'moono'; |
|
109 | + } |
|
74 | 110 | |
75 | 111 | $member_config = $config; |
76 | 112 | |
@@ -116,12 +152,18 @@ discard block |
||
116 | 152 | $logged_info = Context::get('logged_info'); |
117 | 153 | $act = Context::get('cur_act'); |
118 | 154 | // When click user's own nickname |
119 | - if($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
155 | + if($member_srl == $logged_info->member_srl) { |
|
156 | + $member_info = $logged_info; |
|
157 | + } |
|
120 | 158 | // When click other's nickname |
121 | - else $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
|
159 | + else { |
|
160 | + $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
|
161 | + } |
|
122 | 162 | |
123 | 163 | $member_srl = $member_info->member_srl; |
124 | - if(!$member_srl) return; |
|
164 | + if(!$member_srl) { |
|
165 | + return; |
|
166 | + } |
|
125 | 167 | // List variables |
126 | 168 | $user_id = $member_info->user_id; |
127 | 169 | $user_name = $member_info->user_name; |
@@ -156,11 +198,13 @@ discard block |
||
156 | 198 | } |
157 | 199 | } |
158 | 200 | // View homepage info |
159 | - if($member_info->homepage) |
|
160 | - $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank'); |
|
201 | + if($member_info->homepage) { |
|
202 | + $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank'); |
|
203 | + } |
|
161 | 204 | // View blog info |
162 | - if($member_info->blog) |
|
163 | - $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank'); |
|
205 | + if($member_info->blog) { |
|
206 | + $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank'); |
|
207 | + } |
|
164 | 208 | // Call a trigger (after) |
165 | 209 | ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null); |
166 | 210 | // Display a menu for editting member info to a top administrator |
@@ -195,16 +239,14 @@ discard block |
||
195 | 239 | if(Mobile::isFromMobilePhone()) |
196 | 240 | { |
197 | 241 | return true; |
198 | - } |
|
199 | - elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
242 | + } elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
200 | 243 | { |
201 | 244 | // IPv6: require same /48 |
202 | 245 | if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
203 | 246 | { |
204 | 247 | return true; |
205 | 248 | } |
206 | - } |
|
207 | - else |
|
249 | + } else |
|
208 | 250 | { |
209 | 251 | // IPv4: require same /24 |
210 | 252 | if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
@@ -234,10 +276,12 @@ discard block |
||
234 | 276 | $logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl); |
235 | 277 | // Add is_site_admin bool variable into logged_info if site_administrator is |
236 | 278 | $oModuleModel = getModel('module'); |
237 | - if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
238 | - else $logged_info->is_site_admin = false; |
|
239 | - } |
|
240 | - else |
|
279 | + if($oModuleModel->isSiteAdmin($logged_info)) { |
|
280 | + $logged_info->is_site_admin = true; |
|
281 | + } else { |
|
282 | + $logged_info->is_site_admin = false; |
|
283 | + } |
|
284 | + } else |
|
241 | 285 | { |
242 | 286 | // Register a default group if the site doesn't have a member group |
243 | 287 | if(count($logged_info->group_list) === 0) |
@@ -263,13 +307,19 @@ discard block |
||
263 | 307 | */ |
264 | 308 | function getMemberInfoByUserID($user_id, $columnList = array()) |
265 | 309 | { |
266 | - if(!$user_id) return; |
|
310 | + if(!$user_id) { |
|
311 | + return; |
|
312 | + } |
|
267 | 313 | |
268 | 314 | $args = new stdClass; |
269 | 315 | $args->user_id = $user_id; |
270 | 316 | $output = executeQuery('member.getMemberInfo', $args); |
271 | - if(!$output->toBool()) return $output; |
|
272 | - if(!$output->data) return; |
|
317 | + if(!$output->toBool()) { |
|
318 | + return $output; |
|
319 | + } |
|
320 | + if(!$output->data) { |
|
321 | + return; |
|
322 | + } |
|
273 | 323 | |
274 | 324 | $member_info = $this->arrangeMemberInfo($output->data); |
275 | 325 | |
@@ -281,7 +331,9 @@ discard block |
||
281 | 331 | */ |
282 | 332 | function getMemberInfoByEmailAddress($email_address) |
283 | 333 | { |
284 | - if(!$email_address) return; |
|
334 | + if(!$email_address) { |
|
335 | + return; |
|
336 | + } |
|
285 | 337 | |
286 | 338 | $args = new stdClass(); |
287 | 339 | |
@@ -290,15 +342,18 @@ discard block |
||
290 | 342 | { |
291 | 343 | $args->email_address = strtolower($email_address); |
292 | 344 | $output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args); |
293 | - } |
|
294 | - else |
|
345 | + } else |
|
295 | 346 | { |
296 | 347 | $args->email_address = $email_address; |
297 | 348 | $output = executeQuery('member.getMemberInfoByEmailAddress', $args); |
298 | 349 | } |
299 | 350 | |
300 | - if(!$output->toBool()) return $output; |
|
301 | - if(!$output->data) return; |
|
351 | + if(!$output->toBool()) { |
|
352 | + return $output; |
|
353 | + } |
|
354 | + if(!$output->data) { |
|
355 | + return; |
|
356 | + } |
|
302 | 357 | |
303 | 358 | $member_info = $this->arrangeMemberInfo($output->data); |
304 | 359 | return $member_info; |
@@ -309,7 +364,9 @@ discard block |
||
309 | 364 | */ |
310 | 365 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
311 | 366 | { |
312 | - if(!$member_srl) return; |
|
367 | + if(!$member_srl) { |
|
368 | + return; |
|
369 | + } |
|
313 | 370 | |
314 | 371 | //columnList size zero... get full member info |
315 | 372 | if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
@@ -332,13 +389,17 @@ discard block |
||
332 | 389 | $output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList); |
333 | 390 | if(!$output->data) |
334 | 391 | { |
335 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
392 | + if($oCacheHandler->isSupport()) { |
|
393 | + $oCacheHandler->put($cache_key, new stdClass); |
|
394 | + } |
|
336 | 395 | return; |
337 | 396 | } |
338 | 397 | $this->arrangeMemberInfo($output->data, $site_srl); |
339 | 398 | |
340 | 399 | //insert in cache |
341 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
400 | + if($oCacheHandler->isSupport()) { |
|
401 | + $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
402 | + } |
|
342 | 403 | } |
343 | 404 | } |
344 | 405 | |
@@ -372,8 +433,12 @@ discard block |
||
372 | 433 | { |
373 | 434 | foreach($extra_vars as $key => $val) |
374 | 435 | { |
375 | - if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
376 | - if(!$info->{$key}) $info->{$key} = $val; |
|
436 | + if(!is_array($val) && strpos($val, '|@|') !== FALSE) { |
|
437 | + $val = explode('|@|', $val); |
|
438 | + } |
|
439 | + if(!$info->{$key}) { |
|
440 | + $info->{$key} = $val; |
|
441 | + } |
|
377 | 442 | } |
378 | 443 | } |
379 | 444 | |
@@ -396,8 +461,7 @@ discard block |
||
396 | 461 | if(is_array($val)) |
397 | 462 | { |
398 | 463 | $oSecurity->encodeHTML($key . '.'); |
399 | - } |
|
400 | - else |
|
464 | + } else |
|
401 | 465 | { |
402 | 466 | $oSecurity->encodeHTML($key); |
403 | 467 | } |
@@ -460,7 +524,9 @@ discard block |
||
460 | 524 | */ |
461 | 525 | function getLoggedMemberSrl() |
462 | 526 | { |
463 | - if(!$this->isLogged()) return; |
|
527 | + if(!$this->isLogged()) { |
|
528 | + return; |
|
529 | + } |
|
464 | 530 | return $_SESSION['member_srl']; |
465 | 531 | } |
466 | 532 | |
@@ -469,7 +535,9 @@ discard block |
||
469 | 535 | */ |
470 | 536 | function getLoggedUserID() |
471 | 537 | { |
472 | - if(!$this->isLogged()) return; |
|
538 | + if(!$this->isLogged()) { |
|
539 | + return; |
|
540 | + } |
|
473 | 541 | $logged_info = Context::get('logged_info'); |
474 | 542 | return $logged_info->user_id; |
475 | 543 | } |
@@ -501,9 +569,13 @@ discard block |
||
501 | 569 | $output = executeQueryArray('member.getMemberGroups', $args); |
502 | 570 | $group_list = $output->data; |
503 | 571 | //insert in cache |
504 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
572 | + if($oCacheHandler->isSupport()) { |
|
573 | + $oCacheHandler->put($cache_key, $group_list); |
|
574 | + } |
|
575 | + } |
|
576 | + if(!$group_list) { |
|
577 | + return array(); |
|
505 | 578 | } |
506 | - if(!$group_list) return array(); |
|
507 | 579 | |
508 | 580 | foreach($group_list as $group) |
509 | 581 | { |
@@ -523,7 +595,9 @@ discard block |
||
523 | 595 | $args->site_srl = $site_srl; |
524 | 596 | $args->sort_index = 'list_order'; |
525 | 597 | $output = executeQueryArray('member.getMembersGroups', $args); |
526 | - if(!$output->data) return array(); |
|
598 | + if(!$output->data) { |
|
599 | + return array(); |
|
600 | + } |
|
527 | 601 | |
528 | 602 | $result = array(); |
529 | 603 | foreach($output->data as $key=>$val) |
@@ -615,7 +689,9 @@ discard block |
||
615 | 689 | $output = executeQueryArray('member.getGroups', $args); |
616 | 690 | $group_list = $output->data; |
617 | 691 | //insert in cache |
618 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
692 | + if($oCacheHandler->isSupport()) { |
|
693 | + $oCacheHandler->put($cache_key, $group_list); |
|
694 | + } |
|
619 | 695 | } |
620 | 696 | |
621 | 697 | if(!$group_list) |
@@ -663,9 +739,13 @@ discard block |
||
663 | 739 | $output = executeQuery('member.getJoinFormList', $args); |
664 | 740 | // NULL if output data deosn't exist |
665 | 741 | $join_form_list = $output->data; |
666 | - if(!$join_form_list) return NULL; |
|
742 | + if(!$join_form_list) { |
|
743 | + return NULL; |
|
744 | + } |
|
667 | 745 | // Need to unserialize because serialized array is inserted into DB in case of default_value |
668 | - if(!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
746 | + if(!is_array($join_form_list)) { |
|
747 | + $join_form_list = array($join_form_list); |
|
748 | + } |
|
669 | 749 | $join_form_count = count($join_form_list); |
670 | 750 | for($i=0;$i<$join_form_count;$i++) |
671 | 751 | { |
@@ -682,9 +762,10 @@ discard block |
||
682 | 762 | if(in_array($column_type, array('checkbox','select','radio'))) |
683 | 763 | { |
684 | 764 | $join_form_list[$i]->default_value = unserialize($default_value); |
685 | - if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
686 | - } |
|
687 | - else |
|
765 | + if(!$join_form_list[$i]->default_value[0]) { |
|
766 | + $join_form_list[$i]->default_value = ''; |
|
767 | + } |
|
768 | + } else |
|
688 | 769 | { |
689 | 770 | $join_form_list[$i]->default_value = ''; |
690 | 771 | } |
@@ -698,13 +779,18 @@ discard block |
||
698 | 779 | { |
699 | 780 | foreach($this->join_form_list as $key => $val) |
700 | 781 | { |
701 | - if($val->is_active != 'Y') continue; |
|
782 | + if($val->is_active != 'Y') { |
|
783 | + continue; |
|
784 | + } |
|
702 | 785 | unset($obj); |
703 | 786 | $obj->type = $val->column_type; |
704 | 787 | $obj->name = $val->column_name; |
705 | 788 | $obj->lang = $val->column_title; |
706 | - if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false; |
|
707 | - else $obj->required = false; |
|
789 | + if($logged_info->is_admin != 'Y') { |
|
790 | + $obj->required = $val->required=='Y'?true:false; |
|
791 | + } else { |
|
792 | + $obj->required = false; |
|
793 | + } |
|
708 | 794 | $filter_output[] = $obj; |
709 | 795 | |
710 | 796 | unset($open_obj); |
@@ -755,7 +841,9 @@ discard block |
||
755 | 841 | function getCombineJoinForm($member_info) |
756 | 842 | { |
757 | 843 | $extend_form_list = $this->getJoinFormlist(); |
758 | - if(!$extend_form_list) return; |
|
844 | + if(!$extend_form_list) { |
|
845 | + return; |
|
846 | + } |
|
759 | 847 | // Member info is open only to an administrator and him/herself when is_private is true. |
760 | 848 | $logged_info = Context::get('logged_info'); |
761 | 849 | |
@@ -768,7 +856,9 @@ discard block |
||
768 | 856 | switch($item->column_type) |
769 | 857 | { |
770 | 858 | case 'checkbox' : |
771 | - if($value && !is_array($value)) $value = array($value); |
|
859 | + if($value && !is_array($value)) { |
|
860 | + $value = array($value); |
|
861 | + } |
|
772 | 862 | break; |
773 | 863 | case 'text' : |
774 | 864 | case 'homepage' : |
@@ -782,8 +872,11 @@ discard block |
||
782 | 872 | |
783 | 873 | $extend_form_list[$srl]->value = $value; |
784 | 874 | |
785 | - if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true; |
|
786 | - else $extend_form_list[$srl]->is_opened = false; |
|
875 | + if($member_info->{'open_'.$column_name}=='Y') { |
|
876 | + $extend_form_list[$srl]->is_opened = true; |
|
877 | + } else { |
|
878 | + $extend_form_list[$srl]->is_opened = false; |
|
879 | + } |
|
787 | 880 | } |
788 | 881 | return $extend_form_list; |
789 | 882 | } |
@@ -796,7 +889,9 @@ discard block |
||
796 | 889 | $args->member_join_form_srl = $member_join_form_srl; |
797 | 890 | $output = executeQuery('member.getJoinForm', $args); |
798 | 891 | $join_form = $output->data; |
799 | - if(!$join_form) return NULL; |
|
892 | + if(!$join_form) { |
|
893 | + return NULL; |
|
894 | + } |
|
800 | 895 | |
801 | 896 | $column_type = $join_form->column_type; |
802 | 897 | $default_value = $join_form->default_value; |
@@ -804,8 +899,7 @@ discard block |
||
804 | 899 | if(in_array($column_type, array('checkbox','select','radio'))) |
805 | 900 | { |
806 | 901 | $join_form->default_value = unserialize($default_value); |
807 | - } |
|
808 | - else |
|
902 | + } else |
|
809 | 903 | { |
810 | 904 | $join_form->default_value = ''; |
811 | 905 | } |
@@ -834,7 +928,9 @@ discard block |
||
834 | 928 | function getDeniedIDs() |
835 | 929 | { |
836 | 930 | $output = executeQueryArray('member.getDeniedIDs'); |
837 | - if(!$output->toBool()) return array(); |
|
931 | + if(!$output->toBool()) { |
|
932 | + return array(); |
|
933 | + } |
|
838 | 934 | return $output->data; |
839 | 935 | } |
840 | 936 | |
@@ -857,7 +953,9 @@ discard block |
||
857 | 953 | $args = new stdClass(); |
858 | 954 | $args->user_id = $user_id; |
859 | 955 | $output = executeQuery('member.chkDeniedID', $args); |
860 | - if($output->data->count) return true; |
|
956 | + if($output->data->count) { |
|
957 | + return true; |
|
958 | + } |
|
861 | 959 | return false; |
862 | 960 | } |
863 | 961 | |
@@ -869,7 +967,9 @@ discard block |
||
869 | 967 | $args = new stdClass(); |
870 | 968 | $args->nick_name = $nickName; |
871 | 969 | $output = executeQuery('member.chkDeniedNickName', $args); |
872 | - if($output->data->count) return true; |
|
970 | + if($output->data->count) { |
|
971 | + return true; |
|
972 | + } |
|
873 | 973 | if(!$output->toBool()) |
874 | 974 | { |
875 | 975 | return true; |
@@ -922,8 +1022,9 @@ discard block |
||
922 | 1022 | $info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file)); |
923 | 1023 | $info->file = './'.$image_name_file; |
924 | 1024 | $GLOBALS['__member_info__']['image_name'][$member_srl] = $info; |
1025 | + } else { |
|
1026 | + $GLOBALS['__member_info__']['image_name'][$member_srl] = null; |
|
925 | 1027 | } |
926 | - else $GLOBALS['__member_info__']['image_name'][$member_srl] = null; |
|
927 | 1028 | } |
928 | 1029 | return $GLOBALS['__member_info__']['image_name'][$member_srl]; |
929 | 1030 | } |
@@ -944,8 +1045,9 @@ discard block |
||
944 | 1045 | $info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file)); |
945 | 1046 | $info->file = './'.$image_mark_file; |
946 | 1047 | $GLOBALS['__member_info__']['image_mark'][$member_srl] = $info; |
1048 | + } else { |
|
1049 | + $GLOBALS['__member_info__']['image_mark'][$member_srl] = null; |
|
947 | 1050 | } |
948 | - else $GLOBALS['__member_info__']['image_mark'][$member_srl] = null; |
|
949 | 1051 | } |
950 | 1052 | |
951 | 1053 | return $GLOBALS['__member_info__']['image_mark'][$member_srl]; |
@@ -987,9 +1089,13 @@ discard block |
||
987 | 1089 | } |
988 | 1090 | } |
989 | 1091 | } |
990 | - if (!$info) $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N'; |
|
1092 | + if (!$info) { |
|
1093 | + $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N'; |
|
1094 | + } |
|
1095 | + } |
|
1096 | + if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') { |
|
1097 | + return null; |
|
991 | 1098 | } |
992 | - if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') return null; |
|
993 | 1099 | |
994 | 1100 | return $GLOBALS['__member_info__']['group_image_mark'][$member_srl]; |
995 | 1101 | } |
@@ -1007,8 +1113,9 @@ discard block |
||
1007 | 1113 | $buff = FileHandler::readFile($filename); |
1008 | 1114 | $signature = preg_replace('/<\?.*?\?>/', '', $buff); |
1009 | 1115 | $GLOBALS['__member_info__']['signature'][$member_srl] = $signature; |
1116 | + } else { |
|
1117 | + $GLOBALS['__member_info__']['signature'][$member_srl] = null; |
|
1010 | 1118 | } |
1011 | - else $GLOBALS['__member_info__']['signature'][$member_srl] = null; |
|
1012 | 1119 | } |
1013 | 1120 | return $GLOBALS['__member_info__']['signature'][$member_srl]; |
1014 | 1121 | } |
@@ -1046,14 +1153,18 @@ discard block |
||
1046 | 1153 | if(!$need_upgrade) |
1047 | 1154 | { |
1048 | 1155 | $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm(); |
1049 | - if($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
1156 | + if($required_algorithm !== $current_algorithm) { |
|
1157 | + $need_upgrade = true; |
|
1158 | + } |
|
1050 | 1159 | } |
1051 | 1160 | |
1052 | 1161 | if(!$need_upgrade) |
1053 | 1162 | { |
1054 | 1163 | $required_work_factor = $oPassword->getWorkFactor(); |
1055 | 1164 | $current_work_factor = $oPassword->checkWorkFactor($hashed_password); |
1056 | - if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
1165 | + if($current_work_factor !== false && $required_work_factor > $current_work_factor) { |
|
1166 | + $need_upgrade = true; |
|
1167 | + } |
|
1057 | 1168 | } |
1058 | 1169 | |
1059 | 1170 | if($need_upgrade === true) |
@@ -1084,7 +1195,9 @@ discard block |
||
1084 | 1195 | function checkPasswordStrength($password, $strength) |
1085 | 1196 | { |
1086 | 1197 | $logged_info = Context::get('logged_info'); |
1087 | - if($logged_info->is_admin == 'Y') return true; |
|
1198 | + if($logged_info->is_admin == 'Y') { |
|
1199 | + return true; |
|
1200 | + } |
|
1088 | 1201 | |
1089 | 1202 | if($strength == NULL) |
1090 | 1203 | { |
@@ -1096,15 +1209,21 @@ discard block |
||
1096 | 1209 | |
1097 | 1210 | switch ($strength) { |
1098 | 1211 | case 'high': |
1099 | - if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
1212 | + if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) { |
|
1213 | + return false; |
|
1214 | + } |
|
1100 | 1215 | /* no break */ |
1101 | 1216 | |
1102 | 1217 | case 'normal': |
1103 | - if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
1218 | + if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) { |
|
1219 | + return false; |
|
1220 | + } |
|
1104 | 1221 | break; |
1105 | 1222 | |
1106 | 1223 | case 'low': |
1107 | - if($length < 4) return false; |
|
1224 | + if($length < 4) { |
|
1225 | + return false; |
|
1226 | + } |
|
1108 | 1227 | break; |
1109 | 1228 | } |
1110 | 1229 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | static $member_config; |
28 | 28 | |
29 | - if($member_config) |
|
29 | + if ($member_config) |
|
30 | 30 | { |
31 | 31 | return $member_config; |
32 | 32 | } |
@@ -35,42 +35,42 @@ discard block |
||
35 | 35 | $oModuleModel = getModel('module'); |
36 | 36 | $config = $oModuleModel->getModuleConfig('member'); |
37 | 37 | |
38 | - if(!$config->signupForm || !is_array($config->signupForm)) |
|
38 | + if (!$config->signupForm || !is_array($config->signupForm)) |
|
39 | 39 | { |
40 | 40 | $oMemberAdminController = getAdminController('member'); |
41 | 41 | $identifier = ($config->identifier) ? $config->identifier : 'email_address'; |
42 | 42 | $config->signupForm = $oMemberAdminController->createSignupForm($identifier); |
43 | 43 | } |
44 | 44 | //for multi language |
45 | - foreach($config->signupForm AS $key=>$value) |
|
45 | + foreach ($config->signupForm AS $key=>$value) |
|
46 | 46 | { |
47 | 47 | $config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title; |
48 | - if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
49 | - if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
48 | + if ($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
49 | + if ($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Get terms of user |
53 | 53 | $config->agreement = memberModel::_getAgreement(); |
54 | 54 | |
55 | - if(!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
56 | - if(!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
57 | - if(!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
58 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
59 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
60 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
61 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
62 | - if(!$config->skin) $config->skin = 'default'; |
|
63 | - if(!$config->colorset) $config->colorset = 'white'; |
|
64 | - if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
65 | - if(!$config->group_image_mark) $config->group_image_mark = "N"; |
|
55 | + if (!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
56 | + if (!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
57 | + if (!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
58 | + if (!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
59 | + if (!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
60 | + if (!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
61 | + if (!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
62 | + if (!$config->skin) $config->skin = 'default'; |
|
63 | + if (!$config->colorset) $config->colorset = 'white'; |
|
64 | + if (!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
65 | + if (!$config->group_image_mark) $config->group_image_mark = "N"; |
|
66 | 66 | |
67 | - if(!$config->identifier) $config->identifier = 'user_id'; |
|
67 | + if (!$config->identifier) $config->identifier = 'user_id'; |
|
68 | 68 | |
69 | - if(!$config->max_error_count) $config->max_error_count = 10; |
|
70 | - if(!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
69 | + if (!$config->max_error_count) $config->max_error_count = 10; |
|
70 | + if (!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
71 | 71 | |
72 | - if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
73 | - if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
72 | + if (!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
73 | + if (!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
74 | 74 | |
75 | 75 | $member_config = $config; |
76 | 76 | |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | |
80 | 80 | function _getAgreement() |
81 | 81 | { |
82 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
83 | - if(is_readable($agreement_file)) |
|
82 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt'; |
|
83 | + if (is_readable($agreement_file)) |
|
84 | 84 | { |
85 | 85 | return FileHandler::readFile($agreement_file); |
86 | 86 | } |
87 | 87 | |
88 | 88 | $db_info = Context::getDBInfo(); |
89 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $db_info->lang_type . '.txt'; |
|
90 | - if(is_readable($agreement_file)) |
|
89 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$db_info->lang_type.'.txt'; |
|
90 | + if (is_readable($agreement_file)) |
|
91 | 91 | { |
92 | 92 | return FileHandler::readFile($agreement_file); |
93 | 93 | } |
94 | 94 | |
95 | 95 | $lang_selected = Context::loadLangSelected(); |
96 | - foreach($lang_selected as $key => $val) |
|
96 | + foreach ($lang_selected as $key => $val) |
|
97 | 97 | { |
98 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $key . '.txt'; |
|
99 | - if(is_readable($agreement_file)) |
|
98 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$key.'.txt'; |
|
99 | + if (is_readable($agreement_file)) |
|
100 | 100 | { |
101 | 101 | return FileHandler::readFile($agreement_file); |
102 | 102 | } |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | $logged_info = Context::get('logged_info'); |
117 | 117 | $act = Context::get('cur_act'); |
118 | 118 | // When click user's own nickname |
119 | - if($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
119 | + if ($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
120 | 120 | // When click other's nickname |
121 | 121 | else $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
122 | 122 | |
123 | 123 | $member_srl = $member_info->member_srl; |
124 | - if(!$member_srl) return; |
|
124 | + if (!$member_srl) return; |
|
125 | 125 | // List variables |
126 | 126 | $user_id = $member_info->user_id; |
127 | 127 | $user_name = $member_info->user_name; |
@@ -130,18 +130,18 @@ discard block |
||
130 | 130 | |
131 | 131 | $oMemberController = getController('member'); |
132 | 132 | // Display member information (Don't display to non-logged user) |
133 | - if($logged_info->member_srl) |
|
133 | + if ($logged_info->member_srl) |
|
134 | 134 | { |
135 | - $url = getUrl('','mid',$mid,'act','dispMemberInfo','member_srl',$member_srl); |
|
136 | - $oMemberController->addMemberPopupMenu($url,'cmd_view_member_info',$icon_path,'self'); |
|
135 | + $url = getUrl('', 'mid', $mid, 'act', 'dispMemberInfo', 'member_srl', $member_srl); |
|
136 | + $oMemberController->addMemberPopupMenu($url, 'cmd_view_member_info', $icon_path, 'self'); |
|
137 | 137 | } |
138 | 138 | // When click other's nickname |
139 | - if($member_srl != $logged_info->member_srl && $logged_info->member_srl) |
|
139 | + if ($member_srl != $logged_info->member_srl && $logged_info->member_srl) |
|
140 | 140 | { |
141 | 141 | // Get email config |
142 | - foreach($this->module_config->signupForm as $field) |
|
142 | + foreach ($this->module_config->signupForm as $field) |
|
143 | 143 | { |
144 | - if($field->name == 'email_address') |
|
144 | + if ($field->name == 'email_address') |
|
145 | 145 | { |
146 | 146 | $email_config = $field; |
147 | 147 | break; |
@@ -149,36 +149,36 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | // Send an email only if email address is public |
152 | - if(($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) |
|
152 | + if (($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) |
|
153 | 153 | { |
154 | 154 | $url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
155 | - $oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path); |
|
155 | + $oMemberController->addMemberPopupMenu($url, 'cmd_send_email', $icon_path); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | // View homepage info |
159 | - if($member_info->homepage) |
|
159 | + if ($member_info->homepage) |
|
160 | 160 | $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank'); |
161 | 161 | // View blog info |
162 | - if($member_info->blog) |
|
162 | + if ($member_info->blog) |
|
163 | 163 | $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank'); |
164 | 164 | // Call a trigger (after) |
165 | 165 | ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null); |
166 | 166 | // Display a menu for editting member info to a top administrator |
167 | - if($logged_info->is_admin == 'Y') |
|
167 | + if ($logged_info->is_admin == 'Y') |
|
168 | 168 | { |
169 | - $url = getUrl('','module','admin','act','dispMemberAdminInsert','member_srl',$member_srl); |
|
170 | - $oMemberController->addMemberPopupMenu($url,'cmd_manage_member_info',$icon_path,'MemberModifyInfo'); |
|
169 | + $url = getUrl('', 'module', 'admin', 'act', 'dispMemberAdminInsert', 'member_srl', $member_srl); |
|
170 | + $oMemberController->addMemberPopupMenu($url, 'cmd_manage_member_info', $icon_path, 'MemberModifyInfo'); |
|
171 | 171 | |
172 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','member_srl','search_keyword',$member_srl); |
|
173 | - $oMemberController->addMemberPopupMenu($url,'cmd_trace_document',$icon_path,'TraceMemberDocument'); |
|
172 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl); |
|
173 | + $oMemberController->addMemberPopupMenu($url, 'cmd_trace_document', $icon_path, 'TraceMemberDocument'); |
|
174 | 174 | |
175 | - $url = getUrl('','module','admin','act','dispCommentAdminList','search_target','member_srl','search_keyword',$member_srl); |
|
176 | - $oMemberController->addMemberPopupMenu($url,'cmd_trace_comment',$icon_path,'TraceMemberComment'); |
|
175 | + $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl); |
|
176 | + $oMemberController->addMemberPopupMenu($url, 'cmd_trace_comment', $icon_path, 'TraceMemberComment'); |
|
177 | 177 | } |
178 | 178 | // Change a language of pop-up menu |
179 | 179 | $menus = Context::get('member_popup_menu_list'); |
180 | 180 | $menus_count = count($menus); |
181 | - for($i=0;$i<$menus_count;$i++) |
|
181 | + for ($i = 0; $i < $menus_count; $i++) |
|
182 | 182 | { |
183 | 183 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
184 | 184 | } |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | * @brief Check if logged-in |
191 | 191 | */ |
192 | 192 | function isLogged() { |
193 | - if($_SESSION['is_logged']) |
|
193 | + if ($_SESSION['is_logged']) |
|
194 | 194 | { |
195 | - if(Mobile::isFromMobilePhone()) |
|
195 | + if (Mobile::isFromMobilePhone()) |
|
196 | 196 | { |
197 | 197 | return true; |
198 | 198 | } |
199 | - elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
199 | + elseif (filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
200 | 200 | { |
201 | 201 | // IPv6: require same /48 |
202 | - if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
|
202 | + if (strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
|
203 | 203 | { |
204 | 204 | return true; |
205 | 205 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | else |
208 | 208 | { |
209 | 209 | // IPv4: require same /24 |
210 | - if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
|
210 | + if (ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
|
211 | 211 | { |
212 | 212 | return true; |
213 | 213 | } |
@@ -224,23 +224,23 @@ discard block |
||
224 | 224 | function getLoggedInfo() |
225 | 225 | { |
226 | 226 | // Return session info if session info is requested and the user is logged-in |
227 | - if($this->isLogged()) |
|
227 | + if ($this->isLogged()) |
|
228 | 228 | { |
229 | 229 | $logged_info = Context::get('logged_info'); |
230 | 230 | // Admin/Group list defined depending on site_module_info |
231 | 231 | $site_module_info = Context::get('site_module_info'); |
232 | - if($site_module_info->site_srl) |
|
232 | + if ($site_module_info->site_srl) |
|
233 | 233 | { |
234 | 234 | $logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl); |
235 | 235 | // Add is_site_admin bool variable into logged_info if site_administrator is |
236 | 236 | $oModuleModel = getModel('module'); |
237 | - if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
237 | + if ($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
238 | 238 | else $logged_info->is_site_admin = false; |
239 | 239 | } |
240 | 240 | else |
241 | 241 | { |
242 | 242 | // Register a default group if the site doesn't have a member group |
243 | - if(count($logged_info->group_list) === 0) |
|
243 | + if (count($logged_info->group_list) === 0) |
|
244 | 244 | { |
245 | 245 | $default_group = $this->getDefaultGroup(0); |
246 | 246 | $oMemberController = getController('member'); |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function getMemberInfoByUserID($user_id, $columnList = array()) |
265 | 265 | { |
266 | - if(!$user_id) return; |
|
266 | + if (!$user_id) return; |
|
267 | 267 | |
268 | 268 | $args = new stdClass; |
269 | 269 | $args->user_id = $user_id; |
270 | 270 | $output = executeQuery('member.getMemberInfo', $args); |
271 | - if(!$output->toBool()) return $output; |
|
272 | - if(!$output->data) return; |
|
271 | + if (!$output->toBool()) return $output; |
|
272 | + if (!$output->data) return; |
|
273 | 273 | |
274 | 274 | $member_info = $this->arrangeMemberInfo($output->data); |
275 | 275 | |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | */ |
282 | 282 | function getMemberInfoByEmailAddress($email_address) |
283 | 283 | { |
284 | - if(!$email_address) return; |
|
284 | + if (!$email_address) return; |
|
285 | 285 | |
286 | 286 | $args = new stdClass(); |
287 | 287 | |
288 | - $db_info = Context::getDBInfo (); |
|
289 | - if($db_info->master_db['db_type'] == "cubrid") |
|
288 | + $db_info = Context::getDBInfo(); |
|
289 | + if ($db_info->master_db['db_type'] == "cubrid") |
|
290 | 290 | { |
291 | 291 | $args->email_address = strtolower($email_address); |
292 | 292 | $output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args); |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | $output = executeQuery('member.getMemberInfoByEmailAddress', $args); |
298 | 298 | } |
299 | 299 | |
300 | - if(!$output->toBool()) return $output; |
|
301 | - if(!$output->data) return; |
|
300 | + if (!$output->toBool()) return $output; |
|
301 | + if (!$output->data) return; |
|
302 | 302 | |
303 | 303 | $member_info = $this->arrangeMemberInfo($output->data); |
304 | 304 | return $member_info; |
@@ -309,36 +309,36 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
311 | 311 | { |
312 | - if(!$member_srl) return; |
|
312 | + if (!$member_srl) return; |
|
313 | 313 | |
314 | 314 | //columnList size zero... get full member info |
315 | - if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
|
315 | + if (!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
|
316 | 316 | { |
317 | 317 | $GLOBALS['__member_info__'][$member_srl] = false; |
318 | 318 | |
319 | 319 | $oCacheHandler = CacheHandler::getInstance('object'); |
320 | - if($oCacheHandler->isSupport()) |
|
320 | + if ($oCacheHandler->isSupport()) |
|
321 | 321 | { |
322 | 322 | $columnList = array(); |
323 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
323 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
324 | 324 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
325 | 325 | $GLOBALS['__member_info__'][$member_srl] = $oCacheHandler->get($cache_key); |
326 | 326 | } |
327 | 327 | |
328 | - if($GLOBALS['__member_info__'][$member_srl] === false) |
|
328 | + if ($GLOBALS['__member_info__'][$member_srl] === false) |
|
329 | 329 | { |
330 | 330 | $args = new stdClass(); |
331 | 331 | $args->member_srl = $member_srl; |
332 | 332 | $output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList); |
333 | - if(!$output->data) |
|
333 | + if (!$output->data) |
|
334 | 334 | { |
335 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
335 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
336 | 336 | return; |
337 | 337 | } |
338 | 338 | $this->arrangeMemberInfo($output->data, $site_srl); |
339 | 339 | |
340 | 340 | //insert in cache |
341 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
341 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | */ |
351 | 351 | function arrangeMemberInfo($info, $site_srl = 0) |
352 | 352 | { |
353 | - if(!$GLOBALS['__member_info__'][$info->member_srl]) |
|
353 | + if (!$GLOBALS['__member_info__'][$info->member_srl]) |
|
354 | 354 | { |
355 | 355 | $oModuleModel = getModel('module'); |
356 | 356 | $config = $oModuleModel->getModuleConfig('member'); |
@@ -359,25 +359,25 @@ discard block |
||
359 | 359 | $info->profile_image = $this->getProfileImage($info->member_srl); |
360 | 360 | $info->image_name = $this->getImageName($info->member_srl); |
361 | 361 | $info->image_mark = $this->getImageMark($info->member_srl); |
362 | - if($config->group_image_mark=='Y') |
|
362 | + if ($config->group_image_mark == 'Y') |
|
363 | 363 | { |
364 | - $info->group_mark = $this->getGroupImageMark($info->member_srl,$site_srl); |
|
364 | + $info->group_mark = $this->getGroupImageMark($info->member_srl, $site_srl); |
|
365 | 365 | } |
366 | 366 | $info->signature = $this->getSignature($info->member_srl); |
367 | 367 | $info->group_list = $this->getMemberGroups($info->member_srl, $site_srl); |
368 | 368 | |
369 | 369 | $extra_vars = unserialize($info->extra_vars); |
370 | 370 | unset($info->extra_vars); |
371 | - if($extra_vars) |
|
371 | + if ($extra_vars) |
|
372 | 372 | { |
373 | - foreach($extra_vars as $key => $val) |
|
373 | + foreach ($extra_vars as $key => $val) |
|
374 | 374 | { |
375 | - if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
376 | - if(!$info->{$key}) $info->{$key} = $val; |
|
375 | + if (!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
376 | + if (!$info->{$key}) $info->{$key} = $val; |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | - if(strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer)) |
|
380 | + if (strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer)) |
|
381 | 381 | { |
382 | 382 | $info->find_account_answer = null; |
383 | 383 | } |
@@ -389,13 +389,13 @@ discard block |
||
389 | 389 | $info->homepage = strip_tags($info->homepage); |
390 | 390 | $info->blog = strip_tags($info->blog); |
391 | 391 | |
392 | - if($extra_vars) |
|
392 | + if ($extra_vars) |
|
393 | 393 | { |
394 | - foreach($extra_vars as $key => $val) |
|
394 | + foreach ($extra_vars as $key => $val) |
|
395 | 395 | { |
396 | - if(is_array($val)) |
|
396 | + if (is_array($val)) |
|
397 | 397 | { |
398 | - $oSecurity->encodeHTML($key . '.'); |
|
398 | + $oSecurity->encodeHTML($key.'.'); |
|
399 | 399 | } |
400 | 400 | else |
401 | 401 | { |
@@ -406,12 +406,12 @@ discard block |
||
406 | 406 | |
407 | 407 | // Check format. |
408 | 408 | $oValidator = new Validator(); |
409 | - if(!$oValidator->applyRule('url', $info->homepage)) |
|
409 | + if (!$oValidator->applyRule('url', $info->homepage)) |
|
410 | 410 | { |
411 | 411 | $info->homepage = ''; |
412 | 412 | } |
413 | 413 | |
414 | - if(!$oValidator->applyRule('url', $info->blog)) |
|
414 | + if (!$oValidator->applyRule('url', $info->blog)) |
|
415 | 415 | { |
416 | 416 | $info->blog = ''; |
417 | 417 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | function getLoggedMemberSrl() |
462 | 462 | { |
463 | - if(!$this->isLogged()) return; |
|
463 | + if (!$this->isLogged()) return; |
|
464 | 464 | return $_SESSION['member_srl']; |
465 | 465 | } |
466 | 466 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | */ |
470 | 470 | function getLoggedUserID() |
471 | 471 | { |
472 | - if(!$this->isLogged()) return; |
|
472 | + if (!$this->isLogged()) return; |
|
473 | 473 | $logged_info = Context::get('logged_info'); |
474 | 474 | return $logged_info->user_id; |
475 | 475 | } |
@@ -484,16 +484,16 @@ discard block |
||
484 | 484 | // cache controll |
485 | 485 | $group_list = false; |
486 | 486 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
487 | - if($oCacheHandler->isSupport()) |
|
487 | + if ($oCacheHandler->isSupport()) |
|
488 | 488 | { |
489 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_'.$site_srl; |
|
489 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
490 | 490 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
491 | 491 | $group_list = $oCacheHandler->get($cache_key); |
492 | 492 | } |
493 | 493 | |
494 | - if(!$member_groups[$member_srl][$site_srl] || $force_reload) |
|
494 | + if (!$member_groups[$member_srl][$site_srl] || $force_reload) |
|
495 | 495 | { |
496 | - if($group_list === false) |
|
496 | + if ($group_list === false) |
|
497 | 497 | { |
498 | 498 | $args = new stdClass(); |
499 | 499 | $args->member_srl = $member_srl; |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | $output = executeQueryArray('member.getMemberGroups', $args); |
502 | 502 | $group_list = $output->data; |
503 | 503 | //insert in cache |
504 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
504 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
505 | 505 | } |
506 | - if(!$group_list) return array(); |
|
506 | + if (!$group_list) return array(); |
|
507 | 507 | |
508 | - foreach($group_list as $group) |
|
508 | + foreach ($group_list as $group) |
|
509 | 509 | { |
510 | 510 | $result[$group->group_srl] = $group->title; |
511 | 511 | } |
@@ -519,14 +519,14 @@ discard block |
||
519 | 519 | */ |
520 | 520 | function getMembersGroups($member_srls, $site_srl = 0) |
521 | 521 | { |
522 | - $args->member_srls = implode(',',$member_srls); |
|
522 | + $args->member_srls = implode(',', $member_srls); |
|
523 | 523 | $args->site_srl = $site_srl; |
524 | 524 | $args->sort_index = 'list_order'; |
525 | 525 | $output = executeQueryArray('member.getMembersGroups', $args); |
526 | - if(!$output->data) return array(); |
|
526 | + if (!$output->data) return array(); |
|
527 | 527 | |
528 | 528 | $result = array(); |
529 | - foreach($output->data as $key=>$val) |
|
529 | + foreach ($output->data as $key=>$val) |
|
530 | 530 | { |
531 | 531 | $result[$val->member_srl][] = $val->title; |
532 | 532 | } |
@@ -540,21 +540,21 @@ discard block |
||
540 | 540 | { |
541 | 541 | $default_group = false; |
542 | 542 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
543 | - if($oCacheHandler->isSupport()) |
|
543 | + if ($oCacheHandler->isSupport()) |
|
544 | 544 | { |
545 | 545 | $columnList = array(); |
546 | - $object_key = 'default_group_' . $site_srl; |
|
546 | + $object_key = 'default_group_'.$site_srl; |
|
547 | 547 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
548 | 548 | $default_group = $oCacheHandler->get($cache_key); |
549 | 549 | } |
550 | 550 | |
551 | - if($default_group === false) |
|
551 | + if ($default_group === false) |
|
552 | 552 | { |
553 | 553 | $args = new stdClass(); |
554 | 554 | $args->site_srl = $site_srl; |
555 | 555 | $output = executeQuery('member.getDefaultGroup', $args, $columnList); |
556 | 556 | $default_group = $output->data; |
557 | - if($oCacheHandler->isSupport()) |
|
557 | + if ($oCacheHandler->isSupport()) |
|
558 | 558 | { |
559 | 559 | $oCacheHandler->put($cache_key, $default_group); |
560 | 560 | } |
@@ -588,25 +588,25 @@ discard block |
||
588 | 588 | */ |
589 | 589 | function getGroups($site_srl = 0) |
590 | 590 | { |
591 | - if(!$GLOBALS['__group_info__'][$site_srl]) |
|
591 | + if (!$GLOBALS['__group_info__'][$site_srl]) |
|
592 | 592 | { |
593 | 593 | $result = array(); |
594 | 594 | |
595 | - if(!isset($site_srl)) |
|
595 | + if (!isset($site_srl)) |
|
596 | 596 | { |
597 | 597 | $site_srl = 0; |
598 | 598 | } |
599 | 599 | |
600 | 600 | $group_list = false; |
601 | 601 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
602 | - if($oCacheHandler->isSupport()) |
|
602 | + if ($oCacheHandler->isSupport()) |
|
603 | 603 | { |
604 | 604 | $object_key = 'member_groups:site_'.$site_srl; |
605 | 605 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
606 | 606 | $group_list = $oCacheHandler->get($cache_key); |
607 | 607 | } |
608 | 608 | |
609 | - if($group_list === false) |
|
609 | + if ($group_list === false) |
|
610 | 610 | { |
611 | 611 | $args = new stdClass(); |
612 | 612 | $args->site_srl = $site_srl; |
@@ -615,16 +615,16 @@ discard block |
||
615 | 615 | $output = executeQueryArray('member.getGroups', $args); |
616 | 616 | $group_list = $output->data; |
617 | 617 | //insert in cache |
618 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
618 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
619 | 619 | } |
620 | 620 | |
621 | - if(!$group_list) |
|
621 | + if (!$group_list) |
|
622 | 622 | { |
623 | 623 | return array(); |
624 | 624 | } |
625 | 625 | |
626 | 626 | |
627 | - foreach($group_list as $val) |
|
627 | + foreach ($group_list as $val) |
|
628 | 628 | { |
629 | 629 | $result[$val->group_srl] = $val; |
630 | 630 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | // Set to ignore if a super administrator. |
656 | 656 | $logged_info = Context::get('logged_info'); |
657 | 657 | |
658 | - if(!$this->join_form_list) |
|
658 | + if (!$this->join_form_list) |
|
659 | 659 | { |
660 | 660 | // Argument setting to sort list_order column |
661 | 661 | $args = new stdClass(); |
@@ -663,11 +663,11 @@ discard block |
||
663 | 663 | $output = executeQuery('member.getJoinFormList', $args); |
664 | 664 | // NULL if output data deosn't exist |
665 | 665 | $join_form_list = $output->data; |
666 | - if(!$join_form_list) return NULL; |
|
666 | + if (!$join_form_list) return NULL; |
|
667 | 667 | // Need to unserialize because serialized array is inserted into DB in case of default_value |
668 | - if(!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
668 | + if (!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
669 | 669 | $join_form_count = count($join_form_list); |
670 | - for($i=0;$i<$join_form_count;$i++) |
|
670 | + for ($i = 0; $i < $join_form_count; $i++) |
|
671 | 671 | { |
672 | 672 | $join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name); |
673 | 673 | |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | // Add language variable |
680 | 680 | $lang->extend_vars[$column_name] = $column_title; |
681 | 681 | // unserialize if the data type if checkbox, select and so on |
682 | - if(in_array($column_type, array('checkbox','select','radio'))) |
|
682 | + if (in_array($column_type, array('checkbox', 'select', 'radio'))) |
|
683 | 683 | { |
684 | 684 | $join_form_list[$i]->default_value = unserialize($default_value); |
685 | - if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
685 | + if (!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
686 | 686 | } |
687 | 687 | else |
688 | 688 | { |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | $this->join_form_list = $list; |
695 | 695 | } |
696 | 696 | // Get object style if the filter_response is true |
697 | - if($filter_response && count($this->join_form_list)) |
|
697 | + if ($filter_response && count($this->join_form_list)) |
|
698 | 698 | { |
699 | - foreach($this->join_form_list as $key => $val) |
|
699 | + foreach ($this->join_form_list as $key => $val) |
|
700 | 700 | { |
701 | - if($val->is_active != 'Y') continue; |
|
701 | + if ($val->is_active != 'Y') continue; |
|
702 | 702 | unset($obj); |
703 | 703 | $obj->type = $val->column_type; |
704 | 704 | $obj->name = $val->column_name; |
705 | 705 | $obj->lang = $val->column_title; |
706 | - if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false; |
|
706 | + if ($logged_info->is_admin != 'Y') $obj->required = $val->required == 'Y' ?true:false; |
|
707 | 707 | else $obj->required = false; |
708 | 708 | $filter_output[] = $obj; |
709 | 709 | |
@@ -730,15 +730,15 @@ discard block |
||
730 | 730 | $args->sort_index = "list_order"; |
731 | 731 | $output = executeQueryArray('member.getJoinFormList', $args); |
732 | 732 | |
733 | - if(!$output->toBool()) |
|
733 | + if (!$output->toBool()) |
|
734 | 734 | { |
735 | 735 | return array(); |
736 | 736 | } |
737 | 737 | |
738 | 738 | $joinFormList = array(); |
739 | - foreach($output->data as $val) |
|
739 | + foreach ($output->data as $val) |
|
740 | 740 | { |
741 | - if($val->is_active != 'Y') |
|
741 | + if ($val->is_active != 'Y') |
|
742 | 742 | { |
743 | 743 | continue; |
744 | 744 | } |
@@ -755,20 +755,20 @@ discard block |
||
755 | 755 | function getCombineJoinForm($member_info) |
756 | 756 | { |
757 | 757 | $extend_form_list = $this->getJoinFormlist(); |
758 | - if(!$extend_form_list) return; |
|
758 | + if (!$extend_form_list) return; |
|
759 | 759 | // Member info is open only to an administrator and him/herself when is_private is true. |
760 | 760 | $logged_info = Context::get('logged_info'); |
761 | 761 | |
762 | - foreach($extend_form_list as $srl => $item) |
|
762 | + foreach ($extend_form_list as $srl => $item) |
|
763 | 763 | { |
764 | 764 | $column_name = $item->column_name; |
765 | 765 | $value = $member_info->{$column_name}; |
766 | 766 | |
767 | 767 | // Change values depening on the type of extend form |
768 | - switch($item->column_type) |
|
768 | + switch ($item->column_type) |
|
769 | 769 | { |
770 | 770 | case 'checkbox' : |
771 | - if($value && !is_array($value)) $value = array($value); |
|
771 | + if ($value && !is_array($value)) $value = array($value); |
|
772 | 772 | break; |
773 | 773 | case 'text' : |
774 | 774 | case 'homepage' : |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | |
783 | 783 | $extend_form_list[$srl]->value = $value; |
784 | 784 | |
785 | - if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true; |
|
785 | + if ($member_info->{'open_'.$column_name} == 'Y') $extend_form_list[$srl]->is_opened = true; |
|
786 | 786 | else $extend_form_list[$srl]->is_opened = false; |
787 | 787 | } |
788 | 788 | return $extend_form_list; |
@@ -796,12 +796,12 @@ discard block |
||
796 | 796 | $args->member_join_form_srl = $member_join_form_srl; |
797 | 797 | $output = executeQuery('member.getJoinForm', $args); |
798 | 798 | $join_form = $output->data; |
799 | - if(!$join_form) return NULL; |
|
799 | + if (!$join_form) return NULL; |
|
800 | 800 | |
801 | 801 | $column_type = $join_form->column_type; |
802 | 802 | $default_value = $join_form->default_value; |
803 | 803 | |
804 | - if(in_array($column_type, array('checkbox','select','radio'))) |
|
804 | + if (in_array($column_type, array('checkbox', 'select', 'radio'))) |
|
805 | 805 | { |
806 | 806 | $join_form->default_value = unserialize($default_value); |
807 | 807 | } |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | */ |
819 | 819 | function getDeniedIDList() |
820 | 820 | { |
821 | - if(!$this->denied_id_list) |
|
821 | + if (!$this->denied_id_list) |
|
822 | 822 | { |
823 | 823 | $args->sort_index = "list_order"; |
824 | 824 | $args->page = Context::get('page'); |
@@ -834,14 +834,14 @@ discard block |
||
834 | 834 | function getDeniedIDs() |
835 | 835 | { |
836 | 836 | $output = executeQueryArray('member.getDeniedIDs'); |
837 | - if(!$output->toBool()) return array(); |
|
837 | + if (!$output->toBool()) return array(); |
|
838 | 838 | return $output->data; |
839 | 839 | } |
840 | 840 | |
841 | 841 | function getDeniedNickNames() |
842 | 842 | { |
843 | 843 | $output = executeQueryArray('member.getDeniedNickNames'); |
844 | - if(!$output->toBool()) |
|
844 | + if (!$output->toBool()) |
|
845 | 845 | { |
846 | 846 | return array(); |
847 | 847 | } |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | $args = new stdClass(); |
858 | 858 | $args->user_id = $user_id; |
859 | 859 | $output = executeQuery('member.chkDeniedID', $args); |
860 | - if($output->data->count) return true; |
|
860 | + if ($output->data->count) return true; |
|
861 | 861 | return false; |
862 | 862 | } |
863 | 863 | |
@@ -869,8 +869,8 @@ discard block |
||
869 | 869 | $args = new stdClass(); |
870 | 870 | $args->nick_name = $nickName; |
871 | 871 | $output = executeQuery('member.chkDeniedNickName', $args); |
872 | - if($output->data->count) return true; |
|
873 | - if(!$output->toBool()) |
|
872 | + if ($output->data->count) return true; |
|
873 | + if (!$output->toBool()) |
|
874 | 874 | { |
875 | 875 | return true; |
876 | 876 | } |
@@ -881,20 +881,20 @@ discard block |
||
881 | 881 | */ |
882 | 882 | function getProfileImage($member_srl) |
883 | 883 | { |
884 | - if(!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) |
|
884 | + if (!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) |
|
885 | 885 | { |
886 | 886 | $GLOBALS['__member_info__']['profile_image'][$member_srl] = null; |
887 | - $exts = array('gif','jpg','png'); |
|
888 | - for($i=0;$i<3;$i++) |
|
887 | + $exts = array('gif', 'jpg', 'png'); |
|
888 | + for ($i = 0; $i < 3; $i++) |
|
889 | 889 | { |
890 | 890 | $image_name_file = sprintf('files/member_extra_info/profile_image/%s%d.%s', getNumberingPath($member_srl), $member_srl, $exts[$i]); |
891 | - if(file_exists($image_name_file)) |
|
891 | + if (file_exists($image_name_file)) |
|
892 | 892 | { |
893 | 893 | list($width, $height, $type, $attrs) = getimagesize($image_name_file); |
894 | 894 | $info = new stdClass(); |
895 | 895 | $info->width = $width; |
896 | 896 | $info->height = $height; |
897 | - $info->src = Context::getRequestUri().$image_name_file . '?' . date('YmdHis', filemtime($image_name_file)); |
|
897 | + $info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file)); |
|
898 | 898 | $info->file = './'.$image_name_file; |
899 | 899 | $GLOBALS['__member_info__']['profile_image'][$member_srl] = $info; |
900 | 900 | break; |
@@ -910,16 +910,16 @@ discard block |
||
910 | 910 | */ |
911 | 911 | function getImageName($member_srl) |
912 | 912 | { |
913 | - if(!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) |
|
913 | + if (!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) |
|
914 | 914 | { |
915 | 915 | $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
916 | - if(file_exists($image_name_file)) |
|
916 | + if (file_exists($image_name_file)) |
|
917 | 917 | { |
918 | 918 | list($width, $height, $type, $attrs) = getimagesize($image_name_file); |
919 | 919 | $info = new stdClass; |
920 | 920 | $info->width = $width; |
921 | 921 | $info->height = $height; |
922 | - $info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file)); |
|
922 | + $info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file)); |
|
923 | 923 | $info->file = './'.$image_name_file; |
924 | 924 | $GLOBALS['__member_info__']['image_name'][$member_srl] = $info; |
925 | 925 | } |
@@ -933,15 +933,15 @@ discard block |
||
933 | 933 | */ |
934 | 934 | function getImageMark($member_srl) |
935 | 935 | { |
936 | - if(!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) |
|
936 | + if (!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) |
|
937 | 937 | { |
938 | 938 | $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
939 | - if(file_exists($image_mark_file)) |
|
939 | + if (file_exists($image_mark_file)) |
|
940 | 940 | { |
941 | 941 | list($width, $height, $type, $attrs) = getimagesize($image_mark_file); |
942 | 942 | $info->width = $width; |
943 | 943 | $info->height = $height; |
944 | - $info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file)); |
|
944 | + $info->src = Context::getRequestUri().$image_mark_file.'?'.date('YmdHis', filemtime($image_mark_file)); |
|
945 | 945 | $info->file = './'.$image_mark_file; |
946 | 946 | $GLOBALS['__member_info__']['image_mark'][$member_srl] = $info; |
947 | 947 | } |
@@ -955,27 +955,27 @@ discard block |
||
955 | 955 | /** |
956 | 956 | * @brief Get the image mark of the group |
957 | 957 | */ |
958 | - function getGroupImageMark($member_srl,$site_srl=0) |
|
958 | + function getGroupImageMark($member_srl, $site_srl = 0) |
|
959 | 959 | { |
960 | - if(!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl])) |
|
960 | + if (!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl])) |
|
961 | 961 | { |
962 | 962 | $oModuleModel = getModel('module'); |
963 | 963 | $config = $oModuleModel->getModuleConfig('member'); |
964 | - if($config->group_image_mark!='Y') |
|
964 | + if ($config->group_image_mark != 'Y') |
|
965 | 965 | { |
966 | 966 | return null; |
967 | 967 | } |
968 | - $member_group = $this->getMemberGroups($member_srl,$site_srl); |
|
968 | + $member_group = $this->getMemberGroups($member_srl, $site_srl); |
|
969 | 969 | $groups_info = $this->getGroups($site_srl); |
970 | - if(count($member_group) > 0 && is_array($member_group)) |
|
970 | + if (count($member_group) > 0 && is_array($member_group)) |
|
971 | 971 | { |
972 | 972 | $memberGroups = array_keys($member_group); |
973 | 973 | |
974 | - foreach($groups_info as $group_srl=>$group_info) |
|
974 | + foreach ($groups_info as $group_srl=>$group_info) |
|
975 | 975 | { |
976 | - if(in_array($group_srl, $memberGroups)) |
|
976 | + if (in_array($group_srl, $memberGroups)) |
|
977 | 977 | { |
978 | - if($group_info->image_mark) |
|
978 | + if ($group_info->image_mark) |
|
979 | 979 | { |
980 | 980 | $info = new stdClass(); |
981 | 981 | $info->title = $group_info->title; |
@@ -999,10 +999,10 @@ discard block |
||
999 | 999 | */ |
1000 | 1000 | function getSignature($member_srl) |
1001 | 1001 | { |
1002 | - if(!isset($GLOBALS['__member_info__']['signature'][$member_srl])) |
|
1002 | + if (!isset($GLOBALS['__member_info__']['signature'][$member_srl])) |
|
1003 | 1003 | { |
1004 | 1004 | $filename = sprintf('files/member_extra_info/signature/%s%d.signature.php', getNumberingPath($member_srl), $member_srl); |
1005 | - if(file_exists($filename)) |
|
1005 | + if (file_exists($filename)) |
|
1006 | 1006 | { |
1007 | 1007 | $buff = FileHandler::readFile($filename); |
1008 | 1008 | $signature = preg_replace('/<\?.*?\?>/', '', $buff); |
@@ -1020,10 +1020,10 @@ discard block |
||
1020 | 1020 | * @param int $member_srl Set this to member_srl when comparing a member's password (optional) |
1021 | 1021 | * @return bool |
1022 | 1022 | */ |
1023 | - function isValidPassword($hashed_password, $password_text, $member_srl=null) |
|
1023 | + function isValidPassword($hashed_password, $password_text, $member_srl = null) |
|
1024 | 1024 | { |
1025 | 1025 | // False if no password in entered |
1026 | - if(!$password_text) |
|
1026 | + if (!$password_text) |
|
1027 | 1027 | { |
1028 | 1028 | return false; |
1029 | 1029 | } |
@@ -1032,31 +1032,31 @@ discard block |
||
1032 | 1032 | $oPassword = new Password(); |
1033 | 1033 | $current_algorithm = $oPassword->checkAlgorithm($hashed_password); |
1034 | 1034 | $match = $oPassword->checkPassword($password_text, $hashed_password, $current_algorithm); |
1035 | - if(!$match) |
|
1035 | + if (!$match) |
|
1036 | 1036 | { |
1037 | 1037 | return false; |
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | // Update the encryption method if necessary |
1041 | 1041 | $config = $this->getMemberConfig(); |
1042 | - if($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') |
|
1042 | + if ($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') |
|
1043 | 1043 | { |
1044 | 1044 | $need_upgrade = false; |
1045 | 1045 | |
1046 | - if(!$need_upgrade) |
|
1046 | + if (!$need_upgrade) |
|
1047 | 1047 | { |
1048 | 1048 | $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm(); |
1049 | - if($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
1049 | + if ($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | - if(!$need_upgrade) |
|
1052 | + if (!$need_upgrade) |
|
1053 | 1053 | { |
1054 | 1054 | $required_work_factor = $oPassword->getWorkFactor(); |
1055 | 1055 | $current_work_factor = $oPassword->checkWorkFactor($hashed_password); |
1056 | - if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
1056 | + if ($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | - if($need_upgrade === true) |
|
1059 | + if ($need_upgrade === true) |
|
1060 | 1060 | { |
1061 | 1061 | $args = new stdClass(); |
1062 | 1062 | $args->member_srl = $member_srl; |
@@ -1084,27 +1084,27 @@ discard block |
||
1084 | 1084 | function checkPasswordStrength($password, $strength) |
1085 | 1085 | { |
1086 | 1086 | $logged_info = Context::get('logged_info'); |
1087 | - if($logged_info->is_admin == 'Y') return true; |
|
1087 | + if ($logged_info->is_admin == 'Y') return true; |
|
1088 | 1088 | |
1089 | - if($strength == NULL) |
|
1089 | + if ($strength == NULL) |
|
1090 | 1090 | { |
1091 | 1091 | $config = $this->getMemberConfig(); |
1092 | - $strength = $config->password_strength?$config->password_strength:'normal'; |
|
1092 | + $strength = $config->password_strength ? $config->password_strength : 'normal'; |
|
1093 | 1093 | } |
1094 | 1094 | |
1095 | 1095 | $length = strlen($password); |
1096 | 1096 | |
1097 | 1097 | switch ($strength) { |
1098 | 1098 | case 'high': |
1099 | - if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
1099 | + if ($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
1100 | 1100 | /* no break */ |
1101 | 1101 | |
1102 | 1102 | case 'normal': |
1103 | - if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
1103 | + if ($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
1104 | 1104 | break; |
1105 | 1105 | |
1106 | 1106 | case 'low': |
1107 | - if($length < 4) return false; |
|
1107 | + if ($length < 4) return false; |
|
1108 | 1108 | break; |
1109 | 1109 | } |
1110 | 1110 | |
@@ -1115,11 +1115,11 @@ discard block |
||
1115 | 1115 | { |
1116 | 1116 | $groupSrl = 0; |
1117 | 1117 | $output = $this->getGroups($site_srl); |
1118 | - if(is_array($output)) |
|
1118 | + if (is_array($output)) |
|
1119 | 1119 | { |
1120 | - foreach($output AS $key=>$value) |
|
1120 | + foreach ($output AS $key=>$value) |
|
1121 | 1121 | { |
1122 | - if($value->is_admin == 'Y') |
|
1122 | + if ($value->is_admin == 'Y') |
|
1123 | 1123 | { |
1124 | 1124 | $groupSrl = $value->group_srl; |
1125 | 1125 | break; |
@@ -18,6 +18,7 @@ |
||
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Menu depth arrange |
21 | + * @param integer $depth |
|
21 | 22 | * @return void |
22 | 23 | */ |
23 | 24 | function straightenMenu($menu_item, $depth) |
@@ -22,14 +22,18 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function straightenMenu($menu_item, $depth) |
24 | 24 | { |
25 | - if(!$menu_item['link']) return; |
|
25 | + if(!$menu_item['link']) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | $obj = new stdClass; |
27 | 29 | $obj->href = $menu_item['href']; |
28 | 30 | $obj->depth = $depth; |
29 | 31 | $obj->text = $menu_item['text']; |
30 | 32 | $obj->open_window = $menu_item['open_window']; |
31 | 33 | $this->result[] = $obj; |
32 | - if(!$menu_item['list']) return; |
|
34 | + if(!$menu_item['list']) { |
|
35 | + return; |
|
36 | + } |
|
33 | 37 | foreach($menu_item['list'] as $item) |
34 | 38 | { |
35 | 39 | $this->straightenMenu($item, $depth+1); |
@@ -58,7 +62,9 @@ discard block |
||
58 | 62 | $menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php'; |
59 | 63 | } |
60 | 64 | |
61 | - if(file_exists($menu_info->php_file)) @include($menu_info->php_file); |
|
65 | + if(file_exists($menu_info->php_file)) { |
|
66 | + @include($menu_info->php_file); |
|
67 | + } |
|
62 | 68 | if(is_array($menu->list)) |
63 | 69 | { |
64 | 70 | foreach($menu->list as $menu_item) |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function straightenMenu($menu_item, $depth) |
24 | 24 | { |
25 | - if(!$menu_item['link']) return; |
|
25 | + if (!$menu_item['link']) return; |
|
26 | 26 | $obj = new stdClass; |
27 | 27 | $obj->href = $menu_item['href']; |
28 | 28 | $obj->depth = $depth; |
29 | 29 | $obj->text = $menu_item['text']; |
30 | 30 | $obj->open_window = $menu_item['open_window']; |
31 | 31 | $this->result[] = $obj; |
32 | - if(!$menu_item['list']) return; |
|
33 | - foreach($menu_item['list'] as $item) |
|
32 | + if (!$menu_item['list']) return; |
|
33 | + foreach ($menu_item['list'] as $item) |
|
34 | 34 | { |
35 | - $this->straightenMenu($item, $depth+1); |
|
35 | + $this->straightenMenu($item, $depth + 1); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | function dispMenuMenu() |
44 | 44 | { |
45 | 45 | $menu_srl = Context::get('menu_srl'); |
46 | - $oAdminModel =& getAdminModel('menu'); |
|
46 | + $oAdminModel = & getAdminModel('menu'); |
|
47 | 47 | $menu_info = $oAdminModel->getMenu($menu_srl); |
48 | 48 | |
49 | - if(!$menu_srl) |
|
49 | + if (!$menu_srl) |
|
50 | 50 | { |
51 | 51 | $oMenuAdminController = getAdminController('menu'); |
52 | 52 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
53 | 53 | |
54 | - if(file_exists($homeMenuCacheFile)) |
|
54 | + if (file_exists($homeMenuCacheFile)) |
|
55 | 55 | { |
56 | 56 | @include($homeMenuCacheFile); |
57 | 57 | } |
58 | 58 | $menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php'; |
59 | 59 | } |
60 | 60 | |
61 | - if(file_exists($menu_info->php_file)) @include($menu_info->php_file); |
|
62 | - if(is_array($menu->list)) |
|
61 | + if (file_exists($menu_info->php_file)) @include($menu_info->php_file); |
|
62 | + if (is_array($menu->list)) |
|
63 | 63 | { |
64 | - foreach($menu->list as $menu_item) |
|
64 | + foreach ($menu->list as $menu_item) |
|
65 | 65 | { |
66 | 66 | $this->straightenMenu($menu_item, 0); |
67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | Context::set('menu', $this->result); |
71 | 71 | |
72 | - $this->setTemplatePath(sprintf("%stpl/",$this->module_path)); |
|
72 | + $this->setTemplatePath(sprintf("%stpl/", $this->module_path)); |
|
73 | 73 | $this->setTemplateFile('menu.html'); |
74 | 74 | } |
75 | 75 | } |
@@ -260,6 +260,9 @@ discard block |
||
260 | 260 | return $module_srl; |
261 | 261 | } |
262 | 262 | |
263 | + /** |
|
264 | + * @param boolean $isProc |
|
265 | + */ |
|
263 | 266 | private function _returnByProc($isProc, $msg='msg_invalid_request') |
264 | 267 | { |
265 | 268 | if(!$isProc) |
@@ -938,6 +941,9 @@ discard block |
||
938 | 941 | |
939 | 942 | } |
940 | 943 | |
944 | + /** |
|
945 | + * @param string $skinVars |
|
946 | + */ |
|
941 | 947 | public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL) |
942 | 948 | { |
943 | 949 | if(!$moduleSrl && !$mid) |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $args = new stdClass(); |
23 | 23 | $args->title = Context::get('title'); |
24 | 24 | $output = executeQuery('module.insertModuleCategory', $args); |
25 | - if(!$output->toBool()) return $output; |
|
25 | + if (!$output->toBool()) return $output; |
|
26 | 26 | |
27 | 27 | $this->setMessage("success_registed"); |
28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | function procModuleAdminUpdateCategory() |
37 | 37 | { |
38 | 38 | $output = $this->doUpdateModuleCategory(); |
39 | - if(!$output->toBool()) return $output; |
|
39 | + if (!$output->toBool()) return $output; |
|
40 | 40 | |
41 | 41 | $this->setMessage('success_updated'); |
42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | function procModuleAdminDeleteCategory() |
51 | 51 | { |
52 | 52 | $output = $this->doDeleteModuleCategory(); |
53 | - if(!$output->toBool()) return $output; |
|
53 | + if (!$output->toBool()) return $output; |
|
54 | 54 | |
55 | 55 | $this->setMessage('success_deleted'); |
56 | 56 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | function procModuleAdminCopyModule($args = NULL) |
86 | 86 | { |
87 | 87 | $isProc = false; |
88 | - if(!$args) |
|
88 | + if (!$args) |
|
89 | 89 | { |
90 | 90 | $isProc = true; |
91 | 91 | // Get information of the target module to copy |
@@ -97,24 +97,24 @@ discard block |
||
97 | 97 | $module_srl = $args->module_srl; |
98 | 98 | } |
99 | 99 | |
100 | - if(!$module_srl) |
|
100 | + if (!$module_srl) |
|
101 | 101 | { |
102 | 102 | return $this->_returnByProc($isProc); |
103 | 103 | } |
104 | 104 | |
105 | 105 | // Get module name to create and browser title |
106 | 106 | $clones = array(); |
107 | - for($i=1;$i<=10;$i++) |
|
107 | + for ($i = 1; $i <= 10; $i++) |
|
108 | 108 | { |
109 | 109 | $mid = trim($args->{"mid_".$i}); |
110 | - if(!$mid) continue; |
|
111 | - if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
110 | + if (!$mid) continue; |
|
111 | + if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
112 | 112 | $browser_title = $args->{"browser_title_".$i}; |
113 | - if(!$mid) continue; |
|
114 | - if($mid && !$browser_title) $browser_title = $mid; |
|
113 | + if (!$mid) continue; |
|
114 | + if ($mid && !$browser_title) $browser_title = $mid; |
|
115 | 115 | $clones[$mid] = $browser_title; |
116 | 116 | } |
117 | - if(count($clones) < 1) |
|
117 | + if (count($clones) < 1) |
|
118 | 118 | { |
119 | 119 | return $this->_returnByProc($isProc); |
120 | 120 | } |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | $module_args->module_srl = $module_srl; |
130 | 130 | $output = executeQueryArray('module.getModuleGrants', $module_args); |
131 | 131 | $grant = array(); |
132 | - if($output->data) |
|
132 | + if ($output->data) |
|
133 | 133 | { |
134 | - foreach($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
134 | + foreach ($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // get Extra Vars |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | $extra_args->module_srl = $module_srl; |
140 | 140 | $extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args); |
141 | 141 | $extra_vars = new stdClass(); |
142 | - if($extra_output->toBool() && is_array($extra_output->data)) |
|
142 | + if ($extra_output->toBool() && is_array($extra_output->data)) |
|
143 | 143 | { |
144 | - foreach($extra_output->data as $info) |
|
144 | + foreach ($extra_output->data as $info) |
|
145 | 145 | { |
146 | 146 | $extra_vars->{$info->name} = $info->value; |
147 | 147 | } |
@@ -150,17 +150,17 @@ discard block |
||
150 | 150 | $tmpModuleSkinVars = $oModuleModel->getModuleSkinVars($module_srl); |
151 | 151 | $tmpModuleMobileSkinVars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
152 | 152 | |
153 | - if($tmpModuleSkinVars) |
|
153 | + if ($tmpModuleSkinVars) |
|
154 | 154 | { |
155 | - foreach($tmpModuleSkinVars as $key=>$value) |
|
155 | + foreach ($tmpModuleSkinVars as $key=>$value) |
|
156 | 156 | { |
157 | 157 | $moduleSkinVars->{$key} = $value->value; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - if($tmpModuleMobileSkinVars) |
|
161 | + if ($tmpModuleMobileSkinVars) |
|
162 | 162 | { |
163 | - foreach($tmpModuleMobileSkinVars as $key=>$value) |
|
163 | + foreach ($tmpModuleMobileSkinVars as $key=>$value) |
|
164 | 164 | { |
165 | 165 | $moduleMobileSkinVars->{$key} = $value->value; |
166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $triggerObj->moduleSrlList = array(); |
175 | 175 | |
176 | 176 | $errorLog = array(); |
177 | - foreach($clones as $mid => $browser_title) |
|
177 | + foreach ($clones as $mid => $browser_title) |
|
178 | 178 | { |
179 | 179 | $clone_args = new stdClass; |
180 | 180 | $clone_args = clone $module_info; |
@@ -188,29 +188,29 @@ discard block |
||
188 | 188 | // Create a module |
189 | 189 | $output = $oModuleController->insertModule($clone_args); |
190 | 190 | |
191 | - if(!$output->toBool()) |
|
191 | + if (!$output->toBool()) |
|
192 | 192 | { |
193 | - $errorLog[] = $mid . ' : '. $output->message; |
|
193 | + $errorLog[] = $mid.' : '.$output->message; |
|
194 | 194 | continue; |
195 | 195 | } |
196 | 196 | $module_srl = $output->get('module_srl'); |
197 | 197 | |
198 | - if($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE') |
|
198 | + if ($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE') |
|
199 | 199 | { |
200 | 200 | // copy document |
201 | 201 | $oDocumentAdminController = getAdminController('document'); |
202 | 202 | $copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->document_srl), $module_srl, $module_info->category_srl); |
203 | 203 | $document_srls = $copyOutput->get('copied_srls'); |
204 | - if($document_srls && count($document_srls) > 0) |
|
204 | + if ($document_srls && count($document_srls) > 0) |
|
205 | 205 | { |
206 | 206 | $extra_vars->document_srl = array_pop($document_srls); |
207 | 207 | } |
208 | 208 | |
209 | - if($extra_vars->mdocument_srl) |
|
209 | + if ($extra_vars->mdocument_srl) |
|
210 | 210 | { |
211 | 211 | $copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl); |
212 | 212 | $copiedSrls = $copyOutput->get('copied_srls'); |
213 | - if($copiedSrls && count($copiedSrls) > 0) |
|
213 | + if ($copiedSrls && count($copiedSrls) > 0) |
|
214 | 214 | { |
215 | 215 | $extra_vars->mdocument_srl = array_pop($copiedSrls); |
216 | 216 | } |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | // Grant module permissions |
221 | - if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
222 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
221 | + if (count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
222 | + if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
223 | 223 | |
224 | - if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
225 | - if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
224 | + if ($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
225 | + if ($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
226 | 226 | |
227 | 227 | $triggerObj->moduleSrlList[] = $module_srl; |
228 | 228 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | $oDB->commit(); |
233 | 233 | |
234 | - if(count($errorLog) > 0) |
|
234 | + if (count($errorLog) > 0) |
|
235 | 235 | { |
236 | 236 | $message = implode('\n', $errorLog); |
237 | 237 | $this->setMessage($message); |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->setMessage('success_registed'); |
243 | 243 | } |
244 | 244 | |
245 | - if($isProc) |
|
245 | + if ($isProc) |
|
246 | 246 | { |
247 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
247 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
248 | 248 | { |
249 | 249 | global $lang; |
250 | 250 | htmlHeader(); |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | return $module_srl; |
261 | 261 | } |
262 | 262 | |
263 | - private function _returnByProc($isProc, $msg='msg_invalid_request') |
|
263 | + private function _returnByProc($isProc, $msg = 'msg_invalid_request') |
|
264 | 264 | { |
265 | - if(!$isProc) |
|
265 | + if (!$isProc) |
|
266 | 266 | return; |
267 | 267 | else |
268 | 268 | { |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | // Get information of the module |
283 | 283 | $columnList = array('module_srl', 'module'); |
284 | 284 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
285 | - if(!$module_info) return new BaseObject(-1,'msg_invalid_request'); |
|
285 | + if (!$module_info) return new BaseObject(-1, 'msg_invalid_request'); |
|
286 | 286 | // Register Admin ID |
287 | 287 | $oModuleController->deleteAdminId($module_srl); |
288 | 288 | $admin_member = Context::get('admin_member'); |
289 | - if($admin_member) |
|
289 | + if ($admin_member) |
|
290 | 290 | { |
291 | - $admin_members = explode(',',$admin_member); |
|
292 | - foreach($admin_members as $admin_id) |
|
291 | + $admin_members = explode(',', $admin_member); |
|
292 | + foreach ($admin_members as $admin_id) |
|
293 | 293 | { |
294 | 294 | $admin_id = trim($admin_id); |
295 | - if(!$admin_id) continue; |
|
295 | + if (!$admin_id) continue; |
|
296 | 296 | $oModuleController->insertAdminId($module_srl, $admin_id); |
297 | 297 | } |
298 | 298 | } |
@@ -307,13 +307,13 @@ discard block |
||
307 | 307 | $grant_list->manager->default = 'manager'; |
308 | 308 | |
309 | 309 | $grant = new stdClass(); |
310 | - foreach($grant_list as $grant_name => $grant_info) |
|
310 | + foreach ($grant_list as $grant_name => $grant_info) |
|
311 | 311 | { |
312 | 312 | // Get the default value |
313 | 313 | $default = Context::get($grant_name.'_default'); |
314 | 314 | // -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users |
315 | 315 | $grant->{$grant_name} = array(); |
316 | - if(strlen($default)) |
|
316 | + if (strlen($default)) |
|
317 | 317 | { |
318 | 318 | $grant->{$grant_name}[] = $default; |
319 | 319 | continue; |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | else |
323 | 323 | { |
324 | 324 | $group_srls = Context::get($grant_name); |
325 | - if($group_srls) |
|
325 | + if ($group_srls) |
|
326 | 326 | { |
327 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
328 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
327 | + if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls); |
|
328 | + elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls); |
|
329 | 329 | else $group_srls = array($group_srls); |
330 | 330 | $grant->{$grant_name} = $group_srls; |
331 | 331 | } |
@@ -338,18 +338,18 @@ discard block |
||
338 | 338 | $args = new stdClass(); |
339 | 339 | $args->module_srl = $module_srl; |
340 | 340 | $output = executeQuery('module.deleteModuleGrants', $args); |
341 | - if(!$output->toBool()) return $output; |
|
341 | + if (!$output->toBool()) return $output; |
|
342 | 342 | // Permissions stored in the DB |
343 | - foreach($grant as $grant_name => $group_srls) |
|
343 | + foreach ($grant as $grant_name => $group_srls) |
|
344 | 344 | { |
345 | - foreach($group_srls as $val) |
|
345 | + foreach ($group_srls as $val) |
|
346 | 346 | { |
347 | 347 | $args = new stdClass(); |
348 | 348 | $args->module_srl = $module_srl; |
349 | 349 | $args->name = $grant_name; |
350 | 350 | $args->group_srl = $val; |
351 | 351 | $output = executeQuery('module.insertModuleGrant', $args); |
352 | - if(!$output->toBool()) return $output; |
|
352 | + if (!$output->toBool()) return $output; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | $this->setMessage('success_registed'); |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | $oModuleModel = getModel('module'); |
369 | 369 | $columnList = array('module_srl', 'module', 'skin', 'mskin', 'is_skin_fix', 'is_mskin_fix'); |
370 | 370 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
371 | - if($module_info->module_srl) |
|
371 | + if ($module_info->module_srl) |
|
372 | 372 | { |
373 | - if($mode === 'M') |
|
373 | + if ($mode === 'M') |
|
374 | 374 | { |
375 | - if($module_info->is_mskin_fix == 'Y') |
|
375 | + if ($module_info->is_mskin_fix == 'Y') |
|
376 | 376 | { |
377 | 377 | $skin = $module_info->mskin; |
378 | 378 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | } |
384 | 384 | else |
385 | 385 | { |
386 | - if($module_info->is_skin_fix == 'Y') |
|
386 | + if ($module_info->is_skin_fix == 'Y') |
|
387 | 387 | { |
388 | 388 | $skin = $module_info->skin; |
389 | 389 | } |
@@ -394,9 +394,9 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | // Get skin information (to check extra_vars) |
397 | - $module_path = _XE_PATH_ . 'modules/'.$module_info->module; |
|
397 | + $module_path = _XE_PATH_.'modules/'.$module_info->module; |
|
398 | 398 | |
399 | - if($mode === 'M') |
|
399 | + if ($mode === 'M') |
|
400 | 400 | { |
401 | 401 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
402 | 402 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
@@ -417,35 +417,35 @@ discard block |
||
417 | 417 | unset($obj->module); |
418 | 418 | unset($obj->_mode); |
419 | 419 | // Separately handle if a type of extra_vars is an image in the original skin_info |
420 | - if($skin_info->extra_vars) |
|
420 | + if ($skin_info->extra_vars) |
|
421 | 421 | { |
422 | - foreach($skin_info->extra_vars as $vars) |
|
422 | + foreach ($skin_info->extra_vars as $vars) |
|
423 | 423 | { |
424 | - if($vars->type!='image') continue; |
|
424 | + if ($vars->type != 'image') continue; |
|
425 | 425 | |
426 | 426 | $image_obj = $obj->{$vars->name}; |
427 | 427 | // Get a variable to delete |
428 | 428 | $del_var = $obj->{"del_".$vars->name}; |
429 | 429 | unset($obj->{"del_".$vars->name}); |
430 | - if($del_var == 'Y') |
|
430 | + if ($del_var == 'Y') |
|
431 | 431 | { |
432 | 432 | FileHandler::removeFile($skin_vars[$vars->name]->value); |
433 | 433 | continue; |
434 | 434 | } |
435 | 435 | // Use the previous data if not uploaded |
436 | - if(!$image_obj['tmp_name']) |
|
436 | + if (!$image_obj['tmp_name']) |
|
437 | 437 | { |
438 | 438 | $obj->{$vars->name} = $skin_vars[$vars->name]->value; |
439 | 439 | continue; |
440 | 440 | } |
441 | 441 | // Ignore if the file is not successfully uploaded |
442 | - if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
442 | + if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
443 | 443 | { |
444 | 444 | unset($obj->{$vars->name}); |
445 | 445 | continue; |
446 | 446 | } |
447 | 447 | // Ignore if the file is not an image |
448 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
448 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
449 | 449 | { |
450 | 450 | unset($obj->{$vars->name}); |
451 | 451 | continue; |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | // Upload the file to a path |
454 | 454 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
455 | 455 | // Create a directory |
456 | - if(!FileHandler::makeDir($path)) return false; |
|
456 | + if (!FileHandler::makeDir($path)) return false; |
|
457 | 457 | |
458 | 458 | $filename = $path.$image_obj['name']; |
459 | 459 | // Move the file |
460 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
460 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
461 | 461 | { |
462 | 462 | unset($obj->{$vars->name}); |
463 | 463 | continue; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | */ |
482 | 482 | $oModuleController = getController('module'); |
483 | 483 | |
484 | - if($mode === 'M') |
|
484 | + if ($mode === 'M') |
|
485 | 485 | { |
486 | 486 | $output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj); |
487 | 487 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | { |
490 | 490 | $output = $oModuleController->insertModuleSkinVars($module_srl, $obj); |
491 | 491 | } |
492 | - if(!$output->toBool()) |
|
492 | + if (!$output->toBool()) |
|
493 | 493 | { |
494 | 494 | return $output; |
495 | 495 | } |
@@ -506,29 +506,29 @@ discard block |
||
506 | 506 | { |
507 | 507 | $vars = Context::getRequestVars(); |
508 | 508 | |
509 | - if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
509 | + if (!$vars->module_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
510 | 510 | |
511 | - $module_srls = explode(',',$vars->module_srls); |
|
512 | - if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
511 | + $module_srls = explode(',', $vars->module_srls); |
|
512 | + if (count($module_srls) < 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
513 | 513 | |
514 | 514 | $oModuleModel = getModel('module'); |
515 | - $oModuleController= getController('module'); |
|
515 | + $oModuleController = getController('module'); |
|
516 | 516 | $columnList = array('module_srl', 'module', 'menu_srl', 'site_srl', 'mid', 'browser_title', 'is_default', 'content', 'mcontent', 'open_rss', 'regdate'); |
517 | - $updateList = array('module_category_srl','layout_srl','skin','mlayout_srl','mskin','description','header_text','footer_text', 'use_mobile'); |
|
518 | - foreach($updateList as $key=>$val) |
|
517 | + $updateList = array('module_category_srl', 'layout_srl', 'skin', 'mlayout_srl', 'mskin', 'description', 'header_text', 'footer_text', 'use_mobile'); |
|
518 | + foreach ($updateList as $key=>$val) |
|
519 | 519 | { |
520 | - if(!strlen($vars->{$val})) |
|
520 | + if (!strlen($vars->{$val})) |
|
521 | 521 | { |
522 | 522 | unset($updateList[$key]); |
523 | 523 | $columnList[] = $val; |
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
527 | - foreach($module_srls as $module_srl) |
|
527 | + foreach ($module_srls as $module_srl) |
|
528 | 528 | { |
529 | 529 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
530 | 530 | |
531 | - foreach($updateList as $val) |
|
531 | + foreach ($updateList as $val) |
|
532 | 532 | { |
533 | 533 | $module_info->{$val} = $vars->{$val}; |
534 | 534 | } |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | } |
537 | 537 | |
538 | 538 | $this->setMessage('success_registed'); |
539 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
539 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
540 | 540 | { |
541 | - if(Context::get('success_return_url')) |
|
541 | + if (Context::get('success_return_url')) |
|
542 | 542 | { |
543 | 543 | $this->setRedirectUrl(Context::get('success_return_url')); |
544 | 544 | } |
@@ -561,10 +561,10 @@ discard block |
||
561 | 561 | function procModuleAdminModuleGrantSetup() |
562 | 562 | { |
563 | 563 | $module_srls = Context::get('module_srls'); |
564 | - if(!$module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
564 | + if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
565 | 565 | |
566 | - $modules = explode(',',$module_srls); |
|
567 | - if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
566 | + $modules = explode(',', $module_srls); |
|
567 | + if (count($modules) < 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
568 | 568 | |
569 | 569 | $oModuleController = getController('module'); |
570 | 570 | $oModuleModel = getModel('module'); |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | |
582 | 582 | $grant = new stdClass; |
583 | 583 | |
584 | - foreach($grant_list as $grant_name => $grant_info) |
|
584 | + foreach ($grant_list as $grant_name => $grant_info) |
|
585 | 585 | { |
586 | 586 | // Get the default value |
587 | 587 | $default = Context::get($grant_name.'_default'); |
588 | 588 | // -1 = Sign only, 0 = all users |
589 | 589 | $grant->{$grant_name} = array(); |
590 | - if(strlen($default)) |
|
590 | + if (strlen($default)) |
|
591 | 591 | { |
592 | 592 | $grant->{$grant_name}[] = $default; |
593 | 593 | continue; |
@@ -596,12 +596,12 @@ discard block |
||
596 | 596 | else |
597 | 597 | { |
598 | 598 | $group_srls = Context::get($grant_name); |
599 | - if($group_srls) |
|
599 | + if ($group_srls) |
|
600 | 600 | { |
601 | - if(!is_array($group_srls)) |
|
601 | + if (!is_array($group_srls)) |
|
602 | 602 | { |
603 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
604 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
603 | + if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls); |
|
604 | + elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls); |
|
605 | 605 | else $group_srls = array($group_srls); |
606 | 606 | } |
607 | 607 | $grant->{$grant_name} = $group_srls; |
@@ -612,30 +612,30 @@ discard block |
||
612 | 612 | } |
613 | 613 | |
614 | 614 | // Stored in the DB |
615 | - foreach($modules as $module_srl) |
|
615 | + foreach ($modules as $module_srl) |
|
616 | 616 | { |
617 | 617 | $args = new stdClass(); |
618 | 618 | $args->module_srl = $module_srl; |
619 | 619 | $output = executeQuery('module.deleteModuleGrants', $args); |
620 | - if(!$output->toBool()) continue; |
|
620 | + if (!$output->toBool()) continue; |
|
621 | 621 | // Permissions stored in the DB |
622 | - foreach($grant as $grant_name => $group_srls) |
|
622 | + foreach ($grant as $grant_name => $group_srls) |
|
623 | 623 | { |
624 | - foreach($group_srls as $val) |
|
624 | + foreach ($group_srls as $val) |
|
625 | 625 | { |
626 | 626 | $args = new stdClass(); |
627 | 627 | $args->module_srl = $module_srl; |
628 | 628 | $args->name = $grant_name; |
629 | 629 | $args->group_srl = $val; |
630 | 630 | $output = executeQuery('module.insertModuleGrant', $args); |
631 | - if(!$output->toBool()) return $output; |
|
631 | + if (!$output->toBool()) return $output; |
|
632 | 632 | } |
633 | 633 | } |
634 | 634 | } |
635 | 635 | $this->setMessage('success_registed'); |
636 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
636 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
637 | 637 | { |
638 | - if(Context::get('success_return_url')) |
|
638 | + if (Context::get('success_return_url')) |
|
639 | 639 | { |
640 | 640 | $this->setRedirectUrl(Context::get('success_return_url')); |
641 | 641 | } |
@@ -662,38 +662,38 @@ discard block |
||
662 | 662 | $target = Context::get('target'); |
663 | 663 | $module = Context::get('module'); |
664 | 664 | $args = new stdClass(); |
665 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
666 | - $args->name = str_replace(' ','_',Context::get('lang_code')); |
|
667 | - $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
|
668 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
665 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
666 | + $args->name = str_replace(' ', '_', Context::get('lang_code')); |
|
667 | + $args->lang_name = str_replace(' ', '_', Context::get('lang_name')); |
|
668 | + if (!empty($args->lang_name)) $args->name = $args->lang_name; |
|
669 | 669 | |
670 | 670 | // if args->name is empty, random generate for user define language |
671 | - if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
671 | + if (empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
672 | 672 | |
673 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
673 | + if (!$args->name) return new BaseObject(-1, 'msg_invalid_request'); |
|
674 | 674 | // Check whether a language code exists |
675 | 675 | $output = executeQueryArray('module.getLang', $args); |
676 | - if(!$output->toBool()) return $output; |
|
676 | + if (!$output->toBool()) return $output; |
|
677 | 677 | // If exists, clear the old values for updating |
678 | - if($output->data) $output = executeQuery('module.deleteLang', $args); |
|
679 | - if(!$output->toBool()) return $output; |
|
678 | + if ($output->data) $output = executeQuery('module.deleteLang', $args); |
|
679 | + if (!$output->toBool()) return $output; |
|
680 | 680 | // Enter |
681 | 681 | $lang_supported = Context::get('lang_supported'); |
682 | - foreach($lang_supported as $key => $val) |
|
682 | + foreach ($lang_supported as $key => $val) |
|
683 | 683 | { |
684 | 684 | $args->lang_code = $key; |
685 | 685 | $args->value = trim(Context::get($key)); |
686 | 686 | |
687 | 687 | // if request method is json, strip slashes |
688 | - if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
688 | + if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
689 | 689 | { |
690 | 690 | $args->value = stripslashes($args->value); |
691 | 691 | } |
692 | 692 | |
693 | - if($args->value) |
|
693 | + if ($args->value) |
|
694 | 694 | { |
695 | 695 | $output = executeQuery('module.insertLang', $args); |
696 | - if(!$output->toBool()) return $output; |
|
696 | + if (!$output->toBool()) return $output; |
|
697 | 697 | } |
698 | 698 | } |
699 | 699 | $this->makeCacheDefinedLangCode($args->site_srl); |
@@ -713,14 +713,14 @@ discard block |
||
713 | 713 | // Get language code |
714 | 714 | $site_module_info = Context::get('site_module_info'); |
715 | 715 | $args = new stdClass(); |
716 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
717 | - $args->name = str_replace(' ','_',Context::get('name')); |
|
718 | - $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
|
719 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
720 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
716 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
717 | + $args->name = str_replace(' ', '_', Context::get('name')); |
|
718 | + $args->lang_name = str_replace(' ', '_', Context::get('lang_name')); |
|
719 | + if (!empty($args->lang_name)) $args->name = $args->lang_name; |
|
720 | + if (!$args->name) return new BaseObject(-1, 'msg_invalid_request'); |
|
721 | 721 | |
722 | 722 | $output = executeQuery('module.deleteLang', $args); |
723 | - if(!$output->toBool()) return $output; |
|
723 | + if (!$output->toBool()) return $output; |
|
724 | 724 | $this->makeCacheDefinedLangCode($args->site_srl); |
725 | 725 | |
726 | 726 | $this->setMessage("success_deleted", 'info'); |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | function procModuleAdminGetList() |
733 | 733 | { |
734 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
734 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
735 | 735 | |
736 | 736 | $oModuleController = getController('module'); |
737 | 737 | $oModuleModel = getModel('module'); |
@@ -744,12 +744,12 @@ discard block |
||
744 | 744 | $args = new stdClass; |
745 | 745 | $logged_info = Context::get('logged_info'); |
746 | 746 | $site_module_info = Context::get('site_module_info'); |
747 | - if($site_keyword) $args->site_keyword = $site_keyword; |
|
747 | + if ($site_keyword) $args->site_keyword = $site_keyword; |
|
748 | 748 | |
749 | - if(!$site_srl) |
|
749 | + if (!$site_srl) |
|
750 | 750 | { |
751 | - if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
752 | - else $args->site_srl = (int)$site_module_info->site_srl; |
|
751 | + if ($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
752 | + else $args->site_srl = (int) $site_module_info->site_srl; |
|
753 | 753 | } |
754 | 754 | else $args->site_srl = $site_srl; |
755 | 755 | |
@@ -759,12 +759,12 @@ discard block |
||
759 | 759 | // Get a list of modules at the site |
760 | 760 | $output = executeQueryArray('module.getSiteModules', $args); |
761 | 761 | $mid_list = array(); |
762 | - if(count($output->data) > 0) |
|
762 | + if (count($output->data) > 0) |
|
763 | 763 | { |
764 | - foreach($output->data as $val) |
|
764 | + foreach ($output->data as $val) |
|
765 | 765 | { |
766 | 766 | $module = trim($val->module); |
767 | - if(!$module) continue; |
|
767 | + if (!$module) continue; |
|
768 | 768 | |
769 | 769 | // replace user defined lang. |
770 | 770 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $obj->browser_title = $val->browser_title; |
776 | 776 | $obj->mid = $val->mid; |
777 | 777 | $obj->module_category_srl = $val->module_category_srl; |
778 | - if($val->module_category_srl > 0) |
|
778 | + if ($val->module_category_srl > 0) |
|
779 | 779 | { |
780 | 780 | $moduleCategorySrl[] = $val->module_category_srl; |
781 | 781 | } |
@@ -787,23 +787,23 @@ discard block |
||
787 | 787 | $moduleCategorySrl = array_unique($moduleCategorySrl); |
788 | 788 | $output = $oModuleModel->getModuleCategories($moduleCategorySrl); |
789 | 789 | $categoryNameList = array(); |
790 | - if(is_array($output)) |
|
790 | + if (is_array($output)) |
|
791 | 791 | { |
792 | - foreach($output as $value) |
|
792 | + foreach ($output as $value) |
|
793 | 793 | { |
794 | 794 | $categoryNameList[$value->module_category_srl] = $value->title; |
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
798 | 798 | $selected_module = Context::get('selected_module'); |
799 | - if(count($mid_list) > 0) |
|
799 | + if (count($mid_list) > 0) |
|
800 | 800 | { |
801 | - foreach($mid_list as $module => $val) |
|
801 | + foreach ($mid_list as $module => $val) |
|
802 | 802 | { |
803 | - if(!$selected_module) $selected_module = $module; |
|
803 | + if (!$selected_module) $selected_module = $module; |
|
804 | 804 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
805 | 805 | |
806 | - if(!$xml_info) |
|
806 | + if (!$xml_info) |
|
807 | 807 | { |
808 | 808 | unset($mid_list[$module]); |
809 | 809 | continue; |
@@ -812,14 +812,14 @@ discard block |
||
812 | 812 | $mid_list[$module]->title = $xml_info->title; |
813 | 813 | |
814 | 814 | // change module category srl to title |
815 | - if(is_array($val->list)) |
|
815 | + if (is_array($val->list)) |
|
816 | 816 | { |
817 | - foreach($val->list as $key=>$value) |
|
817 | + foreach ($val->list as $key=>$value) |
|
818 | 818 | { |
819 | - if($value->module_category_srl > 0) |
|
819 | + if ($value->module_category_srl > 0) |
|
820 | 820 | { |
821 | 821 | $categorySrl = $mid_list[$module]->list[$key]->module_category_srl; |
822 | - if(isset($categoryNameList[$categorySrl])) |
|
822 | + if (isset($categoryNameList[$categorySrl])) |
|
823 | 823 | { |
824 | 824 | $mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl]; |
825 | 825 | } |
@@ -847,20 +847,20 @@ discard block |
||
847 | 847 | $args = new stdClass(); |
848 | 848 | |
849 | 849 | // Get the language file of the current site |
850 | - if(!$site_srl) |
|
850 | + if (!$site_srl) |
|
851 | 851 | { |
852 | 852 | $site_module_info = Context::get('site_module_info'); |
853 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
853 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
854 | 854 | } |
855 | 855 | else |
856 | 856 | { |
857 | 857 | $args->site_srl = $site_srl; |
858 | 858 | } |
859 | 859 | $output = executeQueryArray('module.getLang', $args); |
860 | - if(!$output->toBool() || !$output->data) return; |
|
860 | + if (!$output->toBool() || !$output->data) return; |
|
861 | 861 | |
862 | 862 | $langMap = array(); |
863 | - foreach($output->data as $lang) |
|
863 | + foreach ($output->data as $lang) |
|
864 | 864 | { |
865 | 865 | $langMap[$lang->lang_code][$lang->name] = $lang->value; |
866 | 866 | } |
@@ -869,29 +869,29 @@ discard block |
||
869 | 869 | $dbInfo = Context::getDBInfo(); |
870 | 870 | $defaultLang = $dbInfo->lang_type; |
871 | 871 | |
872 | - if(!is_array($langMap[$defaultLang])) |
|
872 | + if (!is_array($langMap[$defaultLang])) |
|
873 | 873 | { |
874 | 874 | $langMap[$defaultLang] = array(); |
875 | 875 | } |
876 | 876 | |
877 | 877 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
878 | 878 | |
879 | - foreach($lang_supported as $langCode => $langName) |
|
879 | + foreach ($lang_supported as $langCode => $langName) |
|
880 | 880 | { |
881 | - if(!is_array($langMap[$langCode])) |
|
881 | + if (!is_array($langMap[$langCode])) |
|
882 | 882 | { |
883 | 883 | $langMap[$langCode] = array(); |
884 | 884 | } |
885 | 885 | |
886 | 886 | $langMap[$langCode] += $langMap[$defaultLang]; |
887 | - foreach($lang_supported as $targetLangCode => $targetLangName) |
|
887 | + foreach ($lang_supported as $targetLangCode => $targetLangName) |
|
888 | 888 | { |
889 | - if($langCode == $targetLangCode || $langCode == $defaultLang) |
|
889 | + if ($langCode == $targetLangCode || $langCode == $defaultLang) |
|
890 | 890 | { |
891 | 891 | continue; |
892 | 892 | } |
893 | 893 | |
894 | - if(!is_array($langMap[$targetLangCode])) |
|
894 | + if (!is_array($langMap[$targetLangCode])) |
|
895 | 895 | { |
896 | 896 | $langMap[$targetLangCode] = array(); |
897 | 897 | } |
@@ -899,9 +899,9 @@ discard block |
||
899 | 899 | $langMap[$langCode] += $langMap[$targetLangCode]; |
900 | 900 | } |
901 | 901 | |
902 | - if($oCacheHandler->isSupport()) |
|
902 | + if ($oCacheHandler->isSupport()) |
|
903 | 903 | { |
904 | - $object_key = 'user_defined_langs:' . $args->site_srl . ':' . $langCode; |
|
904 | + $object_key = 'user_defined_langs:'.$args->site_srl.':'.$langCode; |
|
905 | 905 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
906 | 906 | $oCacheHandler->put($cache_key, $langMap[$langCode]); |
907 | 907 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | |
923 | 923 | $isSkinFix = Context::get('is_skin_fix'); |
924 | 924 | |
925 | - if($isSkinFix) |
|
925 | + if ($isSkinFix) |
|
926 | 926 | { |
927 | 927 | $isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y'; |
928 | 928 | } |
@@ -938,14 +938,14 @@ discard block |
||
938 | 938 | |
939 | 939 | public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL) |
940 | 940 | { |
941 | - if(!$moduleSrl && !$mid) |
|
941 | + if (!$moduleSrl && !$mid) |
|
942 | 942 | { |
943 | 943 | return $this->stop(-1, 'msg_invalid_request'); |
944 | 944 | } |
945 | 945 | |
946 | 946 | $oModuleModel = getModel('module'); |
947 | 947 | |
948 | - if($mid) |
|
948 | + if ($mid) |
|
949 | 949 | { |
950 | 950 | $moduleInfo = $oModuleModel->getModuleInfoByMid($mid); |
951 | 951 | } |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
955 | 955 | } |
956 | 956 | |
957 | - if(!$moduleInfo) |
|
957 | + if (!$moduleInfo) |
|
958 | 958 | { |
959 | 959 | return $this->stop(-1, 'msg_module_not_exists'); |
960 | 960 | } |
@@ -963,26 +963,26 @@ discard block |
||
963 | 963 | $layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
964 | 964 | $skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix'; |
965 | 965 | |
966 | - if(strlen($layoutSrl)) |
|
966 | + if (strlen($layoutSrl)) |
|
967 | 967 | { |
968 | 968 | $moduleInfo->{$layoutTargetValue} = $layoutSrl; |
969 | 969 | } |
970 | 970 | |
971 | - if(strlen($isSkinFix)) |
|
971 | + if (strlen($isSkinFix)) |
|
972 | 972 | { |
973 | 973 | $moduleInfo->{$skinFixTargetValue} = $isSkinFix; |
974 | 974 | } |
975 | 975 | |
976 | - if($isSkinFix == 'Y') |
|
976 | + if ($isSkinFix == 'Y') |
|
977 | 977 | { |
978 | 978 | $moduleInfo->{$skinTargetValue} = $skinName; |
979 | 979 | $skinVars = json_decode($skinVars); |
980 | 980 | |
981 | - if(is_array($skinVars)) |
|
981 | + if (is_array($skinVars)) |
|
982 | 982 | { |
983 | - foreach($skinVars as $key => $val) |
|
983 | + foreach ($skinVars as $key => $val) |
|
984 | 984 | { |
985 | - if(empty($val)) |
|
985 | + if (empty($val)) |
|
986 | 986 | { |
987 | 987 | continue; |
988 | 988 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | $menuItemSrl = Context::get('menu_item_srl'); |
1004 | 1004 | $useMobile = Context::get('use_mobile'); |
1005 | 1005 | |
1006 | - if(!$menuItemSrl) |
|
1006 | + if (!$menuItemSrl) |
|
1007 | 1007 | { |
1008 | 1008 | return $this->stop(-1, 'msg_invalid_request'); |
1009 | 1009 | } |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | $args = new stdClass(); |
23 | 23 | $args->title = Context::get('title'); |
24 | 24 | $output = executeQuery('module.insertModuleCategory', $args); |
25 | - if(!$output->toBool()) return $output; |
|
25 | + if(!$output->toBool()) { |
|
26 | + return $output; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | $this->setMessage("success_registed"); |
28 | 30 | |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | function procModuleAdminUpdateCategory() |
37 | 39 | { |
38 | 40 | $output = $this->doUpdateModuleCategory(); |
39 | - if(!$output->toBool()) return $output; |
|
41 | + if(!$output->toBool()) { |
|
42 | + return $output; |
|
43 | + } |
|
40 | 44 | |
41 | 45 | $this->setMessage('success_updated'); |
42 | 46 | |
@@ -50,7 +54,9 @@ discard block |
||
50 | 54 | function procModuleAdminDeleteCategory() |
51 | 55 | { |
52 | 56 | $output = $this->doDeleteModuleCategory(); |
53 | - if(!$output->toBool()) return $output; |
|
57 | + if(!$output->toBool()) { |
|
58 | + return $output; |
|
59 | + } |
|
54 | 60 | |
55 | 61 | $this->setMessage('success_deleted'); |
56 | 62 | |
@@ -91,8 +97,7 @@ discard block |
||
91 | 97 | // Get information of the target module to copy |
92 | 98 | $module_srl = Context::get('module_srl'); |
93 | 99 | $args = Context::getRequestVars(); |
94 | - } |
|
95 | - else |
|
100 | + } else |
|
96 | 101 | { |
97 | 102 | $module_srl = $args->module_srl; |
98 | 103 | } |
@@ -107,11 +112,19 @@ discard block |
||
107 | 112 | for($i=1;$i<=10;$i++) |
108 | 113 | { |
109 | 114 | $mid = trim($args->{"mid_".$i}); |
110 | - if(!$mid) continue; |
|
111 | - if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
115 | + if(!$mid) { |
|
116 | + continue; |
|
117 | + } |
|
118 | + if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) { |
|
119 | + return new BaseObject(-1, 'msg_limit_mid'); |
|
120 | + } |
|
112 | 121 | $browser_title = $args->{"browser_title_".$i}; |
113 | - if(!$mid) continue; |
|
114 | - if($mid && !$browser_title) $browser_title = $mid; |
|
122 | + if(!$mid) { |
|
123 | + continue; |
|
124 | + } |
|
125 | + if($mid && !$browser_title) { |
|
126 | + $browser_title = $mid; |
|
127 | + } |
|
115 | 128 | $clones[$mid] = $browser_title; |
116 | 129 | } |
117 | 130 | if(count($clones) < 1) |
@@ -131,7 +144,9 @@ discard block |
||
131 | 144 | $grant = array(); |
132 | 145 | if($output->data) |
133 | 146 | { |
134 | - foreach($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
147 | + foreach($output->data as $val) { |
|
148 | + $grant[$val->name][] = $val->group_srl; |
|
149 | + } |
|
135 | 150 | } |
136 | 151 | |
137 | 152 | // get Extra Vars |
@@ -218,11 +233,19 @@ discard block |
||
218 | 233 | } |
219 | 234 | |
220 | 235 | // Grant module permissions |
221 | - if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
222 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
236 | + if(count($grant) > 0) { |
|
237 | + $oModuleController->insertModuleGrants($module_srl, $grant); |
|
238 | + } |
|
239 | + if($extra_vars) { |
|
240 | + $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
241 | + } |
|
223 | 242 | |
224 | - if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
225 | - if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
243 | + if($moduleSkinVars) { |
|
244 | + $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
245 | + } |
|
246 | + if($moduleMobileSkinVars) { |
|
247 | + $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
248 | + } |
|
226 | 249 | |
227 | 250 | $triggerObj->moduleSrlList[] = $module_srl; |
228 | 251 | } |
@@ -235,8 +258,7 @@ discard block |
||
235 | 258 | { |
236 | 259 | $message = implode('\n', $errorLog); |
237 | 260 | $this->setMessage($message); |
238 | - } |
|
239 | - else |
|
261 | + } else |
|
240 | 262 | { |
241 | 263 | $message = $lang->success_registed; |
242 | 264 | $this->setMessage('success_registed'); |
@@ -262,9 +284,9 @@ discard block |
||
262 | 284 | |
263 | 285 | private function _returnByProc($isProc, $msg='msg_invalid_request') |
264 | 286 | { |
265 | - if(!$isProc) |
|
266 | - return; |
|
267 | - else |
|
287 | + if(!$isProc) { |
|
288 | + return; |
|
289 | + } else |
|
268 | 290 | { |
269 | 291 | return new BaseObject(-1, $msg); |
270 | 292 | } |
@@ -282,7 +304,9 @@ discard block |
||
282 | 304 | // Get information of the module |
283 | 305 | $columnList = array('module_srl', 'module'); |
284 | 306 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
285 | - if(!$module_info) return new BaseObject(-1,'msg_invalid_request'); |
|
307 | + if(!$module_info) { |
|
308 | + return new BaseObject(-1,'msg_invalid_request'); |
|
309 | + } |
|
286 | 310 | // Register Admin ID |
287 | 311 | $oModuleController->deleteAdminId($module_srl); |
288 | 312 | $admin_member = Context::get('admin_member'); |
@@ -292,7 +316,9 @@ discard block |
||
292 | 316 | foreach($admin_members as $admin_id) |
293 | 317 | { |
294 | 318 | $admin_id = trim($admin_id); |
295 | - if(!$admin_id) continue; |
|
319 | + if(!$admin_id) { |
|
320 | + continue; |
|
321 | + } |
|
296 | 322 | $oModuleController->insertAdminId($module_srl, $admin_id); |
297 | 323 | } |
298 | 324 | } |
@@ -318,15 +344,18 @@ discard block |
||
318 | 344 | $grant->{$grant_name}[] = $default; |
319 | 345 | continue; |
320 | 346 | // users in a particular group |
321 | - } |
|
322 | - else |
|
347 | + } else |
|
323 | 348 | { |
324 | 349 | $group_srls = Context::get($grant_name); |
325 | 350 | if($group_srls) |
326 | 351 | { |
327 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
328 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
329 | - else $group_srls = array($group_srls); |
|
352 | + if(strpos($group_srls,'|@|')!==false) { |
|
353 | + $group_srls = explode('|@|',$group_srls); |
|
354 | + } elseif(strpos($group_srls,',')!==false) { |
|
355 | + $group_srls = explode(',',$group_srls); |
|
356 | + } else { |
|
357 | + $group_srls = array($group_srls); |
|
358 | + } |
|
330 | 359 | $grant->{$grant_name} = $group_srls; |
331 | 360 | } |
332 | 361 | continue; |
@@ -338,7 +367,9 @@ discard block |
||
338 | 367 | $args = new stdClass(); |
339 | 368 | $args->module_srl = $module_srl; |
340 | 369 | $output = executeQuery('module.deleteModuleGrants', $args); |
341 | - if(!$output->toBool()) return $output; |
|
370 | + if(!$output->toBool()) { |
|
371 | + return $output; |
|
372 | + } |
|
342 | 373 | // Permissions stored in the DB |
343 | 374 | foreach($grant as $grant_name => $group_srls) |
344 | 375 | { |
@@ -349,7 +380,9 @@ discard block |
||
349 | 380 | $args->name = $grant_name; |
350 | 381 | $args->group_srl = $val; |
351 | 382 | $output = executeQuery('module.insertModuleGrant', $args); |
352 | - if(!$output->toBool()) return $output; |
|
383 | + if(!$output->toBool()) { |
|
384 | + return $output; |
|
385 | + } |
|
353 | 386 | } |
354 | 387 | } |
355 | 388 | $this->setMessage('success_registed'); |
@@ -375,19 +408,16 @@ discard block |
||
375 | 408 | if($module_info->is_mskin_fix == 'Y') |
376 | 409 | { |
377 | 410 | $skin = $module_info->mskin; |
378 | - } |
|
379 | - else |
|
411 | + } else |
|
380 | 412 | { |
381 | 413 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M'); |
382 | 414 | } |
383 | - } |
|
384 | - else |
|
415 | + } else |
|
385 | 416 | { |
386 | 417 | if($module_info->is_skin_fix == 'Y') |
387 | 418 | { |
388 | 419 | $skin = $module_info->skin; |
389 | - } |
|
390 | - else |
|
420 | + } else |
|
391 | 421 | { |
392 | 422 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P'); |
393 | 423 | } |
@@ -400,8 +430,7 @@ discard block |
||
400 | 430 | { |
401 | 431 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
402 | 432 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
403 | - } |
|
404 | - else |
|
433 | + } else |
|
405 | 434 | { |
406 | 435 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
407 | 436 | $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); |
@@ -421,7 +450,9 @@ discard block |
||
421 | 450 | { |
422 | 451 | foreach($skin_info->extra_vars as $vars) |
423 | 452 | { |
424 | - if($vars->type!='image') continue; |
|
453 | + if($vars->type!='image') { |
|
454 | + continue; |
|
455 | + } |
|
425 | 456 | |
426 | 457 | $image_obj = $obj->{$vars->name}; |
427 | 458 | // Get a variable to delete |
@@ -453,7 +484,9 @@ discard block |
||
453 | 484 | // Upload the file to a path |
454 | 485 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
455 | 486 | // Create a directory |
456 | - if(!FileHandler::makeDir($path)) return false; |
|
487 | + if(!FileHandler::makeDir($path)) { |
|
488 | + return false; |
|
489 | + } |
|
457 | 490 | |
458 | 491 | $filename = $path.$image_obj['name']; |
459 | 492 | // Move the file |
@@ -484,8 +517,7 @@ discard block |
||
484 | 517 | if($mode === 'M') |
485 | 518 | { |
486 | 519 | $output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj); |
487 | - } |
|
488 | - else |
|
520 | + } else |
|
489 | 521 | { |
490 | 522 | $output = $oModuleController->insertModuleSkinVars($module_srl, $obj); |
491 | 523 | } |
@@ -506,10 +538,14 @@ discard block |
||
506 | 538 | { |
507 | 539 | $vars = Context::getRequestVars(); |
508 | 540 | |
509 | - if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
541 | + if(!$vars->module_srls) { |
|
542 | + return new BaseObject(-1,'msg_invalid_request'); |
|
543 | + } |
|
510 | 544 | |
511 | 545 | $module_srls = explode(',',$vars->module_srls); |
512 | - if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
546 | + if(count($module_srls) < 1) { |
|
547 | + return new BaseObject(-1,'msg_invalid_request'); |
|
548 | + } |
|
513 | 549 | |
514 | 550 | $oModuleModel = getModel('module'); |
515 | 551 | $oModuleController= getController('module'); |
@@ -541,8 +577,7 @@ discard block |
||
541 | 577 | if(Context::get('success_return_url')) |
542 | 578 | { |
543 | 579 | $this->setRedirectUrl(Context::get('success_return_url')); |
544 | - } |
|
545 | - else |
|
580 | + } else |
|
546 | 581 | { |
547 | 582 | global $lang; |
548 | 583 | htmlHeader(); |
@@ -561,10 +596,14 @@ discard block |
||
561 | 596 | function procModuleAdminModuleGrantSetup() |
562 | 597 | { |
563 | 598 | $module_srls = Context::get('module_srls'); |
564 | - if(!$module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
599 | + if(!$module_srls) { |
|
600 | + return new BaseObject(-1,'msg_invalid_request'); |
|
601 | + } |
|
565 | 602 | |
566 | 603 | $modules = explode(',',$module_srls); |
567 | - if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
604 | + if(count($modules) < 1) { |
|
605 | + return new BaseObject(-1,'msg_invalid_request'); |
|
606 | + } |
|
568 | 607 | |
569 | 608 | $oModuleController = getController('module'); |
570 | 609 | $oModuleModel = getModel('module'); |
@@ -592,17 +631,20 @@ discard block |
||
592 | 631 | $grant->{$grant_name}[] = $default; |
593 | 632 | continue; |
594 | 633 | // Users in a particular group |
595 | - } |
|
596 | - else |
|
634 | + } else |
|
597 | 635 | { |
598 | 636 | $group_srls = Context::get($grant_name); |
599 | 637 | if($group_srls) |
600 | 638 | { |
601 | 639 | if(!is_array($group_srls)) |
602 | 640 | { |
603 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
604 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
605 | - else $group_srls = array($group_srls); |
|
641 | + if(strpos($group_srls,'|@|')!==false) { |
|
642 | + $group_srls = explode('|@|',$group_srls); |
|
643 | + } elseif(strpos($group_srls,',')!==false) { |
|
644 | + $group_srls = explode(',',$group_srls); |
|
645 | + } else { |
|
646 | + $group_srls = array($group_srls); |
|
647 | + } |
|
606 | 648 | } |
607 | 649 | $grant->{$grant_name} = $group_srls; |
608 | 650 | } |
@@ -617,7 +659,9 @@ discard block |
||
617 | 659 | $args = new stdClass(); |
618 | 660 | $args->module_srl = $module_srl; |
619 | 661 | $output = executeQuery('module.deleteModuleGrants', $args); |
620 | - if(!$output->toBool()) continue; |
|
662 | + if(!$output->toBool()) { |
|
663 | + continue; |
|
664 | + } |
|
621 | 665 | // Permissions stored in the DB |
622 | 666 | foreach($grant as $grant_name => $group_srls) |
623 | 667 | { |
@@ -628,7 +672,9 @@ discard block |
||
628 | 672 | $args->name = $grant_name; |
629 | 673 | $args->group_srl = $val; |
630 | 674 | $output = executeQuery('module.insertModuleGrant', $args); |
631 | - if(!$output->toBool()) return $output; |
|
675 | + if(!$output->toBool()) { |
|
676 | + return $output; |
|
677 | + } |
|
632 | 678 | } |
633 | 679 | } |
634 | 680 | } |
@@ -638,8 +684,7 @@ discard block |
||
638 | 684 | if(Context::get('success_return_url')) |
639 | 685 | { |
640 | 686 | $this->setRedirectUrl(Context::get('success_return_url')); |
641 | - } |
|
642 | - else |
|
687 | + } else |
|
643 | 688 | { |
644 | 689 | global $lang; |
645 | 690 | htmlHeader(); |
@@ -665,18 +710,30 @@ discard block |
||
665 | 710 | $args->site_srl = (int)$site_module_info->site_srl; |
666 | 711 | $args->name = str_replace(' ','_',Context::get('lang_code')); |
667 | 712 | $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
668 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
713 | + if(!empty($args->lang_name)) { |
|
714 | + $args->name = $args->lang_name; |
|
715 | + } |
|
669 | 716 | |
670 | 717 | // if args->name is empty, random generate for user define language |
671 | - if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
718 | + if(empty($args->name)) { |
|
719 | + $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
720 | + } |
|
672 | 721 | |
673 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
722 | + if(!$args->name) { |
|
723 | + return new BaseObject(-1,'msg_invalid_request'); |
|
724 | + } |
|
674 | 725 | // Check whether a language code exists |
675 | 726 | $output = executeQueryArray('module.getLang', $args); |
676 | - if(!$output->toBool()) return $output; |
|
727 | + if(!$output->toBool()) { |
|
728 | + return $output; |
|
729 | + } |
|
677 | 730 | // If exists, clear the old values for updating |
678 | - if($output->data) $output = executeQuery('module.deleteLang', $args); |
|
679 | - if(!$output->toBool()) return $output; |
|
731 | + if($output->data) { |
|
732 | + $output = executeQuery('module.deleteLang', $args); |
|
733 | + } |
|
734 | + if(!$output->toBool()) { |
|
735 | + return $output; |
|
736 | + } |
|
680 | 737 | // Enter |
681 | 738 | $lang_supported = Context::get('lang_supported'); |
682 | 739 | foreach($lang_supported as $key => $val) |
@@ -693,7 +750,9 @@ discard block |
||
693 | 750 | if($args->value) |
694 | 751 | { |
695 | 752 | $output = executeQuery('module.insertLang', $args); |
696 | - if(!$output->toBool()) return $output; |
|
753 | + if(!$output->toBool()) { |
|
754 | + return $output; |
|
755 | + } |
|
697 | 756 | } |
698 | 757 | } |
699 | 758 | $this->makeCacheDefinedLangCode($args->site_srl); |
@@ -716,11 +775,17 @@ discard block |
||
716 | 775 | $args->site_srl = (int)$site_module_info->site_srl; |
717 | 776 | $args->name = str_replace(' ','_',Context::get('name')); |
718 | 777 | $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
719 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
720 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
778 | + if(!empty($args->lang_name)) { |
|
779 | + $args->name = $args->lang_name; |
|
780 | + } |
|
781 | + if(!$args->name) { |
|
782 | + return new BaseObject(-1,'msg_invalid_request'); |
|
783 | + } |
|
721 | 784 | |
722 | 785 | $output = executeQuery('module.deleteLang', $args); |
723 | - if(!$output->toBool()) return $output; |
|
786 | + if(!$output->toBool()) { |
|
787 | + return $output; |
|
788 | + } |
|
724 | 789 | $this->makeCacheDefinedLangCode($args->site_srl); |
725 | 790 | |
726 | 791 | $this->setMessage("success_deleted", 'info'); |
@@ -731,7 +796,9 @@ discard block |
||
731 | 796 | |
732 | 797 | function procModuleAdminGetList() |
733 | 798 | { |
734 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
799 | + if(!Context::get('is_logged')) { |
|
800 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
801 | + } |
|
735 | 802 | |
736 | 803 | $oModuleController = getController('module'); |
737 | 804 | $oModuleModel = getModel('module'); |
@@ -744,14 +811,20 @@ discard block |
||
744 | 811 | $args = new stdClass; |
745 | 812 | $logged_info = Context::get('logged_info'); |
746 | 813 | $site_module_info = Context::get('site_module_info'); |
747 | - if($site_keyword) $args->site_keyword = $site_keyword; |
|
814 | + if($site_keyword) { |
|
815 | + $args->site_keyword = $site_keyword; |
|
816 | + } |
|
748 | 817 | |
749 | 818 | if(!$site_srl) |
750 | 819 | { |
751 | - if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
752 | - else $args->site_srl = (int)$site_module_info->site_srl; |
|
820 | + if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) { |
|
821 | + $args->site_srl = 0; |
|
822 | + } else { |
|
823 | + $args->site_srl = (int)$site_module_info->site_srl; |
|
824 | + } |
|
825 | + } else { |
|
826 | + $args->site_srl = $site_srl; |
|
753 | 827 | } |
754 | - else $args->site_srl = $site_srl; |
|
755 | 828 | |
756 | 829 | $args->sort_index1 = 'sites.domain'; |
757 | 830 | |
@@ -764,7 +837,9 @@ discard block |
||
764 | 837 | foreach($output->data as $val) |
765 | 838 | { |
766 | 839 | $module = trim($val->module); |
767 | - if(!$module) continue; |
|
840 | + if(!$module) { |
|
841 | + continue; |
|
842 | + } |
|
768 | 843 | |
769 | 844 | // replace user defined lang. |
770 | 845 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
@@ -800,7 +875,9 @@ discard block |
||
800 | 875 | { |
801 | 876 | foreach($mid_list as $module => $val) |
802 | 877 | { |
803 | - if(!$selected_module) $selected_module = $module; |
|
878 | + if(!$selected_module) { |
|
879 | + $selected_module = $module; |
|
880 | + } |
|
804 | 881 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
805 | 882 | |
806 | 883 | if(!$xml_info) |
@@ -823,8 +900,7 @@ discard block |
||
823 | 900 | { |
824 | 901 | $mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl]; |
825 | 902 | } |
826 | - } |
|
827 | - else |
|
903 | + } else |
|
828 | 904 | { |
829 | 905 | $mid_list[$module]->list[$key]->module_category_srl = Context::getLang('none_category'); |
830 | 906 | } |
@@ -851,13 +927,14 @@ discard block |
||
851 | 927 | { |
852 | 928 | $site_module_info = Context::get('site_module_info'); |
853 | 929 | $args->site_srl = (int)$site_module_info->site_srl; |
854 | - } |
|
855 | - else |
|
930 | + } else |
|
856 | 931 | { |
857 | 932 | $args->site_srl = $site_srl; |
858 | 933 | } |
859 | 934 | $output = executeQueryArray('module.getLang', $args); |
860 | - if(!$output->toBool() || !$output->data) return; |
|
935 | + if(!$output->toBool() || !$output->data) { |
|
936 | + return; |
|
937 | + } |
|
861 | 938 | |
862 | 939 | $langMap = array(); |
863 | 940 | foreach($output->data as $lang) |
@@ -948,8 +1025,7 @@ discard block |
||
948 | 1025 | if($mid) |
949 | 1026 | { |
950 | 1027 | $moduleInfo = $oModuleModel->getModuleInfoByMid($mid); |
951 | - } |
|
952 | - else |
|
1028 | + } else |
|
953 | 1029 | { |
954 | 1030 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
955 | 1031 | } |
@@ -56,6 +56,9 @@ discard block |
||
56 | 56 | return $output; |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param string $modulePath |
|
61 | + */ |
|
59 | 62 | function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL) |
60 | 63 | { |
61 | 64 | if($modulePath) |
@@ -306,7 +309,7 @@ discard block |
||
306 | 309 | * Skin setting page for the module |
307 | 310 | * |
308 | 311 | * @param $module_srl sequence of module |
309 | - * @param $mode P or M |
|
312 | + * @param string $mode P or M |
|
310 | 313 | * @return string The HTML code |
311 | 314 | */ |
312 | 315 | function _getModuleSkinHTML($module_srl, $mode) |
@@ -395,6 +398,7 @@ discard block |
||
395 | 398 | /** |
396 | 399 | * @brief Get values for a particular language code |
397 | 400 | * Return its corresponding value if lang_code is specified. Otherwise return $name. |
401 | + * @param string $name |
|
398 | 402 | */ |
399 | 403 | function getLangCode($site_srl, $name, $isFullLanguage = FALSE) |
400 | 404 | { |
@@ -513,6 +517,7 @@ discard block |
||
513 | 517 | |
514 | 518 | /** |
515 | 519 | * @brief Return current lang list |
520 | + * @param stdClass $args |
|
516 | 521 | */ |
517 | 522 | function getLangListByLangcode($args) |
518 | 523 | { |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | $args = new stdClass; |
27 | 27 | $args->module_srls = Context::get('module_srls'); |
28 | 28 | $output = executeQueryArray('module.getModulesInfo', $args); |
29 | - if(!$output->toBool() || !$output->data) return new BaseObject(); |
|
29 | + if (!$output->toBool() || !$output->data) return new BaseObject(); |
|
30 | 30 | |
31 | - foreach($output->data as $key => $val) |
|
31 | + foreach ($output->data as $key => $val) |
|
32 | 32 | { |
33 | 33 | $info_xml = $oModuleModel->getModuleInfoXml($val->module); |
34 | 34 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
35 | - $list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title); |
|
35 | + $list[$val->module_srl] = array('module_srl'=>$val->module_srl, 'mid'=>$val->mid, 'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title); |
|
36 | 36 | } |
37 | - $modules = explode(',',$args->module_srls); |
|
38 | - for($i=0;$i<count($modules);$i++) |
|
37 | + $modules = explode(',', $args->module_srls); |
|
38 | + for ($i = 0; $i < count($modules); $i++) |
|
39 | 39 | { |
40 | 40 | $module_list[$modules[$i]] = $list[$modules[$i]]; |
41 | 41 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $args->list_count = 20; |
50 | 50 | $args->page_count = 10; |
51 | 51 | $output = executeQueryArray('module.getModuleMidList', $args); |
52 | - if(!$output->toBool()) return $output; |
|
52 | + if (!$output->toBool()) return $output; |
|
53 | 53 | |
54 | 54 | ModuleModel::syncModuleToSite($output->data); |
55 | 55 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | |
59 | 59 | function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL) |
60 | 60 | { |
61 | - if($modulePath) |
|
61 | + if ($modulePath) |
|
62 | 62 | { |
63 | 63 | // get the skins path |
64 | 64 | $oModuleModel = getModel('module'); |
65 | 65 | $skin_list = $oModuleModel->getSkins($modulePath); |
66 | - Context::set('skin_list',$skin_list); |
|
66 | + Context::set('skin_list', $skin_list); |
|
67 | 67 | |
68 | 68 | $mskin_list = $oModuleModel->getSkins($modulePath, "m.skins"); |
69 | 69 | Context::set('mskin_list', $mskin_list); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $layout_list = $oLayoutModel->getLayoutList(); |
75 | 75 | Context::set('layout_list', $layout_list); |
76 | 76 | |
77 | - $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M"); |
|
77 | + $mobile_layout_list = $oLayoutModel->getLayoutList(0, "M"); |
|
78 | 78 | Context::set('mlayout_list', $mobile_layout_list); |
79 | 79 | |
80 | 80 | $security = new Security(); |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | $security->encodeHTML('skin_list..title'); |
84 | 84 | $security->encodeHTML('mskin_list..title'); |
85 | 85 | |
86 | - $grant_list =new stdClass(); |
|
86 | + $grant_list = new stdClass(); |
|
87 | 87 | // Grant virtual permission for access and manager |
88 | - if(!$grantList) |
|
88 | + if (!$grantList) |
|
89 | 89 | { |
90 | - $grantList =new stdClass(); |
|
90 | + $grantList = new stdClass(); |
|
91 | 91 | } |
92 | 92 | $grantList->access = new stdClass(); |
93 | 93 | $grantList->access->title = Context::getLang('grant_access'); |
94 | 94 | $grantList->access->default = 'guest'; |
95 | - if(count($grantList)) |
|
95 | + if (count($grantList)) |
|
96 | 96 | { |
97 | - foreach($grantList as $key => $val) |
|
97 | + foreach ($grantList as $key => $val) |
|
98 | 98 | { |
99 | - if(!$val->default) $val->default = 'guest'; |
|
100 | - if($val->default == 'root') $val->default = 'manager'; |
|
99 | + if (!$val->default) $val->default = 'guest'; |
|
100 | + if ($val->default == 'root') $val->default = 'manager'; |
|
101 | 101 | $grant_list->{$key} = $val; |
102 | 102 | } |
103 | 103 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); |
120 | 120 | Context::set('setup_content', $content); |
121 | 121 | |
122 | - if(count($tabChoice) == 0) |
|
122 | + if (count($tabChoice) == 0) |
|
123 | 123 | { |
124 | 124 | $tabChoice = array('tab1'=>1, 'tab2'=>1, 'tab3'=>1); |
125 | 125 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | function getModuleGrantHTML($module_srl, $source_grant_list) |
138 | 138 | { |
139 | - if(!$module_srl) |
|
139 | + if (!$module_srl) |
|
140 | 140 | { |
141 | 141 | return; |
142 | 142 | } |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | $grant_list->access = new stdClass(); |
155 | 155 | $grant_list->access->title = Context::getLang('grant_access'); |
156 | 156 | $grant_list->access->default = 'guest'; |
157 | - if(count($source_grant_list)) |
|
157 | + if (count($source_grant_list)) |
|
158 | 158 | { |
159 | - foreach($source_grant_list as $key => $val) |
|
159 | + foreach ($source_grant_list as $key => $val) |
|
160 | 160 | { |
161 | - if(!$val->default) $val->default = 'guest'; |
|
162 | - if($val->default == 'root') $val->default = 'manager'; |
|
161 | + if (!$val->default) $val->default = 'guest'; |
|
162 | + if ($val->default == 'root') $val->default = 'manager'; |
|
163 | 163 | $grant_list->{$key} = $val; |
164 | 164 | } |
165 | 165 | } |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | $args = new stdClass(); |
173 | 173 | $args->module_srl = $module_srl; |
174 | 174 | $output = executeQueryArray('module.getModuleGrants', $args); |
175 | - if($output->data) |
|
175 | + if ($output->data) |
|
176 | 176 | { |
177 | - foreach($output->data as $val) |
|
177 | + foreach ($output->data as $val) |
|
178 | 178 | { |
179 | - if($val->group_srl == 0) $default_grant[$val->name] = 'all'; |
|
180 | - else if($val->group_srl == -1) $default_grant[$val->name] = 'member'; |
|
181 | - else if($val->group_srl == -2) $default_grant[$val->name] = 'site'; |
|
182 | - else if($val->group_srl == -3) $default_grant[$val->name] = 'manager'; |
|
179 | + if ($val->group_srl == 0) $default_grant[$val->name] = 'all'; |
|
180 | + else if ($val->group_srl == -1) $default_grant[$val->name] = 'member'; |
|
181 | + else if ($val->group_srl == -2) $default_grant[$val->name] = 'site'; |
|
182 | + else if ($val->group_srl == -3) $default_grant[$val->name] = 'manager'; |
|
183 | 183 | else |
184 | 184 | { |
185 | 185 | $selected_group[$val->name][] = $val->group_srl; |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | { |
214 | 214 | $targetModule = Context::get('target_module'); |
215 | 215 | $moduleSrl = Context::get('module_srl'); |
216 | - if(!$targetModule || !$moduleSrl) |
|
216 | + if (!$targetModule || !$moduleSrl) |
|
217 | 217 | { |
218 | 218 | return new BaseObject(-1, 'msg_invalid_request'); |
219 | 219 | } |
220 | 220 | |
221 | - if($targetModule == '_SHORTCUT') |
|
221 | + if ($targetModule == '_SHORTCUT') |
|
222 | 222 | { |
223 | 223 | return new BaseObject(0); |
224 | 224 | } |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | $grantList->access = new stdClass(); |
232 | 232 | $grantList->access->title = Context::getLang('grant_access'); |
233 | 233 | $grantList->access->default = 'guest'; |
234 | - if(count($xmlInfo->grant)) |
|
234 | + if (count($xmlInfo->grant)) |
|
235 | 235 | { |
236 | - foreach($xmlInfo->grant as $key => $val) |
|
236 | + foreach ($xmlInfo->grant as $key => $val) |
|
237 | 237 | { |
238 | - if(!$val->default) $val->default = 'guest'; |
|
239 | - if($val->default == 'root') $val->default = 'manager'; |
|
238 | + if (!$val->default) $val->default = 'guest'; |
|
239 | + if ($val->default == 'root') $val->default = 'manager'; |
|
240 | 240 | $grantList->{$key} = $val; |
241 | 241 | } |
242 | 242 | } |
@@ -249,14 +249,14 @@ discard block |
||
249 | 249 | $args = new stdClass(); |
250 | 250 | $args->module_srl = $moduleSrl; |
251 | 251 | $output = executeQueryArray('module.getModuleGrants', $args); |
252 | - if($output->data) |
|
252 | + if ($output->data) |
|
253 | 253 | { |
254 | - foreach($output->data as $val) |
|
254 | + foreach ($output->data as $val) |
|
255 | 255 | { |
256 | - if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all'; |
|
257 | - else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member'; |
|
258 | - else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site'; |
|
259 | - else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager'; |
|
256 | + if ($val->group_srl == 0) $defaultGrant->{$val->name} = 'all'; |
|
257 | + else if ($val->group_srl == -1) $defaultGrant->{$val->name} = 'member'; |
|
258 | + else if ($val->group_srl == -2) $defaultGrant->{$val->name} = 'site'; |
|
259 | + else if ($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager'; |
|
260 | 260 | else |
261 | 261 | { |
262 | 262 | $selectedGroup->{$val->name}[] = $val->group_srl; |
@@ -265,15 +265,15 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - if(is_object($grantList)) |
|
268 | + if (is_object($grantList)) |
|
269 | 269 | { |
270 | - foreach($grantList AS $key=>$value) |
|
270 | + foreach ($grantList AS $key=>$value) |
|
271 | 271 | { |
272 | - if(isset($defaultGrant->{$key})) |
|
272 | + if (isset($defaultGrant->{$key})) |
|
273 | 273 | { |
274 | 274 | $grantList->{$key}->grant = $defaultGrant->{$key}; |
275 | 275 | } |
276 | - if(isset($selectedGroup->{$key})) |
|
276 | + if (isset($selectedGroup->{$key})) |
|
277 | 277 | { |
278 | 278 | $grantList->{$key}->group_srls = $selectedGroup->{$key}; |
279 | 279 | } |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | |
316 | 316 | $oModuleModel = getModel('module'); |
317 | 317 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
318 | - if(!$module_info) return; |
|
318 | + if (!$module_info) return; |
|
319 | 319 | |
320 | - if($mode === 'P') |
|
320 | + if ($mode === 'P') |
|
321 | 321 | { |
322 | - if($module_info->is_skin_fix == 'N') |
|
322 | + if ($module_info->is_skin_fix == 'N') |
|
323 | 323 | { |
324 | 324 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl); |
325 | 325 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | else |
332 | 332 | { |
333 | - if($module_info->is_mskin_fix == 'N') |
|
333 | + if ($module_info->is_mskin_fix == 'N') |
|
334 | 334 | { |
335 | 335 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl); |
336 | 336 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $module_path = './modules/'.$module_info->module; |
344 | 344 | |
345 | 345 | // Get XML information of the skin and skin sinformation set in DB |
346 | - if($mode === 'P') |
|
346 | + if ($mode === 'P') |
|
347 | 347 | { |
348 | 348 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
349 | 349 | $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); |
@@ -354,25 +354,25 @@ discard block |
||
354 | 354 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
355 | 355 | } |
356 | 356 | |
357 | - if(count($skin_info->extra_vars)) |
|
357 | + if (count($skin_info->extra_vars)) |
|
358 | 358 | { |
359 | - foreach($skin_info->extra_vars as $key => $val) |
|
359 | + foreach ($skin_info->extra_vars as $key => $val) |
|
360 | 360 | { |
361 | 361 | $group = $val->group; |
362 | 362 | $name = $val->name; |
363 | 363 | $type = $val->type; |
364 | - if($skin_vars[$name]) |
|
364 | + if ($skin_vars[$name]) |
|
365 | 365 | { |
366 | 366 | $value = $skin_vars[$name]->value; |
367 | 367 | } |
368 | 368 | else $value = ''; |
369 | - if($type=="checkbox") |
|
369 | + if ($type == "checkbox") |
|
370 | 370 | { |
371 | - $value = $value?unserialize($value):array(); |
|
371 | + $value = $value ?unserialize($value) : array(); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $value = empty($value) ? $val->default : $value; |
375 | - $skin_info->extra_vars[$key]->value= $value; |
|
375 | + $skin_info->extra_vars[$key]->value = $value; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | function getLangCode($site_srl, $name, $isFullLanguage = FALSE) |
400 | 400 | { |
401 | - if($isFullLanguage) |
|
401 | + if ($isFullLanguage) |
|
402 | 402 | { |
403 | 403 | $lang_supported = Context::loadLangSupported(); |
404 | 404 | } |
@@ -407,15 +407,15 @@ discard block |
||
407 | 407 | $lang_supported = Context::get('lang_supported'); |
408 | 408 | } |
409 | 409 | |
410 | - if(substr($name,0,12)=='$user_lang->') |
|
410 | + if (substr($name, 0, 12) == '$user_lang->') |
|
411 | 411 | { |
412 | 412 | $args = new stdClass(); |
413 | - $args->site_srl = (int)$site_srl; |
|
414 | - $args->name = substr($name,12); |
|
413 | + $args->site_srl = (int) $site_srl; |
|
414 | + $args->name = substr($name, 12); |
|
415 | 415 | $output = executeQueryArray('module.getLang', $args); |
416 | - if($output->data) |
|
416 | + if ($output->data) |
|
417 | 417 | { |
418 | - foreach($output->data as $key => $val) |
|
418 | + foreach ($output->data as $key => $val) |
|
419 | 419 | { |
420 | 420 | $selected_lang[$val->lang_code] = $val->value; |
421 | 421 | } |
@@ -424,24 +424,24 @@ discard block |
||
424 | 424 | else |
425 | 425 | { |
426 | 426 | $tmp = unserialize($name); |
427 | - if($tmp) |
|
427 | + if ($tmp) |
|
428 | 428 | { |
429 | 429 | $selected_lang = array(); |
430 | 430 | $rand_name = $tmp[Context::getLangType()]; |
431 | - if(!$rand_name) $rand_name = array_shift($tmp); |
|
432 | - if(is_array($lang_supported)) |
|
431 | + if (!$rand_name) $rand_name = array_shift($tmp); |
|
432 | + if (is_array($lang_supported)) |
|
433 | 433 | { |
434 | - foreach($lang_supported as $key => $val) |
|
435 | - $selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name; |
|
434 | + foreach ($lang_supported as $key => $val) |
|
435 | + $selected_lang[$key] = $tmp[$key] ? $tmp[$key] : $rand_name; |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | 440 | $output = array(); |
441 | - if(is_array($lang_supported)) |
|
441 | + if (is_array($lang_supported)) |
|
442 | 442 | { |
443 | - foreach($lang_supported as $key => $val) |
|
444 | - $output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name; |
|
443 | + foreach ($lang_supported as $key => $val) |
|
444 | + $output[$key] = $selected_lang[$key] ? $selected_lang[$key] : $name; |
|
445 | 445 | } |
446 | 446 | return $output; |
447 | 447 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | function getModuleAdminLangCode() |
453 | 453 | { |
454 | 454 | $name = Context::get('name'); |
455 | - if(!$name) return new BaseObject(-1,'msg_invalid_request'); |
|
455 | + if (!$name) return new BaseObject(-1, 'msg_invalid_request'); |
|
456 | 456 | $site_module_info = Context::get('site_module_info'); |
457 | 457 | $this->add('name', $name); |
458 | 458 | $output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | function getModuleAdminLangListByName() |
466 | 466 | { |
467 | 467 | $args = Context::getRequestVars(); |
468 | - if(!$args->site_srl) $args->site_srl = 0; |
|
468 | + if (!$args->site_srl) $args->site_srl = 0; |
|
469 | 469 | |
470 | 470 | $columnList = array('lang_code', 'name', 'value'); |
471 | 471 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | $args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name); |
475 | 475 | $output = executeQueryArray('module.getLangListByName', $args, $columnList); |
476 | - if($output->toBool()) $langList = $output->data; |
|
476 | + if ($output->toBool()) $langList = $output->data; |
|
477 | 477 | |
478 | 478 | $this->add('lang_list', $langList); |
479 | 479 | $this->add('lang_name', $args->langName); |
@@ -485,23 +485,23 @@ discard block |
||
485 | 485 | function getModuleAdminLangListByValue() |
486 | 486 | { |
487 | 487 | $args = Context::getRequestVars(); |
488 | - if(!$args->site_srl) $args->site_srl = 0; |
|
488 | + if (!$args->site_srl) $args->site_srl = 0; |
|
489 | 489 | |
490 | 490 | $langList = array(); |
491 | 491 | |
492 | 492 | // search value |
493 | 493 | $output = executeQueryArray('module.getLangNameByValue', $args); |
494 | - if($output->toBool() && is_array($output->data)) |
|
494 | + if ($output->toBool() && is_array($output->data)) |
|
495 | 495 | { |
496 | 496 | unset($args->value); |
497 | 497 | |
498 | - foreach($output->data as $data) |
|
498 | + foreach ($output->data as $data) |
|
499 | 499 | { |
500 | 500 | $args->langName = $data->name; |
501 | 501 | $columnList = array('lang_code', 'name', 'value'); |
502 | 502 | $outputByName = executeQueryArray('module.getLangListByName', $args, $columnList); |
503 | 503 | |
504 | - if($outputByName->toBool()) |
|
504 | + if ($outputByName->toBool()) |
|
505 | 505 | { |
506 | 506 | $langList = array_merge($langList, $outputByName->data); |
507 | 507 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | function getLangListByLangcode($args) |
518 | 518 | { |
519 | 519 | $output = executeQueryArray('module.getLangListByLangcode', $args); |
520 | - if(!$output->toBool()) return array(); |
|
520 | + if (!$output->toBool()) return array(); |
|
521 | 521 | |
522 | 522 | return $output; |
523 | 523 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | function getModuleAdminMultilingualHtml() |
529 | 529 | { |
530 | 530 | $oTemplate = TemplateHandler::getInstance(); |
531 | - $tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17.html'); |
|
531 | + $tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17.html'); |
|
532 | 532 | |
533 | 533 | $this->add('html', $tpl); |
534 | 534 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | { |
541 | 541 | $site_module_info = Context::get('site_module_info'); |
542 | 542 | $args = new stdClass(); |
543 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
543 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
544 | 544 | $args->langCode = Context::get('lang_code'); |
545 | 545 | $args->page = Context::get('page'); |
546 | 546 | $args->sort_index = 'name'; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $args->list_count = Context::get('list_count'); |
551 | 551 | $args->page_count = 5; |
552 | 552 | |
553 | - if(!$args->langCode) |
|
553 | + if (!$args->langCode) |
|
554 | 554 | { |
555 | 555 | $args->langCode = Context::get('lang_type'); |
556 | 556 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $oSecurity->encodeHTML('lang_code_list..'); |
568 | 568 | |
569 | 569 | $oTemplate = TemplateHandler::getInstance(); |
570 | - $tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17_list.html'); |
|
570 | + $tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17_list.html'); |
|
571 | 571 | |
572 | 572 | $this->add('html', $tpl); |
573 | 573 | } |
@@ -577,9 +577,9 @@ discard block |
||
577 | 577 | */ |
578 | 578 | function getModuleAdminModuleSearcherHtml() |
579 | 579 | { |
580 | - Context::loadLang(_XE_PATH_ . 'modules/admin/lang'); |
|
580 | + Context::loadLang(_XE_PATH_.'modules/admin/lang'); |
|
581 | 581 | $oTemplate = TemplateHandler::getInstance(); |
582 | - $tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'module_searcher_v17.html'); |
|
582 | + $tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'module_searcher_v17.html'); |
|
583 | 583 | |
584 | 584 | $this->add('html', $tpl); |
585 | 585 | } |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | */ |
590 | 590 | function getModuleAdminModuleInfo() |
591 | 591 | { |
592 | - if(Context::get('search_module_srl')) |
|
592 | + if (Context::get('search_module_srl')) |
|
593 | 593 | { |
594 | 594 | $module_srl = Context::get('search_module_srl'); |
595 | 595 | } |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | $args = new stdClass; |
27 | 27 | $args->module_srls = Context::get('module_srls'); |
28 | 28 | $output = executeQueryArray('module.getModulesInfo', $args); |
29 | - if(!$output->toBool() || !$output->data) return new BaseObject(); |
|
29 | + if(!$output->toBool() || !$output->data) { |
|
30 | + return new BaseObject(); |
|
31 | + } |
|
30 | 32 | |
31 | 33 | foreach($output->data as $key => $val) |
32 | 34 | { |
@@ -49,7 +51,9 @@ discard block |
||
49 | 51 | $args->list_count = 20; |
50 | 52 | $args->page_count = 10; |
51 | 53 | $output = executeQueryArray('module.getModuleMidList', $args); |
52 | - if(!$output->toBool()) return $output; |
|
54 | + if(!$output->toBool()) { |
|
55 | + return $output; |
|
56 | + } |
|
53 | 57 | |
54 | 58 | ModuleModel::syncModuleToSite($output->data); |
55 | 59 | |
@@ -96,8 +100,12 @@ discard block |
||
96 | 100 | { |
97 | 101 | foreach($grantList as $key => $val) |
98 | 102 | { |
99 | - if(!$val->default) $val->default = 'guest'; |
|
100 | - if($val->default == 'root') $val->default = 'manager'; |
|
103 | + if(!$val->default) { |
|
104 | + $val->default = 'guest'; |
|
105 | + } |
|
106 | + if($val->default == 'root') { |
|
107 | + $val->default = 'manager'; |
|
108 | + } |
|
101 | 109 | $grant_list->{$key} = $val; |
102 | 110 | } |
103 | 111 | } |
@@ -158,8 +166,12 @@ discard block |
||
158 | 166 | { |
159 | 167 | foreach($source_grant_list as $key => $val) |
160 | 168 | { |
161 | - if(!$val->default) $val->default = 'guest'; |
|
162 | - if($val->default == 'root') $val->default = 'manager'; |
|
169 | + if(!$val->default) { |
|
170 | + $val->default = 'guest'; |
|
171 | + } |
|
172 | + if($val->default == 'root') { |
|
173 | + $val->default = 'manager'; |
|
174 | + } |
|
163 | 175 | $grant_list->{$key} = $val; |
164 | 176 | } |
165 | 177 | } |
@@ -176,11 +188,15 @@ discard block |
||
176 | 188 | { |
177 | 189 | foreach($output->data as $val) |
178 | 190 | { |
179 | - if($val->group_srl == 0) $default_grant[$val->name] = 'all'; |
|
180 | - else if($val->group_srl == -1) $default_grant[$val->name] = 'member'; |
|
181 | - else if($val->group_srl == -2) $default_grant[$val->name] = 'site'; |
|
182 | - else if($val->group_srl == -3) $default_grant[$val->name] = 'manager'; |
|
183 | - else |
|
191 | + if($val->group_srl == 0) { |
|
192 | + $default_grant[$val->name] = 'all'; |
|
193 | + } else if($val->group_srl == -1) { |
|
194 | + $default_grant[$val->name] = 'member'; |
|
195 | + } else if($val->group_srl == -2) { |
|
196 | + $default_grant[$val->name] = 'site'; |
|
197 | + } else if($val->group_srl == -3) { |
|
198 | + $default_grant[$val->name] = 'manager'; |
|
199 | + } else |
|
184 | 200 | { |
185 | 201 | $selected_group[$val->name][] = $val->group_srl; |
186 | 202 | $default_grant[$val->name] = 'group'; |
@@ -235,8 +251,12 @@ discard block |
||
235 | 251 | { |
236 | 252 | foreach($xmlInfo->grant as $key => $val) |
237 | 253 | { |
238 | - if(!$val->default) $val->default = 'guest'; |
|
239 | - if($val->default == 'root') $val->default = 'manager'; |
|
254 | + if(!$val->default) { |
|
255 | + $val->default = 'guest'; |
|
256 | + } |
|
257 | + if($val->default == 'root') { |
|
258 | + $val->default = 'manager'; |
|
259 | + } |
|
240 | 260 | $grantList->{$key} = $val; |
241 | 261 | } |
242 | 262 | } |
@@ -253,11 +273,15 @@ discard block |
||
253 | 273 | { |
254 | 274 | foreach($output->data as $val) |
255 | 275 | { |
256 | - if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all'; |
|
257 | - else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member'; |
|
258 | - else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site'; |
|
259 | - else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager'; |
|
260 | - else |
|
276 | + if($val->group_srl == 0) { |
|
277 | + $defaultGrant->{$val->name} = 'all'; |
|
278 | + } else if($val->group_srl == -1) { |
|
279 | + $defaultGrant->{$val->name} = 'member'; |
|
280 | + } else if($val->group_srl == -2) { |
|
281 | + $defaultGrant->{$val->name} = 'site'; |
|
282 | + } else if($val->group_srl == -3) { |
|
283 | + $defaultGrant->{$val->name} = 'manager'; |
|
284 | + } else |
|
261 | 285 | { |
262 | 286 | $selectedGroup->{$val->name}[] = $val->group_srl; |
263 | 287 | $defaultGrant->{$val->name} = 'group'; |
@@ -315,26 +339,25 @@ discard block |
||
315 | 339 | |
316 | 340 | $oModuleModel = getModel('module'); |
317 | 341 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
318 | - if(!$module_info) return; |
|
342 | + if(!$module_info) { |
|
343 | + return; |
|
344 | + } |
|
319 | 345 | |
320 | 346 | if($mode === 'P') |
321 | 347 | { |
322 | 348 | if($module_info->is_skin_fix == 'N') |
323 | 349 | { |
324 | 350 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl); |
325 | - } |
|
326 | - else |
|
351 | + } else |
|
327 | 352 | { |
328 | 353 | $skin = $module_info->skin; |
329 | 354 | } |
330 | - } |
|
331 | - else |
|
355 | + } else |
|
332 | 356 | { |
333 | 357 | if($module_info->is_mskin_fix == 'N') |
334 | 358 | { |
335 | 359 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl); |
336 | - } |
|
337 | - else |
|
360 | + } else |
|
338 | 361 | { |
339 | 362 | $skin = $module_info->mskin; |
340 | 363 | } |
@@ -347,8 +370,7 @@ discard block |
||
347 | 370 | { |
348 | 371 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
349 | 372 | $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); |
350 | - } |
|
351 | - else |
|
373 | + } else |
|
352 | 374 | { |
353 | 375 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
354 | 376 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
@@ -364,8 +386,9 @@ discard block |
||
364 | 386 | if($skin_vars[$name]) |
365 | 387 | { |
366 | 388 | $value = $skin_vars[$name]->value; |
389 | + } else { |
|
390 | + $value = ''; |
|
367 | 391 | } |
368 | - else $value = ''; |
|
369 | 392 | if($type=="checkbox") |
370 | 393 | { |
371 | 394 | $value = $value?unserialize($value):array(); |
@@ -401,8 +424,7 @@ discard block |
||
401 | 424 | if($isFullLanguage) |
402 | 425 | { |
403 | 426 | $lang_supported = Context::loadLangSupported(); |
404 | - } |
|
405 | - else |
|
427 | + } else |
|
406 | 428 | { |
407 | 429 | $lang_supported = Context::get('lang_supported'); |
408 | 430 | } |
@@ -420,19 +442,21 @@ discard block |
||
420 | 442 | $selected_lang[$val->lang_code] = $val->value; |
421 | 443 | } |
422 | 444 | } |
423 | - } |
|
424 | - else |
|
445 | + } else |
|
425 | 446 | { |
426 | 447 | $tmp = unserialize($name); |
427 | 448 | if($tmp) |
428 | 449 | { |
429 | 450 | $selected_lang = array(); |
430 | 451 | $rand_name = $tmp[Context::getLangType()]; |
431 | - if(!$rand_name) $rand_name = array_shift($tmp); |
|
452 | + if(!$rand_name) { |
|
453 | + $rand_name = array_shift($tmp); |
|
454 | + } |
|
432 | 455 | if(is_array($lang_supported)) |
433 | 456 | { |
434 | - foreach($lang_supported as $key => $val) |
|
435 | - $selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name; |
|
457 | + foreach($lang_supported as $key => $val) { |
|
458 | + $selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name; |
|
459 | + } |
|
436 | 460 | } |
437 | 461 | } |
438 | 462 | } |
@@ -440,8 +464,9 @@ discard block |
||
440 | 464 | $output = array(); |
441 | 465 | if(is_array($lang_supported)) |
442 | 466 | { |
443 | - foreach($lang_supported as $key => $val) |
|
444 | - $output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name; |
|
467 | + foreach($lang_supported as $key => $val) { |
|
468 | + $output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name; |
|
469 | + } |
|
445 | 470 | } |
446 | 471 | return $output; |
447 | 472 | } |
@@ -452,7 +477,9 @@ discard block |
||
452 | 477 | function getModuleAdminLangCode() |
453 | 478 | { |
454 | 479 | $name = Context::get('name'); |
455 | - if(!$name) return new BaseObject(-1,'msg_invalid_request'); |
|
480 | + if(!$name) { |
|
481 | + return new BaseObject(-1,'msg_invalid_request'); |
|
482 | + } |
|
456 | 483 | $site_module_info = Context::get('site_module_info'); |
457 | 484 | $this->add('name', $name); |
458 | 485 | $output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name); |
@@ -465,7 +492,9 @@ discard block |
||
465 | 492 | function getModuleAdminLangListByName() |
466 | 493 | { |
467 | 494 | $args = Context::getRequestVars(); |
468 | - if(!$args->site_srl) $args->site_srl = 0; |
|
495 | + if(!$args->site_srl) { |
|
496 | + $args->site_srl = 0; |
|
497 | + } |
|
469 | 498 | |
470 | 499 | $columnList = array('lang_code', 'name', 'value'); |
471 | 500 | |
@@ -473,7 +502,9 @@ discard block |
||
473 | 502 | |
474 | 503 | $args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name); |
475 | 504 | $output = executeQueryArray('module.getLangListByName', $args, $columnList); |
476 | - if($output->toBool()) $langList = $output->data; |
|
505 | + if($output->toBool()) { |
|
506 | + $langList = $output->data; |
|
507 | + } |
|
477 | 508 | |
478 | 509 | $this->add('lang_list', $langList); |
479 | 510 | $this->add('lang_name', $args->langName); |
@@ -485,7 +516,9 @@ discard block |
||
485 | 516 | function getModuleAdminLangListByValue() |
486 | 517 | { |
487 | 518 | $args = Context::getRequestVars(); |
488 | - if(!$args->site_srl) $args->site_srl = 0; |
|
519 | + if(!$args->site_srl) { |
|
520 | + $args->site_srl = 0; |
|
521 | + } |
|
489 | 522 | |
490 | 523 | $langList = array(); |
491 | 524 | |
@@ -517,7 +550,9 @@ discard block |
||
517 | 550 | function getLangListByLangcode($args) |
518 | 551 | { |
519 | 552 | $output = executeQueryArray('module.getLangListByLangcode', $args); |
520 | - if(!$output->toBool()) return array(); |
|
553 | + if(!$output->toBool()) { |
|
554 | + return array(); |
|
555 | + } |
|
521 | 556 | |
522 | 557 | return $output; |
523 | 558 | } |
@@ -592,8 +627,7 @@ discard block |
||
592 | 627 | if(Context::get('search_module_srl')) |
593 | 628 | { |
594 | 629 | $module_srl = Context::get('search_module_srl'); |
595 | - } |
|
596 | - else |
|
630 | + } else |
|
597 | 631 | { |
598 | 632 | $module_srl = Context::get('module_srl'); |
599 | 633 | } |
@@ -933,6 +933,7 @@ discard block |
||
933 | 933 | |
934 | 934 | /** |
935 | 935 | * @brief Insert skin vars to a module |
936 | + * @param string $mode |
|
936 | 937 | */ |
937 | 938 | function _insertModuleSkinVars($module_srl, $obj, $mode) |
938 | 939 | { |
@@ -1006,6 +1007,7 @@ discard block |
||
1006 | 1007 | |
1007 | 1008 | /** |
1008 | 1009 | * @brief Remove skin vars of a module |
1010 | + * @param string $mode |
|
1009 | 1011 | */ |
1010 | 1012 | function _deleteModuleSkinVars($module_srl, $mode) |
1011 | 1013 | { |
@@ -1242,6 +1244,7 @@ discard block |
||
1242 | 1244 | |
1243 | 1245 | /** |
1244 | 1246 | * @brief Update a file into the file box |
1247 | + * @param stdClass $vars |
|
1245 | 1248 | */ |
1246 | 1249 | function updateModuleFileBox($vars) |
1247 | 1250 | { |
@@ -1283,6 +1286,7 @@ discard block |
||
1283 | 1286 | |
1284 | 1287 | /** |
1285 | 1288 | * @brief Add a file into the file box |
1289 | + * @param stdClass $vars |
|
1286 | 1290 | */ |
1287 | 1291 | function insertModuleFileBox($vars) |
1288 | 1292 | { |
@@ -1336,6 +1340,9 @@ discard block |
||
1336 | 1340 | if(!$output->toBool()) return $output; |
1337 | 1341 | } |
1338 | 1342 | |
1343 | + /** |
|
1344 | + * @param stdClass $vars |
|
1345 | + */ |
|
1339 | 1346 | function deleteModuleFileBox($vars) |
1340 | 1347 | { |
1341 | 1348 | // delete real file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $output = executeQuery('module.insertActionForward', $args); |
30 | 30 | |
31 | 31 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
32 | - if($oCacheHandler->isSupport()) |
|
32 | + if ($oCacheHandler->isSupport()) |
|
33 | 33 | { |
34 | 34 | $cache_key = 'action_forward'; |
35 | 35 | $oCacheHandler->delete($cache_key); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $output = executeQuery('module.deleteActionForward', $args); |
52 | 52 | |
53 | 53 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
54 | - if($oCacheHandler->isSupport()) |
|
54 | + if ($oCacheHandler->isSupport()) |
|
55 | 55 | { |
56 | 56 | $cache_key = 'action_forward'; |
57 | 57 | $oCacheHandler->delete($cache_key); |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | $args->called_position = $called_position; |
76 | 76 | |
77 | 77 | $output = executeQuery('module.insertTrigger', $args); |
78 | - if($output->toBool()) |
|
78 | + if ($output->toBool()) |
|
79 | 79 | { |
80 | 80 | //remove from cache |
81 | 81 | $GLOBALS['__triggers__'] = NULL; |
82 | 82 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
83 | - if($oCacheHandler->isSupport()) |
|
83 | + if ($oCacheHandler->isSupport()) |
|
84 | 84 | { |
85 | 85 | $cache_key = 'triggers'; |
86 | 86 | $oCacheHandler->delete($cache_key); |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | $args->called_position = $called_position; |
105 | 105 | |
106 | 106 | $output = executeQuery('module.deleteTrigger', $args); |
107 | - if($output->toBool()) |
|
107 | + if ($output->toBool()) |
|
108 | 108 | { |
109 | 109 | //remove from cache |
110 | 110 | $GLOBALS['__triggers__'] = NULL; |
111 | 111 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
112 | - if($oCacheHandler->isSupport()) |
|
112 | + if ($oCacheHandler->isSupport()) |
|
113 | 113 | { |
114 | 114 | $cache_key = 'triggers'; |
115 | 115 | $oCacheHandler->delete($cache_key); |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $args->module = $module; |
130 | 130 | |
131 | 131 | $output = executeQuery('module.deleteModuleTriggers', $args); |
132 | - if($output->toBool()) |
|
132 | + if ($output->toBool()) |
|
133 | 133 | { |
134 | 134 | //remove from cache |
135 | 135 | $GLOBALS['__triggers__'] = NULL; |
136 | 136 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
137 | - if($oCacheHandler->isSupport()) |
|
137 | + if ($oCacheHandler->isSupport()) |
|
138 | 138 | { |
139 | 139 | $cache_key = 'triggers'; |
140 | 140 | $oCacheHandler->delete($cache_key); |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | * @brief Add module extend |
149 | 149 | * |
150 | 150 | */ |
151 | - function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
151 | + function insertModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
152 | 152 | { |
153 | - if($kind != 'admin') $kind = ''; |
|
154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
153 | + if ($kind != 'admin') $kind = ''; |
|
154 | + if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false; |
|
155 | + if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false; |
|
156 | 156 | |
157 | 157 | $cache_file = './files/config/module_extend.php'; |
158 | 158 | FileHandler::removeFile($cache_file); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $args->kind = $kind; |
165 | 165 | |
166 | 166 | $output = executeQuery('module.getModuleExtendCount', $args); |
167 | - if($output->data->count>0) return false; |
|
167 | + if ($output->data->count > 0) return false; |
|
168 | 168 | |
169 | 169 | $output = executeQuery('module.insertModuleExtend', $args); |
170 | 170 | return $output; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @brief Delete module extend |
175 | 175 | * |
176 | 176 | */ |
177 | - function deleteModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
177 | + function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
178 | 178 | { |
179 | 179 | $cache_file = './files/config/module_extend.php'; |
180 | 180 | FileHandler::removeFile($cache_file); |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | $oModuleModel = getModel('module'); |
200 | 200 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
201 | 201 | |
202 | - if(!$origin_config) $origin_config = new stdClass; |
|
202 | + if (!$origin_config) $origin_config = new stdClass; |
|
203 | 203 | |
204 | - foreach($config as $key => $val) |
|
204 | + foreach ($config as $key => $val) |
|
205 | 205 | { |
206 | 206 | $origin_config->{$key} = $val; |
207 | 207 | } |
@@ -215,19 +215,19 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function insertModuleConfig($module, $config, $site_srl = 0) |
217 | 217 | { |
218 | - $args =new stdClass(); |
|
218 | + $args = new stdClass(); |
|
219 | 219 | $args->module = $module; |
220 | 220 | $args->config = serialize($config); |
221 | 221 | $args->site_srl = $site_srl; |
222 | 222 | |
223 | 223 | $output = executeQuery('module.deleteModuleConfig', $args); |
224 | - if(!$output->toBool()) return $output; |
|
224 | + if (!$output->toBool()) return $output; |
|
225 | 225 | |
226 | 226 | $output = executeQuery('module.insertModuleConfig', $args); |
227 | 227 | |
228 | 228 | //remove from cache |
229 | 229 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
230 | - if($oCacheHandler->isSupport()) |
|
230 | + if ($oCacheHandler->isSupport()) |
|
231 | 231 | { |
232 | 232 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
233 | 233 | } |
@@ -246,13 +246,13 @@ discard block |
||
246 | 246 | $args->config = serialize($config); |
247 | 247 | |
248 | 248 | $output = executeQuery('module.deleteModulePartConfig', $args); |
249 | - if(!$output->toBool()) return $output; |
|
249 | + if (!$output->toBool()) return $output; |
|
250 | 250 | |
251 | 251 | $output = executeQuery('module.insertModulePartConfig', $args); |
252 | 252 | |
253 | 253 | //remove from cache |
254 | 254 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
255 | - if($oCacheHandler->isSupport()) |
|
255 | + if ($oCacheHandler->isSupport()) |
|
256 | 256 | { |
257 | 257 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
258 | 258 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function insertSite($domain, $index_module_srl) |
267 | 267 | { |
268 | - if(isSiteID($domain)) |
|
268 | + if (isSiteID($domain)) |
|
269 | 269 | { |
270 | 270 | $oModuleModel = getModel('module'); |
271 | - if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
271 | + if ($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1, 'msg_already_registed_vid'); |
|
272 | 272 | } |
273 | 273 | else |
274 | 274 | { |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | $columnList = array('modules.site_srl'); |
285 | 285 | $oModuleModel = getModel('module'); |
286 | 286 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
287 | - if($output) return new BaseObject(-1,'msg_already_registed_vid'); |
|
287 | + if ($output) return new BaseObject(-1, 'msg_already_registed_vid'); |
|
288 | 288 | |
289 | 289 | $output = executeQuery('module.insertSite', $args); |
290 | - if(!$output->toBool()) return $output; |
|
290 | + if (!$output->toBool()) return $output; |
|
291 | 291 | |
292 | 292 | $output->add('site_srl', $args->site_srl); |
293 | 293 | return $output; |
@@ -302,32 +302,32 @@ discard block |
||
302 | 302 | $columnList = array('sites.site_srl', 'sites.domain'); |
303 | 303 | $site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList); |
304 | 304 | |
305 | - if(!$args->domain && $site_info->site_srl == $args->site_srl) |
|
305 | + if (!$args->domain && $site_info->site_srl == $args->site_srl) |
|
306 | 306 | { |
307 | 307 | $args->domain = $site_info->domain; |
308 | 308 | } |
309 | 309 | |
310 | - if($site_info->domain != $args->domain) |
|
310 | + if ($site_info->domain != $args->domain) |
|
311 | 311 | { |
312 | 312 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain'); |
|
314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
313 | + if ($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1, 'msg_already_registed_domain'); |
|
314 | + if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1, 'msg_already_registed_vid'); |
|
315 | 315 | |
316 | - if($args->domain && !isSiteID($args->domain)) |
|
316 | + if ($args->domain && !isSiteID($args->domain)) |
|
317 | 317 | { |
318 | 318 | $args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain; |
319 | 319 | } |
320 | 320 | } |
321 | 321 | $output = executeQuery('module.updateSite', $args); |
322 | 322 | //clear cache for default mid |
323 | - if($args->site_srl == 0) $vid=''; |
|
324 | - else $vid=$args->domain; |
|
323 | + if ($args->site_srl == 0) $vid = ''; |
|
324 | + else $vid = $args->domain; |
|
325 | 325 | |
326 | 326 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
327 | 327 | $mid = $module_info->mid; |
328 | 328 | |
329 | 329 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
330 | - if($oCacheHandler->isSupport()) |
|
330 | + if ($oCacheHandler->isSupport()) |
|
331 | 331 | { |
332 | 332 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
333 | 333 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | unset($args->act); |
346 | 346 | unset($args->page); |
347 | 347 | // Test mid value |
348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
348 | + if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
349 | 349 | // Test variables (separate basic vars and other vars in modules) |
350 | 350 | $extra_vars = clone($args); |
351 | 351 | unset($extra_vars->module_srl); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function insertModule($args) |
381 | 381 | { |
382 | - if(isset($args->isMenuCreate)) |
|
382 | + if (isset($args->isMenuCreate)) |
|
383 | 383 | { |
384 | 384 | $isMenuCreate = $args->isMenuCreate; |
385 | 385 | } |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | } |
390 | 390 | |
391 | 391 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
392 | - if(!$output->toBool()) return $output; |
|
392 | + if (!$output->toBool()) return $output; |
|
393 | 393 | // Check whether the module name already exists |
394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
394 | + if (!$args->site_srl) $args->site_srl = 0; |
|
395 | 395 | $oModuleModel = getModel('module'); |
396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists'); |
|
396 | + if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists'); |
|
397 | 397 | |
398 | 398 | // begin transaction |
399 | 399 | $oDB = &DB::getInstance(); |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | $skin_vars = new stdClass(); |
405 | 405 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
406 | 406 | // Arrange variables and then execute a query |
407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
407 | + if (!$args->module_srl) $args->module_srl = getNextSequence(); |
|
408 | 408 | |
409 | 409 | // default value |
410 | - if($args->skin == '/USE_DEFAULT/') |
|
410 | + if ($args->skin == '/USE_DEFAULT/') |
|
411 | 411 | { |
412 | 412 | $args->is_skin_fix = 'N'; |
413 | 413 | } |
414 | 414 | else |
415 | 415 | { |
416 | - if(isset($args->is_skin_fix)) |
|
416 | + if (isset($args->is_skin_fix)) |
|
417 | 417 | { |
418 | 418 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
419 | 419 | } |
@@ -423,13 +423,13 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | - if($args->mskin == '/USE_DEFAULT/') |
|
426 | + if ($args->mskin == '/USE_DEFAULT/') |
|
427 | 427 | { |
428 | 428 | $args->is_mskin_fix = 'N'; |
429 | 429 | } |
430 | 430 | else |
431 | 431 | { |
432 | - if(isset($args->is_mskin_fix)) |
|
432 | + if (isset($args->is_mskin_fix)) |
|
433 | 433 | { |
434 | 434 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
435 | 435 | } |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | |
444 | 444 | $args->browser_title = strip_tags($args->browser_title); |
445 | 445 | |
446 | - if($isMenuCreate === TRUE) |
|
446 | + if ($isMenuCreate === TRUE) |
|
447 | 447 | { |
448 | 448 | $menuArgs = new stdClass; |
449 | 449 | $menuArgs->menu_srl = $args->menu_srl; |
450 | 450 | $menuOutput = executeQuery('menu.getMenu', $menuArgs); |
451 | 451 | |
452 | 452 | // if menu is not created, create menu also. and does not supported that in virtual site. |
453 | - if(!$menuOutput->data && !$args->site_srl) |
|
453 | + if (!$menuOutput->data && !$args->site_srl) |
|
454 | 454 | { |
455 | 455 | $oMenuAdminModel = getAdminModel('menu'); |
456 | 456 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $menuArgs->listorder = $args->menu_item_srl * -1; |
469 | 469 | |
470 | 470 | $menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs); |
471 | - if(!$menuItemOutput->toBool()) |
|
471 | + if (!$menuItemOutput->toBool()) |
|
472 | 472 | { |
473 | 473 | $oDB->rollback(); |
474 | 474 | return $menuItemOutput; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | // Insert a module |
482 | 482 | $args->menu_srl = $menuArgs->menu_srl; |
483 | 483 | $output = executeQuery('module.insertModule', $args); |
484 | - if(!$output->toBool()) |
|
484 | + if (!$output->toBool()) |
|
485 | 485 | { |
486 | 486 | $oDB->rollback(); |
487 | 487 | return $output; |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | $oDB->commit(); |
494 | 494 | |
495 | 495 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
496 | - if($oCacheHandler->isSupport()) |
|
496 | + if ($oCacheHandler->isSupport()) |
|
497 | 497 | { |
498 | 498 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
499 | 499 | } |
500 | 500 | |
501 | - $output->add('module_srl',$args->module_srl); |
|
501 | + $output->add('module_srl', $args->module_srl); |
|
502 | 502 | return $output; |
503 | 503 | } |
504 | 504 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | function updateModule($args) |
509 | 509 | { |
510 | - if(isset($args->isMenuCreate)) |
|
510 | + if (isset($args->isMenuCreate)) |
|
511 | 511 | { |
512 | 512 | $isMenuCreate = $args->isMenuCreate; |
513 | 513 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
520 | - if(!$output->toBool()) return $output; |
|
520 | + if (!$output->toBool()) return $output; |
|
521 | 521 | // begin transaction |
522 | 522 | $oDB = &DB::getInstance(); |
523 | 523 | $oDB->begin(); |
@@ -526,29 +526,29 @@ discard block |
||
526 | 526 | $columnList = array('module_srl', 'site_srl', 'browser_title', 'mid'); |
527 | 527 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); |
528 | 528 | |
529 | - if(!$args->site_srl || !$args->browser_title) |
|
529 | + if (!$args->site_srl || !$args->browser_title) |
|
530 | 530 | { |
531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
531 | + if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl; |
|
532 | + if (!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | $args->browser_title = strip_tags($args->browser_title); |
536 | 536 | |
537 | 537 | $output = executeQuery('module.isExistsModuleName', $args); |
538 | - if(!$output->toBool() || $output->data->count) |
|
538 | + if (!$output->toBool() || $output->data->count) |
|
539 | 539 | { |
540 | 540 | $oDB->rollback(); |
541 | 541 | return new BaseObject(-1, 'msg_module_name_exists'); |
542 | 542 | } |
543 | 543 | |
544 | 544 | // default value |
545 | - if($args->skin == '/USE_DEFAULT/') |
|
545 | + if ($args->skin == '/USE_DEFAULT/') |
|
546 | 546 | { |
547 | 547 | $args->is_skin_fix = 'N'; |
548 | 548 | } |
549 | 549 | else |
550 | 550 | { |
551 | - if(isset($args->is_skin_fix)) |
|
551 | + if (isset($args->is_skin_fix)) |
|
552 | 552 | { |
553 | 553 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
554 | 554 | } |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | - if($args->mskin == '/USE_DEFAULT/') |
|
561 | + if ($args->mskin == '/USE_DEFAULT/') |
|
562 | 562 | { |
563 | 563 | $args->is_mskin_fix = 'N'; |
564 | 564 | } |
565 | 565 | else |
566 | 566 | { |
567 | - if(isset($args->is_mskin_fix)) |
|
567 | + if (isset($args->is_mskin_fix)) |
|
568 | 568 | { |
569 | 569 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
570 | 570 | } |
@@ -574,27 +574,27 @@ discard block |
||
574 | 574 | } |
575 | 575 | } |
576 | 576 | $output = executeQuery('module.updateModule', $args); |
577 | - if(!$output->toBool()) |
|
577 | + if (!$output->toBool()) |
|
578 | 578 | { |
579 | 579 | $oDB->rollback(); |
580 | 580 | return $output; |
581 | 581 | } |
582 | 582 | |
583 | - if($isMenuCreate === TRUE) |
|
583 | + if ($isMenuCreate === TRUE) |
|
584 | 584 | { |
585 | 585 | $menuArgs = new stdClass; |
586 | 586 | $menuArgs->url = $module_info->mid; |
587 | 587 | $menuArgs->site_srl = $module_info->site_srl; |
588 | 588 | $menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs); |
589 | - if($menuOutput->data && count($menuOutput->data)) |
|
589 | + if ($menuOutput->data && count($menuOutput->data)) |
|
590 | 590 | { |
591 | 591 | $oMenuAdminController = getAdminController('menu'); |
592 | - foreach($menuOutput->data as $itemInfo) |
|
592 | + foreach ($menuOutput->data as $itemInfo) |
|
593 | 593 | { |
594 | 594 | $itemInfo->url = $args->mid; |
595 | 595 | |
596 | 596 | $updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo); |
597 | - if(!$updateMenuItemOutput->toBool()) |
|
597 | + if (!$updateMenuItemOutput->toBool()) |
|
598 | 598 | { |
599 | 599 | $oDB->rollback(); |
600 | 600 | return $updateMenuItemOutput; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | } |
605 | 605 | |
606 | 606 | // if mid changed, change mid of success_return_url to new mid |
607 | - if($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
607 | + if ($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
608 | 608 | { |
609 | 609 | changeValueInUrl('mid', $args->mid, $module_info->mid); |
610 | 610 | } |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | |
615 | 615 | $oDB->commit(); |
616 | 616 | |
617 | - $output->add('module_srl',$args->module_srl); |
|
617 | + $output->add('module_srl', $args->module_srl); |
|
618 | 618 | |
619 | 619 | //remove from cache |
620 | 620 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
621 | - if($oCacheHandler->isSupport()) |
|
621 | + if ($oCacheHandler->isSupport()) |
|
622 | 622 | { |
623 | 623 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
624 | 624 | } |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $args->update_id = $update_id; |
638 | 638 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
639 | 639 | |
640 | - if(!!$output->error) return false; |
|
640 | + if (!!$output->error) return false; |
|
641 | 641 | |
642 | 642 | return true; |
643 | 643 | } |
@@ -652,11 +652,11 @@ discard block |
||
652 | 652 | $args->site_srl = $site_srl; |
653 | 653 | $args->layout_srl = $layout_srl; |
654 | 654 | $output = executeQuery('module.updateModuleSite', $args); |
655 | - if(!$output->toBool()) return $output; |
|
655 | + if (!$output->toBool()) return $output; |
|
656 | 656 | |
657 | 657 | //remove from cache |
658 | 658 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
659 | - if($oCacheHandler->isSupport()) |
|
659 | + if ($oCacheHandler->isSupport()) |
|
660 | 660 | { |
661 | 661 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
662 | 662 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | */ |
672 | 672 | function deleteModule($module_srl, $site_srl = 0) |
673 | 673 | { |
674 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
674 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
675 | 675 | |
676 | 676 | $site_module_info = Context::get('site_module_info'); |
677 | 677 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $args = new stdClass(); |
682 | 682 | $args->url = $output->mid; |
683 | 683 | $args->is_shortcut = 'N'; |
684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
684 | + if (!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
685 | 685 | else $args->site_srl = $site_srl; |
686 | 686 | |
687 | 687 | unset($output); |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | $menuOutput = $oMenuAdminModel->getMenuList($args); |
691 | 691 | |
692 | 692 | // get menu_srl by site_srl |
693 | - if(is_array($menuOutput->data)) |
|
693 | + if (is_array($menuOutput->data)) |
|
694 | 694 | { |
695 | - foreach($menuOutput->data AS $key=>$value) |
|
695 | + foreach ($menuOutput->data AS $key=>$value) |
|
696 | 696 | { |
697 | 697 | $args->menu_srl = $value->menu_srl; |
698 | 698 | break; |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
703 | 703 | // menu delete |
704 | - if($output->data) |
|
704 | + if ($output->data) |
|
705 | 705 | { |
706 | 706 | unset($args); |
707 | 707 | $args = new stdClass; |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $oMenuAdminController = getAdminController('menu'); |
713 | 713 | $output = $oMenuAdminController->deleteItem($args); |
714 | 714 | |
715 | - if($output->isSuccess) |
|
715 | + if ($output->isSuccess) |
|
716 | 716 | { |
717 | 717 | return new BaseObject(0, 'success_deleted'); |
718 | 718 | } |
@@ -734,19 +734,19 @@ discard block |
||
734 | 734 | */ |
735 | 735 | public function onlyDeleteModule($module_srl) |
736 | 736 | { |
737 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
737 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
738 | 738 | |
739 | 739 | // check start module |
740 | 740 | $oModuleModel = getModel('module'); |
741 | 741 | $columnList = array('sites.index_module_srl'); |
742 | 742 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
743 | - if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
743 | + if ($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
744 | 744 | |
745 | 745 | // Call a trigger (before) |
746 | 746 | $trigger_obj = new stdClass(); |
747 | 747 | $trigger_obj->module_srl = $module_srl; |
748 | 748 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
749 | - if(!$output->toBool()) return $output; |
|
749 | + if (!$output->toBool()) return $output; |
|
750 | 750 | |
751 | 751 | // begin transaction |
752 | 752 | $oDB = &DB::getInstance(); |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $args->module_srl = $module_srl; |
757 | 757 | // Delete module information from the DB |
758 | 758 | $output = executeQuery('module.deleteModule', $args); |
759 | - if(!$output->toBool()) |
|
759 | + if (!$output->toBool()) |
|
760 | 760 | { |
761 | 761 | $oDB->rollback(); |
762 | 762 | return $output; |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | // Remove the module manager |
771 | 771 | $this->deleteAdminId($module_srl); |
772 | 772 | // Call a trigger (after) |
773 | - if($output->toBool()) |
|
773 | + if ($output->toBool()) |
|
774 | 774 | { |
775 | 775 | $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); |
776 | - if(!$trigger_output->toBool()) |
|
776 | + if (!$trigger_output->toBool()) |
|
777 | 777 | { |
778 | 778 | $oDB->rollback(); |
779 | 779 | return $trigger_output; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | |
786 | 786 | //remove from cache |
787 | 787 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
788 | - if($oCacheHandler->isSupport()) |
|
788 | + if ($oCacheHandler->isSupport()) |
|
789 | 789 | { |
790 | 790 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
791 | 791 | } |
@@ -807,10 +807,10 @@ discard block |
||
807 | 807 | function clearDefaultModule() |
808 | 808 | { |
809 | 809 | $output = executeQuery('module.clearDefaultModule'); |
810 | - if(!$output->toBool()) return $output; |
|
810 | + if (!$output->toBool()) return $output; |
|
811 | 811 | |
812 | 812 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
813 | - if($oCacheHandler->isSupport()) |
|
813 | + if ($oCacheHandler->isSupport()) |
|
814 | 814 | { |
815 | 815 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
816 | 816 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | $output = executeQuery('module.updateModuleMenu', $args); |
827 | 827 | |
828 | 828 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
829 | - if($oCacheHandler->isSupport()) |
|
829 | + if ($oCacheHandler->isSupport()) |
|
830 | 830 | { |
831 | 831 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
832 | 832 | } |
@@ -839,15 +839,15 @@ discard block |
||
839 | 839 | */ |
840 | 840 | function updateModuleLayout($layout_srl, $menu_srl_list) |
841 | 841 | { |
842 | - if(!count($menu_srl_list)) return; |
|
842 | + if (!count($menu_srl_list)) return; |
|
843 | 843 | |
844 | 844 | $args = new stdClass; |
845 | 845 | $args->layout_srl = $layout_srl; |
846 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
846 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
847 | 847 | $output = executeQuery('module.updateModuleLayout', $args); |
848 | 848 | |
849 | 849 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
850 | - if($oCacheHandler->isSupport()) |
|
850 | + if ($oCacheHandler->isSupport()) |
|
851 | 851 | { |
852 | 852 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
853 | 853 | } |
@@ -866,37 +866,37 @@ discard block |
||
866 | 866 | |
867 | 867 | $output = executeQuery('module.deleteSiteAdmin', $args); |
868 | 868 | |
869 | - if(!$output->toBool()) return $output; |
|
869 | + if (!$output->toBool()) return $output; |
|
870 | 870 | // Get user id of an administrator |
871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
872 | - foreach($arr_admins as $key => $user_id) |
|
871 | + if (!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
872 | + foreach ($arr_admins as $key => $user_id) |
|
873 | 873 | { |
874 | - if(!trim($user_id)) continue; |
|
874 | + if (!trim($user_id)) continue; |
|
875 | 875 | $admins[] = trim($user_id); |
876 | 876 | } |
877 | - if(!count($admins)) return new BaseObject(); |
|
877 | + if (!count($admins)) return new BaseObject(); |
|
878 | 878 | |
879 | 879 | $oMemberModel = getModel('member'); |
880 | 880 | $member_config = $oMemberModel->getMemberConfig(); |
881 | - if($member_config->identifier == 'email_address') |
|
881 | + if ($member_config->identifier == 'email_address') |
|
882 | 882 | { |
883 | - $args->email_address = '\''.implode('\',\'',$admins).'\''; |
|
883 | + $args->email_address = '\''.implode('\',\'', $admins).'\''; |
|
884 | 884 | } |
885 | 885 | else |
886 | 886 | { |
887 | - $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
|
887 | + $args->user_ids = '\''.implode('\',\'', $admins).'\''; |
|
888 | 888 | } |
889 | 889 | $output = executeQueryArray('module.getAdminSrls', $args); |
890 | - if(!$output->toBool()||!$output->data) return $output; |
|
890 | + if (!$output->toBool() || !$output->data) return $output; |
|
891 | 891 | |
892 | - foreach($output->data as $key => $val) |
|
892 | + foreach ($output->data as $key => $val) |
|
893 | 893 | { |
894 | 894 | unset($args); |
895 | 895 | $args = new stdClass; |
896 | 896 | $args->site_srl = $site_srl; |
897 | 897 | $args->member_srl = $val->member_srl; |
898 | 898 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
899 | - if(!$output->toBool()) return $output; |
|
899 | + if (!$output->toBool()) return $output; |
|
900 | 900 | } |
901 | 901 | return new BaseObject(); |
902 | 902 | } |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | $oMemberModel = getModel('member'); |
910 | 910 | $member_config = $oMemberModel->getMemberConfig(); |
911 | 911 | |
912 | - if($member_config->identifier == 'email_address') |
|
912 | + if ($member_config->identifier == 'email_address') |
|
913 | 913 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
914 | 914 | else |
915 | 915 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
916 | 916 | |
917 | - if(!$member_info->member_srl) return; |
|
917 | + if (!$member_info->member_srl) return; |
|
918 | 918 | $args = new stdClass(); |
919 | 919 | $args->module_srl = $module_srl; |
920 | 920 | $args->member_srl = $member_info->member_srl; |
@@ -929,11 +929,11 @@ discard block |
||
929 | 929 | $args = new stdClass(); |
930 | 930 | $args->module_srl = $module_srl; |
931 | 931 | |
932 | - if($admin_id) |
|
932 | + if ($admin_id) |
|
933 | 933 | { |
934 | 934 | $oMemberModel = getModel('member'); |
935 | 935 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
936 | + if ($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
937 | 937 | } |
938 | 938 | return executeQuery('module.deleteAdminId', $args); |
939 | 939 | } |
@@ -970,18 +970,18 @@ discard block |
||
970 | 970 | $oDB->begin(); |
971 | 971 | |
972 | 972 | $output = $this->_deleteModuleSkinVars($module_srl, $mode); |
973 | - if(!$output->toBool()) |
|
973 | + if (!$output->toBool()) |
|
974 | 974 | { |
975 | 975 | $oDB->rollback(); |
976 | 976 | return $output; |
977 | 977 | } |
978 | 978 | |
979 | 979 | getDestroyXeVars($obj); |
980 | - if(!$obj || !count($obj)) return new BaseObject(); |
|
980 | + if (!$obj || !count($obj)) return new BaseObject(); |
|
981 | 981 | |
982 | 982 | $args = new stdClass; |
983 | 983 | $args->module_srl = $module_srl; |
984 | - foreach($obj as $key => $val) |
|
984 | + foreach ($obj as $key => $val) |
|
985 | 985 | { |
986 | 986 | // #17927989 For an old board which used the old blog module |
987 | 987 | // it often saved menu item(stdClass) on the skin info column |
@@ -992,9 +992,9 @@ discard block |
||
992 | 992 | |
993 | 993 | $args->name = trim($key); |
994 | 994 | $args->value = trim($val); |
995 | - if(!$args->name || !$args->value) continue; |
|
995 | + if (!$args->name || !$args->value) continue; |
|
996 | 996 | |
997 | - if($mode === 'P') |
|
997 | + if ($mode === 'P') |
|
998 | 998 | { |
999 | 999 | $output = executeQuery('module.insertModuleSkinVars', $args); |
1000 | 1000 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | { |
1003 | 1003 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
1004 | 1004 | } |
1005 | - if(!$output->toBool()) |
|
1005 | + if (!$output->toBool()) |
|
1006 | 1006 | { |
1007 | 1007 | return $output; |
1008 | 1008 | $oDB->rollback(); |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | $args->module_srl = $module_srl; |
1042 | 1042 | $mode = $mode === 'P' ? 'P' : 'M'; |
1043 | 1043 | |
1044 | - if($mode === 'P') |
|
1044 | + if ($mode === 'P') |
|
1045 | 1045 | { |
1046 | 1046 | $object_key = 'module_skin_vars:'.$module_srl; |
1047 | 1047 | $query = 'module.deleteModuleSkinVars'; |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | //remove from cache |
1056 | 1056 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1057 | 1057 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1058 | - if($oCacheHandler->isSupport()) |
|
1058 | + if ($oCacheHandler->isSupport()) |
|
1059 | 1059 | { |
1060 | 1060 | $oCacheHandler->delete($cache_key); |
1061 | 1061 | } |
@@ -1070,22 +1070,22 @@ discard block |
||
1070 | 1070 | { |
1071 | 1071 | $this->deleteModuleExtraVars($module_srl); |
1072 | 1072 | getDestroyXeVars($obj); |
1073 | - if(!$obj || !count($obj)) return; |
|
1073 | + if (!$obj || !count($obj)) return; |
|
1074 | 1074 | |
1075 | - foreach($obj as $key => $val) |
|
1075 | + foreach ($obj as $key => $val) |
|
1076 | 1076 | { |
1077 | - if(is_object($val) || is_array($val)) continue; |
|
1077 | + if (is_object($val) || is_array($val)) continue; |
|
1078 | 1078 | |
1079 | 1079 | $args = new stdClass(); |
1080 | 1080 | $args->module_srl = $module_srl; |
1081 | 1081 | $args->name = trim($key); |
1082 | 1082 | $args->value = trim($val); |
1083 | - if(!$args->name || !$args->value) continue; |
|
1083 | + if (!$args->name || !$args->value) continue; |
|
1084 | 1084 | $output = executeQuery('module.insertModuleExtraVars', $args); |
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1088 | - if($oCacheHandler->isSupport()) |
|
1088 | + if ($oCacheHandler->isSupport()) |
|
1089 | 1089 | { |
1090 | 1090 | $object_key = 'module_extra_vars:'.$module_srl; |
1091 | 1091 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | |
1105 | 1105 | //remove from cache |
1106 | 1106 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1107 | - if($oCacheHandler->isSupport()) |
|
1107 | + if ($oCacheHandler->isSupport()) |
|
1108 | 1108 | { |
1109 | 1109 | $object_key = 'module_extra_vars:'.$module_srl; |
1110 | 1110 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1120,19 +1120,19 @@ discard block |
||
1120 | 1120 | function insertModuleGrants($module_srl, $obj) |
1121 | 1121 | { |
1122 | 1122 | $this->deleteModuleGrants($module_srl); |
1123 | - if(!$obj || !count($obj)) return; |
|
1123 | + if (!$obj || !count($obj)) return; |
|
1124 | 1124 | |
1125 | - foreach($obj as $name => $val) |
|
1125 | + foreach ($obj as $name => $val) |
|
1126 | 1126 | { |
1127 | - if(!$val || !count($val)) continue; |
|
1127 | + if (!$val || !count($val)) continue; |
|
1128 | 1128 | |
1129 | - foreach($val as $group_srl) |
|
1129 | + foreach ($val as $group_srl) |
|
1130 | 1130 | { |
1131 | 1131 | $args = new stdClass(); |
1132 | 1132 | $args->module_srl = $module_srl; |
1133 | 1133 | $args->name = $name; |
1134 | 1134 | $args->group_srl = trim($group_srl); |
1135 | - if(!$args->name || !$args->group_srl) continue; |
|
1135 | + if (!$args->name || !$args->group_srl) continue; |
|
1136 | 1136 | executeQuery('module.insertModuleGrant', $args); |
1137 | 1137 | } |
1138 | 1138 | } |
@@ -1153,9 +1153,9 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | function replaceDefinedLangCode(&$output, $isReplaceLangCode = true) |
1155 | 1155 | { |
1156 | - if($isReplaceLangCode) |
|
1156 | + if ($isReplaceLangCode) |
|
1157 | 1157 | { |
1158 | - $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output); |
|
1158 | + $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output); |
|
1159 | 1159 | } |
1160 | 1160 | } |
1161 | 1161 | |
@@ -1164,29 +1164,29 @@ discard block |
||
1164 | 1164 | static $lang = false; |
1165 | 1165 | |
1166 | 1166 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1167 | - if($lang === false && $oCacheHandler->isSupport()) |
|
1167 | + if ($lang === false && $oCacheHandler->isSupport()) |
|
1168 | 1168 | { |
1169 | 1169 | $site_module_info = Context::get('site_module_info'); |
1170 | - if(!$site_module_info) |
|
1170 | + if (!$site_module_info) |
|
1171 | 1171 | { |
1172 | 1172 | $oModuleModel = getModel('module'); |
1173 | 1173 | $site_module_info = $oModuleModel->getDefaultMid(); |
1174 | 1174 | Context::set('site_module_info', $site_module_info); |
1175 | 1175 | } |
1176 | 1176 | |
1177 | - $object_key = 'user_defined_langs:' . $site_module_info->site_srl . ':' . Context::getLangType(); |
|
1177 | + $object_key = 'user_defined_langs:'.$site_module_info->site_srl.':'.Context::getLangType(); |
|
1178 | 1178 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1179 | 1179 | $lang = $oCacheHandler->get($cache_key); |
1180 | 1180 | |
1181 | - if($lang === false) { |
|
1181 | + if ($lang === false) { |
|
1182 | 1182 | $oModuleAdminController = getAdminController('module'); |
1183 | 1183 | $lang = $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | |
1187 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1187 | + if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1188 | 1188 | |
1189 | - return str_replace('$user_lang->','',$matches[0]); |
|
1189 | + return str_replace('$user_lang->', '', $matches[0]); |
|
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | |
@@ -1199,17 +1199,17 @@ discard block |
||
1199 | 1199 | if ($ajax) Context::setRequestMethod('JSON'); |
1200 | 1200 | |
1201 | 1201 | $logged_info = Context::get('logged_info'); |
1202 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1202 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1203 | 1203 | |
1204 | - $vars = Context::gets('addfile','filter'); |
|
1204 | + $vars = Context::gets('addfile', 'filter'); |
|
1205 | 1205 | $attributeNames = Context::get('attribute_name'); |
1206 | 1206 | $attributeValues = Context::get('attribute_value'); |
1207 | - if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
1207 | + if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
1208 | 1208 | { |
1209 | 1209 | $attributes = array(); |
1210 | - foreach($attributeNames as $no => $name) |
|
1210 | + foreach ($attributeNames as $no => $name) |
|
1211 | 1211 | { |
1212 | - if(empty($name)) |
|
1212 | + if (empty($name)) |
|
1213 | 1213 | { |
1214 | 1214 | continue; |
1215 | 1215 | } |
@@ -1221,16 +1221,16 @@ discard block |
||
1221 | 1221 | $vars->comment = $attributes; |
1222 | 1222 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1223 | 1223 | |
1224 | - $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1224 | + $ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1225 | 1225 | $vars->ext = $ext; |
1226 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
1227 | - else $filter = array('jpg','jpeg','gif','png'); |
|
1228 | - if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
1226 | + if ($vars->filter) $filter = explode(',', $vars->filter); |
|
1227 | + else $filter = array('jpg', 'jpeg', 'gif', 'png'); |
|
1228 | + if (!in_array($ext, $filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
1229 | 1229 | |
1230 | 1230 | $vars->member_srl = $logged_info->member_srl; |
1231 | 1231 | |
1232 | 1232 | // update |
1233 | - if($module_filebox_srl > 0) |
|
1233 | + if ($module_filebox_srl > 0) |
|
1234 | 1234 | { |
1235 | 1235 | $vars->module_filebox_srl = $module_filebox_srl; |
1236 | 1236 | $output = $this->updateModuleFileBox($vars); |
@@ -1238,10 +1238,10 @@ discard block |
||
1238 | 1238 | // insert |
1239 | 1239 | else |
1240 | 1240 | { |
1241 | - if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
1241 | + if (!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
1242 | 1242 | $addfile = Context::get('addfile'); |
1243 | - if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
1244 | - if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
1243 | + if (!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
1244 | + if ($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
1245 | 1245 | $output = $this->insertModuleFileBox($vars); |
1246 | 1246 | } |
1247 | 1247 | |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | } |
1256 | 1256 | else |
1257 | 1257 | { |
1258 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
1258 | + if ($output) $this->add('save_filename', $output->get('save_filename')); |
|
1259 | 1259 | else $this->add('save_filename', ''); |
1260 | 1260 | } |
1261 | 1261 | } |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | { |
1268 | 1268 | $args = new stdClass; |
1269 | 1269 | // have file |
1270 | - if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
1270 | + if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
1271 | 1271 | { |
1272 | 1272 | $oModuleModel = getModel('module'); |
1273 | 1273 | $output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl); |
@@ -1276,18 +1276,18 @@ discard block |
||
1276 | 1276 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
1277 | 1277 | FileHandler::makeDir($path); |
1278 | 1278 | |
1279 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext); |
|
1279 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext); |
|
1280 | 1280 | $tmp = $vars->addfile['tmp_name']; |
1281 | 1281 | |
1282 | 1282 | // Check uploaded file |
1283 | - if(!checkUploadedFile($tmp)) return false; |
|
1283 | + if (!checkUploadedFile($tmp)) return false; |
|
1284 | 1284 | |
1285 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
1285 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
1286 | 1286 | { |
1287 | 1287 | return false; |
1288 | 1288 | } |
1289 | 1289 | |
1290 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1290 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1291 | 1291 | $args->filename = $save_filename; |
1292 | 1292 | $args->filesize = $vars->addfile['size']; |
1293 | 1293 | } |
@@ -1313,14 +1313,14 @@ discard block |
||
1313 | 1313 | $oModuleModel = getModel('module'); |
1314 | 1314 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
1315 | 1315 | FileHandler::makeDir($path); |
1316 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext); |
|
1316 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext); |
|
1317 | 1317 | $tmp = $vars->addfile['tmp_name']; |
1318 | 1318 | |
1319 | 1319 | // Check uploaded file |
1320 | - if(!checkUploadedFile($tmp)) return false; |
|
1320 | + if (!checkUploadedFile($tmp)) return false; |
|
1321 | 1321 | |
1322 | 1322 | // upload |
1323 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
1323 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
1324 | 1324 | { |
1325 | 1325 | return false; |
1326 | 1326 | } |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | $args->member_srl = $vars->member_srl; |
1332 | 1332 | $args->comment = $vars->comment; |
1333 | 1333 | $args->filename = $save_filename; |
1334 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1334 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1335 | 1335 | $args->filesize = $vars->addfile['size']; |
1336 | 1336 | |
1337 | 1337 | $output = executeQuery('module.insertModuleFileBox', $args); |
@@ -1346,14 +1346,14 @@ discard block |
||
1346 | 1346 | function procModuleFileBoxDelete() |
1347 | 1347 | { |
1348 | 1348 | $logged_info = Context::get('logged_info'); |
1349 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1349 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1350 | 1350 | |
1351 | 1351 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1352 | - if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1352 | + if (!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1353 | 1353 | $vars = new stdClass(); |
1354 | 1354 | $vars->module_filebox_srl = $module_filebox_srl; |
1355 | 1355 | $output = $this->deleteModuleFileBox($vars); |
1356 | - if(!$output->toBool()) return $output; |
|
1356 | + if (!$output->toBool()) return $output; |
|
1357 | 1357 | } |
1358 | 1358 | |
1359 | 1359 | function deleteModuleFileBox($vars) |
@@ -1376,11 +1376,11 @@ discard block |
||
1376 | 1376 | $this->unlockTimeoutPassed(); |
1377 | 1377 | $args = new stdClass; |
1378 | 1378 | $args->lock_name = $lock_name; |
1379 | - if(!$timeout) $timeout = 60; |
|
1379 | + if (!$timeout) $timeout = 60; |
|
1380 | 1380 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
1381 | - if($member_srl) $args->member_srl = $member_srl; |
|
1381 | + if ($member_srl) $args->member_srl = $member_srl; |
|
1382 | 1382 | $output = executeQuery('module.insertLock', $args); |
1383 | - if($output->toBool()) |
|
1383 | + if ($output->toBool()) |
|
1384 | 1384 | { |
1385 | 1385 | $output->add('lock_name', $lock_name); |
1386 | 1386 | $output->add('deadline', $args->deadline); |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | $output = executeQuery('module.updateModuleInSites', $args); |
1410 | 1410 | |
1411 | 1411 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1412 | - if($oCacheHandler->isSupport()) |
|
1412 | + if ($oCacheHandler->isSupport()) |
|
1413 | 1413 | { |
1414 | 1414 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
1415 | 1415 | } |
@@ -150,9 +150,15 @@ discard block |
||
150 | 150 | */ |
151 | 151 | function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
152 | 152 | { |
153 | - if($kind != 'admin') $kind = ''; |
|
154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
153 | + if($kind != 'admin') { |
|
154 | + $kind = ''; |
|
155 | + } |
|
156 | + if(!in_array($type,array('model','controller','view','api','mobile'))) { |
|
157 | + return false; |
|
158 | + } |
|
159 | + if(in_array($parent_module, array('module','addon','widget','layout'))) { |
|
160 | + return false; |
|
161 | + } |
|
156 | 162 | |
157 | 163 | $cache_file = './files/config/module_extend.php'; |
158 | 164 | FileHandler::removeFile($cache_file); |
@@ -164,7 +170,9 @@ discard block |
||
164 | 170 | $args->kind = $kind; |
165 | 171 | |
166 | 172 | $output = executeQuery('module.getModuleExtendCount', $args); |
167 | - if($output->data->count>0) return false; |
|
173 | + if($output->data->count>0) { |
|
174 | + return false; |
|
175 | + } |
|
168 | 176 | |
169 | 177 | $output = executeQuery('module.insertModuleExtend', $args); |
170 | 178 | return $output; |
@@ -199,7 +207,9 @@ discard block |
||
199 | 207 | $oModuleModel = getModel('module'); |
200 | 208 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
201 | 209 | |
202 | - if(!$origin_config) $origin_config = new stdClass; |
|
210 | + if(!$origin_config) { |
|
211 | + $origin_config = new stdClass; |
|
212 | + } |
|
203 | 213 | |
204 | 214 | foreach($config as $key => $val) |
205 | 215 | { |
@@ -221,7 +231,9 @@ discard block |
||
221 | 231 | $args->site_srl = $site_srl; |
222 | 232 | |
223 | 233 | $output = executeQuery('module.deleteModuleConfig', $args); |
224 | - if(!$output->toBool()) return $output; |
|
234 | + if(!$output->toBool()) { |
|
235 | + return $output; |
|
236 | + } |
|
225 | 237 | |
226 | 238 | $output = executeQuery('module.insertModuleConfig', $args); |
227 | 239 | |
@@ -246,7 +258,9 @@ discard block |
||
246 | 258 | $args->config = serialize($config); |
247 | 259 | |
248 | 260 | $output = executeQuery('module.deleteModulePartConfig', $args); |
249 | - if(!$output->toBool()) return $output; |
|
261 | + if(!$output->toBool()) { |
|
262 | + return $output; |
|
263 | + } |
|
250 | 264 | |
251 | 265 | $output = executeQuery('module.insertModulePartConfig', $args); |
252 | 266 | |
@@ -268,9 +282,10 @@ discard block |
||
268 | 282 | if(isSiteID($domain)) |
269 | 283 | { |
270 | 284 | $oModuleModel = getModel('module'); |
271 | - if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
272 | - } |
|
273 | - else |
|
285 | + if($oModuleModel->isIDExists($domain, 0)) { |
|
286 | + return new BaseObject(-1,'msg_already_registed_vid'); |
|
287 | + } |
|
288 | + } else |
|
274 | 289 | { |
275 | 290 | $domain = strtolower($domain); |
276 | 291 | } |
@@ -284,10 +299,14 @@ discard block |
||
284 | 299 | $columnList = array('modules.site_srl'); |
285 | 300 | $oModuleModel = getModel('module'); |
286 | 301 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
287 | - if($output) return new BaseObject(-1,'msg_already_registed_vid'); |
|
302 | + if($output) { |
|
303 | + return new BaseObject(-1,'msg_already_registed_vid'); |
|
304 | + } |
|
288 | 305 | |
289 | 306 | $output = executeQuery('module.insertSite', $args); |
290 | - if(!$output->toBool()) return $output; |
|
307 | + if(!$output->toBool()) { |
|
308 | + return $output; |
|
309 | + } |
|
291 | 310 | |
292 | 311 | $output->add('site_srl', $args->site_srl); |
293 | 312 | return $output; |
@@ -310,8 +329,12 @@ discard block |
||
310 | 329 | if($site_info->domain != $args->domain) |
311 | 330 | { |
312 | 331 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain'); |
|
314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
332 | + if($info->site_srl && $info->site_srl != $args->site_srl) { |
|
333 | + return new BaseObject(-1,'msg_already_registed_domain'); |
|
334 | + } |
|
335 | + if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) { |
|
336 | + return new BaseObject(-1,'msg_already_registed_vid'); |
|
337 | + } |
|
315 | 338 | |
316 | 339 | if($args->domain && !isSiteID($args->domain)) |
317 | 340 | { |
@@ -320,8 +343,11 @@ discard block |
||
320 | 343 | } |
321 | 344 | $output = executeQuery('module.updateSite', $args); |
322 | 345 | //clear cache for default mid |
323 | - if($args->site_srl == 0) $vid=''; |
|
324 | - else $vid=$args->domain; |
|
346 | + if($args->site_srl == 0) { |
|
347 | + $vid=''; |
|
348 | + } else { |
|
349 | + $vid=$args->domain; |
|
350 | + } |
|
325 | 351 | |
326 | 352 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
327 | 353 | $mid = $module_info->mid; |
@@ -345,7 +371,9 @@ discard block |
||
345 | 371 | unset($args->act); |
346 | 372 | unset($args->page); |
347 | 373 | // Test mid value |
348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
374 | + if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) { |
|
375 | + return new BaseObject(-1, 'msg_limit_mid'); |
|
376 | + } |
|
349 | 377 | // Test variables (separate basic vars and other vars in modules) |
350 | 378 | $extra_vars = clone($args); |
351 | 379 | unset($extra_vars->module_srl); |
@@ -382,18 +410,23 @@ discard block |
||
382 | 410 | if(isset($args->isMenuCreate)) |
383 | 411 | { |
384 | 412 | $isMenuCreate = $args->isMenuCreate; |
385 | - } |
|
386 | - else |
|
413 | + } else |
|
387 | 414 | { |
388 | 415 | $isMenuCreate = TRUE; |
389 | 416 | } |
390 | 417 | |
391 | 418 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
392 | - if(!$output->toBool()) return $output; |
|
419 | + if(!$output->toBool()) { |
|
420 | + return $output; |
|
421 | + } |
|
393 | 422 | // Check whether the module name already exists |
394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
423 | + if(!$args->site_srl) { |
|
424 | + $args->site_srl = 0; |
|
425 | + } |
|
395 | 426 | $oModuleModel = getModel('module'); |
396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists'); |
|
427 | + if($oModuleModel->isIDExists($args->mid, $args->site_srl)) { |
|
428 | + return new BaseObject(-1, 'msg_module_name_exists'); |
|
429 | + } |
|
397 | 430 | |
398 | 431 | // begin transaction |
399 | 432 | $oDB = &DB::getInstance(); |
@@ -404,20 +437,20 @@ discard block |
||
404 | 437 | $skin_vars = new stdClass(); |
405 | 438 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
406 | 439 | // Arrange variables and then execute a query |
407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
440 | + if(!$args->module_srl) { |
|
441 | + $args->module_srl = getNextSequence(); |
|
442 | + } |
|
408 | 443 | |
409 | 444 | // default value |
410 | 445 | if($args->skin == '/USE_DEFAULT/') |
411 | 446 | { |
412 | 447 | $args->is_skin_fix = 'N'; |
413 | - } |
|
414 | - else |
|
448 | + } else |
|
415 | 449 | { |
416 | 450 | if(isset($args->is_skin_fix)) |
417 | 451 | { |
418 | 452 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
419 | - } |
|
420 | - else |
|
453 | + } else |
|
421 | 454 | { |
422 | 455 | $args->is_skin_fix = 'Y'; |
423 | 456 | } |
@@ -426,14 +459,12 @@ discard block |
||
426 | 459 | if($args->mskin == '/USE_DEFAULT/') |
427 | 460 | { |
428 | 461 | $args->is_mskin_fix = 'N'; |
429 | - } |
|
430 | - else |
|
462 | + } else |
|
431 | 463 | { |
432 | 464 | if(isset($args->is_mskin_fix)) |
433 | 465 | { |
434 | 466 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
435 | - } |
|
436 | - else |
|
467 | + } else |
|
437 | 468 | { |
438 | 469 | $args->is_mskin_fix = 'Y'; |
439 | 470 | } |
@@ -510,14 +541,15 @@ discard block |
||
510 | 541 | if(isset($args->isMenuCreate)) |
511 | 542 | { |
512 | 543 | $isMenuCreate = $args->isMenuCreate; |
513 | - } |
|
514 | - else |
|
544 | + } else |
|
515 | 545 | { |
516 | 546 | $isMenuCreate = TRUE; |
517 | 547 | } |
518 | 548 | |
519 | 549 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
520 | - if(!$output->toBool()) return $output; |
|
550 | + if(!$output->toBool()) { |
|
551 | + return $output; |
|
552 | + } |
|
521 | 553 | // begin transaction |
522 | 554 | $oDB = &DB::getInstance(); |
523 | 555 | $oDB->begin(); |
@@ -528,8 +560,12 @@ discard block |
||
528 | 560 | |
529 | 561 | if(!$args->site_srl || !$args->browser_title) |
530 | 562 | { |
531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
563 | + if(!$args->site_srl) { |
|
564 | + $args->site_srl = (int)$module_info->site_srl; |
|
565 | + } |
|
566 | + if(!$args->browser_title) { |
|
567 | + $args->browser_title = $module_info->browser_title; |
|
568 | + } |
|
533 | 569 | } |
534 | 570 | |
535 | 571 | $args->browser_title = strip_tags($args->browser_title); |
@@ -545,14 +581,12 @@ discard block |
||
545 | 581 | if($args->skin == '/USE_DEFAULT/') |
546 | 582 | { |
547 | 583 | $args->is_skin_fix = 'N'; |
548 | - } |
|
549 | - else |
|
584 | + } else |
|
550 | 585 | { |
551 | 586 | if(isset($args->is_skin_fix)) |
552 | 587 | { |
553 | 588 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
554 | - } |
|
555 | - else |
|
589 | + } else |
|
556 | 590 | { |
557 | 591 | $args->is_skin_fix = 'Y'; |
558 | 592 | } |
@@ -561,14 +595,12 @@ discard block |
||
561 | 595 | if($args->mskin == '/USE_DEFAULT/') |
562 | 596 | { |
563 | 597 | $args->is_mskin_fix = 'N'; |
564 | - } |
|
565 | - else |
|
598 | + } else |
|
566 | 599 | { |
567 | 600 | if(isset($args->is_mskin_fix)) |
568 | 601 | { |
569 | 602 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
570 | - } |
|
571 | - else |
|
603 | + } else |
|
572 | 604 | { |
573 | 605 | $args->is_mskin_fix = 'Y'; |
574 | 606 | } |
@@ -637,7 +669,9 @@ discard block |
||
637 | 669 | $args->update_id = $update_id; |
638 | 670 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
639 | 671 | |
640 | - if(!!$output->error) return false; |
|
672 | + if(!!$output->error) { |
|
673 | + return false; |
|
674 | + } |
|
641 | 675 | |
642 | 676 | return true; |
643 | 677 | } |
@@ -652,7 +686,9 @@ discard block |
||
652 | 686 | $args->site_srl = $site_srl; |
653 | 687 | $args->layout_srl = $layout_srl; |
654 | 688 | $output = executeQuery('module.updateModuleSite', $args); |
655 | - if(!$output->toBool()) return $output; |
|
689 | + if(!$output->toBool()) { |
|
690 | + return $output; |
|
691 | + } |
|
656 | 692 | |
657 | 693 | //remove from cache |
658 | 694 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -671,7 +707,9 @@ discard block |
||
671 | 707 | */ |
672 | 708 | function deleteModule($module_srl, $site_srl = 0) |
673 | 709 | { |
674 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
710 | + if(!$module_srl) { |
|
711 | + return new BaseObject(-1,'msg_invalid_request'); |
|
712 | + } |
|
675 | 713 | |
676 | 714 | $site_module_info = Context::get('site_module_info'); |
677 | 715 | |
@@ -681,8 +719,11 @@ discard block |
||
681 | 719 | $args = new stdClass(); |
682 | 720 | $args->url = $output->mid; |
683 | 721 | $args->is_shortcut = 'N'; |
684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
685 | - else $args->site_srl = $site_srl; |
|
722 | + if(!$site_srl) { |
|
723 | + $args->site_srl = $site_module_info->site_srl; |
|
724 | + } else { |
|
725 | + $args->site_srl = $site_srl; |
|
726 | + } |
|
686 | 727 | |
687 | 728 | unset($output); |
688 | 729 | |
@@ -715,8 +756,7 @@ discard block |
||
715 | 756 | if($output->isSuccess) |
716 | 757 | { |
717 | 758 | return new BaseObject(0, 'success_deleted'); |
718 | - } |
|
719 | - else |
|
759 | + } else |
|
720 | 760 | { |
721 | 761 | return new BaseObject($output->error, $output->message); |
722 | 762 | } |
@@ -734,19 +774,25 @@ discard block |
||
734 | 774 | */ |
735 | 775 | public function onlyDeleteModule($module_srl) |
736 | 776 | { |
737 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
777 | + if(!$module_srl) { |
|
778 | + return new BaseObject(-1,'msg_invalid_request'); |
|
779 | + } |
|
738 | 780 | |
739 | 781 | // check start module |
740 | 782 | $oModuleModel = getModel('module'); |
741 | 783 | $columnList = array('sites.index_module_srl'); |
742 | 784 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
743 | - if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
785 | + if($module_srl == $start_module->index_module_srl) { |
|
786 | + return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
787 | + } |
|
744 | 788 | |
745 | 789 | // Call a trigger (before) |
746 | 790 | $trigger_obj = new stdClass(); |
747 | 791 | $trigger_obj->module_srl = $module_srl; |
748 | 792 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
749 | - if(!$output->toBool()) return $output; |
|
793 | + if(!$output->toBool()) { |
|
794 | + return $output; |
|
795 | + } |
|
750 | 796 | |
751 | 797 | // begin transaction |
752 | 798 | $oDB = &DB::getInstance(); |
@@ -807,7 +853,9 @@ discard block |
||
807 | 853 | function clearDefaultModule() |
808 | 854 | { |
809 | 855 | $output = executeQuery('module.clearDefaultModule'); |
810 | - if(!$output->toBool()) return $output; |
|
856 | + if(!$output->toBool()) { |
|
857 | + return $output; |
|
858 | + } |
|
811 | 859 | |
812 | 860 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
813 | 861 | if($oCacheHandler->isSupport()) |
@@ -839,7 +887,9 @@ discard block |
||
839 | 887 | */ |
840 | 888 | function updateModuleLayout($layout_srl, $menu_srl_list) |
841 | 889 | { |
842 | - if(!count($menu_srl_list)) return; |
|
890 | + if(!count($menu_srl_list)) { |
|
891 | + return; |
|
892 | + } |
|
843 | 893 | |
844 | 894 | $args = new stdClass; |
845 | 895 | $args->layout_srl = $layout_srl; |
@@ -866,28 +916,37 @@ discard block |
||
866 | 916 | |
867 | 917 | $output = executeQuery('module.deleteSiteAdmin', $args); |
868 | 918 | |
869 | - if(!$output->toBool()) return $output; |
|
919 | + if(!$output->toBool()) { |
|
920 | + return $output; |
|
921 | + } |
|
870 | 922 | // Get user id of an administrator |
871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
923 | + if(!is_array($arr_admins) || !count($arr_admins)) { |
|
924 | + return new BaseObject(); |
|
925 | + } |
|
872 | 926 | foreach($arr_admins as $key => $user_id) |
873 | 927 | { |
874 | - if(!trim($user_id)) continue; |
|
928 | + if(!trim($user_id)) { |
|
929 | + continue; |
|
930 | + } |
|
875 | 931 | $admins[] = trim($user_id); |
876 | 932 | } |
877 | - if(!count($admins)) return new BaseObject(); |
|
933 | + if(!count($admins)) { |
|
934 | + return new BaseObject(); |
|
935 | + } |
|
878 | 936 | |
879 | 937 | $oMemberModel = getModel('member'); |
880 | 938 | $member_config = $oMemberModel->getMemberConfig(); |
881 | 939 | if($member_config->identifier == 'email_address') |
882 | 940 | { |
883 | 941 | $args->email_address = '\''.implode('\',\'',$admins).'\''; |
884 | - } |
|
885 | - else |
|
942 | + } else |
|
886 | 943 | { |
887 | 944 | $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
888 | 945 | } |
889 | 946 | $output = executeQueryArray('module.getAdminSrls', $args); |
890 | - if(!$output->toBool()||!$output->data) return $output; |
|
947 | + if(!$output->toBool()||!$output->data) { |
|
948 | + return $output; |
|
949 | + } |
|
891 | 950 | |
892 | 951 | foreach($output->data as $key => $val) |
893 | 952 | { |
@@ -896,7 +955,9 @@ discard block |
||
896 | 955 | $args->site_srl = $site_srl; |
897 | 956 | $args->member_srl = $val->member_srl; |
898 | 957 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
899 | - if(!$output->toBool()) return $output; |
|
958 | + if(!$output->toBool()) { |
|
959 | + return $output; |
|
960 | + } |
|
900 | 961 | } |
901 | 962 | return new BaseObject(); |
902 | 963 | } |
@@ -909,12 +970,15 @@ discard block |
||
909 | 970 | $oMemberModel = getModel('member'); |
910 | 971 | $member_config = $oMemberModel->getMemberConfig(); |
911 | 972 | |
912 | - if($member_config->identifier == 'email_address') |
|
913 | - $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
914 | - else |
|
915 | - $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
973 | + if($member_config->identifier == 'email_address') { |
|
974 | + $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
975 | + } else { |
|
976 | + $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
977 | + } |
|
916 | 978 | |
917 | - if(!$member_info->member_srl) return; |
|
979 | + if(!$member_info->member_srl) { |
|
980 | + return; |
|
981 | + } |
|
918 | 982 | $args = new stdClass(); |
919 | 983 | $args->module_srl = $module_srl; |
920 | 984 | $args->member_srl = $member_info->member_srl; |
@@ -933,7 +997,9 @@ discard block |
||
933 | 997 | { |
934 | 998 | $oMemberModel = getModel('member'); |
935 | 999 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
1000 | + if($member_info->member_srl) { |
|
1001 | + $args->member_srl = $member_info->member_srl; |
|
1002 | + } |
|
937 | 1003 | } |
938 | 1004 | return executeQuery('module.deleteAdminId', $args); |
939 | 1005 | } |
@@ -977,7 +1043,9 @@ discard block |
||
977 | 1043 | } |
978 | 1044 | |
979 | 1045 | getDestroyXeVars($obj); |
980 | - if(!$obj || !count($obj)) return new BaseObject(); |
|
1046 | + if(!$obj || !count($obj)) { |
|
1047 | + return new BaseObject(); |
|
1048 | + } |
|
981 | 1049 | |
982 | 1050 | $args = new stdClass; |
983 | 1051 | $args->module_srl = $module_srl; |
@@ -987,18 +1055,23 @@ discard block |
||
987 | 1055 | // it often saved menu item(stdClass) on the skin info column |
988 | 1056 | // When updating the module on XE core 1.2.0 later versions, it occurs an error |
989 | 1057 | // fixed the error |
990 | - if (is_object($val)) continue; |
|
991 | - if (is_array($val)) $val = serialize($val); |
|
1058 | + if (is_object($val)) { |
|
1059 | + continue; |
|
1060 | + } |
|
1061 | + if (is_array($val)) { |
|
1062 | + $val = serialize($val); |
|
1063 | + } |
|
992 | 1064 | |
993 | 1065 | $args->name = trim($key); |
994 | 1066 | $args->value = trim($val); |
995 | - if(!$args->name || !$args->value) continue; |
|
1067 | + if(!$args->name || !$args->value) { |
|
1068 | + continue; |
|
1069 | + } |
|
996 | 1070 | |
997 | 1071 | if($mode === 'P') |
998 | 1072 | { |
999 | 1073 | $output = executeQuery('module.insertModuleSkinVars', $args); |
1000 | - } |
|
1001 | - else |
|
1074 | + } else |
|
1002 | 1075 | { |
1003 | 1076 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
1004 | 1077 | } |
@@ -1045,8 +1118,7 @@ discard block |
||
1045 | 1118 | { |
1046 | 1119 | $object_key = 'module_skin_vars:'.$module_srl; |
1047 | 1120 | $query = 'module.deleteModuleSkinVars'; |
1048 | - } |
|
1049 | - else |
|
1121 | + } else |
|
1050 | 1122 | { |
1051 | 1123 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
1052 | 1124 | $query = 'module.deleteModuleMobileSkinVars'; |
@@ -1070,17 +1142,23 @@ discard block |
||
1070 | 1142 | { |
1071 | 1143 | $this->deleteModuleExtraVars($module_srl); |
1072 | 1144 | getDestroyXeVars($obj); |
1073 | - if(!$obj || !count($obj)) return; |
|
1145 | + if(!$obj || !count($obj)) { |
|
1146 | + return; |
|
1147 | + } |
|
1074 | 1148 | |
1075 | 1149 | foreach($obj as $key => $val) |
1076 | 1150 | { |
1077 | - if(is_object($val) || is_array($val)) continue; |
|
1151 | + if(is_object($val) || is_array($val)) { |
|
1152 | + continue; |
|
1153 | + } |
|
1078 | 1154 | |
1079 | 1155 | $args = new stdClass(); |
1080 | 1156 | $args->module_srl = $module_srl; |
1081 | 1157 | $args->name = trim($key); |
1082 | 1158 | $args->value = trim($val); |
1083 | - if(!$args->name || !$args->value) continue; |
|
1159 | + if(!$args->name || !$args->value) { |
|
1160 | + continue; |
|
1161 | + } |
|
1084 | 1162 | $output = executeQuery('module.insertModuleExtraVars', $args); |
1085 | 1163 | } |
1086 | 1164 | |
@@ -1120,11 +1198,15 @@ discard block |
||
1120 | 1198 | function insertModuleGrants($module_srl, $obj) |
1121 | 1199 | { |
1122 | 1200 | $this->deleteModuleGrants($module_srl); |
1123 | - if(!$obj || !count($obj)) return; |
|
1201 | + if(!$obj || !count($obj)) { |
|
1202 | + return; |
|
1203 | + } |
|
1124 | 1204 | |
1125 | 1205 | foreach($obj as $name => $val) |
1126 | 1206 | { |
1127 | - if(!$val || !count($val)) continue; |
|
1207 | + if(!$val || !count($val)) { |
|
1208 | + continue; |
|
1209 | + } |
|
1128 | 1210 | |
1129 | 1211 | foreach($val as $group_srl) |
1130 | 1212 | { |
@@ -1132,7 +1214,9 @@ discard block |
||
1132 | 1214 | $args->module_srl = $module_srl; |
1133 | 1215 | $args->name = $name; |
1134 | 1216 | $args->group_srl = trim($group_srl); |
1135 | - if(!$args->name || !$args->group_srl) continue; |
|
1217 | + if(!$args->name || !$args->group_srl) { |
|
1218 | + continue; |
|
1219 | + } |
|
1136 | 1220 | executeQuery('module.insertModuleGrant', $args); |
1137 | 1221 | } |
1138 | 1222 | } |
@@ -1184,7 +1268,9 @@ discard block |
||
1184 | 1268 | } |
1185 | 1269 | } |
1186 | 1270 | |
1187 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1271 | + if(!Context::get($matches[1]) && $lang[$matches[1]]) { |
|
1272 | + return $lang[$matches[1]]; |
|
1273 | + } |
|
1188 | 1274 | |
1189 | 1275 | return str_replace('$user_lang->','',$matches[0]); |
1190 | 1276 | } |
@@ -1196,10 +1282,14 @@ discard block |
||
1196 | 1282 | function procModuleFileBoxAdd() |
1197 | 1283 | { |
1198 | 1284 | $ajax = Context::get('ajax'); |
1199 | - if ($ajax) Context::setRequestMethod('JSON'); |
|
1285 | + if ($ajax) { |
|
1286 | + Context::setRequestMethod('JSON'); |
|
1287 | + } |
|
1200 | 1288 | |
1201 | 1289 | $logged_info = Context::get('logged_info'); |
1202 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1290 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
1291 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
1292 | + } |
|
1203 | 1293 | |
1204 | 1294 | $vars = Context::gets('addfile','filter'); |
1205 | 1295 | $attributeNames = Context::get('attribute_name'); |
@@ -1223,9 +1313,14 @@ discard block |
||
1223 | 1313 | |
1224 | 1314 | $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
1225 | 1315 | $vars->ext = $ext; |
1226 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
1227 | - else $filter = array('jpg','jpeg','gif','png'); |
|
1228 | - if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
1316 | + if($vars->filter) { |
|
1317 | + $filter = explode(',',$vars->filter); |
|
1318 | + } else { |
|
1319 | + $filter = array('jpg','jpeg','gif','png'); |
|
1320 | + } |
|
1321 | + if(!in_array($ext,$filter)) { |
|
1322 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1323 | + } |
|
1229 | 1324 | |
1230 | 1325 | $vars->member_srl = $logged_info->member_srl; |
1231 | 1326 | |
@@ -1238,10 +1333,16 @@ discard block |
||
1238 | 1333 | // insert |
1239 | 1334 | else |
1240 | 1335 | { |
1241 | - if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
1336 | + if(!Context::isUploaded()) { |
|
1337 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1338 | + } |
|
1242 | 1339 | $addfile = Context::get('addfile'); |
1243 | - if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
1244 | - if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
1340 | + if(!is_uploaded_file($addfile['tmp_name'])) { |
|
1341 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1342 | + } |
|
1343 | + if($vars->addfile['error'] != 0) { |
|
1344 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1345 | + } |
|
1245 | 1346 | $output = $this->insertModuleFileBox($vars); |
1246 | 1347 | } |
1247 | 1348 | |
@@ -1252,11 +1353,13 @@ discard block |
||
1252 | 1353 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox'); |
1253 | 1354 | $this->setRedirectUrl($returnUrl); |
1254 | 1355 | return; |
1255 | - } |
|
1256 | - else |
|
1356 | + } else |
|
1257 | 1357 | { |
1258 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
1259 | - else $this->add('save_filename', ''); |
|
1358 | + if($output) { |
|
1359 | + $this->add('save_filename', $output->get('save_filename')); |
|
1360 | + } else { |
|
1361 | + $this->add('save_filename', ''); |
|
1362 | + } |
|
1260 | 1363 | } |
1261 | 1364 | } |
1262 | 1365 | |
@@ -1280,7 +1383,9 @@ discard block |
||
1280 | 1383 | $tmp = $vars->addfile['tmp_name']; |
1281 | 1384 | |
1282 | 1385 | // Check uploaded file |
1283 | - if(!checkUploadedFile($tmp)) return false; |
|
1386 | + if(!checkUploadedFile($tmp)) { |
|
1387 | + return false; |
|
1388 | + } |
|
1284 | 1389 | |
1285 | 1390 | if(!@move_uploaded_file($tmp, $save_filename)) |
1286 | 1391 | { |
@@ -1317,7 +1422,9 @@ discard block |
||
1317 | 1422 | $tmp = $vars->addfile['tmp_name']; |
1318 | 1423 | |
1319 | 1424 | // Check uploaded file |
1320 | - if(!checkUploadedFile($tmp)) return false; |
|
1425 | + if(!checkUploadedFile($tmp)) { |
|
1426 | + return false; |
|
1427 | + } |
|
1321 | 1428 | |
1322 | 1429 | // upload |
1323 | 1430 | if(!@move_uploaded_file($tmp, $save_filename)) |
@@ -1346,14 +1453,20 @@ discard block |
||
1346 | 1453 | function procModuleFileBoxDelete() |
1347 | 1454 | { |
1348 | 1455 | $logged_info = Context::get('logged_info'); |
1349 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1456 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
1457 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
1458 | + } |
|
1350 | 1459 | |
1351 | 1460 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1352 | - if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1461 | + if(!$module_filebox_srl) { |
|
1462 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1463 | + } |
|
1353 | 1464 | $vars = new stdClass(); |
1354 | 1465 | $vars->module_filebox_srl = $module_filebox_srl; |
1355 | 1466 | $output = $this->deleteModuleFileBox($vars); |
1356 | - if(!$output->toBool()) return $output; |
|
1467 | + if(!$output->toBool()) { |
|
1468 | + return $output; |
|
1469 | + } |
|
1357 | 1470 | } |
1358 | 1471 | |
1359 | 1472 | function deleteModuleFileBox($vars) |
@@ -1376,9 +1489,13 @@ discard block |
||
1376 | 1489 | $this->unlockTimeoutPassed(); |
1377 | 1490 | $args = new stdClass; |
1378 | 1491 | $args->lock_name = $lock_name; |
1379 | - if(!$timeout) $timeout = 60; |
|
1492 | + if(!$timeout) { |
|
1493 | + $timeout = 60; |
|
1494 | + } |
|
1380 | 1495 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
1381 | - if($member_srl) $args->member_srl = $member_srl; |
|
1496 | + if($member_srl) { |
|
1497 | + $args->member_srl = $member_srl; |
|
1498 | + } |
|
1382 | 1499 | $output = executeQuery('module.insertLock', $args); |
1383 | 1500 | if($output->toBool()) |
1384 | 1501 | { |
@@ -129,6 +129,8 @@ discard block |
||
129 | 129 | |
130 | 130 | /** |
131 | 131 | * @brief Save the file and return if a file is requested by http |
132 | + * @param integer $caching_interval |
|
133 | + * @param string $cache_file |
|
132 | 134 | */ |
133 | 135 | function getHtmlPage($path, $caching_interval, $cache_file) |
134 | 136 | { |
@@ -167,6 +169,8 @@ discard block |
||
167 | 169 | |
168 | 170 | /** |
169 | 171 | * @brief Create a cache file in order to include if it is an internal file |
172 | + * @param integer $caching_interval |
|
173 | + * @param string $cache_file |
|
170 | 174 | */ |
171 | 175 | function executeFile($target_file, $caching_interval, $cache_file) |
172 | 176 | { |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | // Get a template path (page in the administrative template tpl putting together) |
23 | 23 | $this->setTemplatePath($this->module_path.'tpl'); |
24 | 24 | |
25 | - switch($this->module_info->page_type) |
|
25 | + switch ($this->module_info->page_type) |
|
26 | 26 | { |
27 | 27 | case 'WIDGET' : |
28 | 28 | { |
29 | 29 | $this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus()); |
30 | - $this->interval = (int)($this->module_info->page_caching_interval); |
|
30 | + $this->interval = (int) ($this->module_info->page_caching_interval); |
|
31 | 31 | break; |
32 | 32 | } |
33 | 33 | case 'OUTSIDE' : |
34 | 34 | { |
35 | 35 | $this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getSslStatus()); |
36 | - $this->interval = (int)($this->module_info->page_caching_interval); |
|
36 | + $this->interval = (int) ($this->module_info->page_caching_interval); |
|
37 | 37 | $this->path = $this->module_info->path; |
38 | 38 | break; |
39 | 39 | } |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | function dispPageIndex() |
47 | 47 | { |
48 | 48 | // Variables used in the template Context:: set() |
49 | - if($this->module_srl) Context::set('module_srl',$this->module_srl); |
|
49 | + if ($this->module_srl) Context::set('module_srl', $this->module_srl); |
|
50 | 50 | |
51 | 51 | $page_type_name = strtolower($this->module_info->page_type); |
52 | - $method = '_get' . ucfirst($page_type_name) . 'Content'; |
|
53 | - if(method_exists($this, $method)) $page_content = $this->{$method}(); |
|
52 | + $method = '_get'.ucfirst($page_type_name).'Content'; |
|
53 | + if (method_exists($this, $method)) $page_content = $this->{$method}(); |
|
54 | 54 | else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
55 | 55 | |
56 | 56 | Context::set('module_info', $this->module_info); |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | |
62 | 62 | function _getWidgetContent() |
63 | 63 | { |
64 | - if($this->interval>0) |
|
64 | + if ($this->interval > 0) |
|
65 | 65 | { |
66 | - if(!file_exists($this->cache_file)) $mtime = 0; |
|
66 | + if (!file_exists($this->cache_file)) $mtime = 0; |
|
67 | 67 | else $mtime = filemtime($this->cache_file); |
68 | 68 | |
69 | - if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME']) |
|
69 | + if ($mtime + $this->interval * 60 > $_SERVER['REQUEST_TIME']) |
|
70 | 70 | { |
71 | 71 | $page_content = FileHandler::readFile($this->cache_file); |
72 | 72 | $page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | else |
82 | 82 | { |
83 | - if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
83 | + if (file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
84 | 84 | $page_content = $this->module_info->content; |
85 | 85 | } |
86 | 86 | return $page_content; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $oDocumentModel = getModel('document'); |
94 | 94 | $oDocument = $oDocumentModel->getDocument(0, true); |
95 | 95 | |
96 | - if($this->module_info->document_srl) |
|
96 | + if ($this->module_info->document_srl) |
|
97 | 97 | { |
98 | 98 | $document_srl = $this->module_info->document_srl; |
99 | 99 | $oDocument->setDocument($document_srl); |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | function _getOutsideContent() |
119 | 119 | { |
120 | 120 | // check if it is http or internal file |
121 | - if($this->path) |
|
121 | + if ($this->path) |
|
122 | 122 | { |
123 | - if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
123 | + if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
124 | 124 | else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
125 | 125 | } |
126 | 126 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | function getHtmlPage($path, $caching_interval, $cache_file) |
134 | 134 | { |
135 | 135 | // Verify cache |
136 | - if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME']) |
|
136 | + if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME']) |
|
137 | 137 | { |
138 | 138 | $content = FileHandler::readFile($cache_file); |
139 | 139 | } |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | $content = $buff->content; |
155 | 155 | // Extract a title |
156 | 156 | $title = $oPageController->getTitle($content); |
157 | - if($title) Context::setBrowserTitle($title); |
|
157 | + if ($title) Context::setBrowserTitle($title); |
|
158 | 158 | // Extract header script |
159 | 159 | $head_script = $oPageController->getHeadScript($content); |
160 | - if($head_script) Context::addHtmlHeader($head_script); |
|
160 | + if ($head_script) Context::addHtmlHeader($head_script); |
|
161 | 161 | // Extract content from the body |
162 | 162 | $body_script = $oPageController->getBodyScript($content); |
163 | - if(!$body_script) $body_script = $content; |
|
163 | + if (!$body_script) $body_script = $content; |
|
164 | 164 | |
165 | 165 | return $content; |
166 | 166 | } |
@@ -171,32 +171,32 @@ discard block |
||
171 | 171 | function executeFile($target_file, $caching_interval, $cache_file) |
172 | 172 | { |
173 | 173 | // Cancel if the file doesn't exist |
174 | - if(!file_exists(FileHandler::getRealPath($target_file))) return; |
|
174 | + if (!file_exists(FileHandler::getRealPath($target_file))) return; |
|
175 | 175 | |
176 | 176 | // Get a path and filename |
177 | - $tmp_path = explode('/',$cache_file); |
|
178 | - $filename = $tmp_path[count($tmp_path)-1]; |
|
179 | - $filepath = preg_replace('/'.$filename."$/i","",$cache_file); |
|
177 | + $tmp_path = explode('/', $cache_file); |
|
178 | + $filename = $tmp_path[count($tmp_path) - 1]; |
|
179 | + $filepath = preg_replace('/'.$filename."$/i", "", $cache_file); |
|
180 | 180 | $cache_file = FileHandler::getRealPath($cache_file); |
181 | 181 | |
182 | 182 | $level = ob_get_level(); |
183 | 183 | // Verify cache |
184 | - if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file)) |
|
184 | + if ($caching_interval < 1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval * 60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file) < filemtime($target_file)) |
|
185 | 185 | { |
186 | - if(file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
186 | + if (file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
187 | 187 | |
188 | 188 | // Read a target file and get content |
189 | 189 | ob_start(); |
190 | 190 | include(FileHandler::getRealPath($target_file)); |
191 | 191 | $content = ob_get_clean(); |
192 | 192 | // Replace relative path to the absolute path |
193 | - $this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/'; |
|
194 | - $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content); |
|
195 | - $content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content); |
|
193 | + $this->path = str_replace('\\', '/', realpath(dirname($target_file))).'/'; |
|
194 | + $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is', array($this, '_replacePath'), $content); |
|
195 | + $content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is', array($this, '_replacePath'), $content); |
|
196 | 196 | |
197 | 197 | FileHandler::writeFile($cache_file, $content); |
198 | 198 | // Include and then Return the result |
199 | - if(!file_exists($cache_file)) return; |
|
199 | + if (!file_exists($cache_file)) return; |
|
200 | 200 | // Attempt to compile |
201 | 201 | $oTemplate = &TemplateHandler::getInstance(); |
202 | 202 | $script = $oTemplate->compileDirect($filepath, $filename); |
@@ -223,20 +223,20 @@ discard block |
||
223 | 223 | $val = trim($matches[3]); |
224 | 224 | // Pass if the path is external or starts with /, #, { characters |
225 | 225 | // /=absolute path, #=hash in a page, {=Template syntax |
226 | - if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val)) |
|
226 | + if (strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i', $val)) |
|
227 | 227 | { |
228 | 228 | return $matches[0]; |
229 | 229 | // In case of .. , get a path |
230 | 230 | } |
231 | - else if(strncasecmp('..', $val, 2) === 0) |
|
231 | + else if (strncasecmp('..', $val, 2) === 0) |
|
232 | 232 | { |
233 | 233 | $p = Context::pathToUrl($this->path); |
234 | - return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
|
234 | + return sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]); |
|
235 | 235 | } |
236 | 236 | |
237 | - if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2); |
|
237 | + if (strncasecmp('..', $val, 2) === 0) $val = substr($val, 2); |
|
238 | 238 | $p = Context::pathToUrl($this->path); |
239 | - $path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
|
239 | + $path = sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]); |
|
240 | 240 | |
241 | 241 | return $path; |
242 | 242 | } |
@@ -46,12 +46,17 @@ discard block |
||
46 | 46 | function dispPageIndex() |
47 | 47 | { |
48 | 48 | // Variables used in the template Context:: set() |
49 | - if($this->module_srl) Context::set('module_srl',$this->module_srl); |
|
49 | + if($this->module_srl) { |
|
50 | + Context::set('module_srl',$this->module_srl); |
|
51 | + } |
|
50 | 52 | |
51 | 53 | $page_type_name = strtolower($this->module_info->page_type); |
52 | 54 | $method = '_get' . ucfirst($page_type_name) . 'Content'; |
53 | - if(method_exists($this, $method)) $page_content = $this->{$method}(); |
|
54 | - else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
55 | + if(method_exists($this, $method)) { |
|
56 | + $page_content = $this->{$method}(); |
|
57 | + } else { |
|
58 | + return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
59 | + } |
|
55 | 60 | |
56 | 61 | Context::set('module_info', $this->module_info); |
57 | 62 | Context::set('page_content', $page_content); |
@@ -63,24 +68,27 @@ discard block |
||
63 | 68 | { |
64 | 69 | if($this->interval>0) |
65 | 70 | { |
66 | - if(!file_exists($this->cache_file)) $mtime = 0; |
|
67 | - else $mtime = filemtime($this->cache_file); |
|
71 | + if(!file_exists($this->cache_file)) { |
|
72 | + $mtime = 0; |
|
73 | + } else { |
|
74 | + $mtime = filemtime($this->cache_file); |
|
75 | + } |
|
68 | 76 | |
69 | 77 | if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME']) |
70 | 78 | { |
71 | 79 | $page_content = FileHandler::readFile($this->cache_file); |
72 | 80 | $page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content); |
73 | - } |
|
74 | - else |
|
81 | + } else |
|
75 | 82 | { |
76 | 83 | $oWidgetController = getController('widget'); |
77 | 84 | $page_content = $oWidgetController->transWidgetCode($this->module_info->content); |
78 | 85 | FileHandler::writeFile($this->cache_file, $page_content); |
79 | 86 | } |
80 | - } |
|
81 | - else |
|
87 | + } else |
|
82 | 88 | { |
83 | - if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
89 | + if(file_exists($this->cache_file)) { |
|
90 | + FileHandler::removeFile($this->cache_file); |
|
91 | + } |
|
84 | 92 | $page_content = $this->module_info->content; |
85 | 93 | } |
86 | 94 | return $page_content; |
@@ -104,8 +112,7 @@ discard block |
||
104 | 112 | if ($this->module_info->skin) |
105 | 113 | { |
106 | 114 | $templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin)); |
107 | - } |
|
108 | - else |
|
115 | + } else |
|
109 | 116 | { |
110 | 117 | $templatePath = ($this->module_path.'skins/default'); |
111 | 118 | } |
@@ -120,8 +127,11 @@ discard block |
||
120 | 127 | // check if it is http or internal file |
121 | 128 | if($this->path) |
122 | 129 | { |
123 | - if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
124 | - else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
|
130 | + if(preg_match("/^([a-z]+):\/\//i",$this->path)) { |
|
131 | + $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
132 | + } else { |
|
133 | + $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
|
134 | + } |
|
125 | 135 | } |
126 | 136 | |
127 | 137 | return $content; |
@@ -136,8 +146,7 @@ discard block |
||
136 | 146 | if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME']) |
137 | 147 | { |
138 | 148 | $content = FileHandler::readFile($cache_file); |
139 | - } |
|
140 | - else |
|
149 | + } else |
|
141 | 150 | { |
142 | 151 | FileHandler::getRemoteFile($path, $cache_file); |
143 | 152 | $content = FileHandler::readFile($cache_file); |
@@ -154,13 +163,19 @@ discard block |
||
154 | 163 | $content = $buff->content; |
155 | 164 | // Extract a title |
156 | 165 | $title = $oPageController->getTitle($content); |
157 | - if($title) Context::setBrowserTitle($title); |
|
166 | + if($title) { |
|
167 | + Context::setBrowserTitle($title); |
|
168 | + } |
|
158 | 169 | // Extract header script |
159 | 170 | $head_script = $oPageController->getHeadScript($content); |
160 | - if($head_script) Context::addHtmlHeader($head_script); |
|
171 | + if($head_script) { |
|
172 | + Context::addHtmlHeader($head_script); |
|
173 | + } |
|
161 | 174 | // Extract content from the body |
162 | 175 | $body_script = $oPageController->getBodyScript($content); |
163 | - if(!$body_script) $body_script = $content; |
|
176 | + if(!$body_script) { |
|
177 | + $body_script = $content; |
|
178 | + } |
|
164 | 179 | |
165 | 180 | return $content; |
166 | 181 | } |
@@ -171,7 +186,9 @@ discard block |
||
171 | 186 | function executeFile($target_file, $caching_interval, $cache_file) |
172 | 187 | { |
173 | 188 | // Cancel if the file doesn't exist |
174 | - if(!file_exists(FileHandler::getRealPath($target_file))) return; |
|
189 | + if(!file_exists(FileHandler::getRealPath($target_file))) { |
|
190 | + return; |
|
191 | + } |
|
175 | 192 | |
176 | 193 | // Get a path and filename |
177 | 194 | $tmp_path = explode('/',$cache_file); |
@@ -183,7 +200,9 @@ discard block |
||
183 | 200 | // Verify cache |
184 | 201 | if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file)) |
185 | 202 | { |
186 | - if(file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
203 | + if(file_exists($cache_file)) { |
|
204 | + FileHandler::removeFile($cache_file); |
|
205 | + } |
|
187 | 206 | |
188 | 207 | // Read a target file and get content |
189 | 208 | ob_start(); |
@@ -196,7 +215,9 @@ discard block |
||
196 | 215 | |
197 | 216 | FileHandler::writeFile($cache_file, $content); |
198 | 217 | // Include and then Return the result |
199 | - if(!file_exists($cache_file)) return; |
|
218 | + if(!file_exists($cache_file)) { |
|
219 | + return; |
|
220 | + } |
|
200 | 221 | // Attempt to compile |
201 | 222 | $oTemplate = &TemplateHandler::getInstance(); |
202 | 223 | $script = $oTemplate->compileDirect($filepath, $filename); |
@@ -227,14 +248,15 @@ discard block |
||
227 | 248 | { |
228 | 249 | return $matches[0]; |
229 | 250 | // In case of .. , get a path |
230 | - } |
|
231 | - else if(strncasecmp('..', $val, 2) === 0) |
|
251 | + } else if(strncasecmp('..', $val, 2) === 0) |
|
232 | 252 | { |
233 | 253 | $p = Context::pathToUrl($this->path); |
234 | 254 | return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
235 | 255 | } |
236 | 256 | |
237 | - if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2); |
|
257 | + if(strncasecmp('..', $val, 2) === 0) { |
|
258 | + $val = substr($val,2); |
|
259 | + } |
|
238 | 260 | $p = Context::pathToUrl($this->path); |
239 | 261 | $path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
240 | 262 |
@@ -478,6 +478,7 @@ |
||
478 | 478 | |
479 | 479 | /** |
480 | 480 | * @brief Set points |
481 | + * @param string $mode |
|
481 | 482 | */ |
482 | 483 | function setPoint($member_srl, $point, $mode = null) |
483 | 484 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $point = $config->signup_point; |
32 | 32 | // Increase the point |
33 | 33 | $cur_point += $point; |
34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
35 | 35 | |
36 | 36 | return new BaseObject(); |
37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new BaseObject(); |
|
45 | + if (!$member_srl) return new BaseObject(); |
|
46 | 46 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new BaseObject(); |
|
48 | 48 | // Get the point module information |
49 | 49 | $oModuleModel = getModel('module'); |
50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $point = $config->login_point; |
56 | 56 | // Increase the point |
57 | 57 | $cur_point += $point; |
58 | - $this->setPoint($member_srl,$cur_point); |
|
58 | + $this->setPoint($member_srl, $cur_point); |
|
59 | 59 | |
60 | 60 | return new BaseObject(); |
61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | function triggerInsertDocument(&$obj) |
67 | 67 | { |
68 | 68 | $oDocumentModel = getModel('document'); |
69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
70 | 70 | { |
71 | 71 | $module_srl = $obj->module_srl; |
72 | 72 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
73 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
74 | 74 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
75 | + if ($module_srl == $member_srl) return new BaseObject(); |
|
76 | 76 | // Get the point module information |
77 | 77 | $oModuleModel = getModel('module'); |
78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
80 | 80 | // Get the points of the member |
81 | 81 | $oPointModel = getModel('point'); |
82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 83 | |
84 | 84 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
86 | 86 | $cur_point += $point; |
87 | 87 | // Add points for attaching a file |
88 | 88 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
91 | 91 | // Increase the point |
92 | - $this->setPoint($member_srl,$cur_point); |
|
92 | + $this->setPoint($member_srl, $cur_point); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return new BaseObject(); |
@@ -106,24 +106,24 @@ discard block |
||
106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
107 | 107 | |
108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
110 | 110 | { |
111 | 111 | $oModuleModel = getModel('module'); |
112 | 112 | |
113 | 113 | // Get the point module information |
114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
116 | 116 | // Get the points of the member |
117 | 117 | $oPointModel = getModel('point'); |
118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 119 | |
120 | 120 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
122 | 122 | $cur_point += $point; |
123 | 123 | // Add points for attaching a file |
124 | 124 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
127 | 127 | // Increase the point |
128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
141 | 141 | |
142 | 142 | $oDocumentModel = getModel('document'); |
143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
144 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
145 | 145 | // Get the point module information |
146 | 146 | $oModuleModel = getModel('module'); |
147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
149 | 149 | // The process related to clearing the post comments |
150 | 150 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
152 | 152 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new BaseObject(); |
|
153 | + if ($comment_point > 0) return new BaseObject(); |
|
154 | 154 | // Get all the comments related to this post |
155 | 155 | $cp_args = new stdClass(); |
156 | 156 | $cp_args->document_srl = $document_srl; |
157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 158 | // Return if there is no object |
159 | - if(!$output->data) return new BaseObject(); |
|
159 | + if (!$output->data) return new BaseObject(); |
|
160 | 160 | // Organize the member number |
161 | 161 | $member_srls = array(); |
162 | 162 | $cnt = count($output->data); |
163 | - for($i=0;$i<$cnt;$i++) |
|
163 | + for ($i = 0; $i < $cnt; $i++) |
|
164 | 164 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 167 | } |
168 | 168 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new BaseObject(); |
|
169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | + if (!count($member_srls)) return new BaseObject(); |
|
171 | 171 | // Remove all the points for each member |
172 | 172 | $oPointModel = getModel('point'); |
173 | 173 | // Get the points |
174 | 174 | $point = $module_config['download_file']; |
175 | - foreach($member_srls as $member_srl => $cnt) |
|
175 | + foreach ($member_srls as $member_srl => $cnt) |
|
176 | 176 | { |
177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
178 | 178 | $cur_point -= $cnt * $comment_point; |
179 | - $this->setPoint($member_srl,$cur_point); |
|
179 | + $this->setPoint($member_srl, $cur_point); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return new BaseObject(); |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | { |
190 | 190 | $oDocumentModel = getModel('document'); |
191 | 191 | |
192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
193 | 193 | { |
194 | 194 | $module_srl = $obj->module_srl; |
195 | 195 | $member_srl = $obj->member_srl; |
196 | 196 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
197 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
198 | 198 | // Run only when logged in |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
200 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
201 | 201 | // Get the points of the member |
202 | 202 | $oPointModel = getModel('point'); |
203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 208 | |
209 | 209 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new BaseObject(); |
|
212 | + if ($point < 0) return new BaseObject(); |
|
213 | 213 | $cur_point -= $point; |
214 | 214 | // Add points related to deleting an attachment |
215 | 215 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
216 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | + if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
218 | 218 | // Increase the point |
219 | - $this->setPoint($member_srl,$cur_point); |
|
219 | + $this->setPoint($member_srl, $cur_point); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return new BaseObject(); |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | { |
230 | 230 | $module_srl = $obj->module_srl; |
231 | 231 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
232 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
233 | 233 | // Do not increase the points if the member is the author of the post |
234 | 234 | $document_srl = $obj->document_srl; |
235 | 235 | $oDocumentModel = getModel('document'); |
236 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new BaseObject(); |
|
238 | 238 | // Get the point module information |
239 | 239 | $oModuleModel = getModel('module'); |
240 | 240 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 245 | |
246 | 246 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
247 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
248 | 248 | // Increase the point |
249 | 249 | $cur_point += $point; |
250 | - $this->setPoint($member_srl,$cur_point); |
|
250 | + $this->setPoint($member_srl, $cur_point); |
|
251 | 251 | |
252 | 252 | return new BaseObject(); |
253 | 253 | } |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $module_srl = $obj->module_srl; |
265 | 265 | $member_srl = abs($obj->member_srl); |
266 | 266 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
267 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
268 | 268 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
270 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
271 | + if ($oDocument->get('member_srl') == $member_srl) return new BaseObject(); |
|
272 | 272 | // Get the point module information |
273 | 273 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 274 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 277 | |
278 | 278 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
279 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
280 | 280 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new BaseObject(); |
|
281 | + if ($point < 0) return new BaseObject(); |
|
282 | 282 | // Increase the point |
283 | 283 | $cur_point -= $point; |
284 | - $this->setPoint($member_srl,$cur_point); |
|
284 | + $this->setPoint($member_srl, $cur_point); |
|
285 | 285 | |
286 | 286 | return new BaseObject(); |
287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function triggerDeleteFile(&$obj) |
303 | 303 | { |
304 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
304 | + if ($obj->isvalid != 'Y') return new BaseObject(); |
|
305 | 305 | |
306 | 306 | $module_srl = $obj->module_srl; |
307 | 307 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
308 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
309 | 309 | // Get the point module information |
310 | 310 | $oModuleModel = getModel('module'); |
311 | 311 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 316 | |
317 | 317 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
318 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
319 | 319 | // Increase the point |
320 | 320 | $cur_point -= $point; |
321 | - $this->setPoint($member_srl,$cur_point); |
|
321 | + $this->setPoint($member_srl, $cur_point); |
|
322 | 322 | |
323 | 323 | return new BaseObject(); |
324 | 324 | } |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | $logged_info = Context::get('logged_info'); |
332 | 332 | $member_srl = $logged_info->member_srl; |
333 | 333 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new BaseObject(); |
|
334 | + if (!$module_srl) return new BaseObject(); |
|
335 | 335 | |
336 | 336 | // Pass if it is your file |
337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
337 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
338 | 338 | $oModuleModel = getModel('module'); |
339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | // If the user is not logged in and download requires points, deny access. |
351 | - if(!Context::get('is_logged')) |
|
351 | + if (!Context::get('is_logged')) |
|
352 | 352 | { |
353 | - if($config->disable_download == 'Y' && $point) |
|
353 | + if ($config->disable_download == 'Y' && $point) |
|
354 | 354 | { |
355 | - return new BaseObject(-1,'msg_not_permitted_download'); |
|
355 | + return new BaseObject(-1, 'msg_not_permitted_download'); |
|
356 | 356 | } |
357 | 357 | else |
358 | 358 | { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // If the member does not have enough points, deny access. |
368 | 368 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
369 | 369 | { |
370 | - return new BaseObject(-1,'msg_cannot_download'); |
|
370 | + return new BaseObject(-1, 'msg_cannot_download'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -381,13 +381,13 @@ discard block |
||
381 | 381 | { |
382 | 382 | // Run only when logged in |
383 | 383 | $logged_info = Context::get('logged_info'); |
384 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
384 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
385 | 385 | $module_srl = $obj->module_srl; |
386 | 386 | $member_srl = $logged_info->member_srl; |
387 | - if(!$module_srl) return new BaseObject(); |
|
387 | + if (!$module_srl) return new BaseObject(); |
|
388 | 388 | |
389 | 389 | // Pass if it is your file |
390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
390 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
391 | 391 | |
392 | 392 | // Get the point module information |
393 | 393 | $oModuleModel = getModel('module'); |
@@ -428,22 +428,22 @@ discard block |
||
428 | 428 | // Get the original author number |
429 | 429 | $target_member_srl = abs($obj->get('member_srl')); |
430 | 430 | // Pass without increasing the hits if the viewer is the same as the author |
431 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
431 | + if ($target_member_srl == $member_srl) return new BaseObject(); |
|
432 | 432 | // Get the point information for each module |
433 | 433 | $config = $oModuleModel->getModuleConfig('point'); |
434 | 434 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
435 | 435 | // Get hits points |
436 | 436 | $point = $module_config['read_document']; |
437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
437 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
438 | 438 | // Pass if there are no requested points |
439 | - if(!$point) return new BaseObject(); |
|
439 | + if (!$point) return new BaseObject(); |
|
440 | 440 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
441 | - if($member_srl) |
|
441 | + if ($member_srl) |
|
442 | 442 | { |
443 | 443 | $args->member_srl = $member_srl; |
444 | 444 | $args->document_srl = $obj->document_srl; |
445 | 445 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
446 | - if($output->data->count) return new BaseObject(); |
|
446 | + if ($output->data->count) return new BaseObject(); |
|
447 | 447 | $cur_point = $oPointModel->getPoint($member_srl, true); |
448 | 448 | } |
449 | 449 | else |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $config = $oModuleModel->getModuleConfig('point'); |
455 | 455 | // When the requested points are negative, compared it with the current point |
456 | 456 | $_SESSION['banned_document'][$obj->document_srl] = false; |
457 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
457 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
458 | 458 | { |
459 | 459 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
460 | 460 | $obj->add('content', $message); |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | return new BaseObject(-1, $message); |
463 | 463 | } |
464 | 464 | // If not logged in, pass |
465 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
465 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
466 | 466 | // Pass, if there are no requested points |
467 | - if(!$point) return new BaseObject(); |
|
467 | + if (!$point) return new BaseObject(); |
|
468 | 468 | // If the read record is missing, leave it |
469 | 469 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
470 | 470 | // Increase the point |
471 | 471 | $cur_point += $point; |
472 | - $this->setPoint($member_srl,$cur_point); |
|
472 | + $this->setPoint($member_srl, $cur_point); |
|
473 | 473 | |
474 | 474 | return new BaseObject(); |
475 | 475 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | { |
482 | 482 | $module_srl = $obj->module_srl; |
483 | 483 | $member_srl = $obj->member_srl; |
484 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
484 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
485 | 485 | |
486 | 486 | $oModuleModel = getModel('module'); |
487 | 487 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | $oPointModel = getModel('point'); |
491 | 491 | $cur_point = $oPointModel->getPoint($member_srl, true); |
492 | 492 | |
493 | - if( $obj->point > 0 ) |
|
493 | + if ($obj->point > 0) |
|
494 | 494 | { |
495 | 495 | $point = $module_config['voted']; |
496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
496 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
497 | 497 | } |
498 | 498 | else |
499 | 499 | { |
500 | 500 | $point = $module_config['blamed']; |
501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
501 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
502 | 502 | } |
503 | 503 | |
504 | - if(!$point) return new BaseObject(); |
|
504 | + if (!$point) return new BaseObject(); |
|
505 | 505 | // Increase the point |
506 | 506 | $cur_point += $point; |
507 | - $this->setPoint($member_srl,$cur_point); |
|
507 | + $this->setPoint($member_srl, $cur_point); |
|
508 | 508 | |
509 | 509 | return new BaseObject(); |
510 | 510 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | { |
517 | 517 | $member_srl = abs($member_srl); |
518 | 518 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
519 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
520 | 520 | |
521 | 521 | // Get configuration information |
522 | 522 | $oMemberModel = getModel('member'); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $args->member_srl = $member_srl; |
534 | 534 | $args->point = $current_point; |
535 | 535 | |
536 | - switch($mode) |
|
536 | + switch ($mode) |
|
537 | 537 | { |
538 | 538 | case 'add' : |
539 | 539 | $args->point += $point; |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $args->point = $point; |
547 | 547 | break; |
548 | 548 | } |
549 | - if($args->point < 0) $args->point = 0; |
|
549 | + if ($args->point < 0) $args->point = 0; |
|
550 | 550 | $point = $args->point; |
551 | 551 | |
552 | 552 | // Call a trigger (before) |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $trigger_obj->current_level = $current_level; |
558 | 558 | $trigger_obj->set_point = $point; |
559 | 559 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
560 | - if(!$trigger_output->toBool()) |
|
560 | + if (!$trigger_output->toBool()) |
|
561 | 561 | { |
562 | 562 | return $trigger_output; |
563 | 563 | } |
@@ -568,19 +568,19 @@ discard block |
||
568 | 568 | |
569 | 569 | // If there are points, update, if no, insert |
570 | 570 | $oPointModel = getModel('point'); |
571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
571 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
572 | 572 | else executeQuery("point.insertPoint", $args); |
573 | 573 | |
574 | 574 | // Get a new level |
575 | 575 | $level = $oPointModel->getLevel($point, $config->level_step); |
576 | 576 | |
577 | 577 | // If existing level and a new one are different attempt to set a point group |
578 | - if($level != $current_level) |
|
578 | + if ($level != $current_level) |
|
579 | 579 | { |
580 | 580 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
581 | 581 | $point_group = $config->point_group; |
582 | 582 | // If the point group exists |
583 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
583 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
584 | 584 | { |
585 | 585 | // Get the default group |
586 | 586 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -590,29 +590,29 @@ discard block |
||
590 | 590 | |
591 | 591 | asort($point_group); |
592 | 592 | // Reset group after initialization |
593 | - if($config->group_reset != 'N') |
|
593 | + if ($config->group_reset != 'N') |
|
594 | 594 | { |
595 | 595 | // If the new level is in the right group |
596 | - if(in_array($level, $point_group)) |
|
596 | + if (in_array($level, $point_group)) |
|
597 | 597 | { |
598 | 598 | // Delete all groups except the one which the current level belongs to |
599 | - foreach($point_group as $group_srl => $target_level) |
|
599 | + foreach ($point_group as $group_srl => $target_level) |
|
600 | 600 | { |
601 | 601 | $del_group_list[] = $group_srl; |
602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
602 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | // Otherwise, in case the level is reduced, add the recent group |
606 | 606 | else |
607 | 607 | { |
608 | 608 | $i = $level; |
609 | - while($i > 0) |
|
609 | + while ($i > 0) |
|
610 | 610 | { |
611 | - if(in_array($i, $point_group)) |
|
611 | + if (in_array($i, $point_group)) |
|
612 | 612 | { |
613 | - foreach($point_group as $group_srl => $target_level) |
|
613 | + foreach ($point_group as $group_srl => $target_level) |
|
614 | 614 | { |
615 | - if($target_level == $i) |
|
615 | + if ($target_level == $i) |
|
616 | 616 | { |
617 | 617 | $new_group_list[] = $group_srl; |
618 | 618 | } |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | } |
624 | 624 | } |
625 | 625 | // Delete the group of a level which is higher than the current level |
626 | - foreach($point_group as $group_srl => $target_level) |
|
626 | + foreach ($point_group as $group_srl => $target_level) |
|
627 | 627 | { |
628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
628 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
629 | 629 | } |
630 | 630 | $del_group_list[] = $default_group->group_srl; |
631 | 631 | } |
@@ -633,16 +633,16 @@ discard block |
||
633 | 633 | else |
634 | 634 | { |
635 | 635 | // Check until the current level by rotating setting the configurations of the point groups |
636 | - foreach($point_group as $group_srl => $target_level) |
|
636 | + foreach ($point_group as $group_srl => $target_level) |
|
637 | 637 | { |
638 | 638 | $del_group_list[] = $group_srl; |
639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
639 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
640 | 640 | } |
641 | 641 | } |
642 | 642 | // If there is no a new group, granted the default group |
643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
643 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
644 | 644 | // Remove linkage group |
645 | - if($del_group_list && count($del_group_list)) |
|
645 | + if ($del_group_list && count($del_group_list)) |
|
646 | 646 | { |
647 | 647 | $del_group_args = new stdClass; |
648 | 648 | $del_group_args->member_srl = $member_srl; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
651 | 651 | } |
652 | 652 | // Grant a new group |
653 | - foreach($new_group_list as $group_srl) |
|
653 | + foreach ($new_group_list as $group_srl) |
|
654 | 654 | { |
655 | 655 | $new_group_args = new stdClass; |
656 | 656 | $new_group_args->member_srl = $member_srl; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $trigger_obj->del_group_list = $del_group_list; |
666 | 666 | $trigger_obj->new_level = $level; |
667 | 667 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
668 | - if(!$trigger_output->toBool()) |
|
668 | + if (!$trigger_output->toBool()) |
|
669 | 669 | { |
670 | 670 | $oDB->rollback(); |
671 | 671 | return $trigger_output; |
@@ -681,17 +681,17 @@ discard block |
||
681 | 681 | FileHandler::writeFile($cache_filename, $point); |
682 | 682 | |
683 | 683 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
684 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
684 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
685 | 685 | { |
686 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
686 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
687 | 687 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
688 | 688 | $oCacheHandler->delete($cache_key); |
689 | 689 | } |
690 | 690 | |
691 | 691 | $oCacheHandler = CacheHandler::getInstance('object'); |
692 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
692 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
693 | 693 | { |
694 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
694 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
695 | 695 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
696 | 696 | $oCacheHandler->delete($cache_key); |
697 | 697 | } |
@@ -705,9 +705,9 @@ discard block |
||
705 | 705 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
706 | 706 | |
707 | 707 | $oModuleController = getController('module'); |
708 | - if(is_array($obj->moduleSrlList)) |
|
708 | + if (is_array($obj->moduleSrlList)) |
|
709 | 709 | { |
710 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
710 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
711 | 711 | { |
712 | 712 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
713 | 713 | } |
@@ -42,9 +42,13 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new BaseObject(); |
|
45 | + if(!$member_srl) { |
|
46 | + return new BaseObject(); |
|
47 | + } |
|
46 | 48 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
50 | + return new BaseObject(); |
|
51 | + } |
|
48 | 52 | // Get the point module information |
49 | 53 | $oModuleModel = getModel('module'); |
50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
70 | 74 | { |
71 | 75 | $module_srl = $obj->module_srl; |
72 | 76 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
77 | + if(!$module_srl || !$member_srl) { |
|
78 | + return new BaseObject(); |
|
79 | + } |
|
74 | 80 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
81 | + if($module_srl == $member_srl) { |
|
82 | + return new BaseObject(); |
|
83 | + } |
|
76 | 84 | // Get the point module information |
77 | 85 | $oModuleModel = getModel('module'); |
78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 91 | |
84 | 92 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
94 | + $point = $config->insert_document; |
|
95 | + } |
|
86 | 96 | $cur_point += $point; |
87 | 97 | // Add points for attaching a file |
88 | 98 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
100 | + $point = $config->upload_file; |
|
101 | + } |
|
102 | + if($obj->uploaded_count) { |
|
103 | + $cur_point += $point * $obj->uploaded_count; |
|
104 | + } |
|
91 | 105 | // Increase the point |
92 | 106 | $this->setPoint($member_srl,$cur_point); |
93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 133 | |
120 | 134 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
136 | + $point = $config->insert_document; |
|
137 | + } |
|
122 | 138 | $cur_point += $point; |
123 | 139 | // Add points for attaching a file |
124 | 140 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
142 | + $point = $config->upload_file; |
|
143 | + } |
|
144 | + if($obj->uploaded_count) { |
|
145 | + $cur_point += $point * $obj->uploaded_count; |
|
146 | + } |
|
127 | 147 | // Increase the point |
128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
141 | 161 | |
142 | 162 | $oDocumentModel = getModel('document'); |
143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
164 | + if(!$oDocument->isExists()) { |
|
165 | + return new BaseObject(); |
|
166 | + } |
|
145 | 167 | // Get the point module information |
146 | 168 | $oModuleModel = getModel('module'); |
147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
149 | 171 | // The process related to clearing the post comments |
150 | 172 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
174 | + $comment_point = $config->insert_comment; |
|
175 | + } |
|
152 | 176 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new BaseObject(); |
|
177 | + if($comment_point>0) { |
|
178 | + return new BaseObject(); |
|
179 | + } |
|
154 | 180 | // Get all the comments related to this post |
155 | 181 | $cp_args = new stdClass(); |
156 | 182 | $cp_args->document_srl = $document_srl; |
157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 184 | // Return if there is no object |
159 | - if(!$output->data) return new BaseObject(); |
|
185 | + if(!$output->data) { |
|
186 | + return new BaseObject(); |
|
187 | + } |
|
160 | 188 | // Organize the member number |
161 | 189 | $member_srls = array(); |
162 | 190 | $cnt = count($output->data); |
163 | 191 | for($i=0;$i<$cnt;$i++) |
164 | 192 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
193 | + if($output->data[$i]->member_srl<1) { |
|
194 | + continue; |
|
195 | + } |
|
166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 197 | } |
168 | 198 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new BaseObject(); |
|
199 | + if($member_srl) { |
|
200 | + unset($member_srls[abs($member_srl)]); |
|
201 | + } |
|
202 | + if(!count($member_srls)) { |
|
203 | + return new BaseObject(); |
|
204 | + } |
|
171 | 205 | // Remove all the points for each member |
172 | 206 | $oPointModel = getModel('point'); |
173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
194 | 228 | $module_srl = $obj->module_srl; |
195 | 229 | $member_srl = $obj->member_srl; |
196 | 230 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
231 | + if(!$module_srl || !$member_srl) { |
|
232 | + return new BaseObject(); |
|
233 | + } |
|
198 | 234 | // Run only when logged in |
199 | 235 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
236 | + if(!$logged_info->member_srl) { |
|
237 | + return new BaseObject(); |
|
238 | + } |
|
201 | 239 | // Get the points of the member |
202 | 240 | $oPointModel = getModel('point'); |
203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,14 +245,22 @@ discard block |
||
207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 246 | |
209 | 247 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
249 | + $point = $config->insert_document; |
|
250 | + } |
|
211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new BaseObject(); |
|
252 | + if($point < 0) { |
|
253 | + return new BaseObject(); |
|
254 | + } |
|
213 | 255 | $cur_point -= $point; |
214 | 256 | // Add points related to deleting an attachment |
215 | 257 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
258 | + if(strlen($point) == 0 && !is_int($point)) { |
|
259 | + $point = $config->upload_file; |
|
260 | + } |
|
261 | + if($obj->uploaded_count) { |
|
262 | + $cur_point -= $point * $obj->uploaded_count; |
|
263 | + } |
|
218 | 264 | // Increase the point |
219 | 265 | $this->setPoint($member_srl,$cur_point); |
220 | 266 | } |
@@ -229,12 +275,16 @@ discard block |
||
229 | 275 | { |
230 | 276 | $module_srl = $obj->module_srl; |
231 | 277 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
278 | + if(!$module_srl || !$member_srl) { |
|
279 | + return new BaseObject(); |
|
280 | + } |
|
233 | 281 | // Do not increase the points if the member is the author of the post |
234 | 282 | $document_srl = $obj->document_srl; |
235 | 283 | $oDocumentModel = getModel('document'); |
236 | 284 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
286 | + return new BaseObject(); |
|
287 | + } |
|
238 | 288 | // Get the point module information |
239 | 289 | $oModuleModel = getModel('module'); |
240 | 290 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,7 +294,9 @@ discard block |
||
244 | 294 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 295 | |
246 | 296 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
297 | + if(strlen($point) == 0 && !is_int($point)) { |
|
298 | + $point = $config->insert_comment; |
|
299 | + } |
|
248 | 300 | // Increase the point |
249 | 301 | $cur_point += $point; |
250 | 302 | $this->setPoint($member_srl,$cur_point); |
@@ -264,11 +316,17 @@ discard block |
||
264 | 316 | $module_srl = $obj->module_srl; |
265 | 317 | $member_srl = abs($obj->member_srl); |
266 | 318 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
319 | + if(!$module_srl || !$member_srl) { |
|
320 | + return new BaseObject(); |
|
321 | + } |
|
268 | 322 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 323 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
324 | + if(!$oDocument->isExists()) { |
|
325 | + return new BaseObject(); |
|
326 | + } |
|
327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
328 | + return new BaseObject(); |
|
329 | + } |
|
272 | 330 | // Get the point module information |
273 | 331 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 332 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,9 +334,13 @@ discard block |
||
276 | 334 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 335 | |
278 | 336 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
337 | + if(strlen($point) == 0 && !is_int($point)) { |
|
338 | + $point = $config->insert_comment; |
|
339 | + } |
|
280 | 340 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new BaseObject(); |
|
341 | + if($point < 0) { |
|
342 | + return new BaseObject(); |
|
343 | + } |
|
282 | 344 | // Increase the point |
283 | 345 | $cur_point -= $point; |
284 | 346 | $this->setPoint($member_srl,$cur_point); |
@@ -301,11 +363,15 @@ discard block |
||
301 | 363 | */ |
302 | 364 | function triggerDeleteFile(&$obj) |
303 | 365 | { |
304 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
366 | + if($obj->isvalid != 'Y') { |
|
367 | + return new BaseObject(); |
|
368 | + } |
|
305 | 369 | |
306 | 370 | $module_srl = $obj->module_srl; |
307 | 371 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
372 | + if(!$module_srl || !$member_srl) { |
|
373 | + return new BaseObject(); |
|
374 | + } |
|
309 | 375 | // Get the point module information |
310 | 376 | $oModuleModel = getModel('module'); |
311 | 377 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,7 +381,9 @@ discard block |
||
315 | 381 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 382 | |
317 | 383 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
384 | + if(strlen($point) == 0 && !is_int($point)) { |
|
385 | + $point = $config->upload_file; |
|
386 | + } |
|
319 | 387 | // Increase the point |
320 | 388 | $cur_point -= $point; |
321 | 389 | $this->setPoint($member_srl,$cur_point); |
@@ -331,18 +399,21 @@ discard block |
||
331 | 399 | $logged_info = Context::get('logged_info'); |
332 | 400 | $member_srl = $logged_info->member_srl; |
333 | 401 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new BaseObject(); |
|
402 | + if(!$module_srl) { |
|
403 | + return new BaseObject(); |
|
404 | + } |
|
335 | 405 | |
336 | 406 | // Pass if it is your file |
337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
407 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
408 | + return new BaseObject(); |
|
409 | + } |
|
338 | 410 | $oModuleModel = getModel('module'); |
339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 412 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
341 | 413 | if (isset($module_config['download_file'])) |
342 | 414 | { |
343 | 415 | $point = intval($module_config['download_file']); |
344 | - } |
|
345 | - else |
|
416 | + } else |
|
346 | 417 | { |
347 | 418 | $point = intval($config->download_file); |
348 | 419 | } |
@@ -353,8 +424,7 @@ discard block |
||
353 | 424 | if($config->disable_download == 'Y' && $point) |
354 | 425 | { |
355 | 426 | return new BaseObject(-1,'msg_not_permitted_download'); |
356 | - } |
|
357 | - else |
|
427 | + } else |
|
358 | 428 | { |
359 | 429 | return new BaseObject(); |
360 | 430 | } |
@@ -381,13 +451,19 @@ discard block |
||
381 | 451 | { |
382 | 452 | // Run only when logged in |
383 | 453 | $logged_info = Context::get('logged_info'); |
384 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
454 | + if(!$logged_info->member_srl) { |
|
455 | + return new BaseObject(); |
|
456 | + } |
|
385 | 457 | $module_srl = $obj->module_srl; |
386 | 458 | $member_srl = $logged_info->member_srl; |
387 | - if(!$module_srl) return new BaseObject(); |
|
459 | + if(!$module_srl) { |
|
460 | + return new BaseObject(); |
|
461 | + } |
|
388 | 462 | |
389 | 463 | // Pass if it is your file |
390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
464 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
465 | + return new BaseObject(); |
|
466 | + } |
|
391 | 467 | |
392 | 468 | // Get the point module information |
393 | 469 | $oModuleModel = getModel('module'); |
@@ -396,8 +472,7 @@ discard block |
||
396 | 472 | if (isset($module_config['download_file'])) |
397 | 473 | { |
398 | 474 | $point = intval($module_config['download_file']); |
399 | - } |
|
400 | - else |
|
475 | + } else |
|
401 | 476 | { |
402 | 477 | $point = intval($config->download_file); |
403 | 478 | } |
@@ -428,25 +503,32 @@ discard block |
||
428 | 503 | // Get the original author number |
429 | 504 | $target_member_srl = abs($obj->get('member_srl')); |
430 | 505 | // Pass without increasing the hits if the viewer is the same as the author |
431 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
506 | + if($target_member_srl == $member_srl) { |
|
507 | + return new BaseObject(); |
|
508 | + } |
|
432 | 509 | // Get the point information for each module |
433 | 510 | $config = $oModuleModel->getModuleConfig('point'); |
434 | 511 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
435 | 512 | // Get hits points |
436 | 513 | $point = $module_config['read_document']; |
437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
514 | + if(strlen($point) == 0 && !is_int($point)) { |
|
515 | + $point = $config->read_document; |
|
516 | + } |
|
438 | 517 | // Pass if there are no requested points |
439 | - if(!$point) return new BaseObject(); |
|
518 | + if(!$point) { |
|
519 | + return new BaseObject(); |
|
520 | + } |
|
440 | 521 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
441 | 522 | if($member_srl) |
442 | 523 | { |
443 | 524 | $args->member_srl = $member_srl; |
444 | 525 | $args->document_srl = $obj->document_srl; |
445 | 526 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
446 | - if($output->data->count) return new BaseObject(); |
|
527 | + if($output->data->count) { |
|
528 | + return new BaseObject(); |
|
529 | + } |
|
447 | 530 | $cur_point = $oPointModel->getPoint($member_srl, true); |
448 | - } |
|
449 | - else |
|
531 | + } else |
|
450 | 532 | { |
451 | 533 | $cur_point = 0; |
452 | 534 | } |
@@ -462,9 +544,13 @@ discard block |
||
462 | 544 | return new BaseObject(-1, $message); |
463 | 545 | } |
464 | 546 | // If not logged in, pass |
465 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
547 | + if(!$logged_info->member_srl) { |
|
548 | + return new BaseObject(); |
|
549 | + } |
|
466 | 550 | // Pass, if there are no requested points |
467 | - if(!$point) return new BaseObject(); |
|
551 | + if(!$point) { |
|
552 | + return new BaseObject(); |
|
553 | + } |
|
468 | 554 | // If the read record is missing, leave it |
469 | 555 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
470 | 556 | // Increase the point |
@@ -481,7 +567,9 @@ discard block |
||
481 | 567 | { |
482 | 568 | $module_srl = $obj->module_srl; |
483 | 569 | $member_srl = $obj->member_srl; |
484 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
570 | + if(!$module_srl || !$member_srl) { |
|
571 | + return new BaseObject(); |
|
572 | + } |
|
485 | 573 | |
486 | 574 | $oModuleModel = getModel('module'); |
487 | 575 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -493,15 +581,20 @@ discard block |
||
493 | 581 | if( $obj->point > 0 ) |
494 | 582 | { |
495 | 583 | $point = $module_config['voted']; |
496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
497 | - } |
|
498 | - else |
|
584 | + if(strlen($point) == 0 && !is_int($point)) { |
|
585 | + $point = $config->voted; |
|
586 | + } |
|
587 | + } else |
|
499 | 588 | { |
500 | 589 | $point = $module_config['blamed']; |
501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
590 | + if(strlen($point) == 0 && !is_int($point)) { |
|
591 | + $point = $config->blamed; |
|
592 | + } |
|
502 | 593 | } |
503 | 594 | |
504 | - if(!$point) return new BaseObject(); |
|
595 | + if(!$point) { |
|
596 | + return new BaseObject(); |
|
597 | + } |
|
505 | 598 | // Increase the point |
506 | 599 | $cur_point += $point; |
507 | 600 | $this->setPoint($member_srl,$cur_point); |
@@ -516,7 +609,9 @@ discard block |
||
516 | 609 | { |
517 | 610 | $member_srl = abs($member_srl); |
518 | 611 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
612 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
613 | + $mode = 'update'; |
|
614 | + } |
|
520 | 615 | |
521 | 616 | // Get configuration information |
522 | 617 | $oMemberModel = getModel('member'); |
@@ -546,7 +641,9 @@ discard block |
||
546 | 641 | $args->point = $point; |
547 | 642 | break; |
548 | 643 | } |
549 | - if($args->point < 0) $args->point = 0; |
|
644 | + if($args->point < 0) { |
|
645 | + $args->point = 0; |
|
646 | + } |
|
550 | 647 | $point = $args->point; |
551 | 648 | |
552 | 649 | // Call a trigger (before) |
@@ -568,8 +665,11 @@ discard block |
||
568 | 665 | |
569 | 666 | // If there are points, update, if no, insert |
570 | 667 | $oPointModel = getModel('point'); |
571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
572 | - else executeQuery("point.insertPoint", $args); |
|
668 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
669 | + executeQuery("point.updatePoint", $args); |
|
670 | + } else { |
|
671 | + executeQuery("point.insertPoint", $args); |
|
672 | + } |
|
573 | 673 | |
574 | 674 | // Get a new level |
575 | 675 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -599,7 +699,9 @@ discard block |
||
599 | 699 | foreach($point_group as $group_srl => $target_level) |
600 | 700 | { |
601 | 701 | $del_group_list[] = $group_srl; |
602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
702 | + if($target_level == $level) { |
|
703 | + $new_group_list[] = $group_srl; |
|
704 | + } |
|
603 | 705 | } |
604 | 706 | } |
605 | 707 | // Otherwise, in case the level is reduced, add the recent group |
@@ -625,7 +727,9 @@ discard block |
||
625 | 727 | // Delete the group of a level which is higher than the current level |
626 | 728 | foreach($point_group as $group_srl => $target_level) |
627 | 729 | { |
628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
730 | + if($target_level > $level) { |
|
731 | + $del_group_list[] = $group_srl; |
|
732 | + } |
|
629 | 733 | } |
630 | 734 | $del_group_list[] = $default_group->group_srl; |
631 | 735 | } |
@@ -636,11 +740,15 @@ discard block |
||
636 | 740 | foreach($point_group as $group_srl => $target_level) |
637 | 741 | { |
638 | 742 | $del_group_list[] = $group_srl; |
639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
743 | + if($target_level <= $level) { |
|
744 | + $new_group_list[] = $group_srl; |
|
745 | + } |
|
640 | 746 | } |
641 | 747 | } |
642 | 748 | // If there is no a new group, granted the default group |
643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
749 | + if(!$new_group_list[0]) { |
|
750 | + $new_group_list[0] = $default_group->group_srl; |
|
751 | + } |
|
644 | 752 | // Remove linkage group |
645 | 753 | if($del_group_list && count($del_group_list)) |
646 | 754 | { |