22 $args =
new stdClass();
66 $args =
new stdClass();
102 return $this->_returnByProc($isProc);
107 for($i=1;$i<=10;$i++)
111 if(!preg_match(
"/^[a-zA-Z]([a-zA-Z0-9_]*)$/i",
$mid))
return new BaseObject(-1,
'msg_limit_mid');
112 $browser_title =
$args->{
"browser_title_".$i};
114 if(
$mid && !$browser_title) $browser_title =
$mid;
115 $clones[
$mid] = $browser_title;
117 if(count($clones) < 1)
119 return $this->_returnByProc($isProc);
125 $columnList = array(
'module',
'module_category_srl',
'layout_srl',
'use_mobile',
'mlayout_srl',
'menu_srl',
'site_srl',
'skin',
'mskin',
'description',
'mcontent',
'open_rss',
'header_text',
'footer_text',
'regdate');
128 $module_args =
new stdClass();
134 foreach(
$output->data as $val) $grant[$val->name][] = $val->group_srl;
138 $extra_args =
new stdClass();
142 if($extra_output->toBool() && is_array($extra_output->data))
144 foreach($extra_output->data as $info)
153 if($tmpModuleSkinVars)
155 foreach($tmpModuleSkinVars as $key=>$value)
157 $moduleSkinVars->{$key} = $value->value;
161 if($tmpModuleMobileSkinVars)
163 foreach($tmpModuleMobileSkinVars as $key=>$value)
165 $moduleMobileSkinVars->{$key} = $value->value;
172 $triggerObj =
new stdClass();
174 $triggerObj->moduleSrlList = array();
177 foreach($clones as $mid => $browser_title)
179 $clone_args =
new stdClass;
181 $clone_args->module_srl = null;
182 $clone_args->content = null;
183 $clone_args->mid = $mid;
184 $clone_args->browser_title = $browser_title;
185 $clone_args->is_default =
'N';
186 $clone_args->isMenuCreate =
$args->isMenuCreate;
187 unset($clone_args->menu_srl);
193 $errorLog[] = $mid .
' : '.
$output->message;
198 if($module_info->module ==
'page' &&
$extra_vars->page_type ==
'ARTICLE')
202 $copyOutput = $oDocumentAdminController->copyDocumentModule(array(
$extra_vars->document_srl),
$module_srl, $module_info->category_srl);
203 $document_srls = $copyOutput->get(
'copied_srls');
204 if($document_srls && count($document_srls) > 0)
206 $extra_vars->document_srl = array_pop($document_srls);
211 $copyOutput = $oDocumentAdminController->copyDocumentModule(array(
$extra_vars->mdocument_srl),
$module_srl, $module_info->category_srl);
212 $copiedSrls = $copyOutput->get(
'copied_srls');
213 if($copiedSrls && count($copiedSrls) > 0)
215 $extra_vars->mdocument_srl = array_pop($copiedSrls);
234 if(count($errorLog) > 0)
236 $message = implode(
'\n', $errorLog);
237 $this->setMessage($message);
241 $message =
$lang->success_registed;
242 $this->setMessage(
'success_registed');
263 private function _returnByProc($isProc, $msg=
'msg_invalid_request')
283 $columnList = array(
'module_srl',
'module');
285 if(!$module_info)
return new BaseObject(-1,
'msg_invalid_request');
291 $admin_members = explode(
',',$admin_member);
292 foreach($admin_members as $admin_id)
294 $admin_id = trim($admin_id);
295 if(!$admin_id)
continue;
300 $xml_info =
$oModuleModel->getModuleActionXML($module_info->module);
302 $grant_list = $xml_info->grant;
304 $grant_list->access =
new stdClass();
305 $grant_list->access->default =
'guest';
306 $grant_list->manager =
new stdClass();
307 $grant_list->manager->default =
'manager';
309 $grant =
new stdClass();
310 foreach($grant_list as $grant_name => $grant_info)
315 $grant->{$grant_name} = array();
318 $grant->{$grant_name}[] = $default;
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);
330 $grant->{$grant_name} = $group_srls;
334 $grant->{$group_srls} = array();
338 $args =
new stdClass();
343 foreach($grant as $grant_name => $group_srls)
345 foreach($group_srls as $val)
347 $args =
new stdClass();
349 $args->name = $grant_name;
350 $args->group_srl = $val;
355 $this->setMessage(
'success_registed');
366 $mode = $mode ===
'P' ?
'P' :
'M';
369 $columnList = array(
'module_srl',
'module',
'skin',
'mskin',
'is_skin_fix',
'is_mskin_fix');
371 if($module_info->module_srl)
375 if($module_info->is_mskin_fix ==
'Y')
377 $skin = $module_info->mskin;
381 $skin =
$oModuleModel->getModuleDefaultSkin($module_info->module,
'M');
386 if($module_info->is_skin_fix ==
'Y')
388 $skin = $module_info->skin;
392 $skin =
$oModuleModel->getModuleDefaultSkin($module_info->module,
'P');
397 $module_path =
_XE_PATH_ .
'modules/'.$module_info->module;
401 $skin_info =
$oModuleModel->loadSkinInfo($module_path, $skin,
'm.skins');
406 $skin_info =
$oModuleModel->loadSkinInfo($module_path, $skin);
413 unset(
$obj->error_return_url);
414 unset(
$obj->module_srl);
420 if($skin_info->extra_vars)
422 foreach($skin_info->extra_vars as $vars)
424 if($vars->type!=
'image')
continue;
426 $image_obj =
$obj->{$vars->name};
428 $del_var =
$obj->{
"del_".$vars->name};
429 unset(
$obj->{
"del_".$vars->name});
436 if(!$image_obj[
'tmp_name'])
438 $obj->{$vars->name} = $skin_vars[$vars->name]->value;
442 if(!is_uploaded_file($image_obj[
'tmp_name']) || !
checkUploadedFile($image_obj[
'tmp_name']))
444 unset(
$obj->{$vars->name});
448 if(!preg_match(
"/\.(jpg|jpeg|gif|png)$/i", $image_obj[
'name']))
450 unset(
$obj->{$vars->name});
454 $path = sprintf(
"./files/attach/images/%s/",
$module_srl);
458 $filename = $path.$image_obj[
'name'];
460 if(!move_uploaded_file($image_obj[
'tmp_name'], $filename))
462 unset(
$obj->{$vars->name});
468 unset(
$obj->{$vars->name});
469 $obj->{$vars->name} = $filename;
498 $this->setMessage(
'success_saved');
499 $this->setRedirectUrl(
Context::get(
'error_return_url'));
509 if(!$vars->module_srls)
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');
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)
520 if(!strlen($vars->{$val}))
522 unset($updateList[$key]);
523 $columnList[] = $val;
529 $module_info =
$oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
531 foreach($updateList as $val)
533 $module_info->{$val} = $vars->{$val};
538 $this->setMessage(
'success_registed');
543 $this->setRedirectUrl(
Context::get(
'success_return_url'));
564 if(!$module_srls)
return new BaseObject(-1,
'msg_invalid_request');
566 $modules = explode(
',',$module_srls);
567 if(count($modules) < 1)
return new BaseObject(-1,
'msg_invalid_request');
572 $columnList = array(
'module_srl',
'module');
573 $module_info =
$oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList);
574 $xml_info =
$oModuleModel->getModuleActionXml($module_info->module);
575 $grant_list = $xml_info->grant;
577 $grant_list->access =
new stdClass();
578 $grant_list->access->default =
'guest';
579 $grant_list->manager =
new stdClass();
580 $grant_list->manager->default =
'manager';
582 $grant =
new stdClass;
584 foreach($grant_list as $grant_name => $grant_info)
589 $grant->{$grant_name} = array();
592 $grant->{$grant_name}[] = $default;
601 if(!is_array($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 else $group_srls = array($group_srls);
607 $grant->{$grant_name} = $group_srls;
611 $grant->{$group_srls} = array();
615 foreach($modules as $module_srl)
617 $args =
new stdClass();
620 if(!
$output->toBool())
continue;
622 foreach($grant as $grant_name => $group_srls)
624 foreach($group_srls as $val)
626 $args =
new stdClass();
628 $args->name = $grant_name;
629 $args->group_srl = $val;
635 $this->setMessage(
'success_registed');
640 $this->setRedirectUrl(
Context::get(
'success_return_url'));
664 $args =
new stdClass();
665 $args->site_srl = (int)$site_module_info->site_srl;
671 if(empty(
$args->name))
$args->name =
'userLang'.date(
'YmdHis').
''.sprintf(
'%03d', mt_rand(0, 100));
682 foreach($lang_supported as $key => $val)
684 $args->lang_code = $key;
699 $this->makeCacheDefinedLangCode(
$args->site_srl);
701 $this->add(
'name',
$args->name);
702 $this->setMessage(
"success_saved",
'info');
705 $this->setRedirectUrl($returnUrl);
715 $args =
new stdClass();
716 $args->site_srl = (int)$site_module_info->site_srl;
724 $this->makeCacheDefinedLangCode(
$args->site_srl);
726 $this->setMessage(
"success_deleted",
'info');
729 $this->setRedirectUrl($returnUrl);
744 $args =
new stdClass;
747 if($site_keyword)
$args->site_keyword = $site_keyword;
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;
754 else $args->site_srl = $site_srl;
756 $args->sort_index1 =
'sites.domain';
758 $moduleCategorySrl = array();
766 $module = trim($val->module);
767 if(!$module)
continue;
772 $obj =
new stdClass();
773 $obj->module_srl = $val->module_srl;
774 $obj->layout_srl = $val->layout_srl;
775 $obj->browser_title = $val->browser_title;
776 $obj->mid = $val->mid;
777 $obj->module_category_srl = $val->module_category_srl;
778 if($val->module_category_srl > 0)
780 $moduleCategorySrl[] = $val->module_category_srl;
782 $mid_list[$module]->list[$val->mid] =
$obj;
787 $moduleCategorySrl = array_unique($moduleCategorySrl);
789 $categoryNameList = array();
794 $categoryNameList[$value->module_category_srl] = $value->title;
799 if(count($mid_list) > 0)
801 foreach($mid_list as $module => $val)
803 if(!$selected_module) $selected_module = $module;
808 unset($mid_list[$module]);
812 $mid_list[$module]->title = $xml_info->title;
815 if(is_array($val->list))
817 foreach($val->list as $key=>$value)
819 if($value->module_category_srl > 0)
821 $categorySrl = $mid_list[$module]->list[$key]->module_category_srl;
822 if(isset($categoryNameList[$categorySrl]))
824 $mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
829 $mid_list[$module]->list[$key]->module_category_srl =
Context::getLang(
'none_category');
836 $security =
new Security($mid_list);
837 $security->encodeHTML(
'....browser_title');
839 $this->add(
'module_list', $mid_list);
847 $args =
new stdClass();
853 $args->site_srl = (int)$site_module_info->site_srl;
857 $args->site_srl = $site_srl;
865 $langMap[$lang->lang_code][$lang->name] = $lang->value;
870 $defaultLang = $dbInfo->lang_type;
872 if(!is_array($langMap[$defaultLang]))
874 $langMap[$defaultLang] = array();
879 foreach($lang_supported as $langCode => $langName)
881 if(!is_array($langMap[$langCode]))
883 $langMap[$langCode] = array();
886 $langMap[$langCode] += $langMap[$defaultLang];
887 foreach($lang_supported as $targetLangCode => $targetLangName)
889 if($langCode == $targetLangCode || $langCode == $defaultLang)
894 if(!is_array($langMap[$targetLangCode]))
896 $langMap[$targetLangCode] = array();
899 $langMap[$langCode] += $langMap[$targetLangCode];
902 if($oCacheHandler->isSupport())
904 $object_key =
'user_defined_langs:' .
$args->site_srl .
':' . $langCode;
905 $cache_key = $oCacheHandler->getGroupKey(
'site_and_module', $object_key);
906 $oCacheHandler->put($cache_key, $langMap[$langCode]);
919 $skinType = ($skinType ==
'M') ?
'M' :
'P';
927 $isSkinFix = ($isSkinFix ==
'N') ?
'N' :
'Y';
933 $output = $this->setDesignInfo($moduleSrl, $mid, $skinType, $layoutSrl, $isSkinFix, $skinName, $skinVars);
939 public function setDesignInfo($moduleSrl = 0, $mid =
'', $skinType =
'P', $layoutSrl = 0, $isSkinFix =
'Y', $skinName =
'', $skinVars = NULL)
941 if(!$moduleSrl && !$mid)
943 return $this->stop(-1,
'msg_invalid_request');
959 return $this->stop(-1,
'msg_module_not_exists');
962 $skinTargetValue = ($skinType ==
'M') ?
'mskin' :
'skin';
963 $layoutTargetValue = ($skinType ==
'M') ?
'mlayout_srl' :
'layout_srl';
964 $skinFixTargetValue = ($skinType ==
'M') ?
'is_mskin_fix' :
'is_skin_fix';
966 if(strlen($layoutSrl))
971 if(strlen($isSkinFix))
976 if($isSkinFix ==
'Y')
979 $skinVars = json_decode($skinVars);
981 if(is_array($skinVars))
983 foreach($skinVars as $key => $val)
1008 return $this->stop(-1,
'msg_invalid_request');
1017 $useMobile = $useMobile !=
'Y' ?
'N' :
'Y';
setMessage($message= 'success', $type=NULL)
getController($module_name)
procModuleAdminInsertGrant()
Save the module permissions.
procModuleAdminDeleteLang()
Remove language.
& getInstance($target= 'object', $info=null, $always_use_file=false)
doDeleteModuleCategory()
Delete the module category.
foreach($sitemap as $id=> &$val) $extra_vars
procModuleAdminUpdateCategory()
Update category.
procModuleAdminInsertLang()
Add/Update language.
procModuleAdminUpdateSkinInfo()
Updating Skins.
doUpdateModuleCategory()
Change the title of the module category.
setDesignInfo($moduleSrl=0, $mid= '', $skinType= 'P', $layoutSrl=0, $isSkinFix= 'Y', $skinName= '', $skinVars=NULL)
$module_srl
integer value to represent a run-time instance of Module (XE Module)
procModuleAdminSetDesignInfo()
$mid
string to represent run-time instance of Module (XE Module)
setRedirectUrl($url= './', $output=NULL)
admin controller class of the module module
procModuleAdminInsertCategory()
Add the module category.
procModuleAdminCopyModule($args=NULL)
Copy Module.
getInstance($db_type=NULL)
if(version_compare(PHP_VERSION, '5.4.0', '<')) else
procModuleAdminUpdateUseMobile()
procModuleAdminModuleSetup()
List module information.
procModuleAdminModuleGrantSetup()
List permissions of the module.
makeCacheDefinedLangCode($site_srl=0)
Save the file of user-defined language code.
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
getAdminController($module_name)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
triggerCall($trigger_name, $called_position, &$obj)
high class of the module module
if(isset($_REQUEST['encode'])) if(isset($_REQUEST['decode'])) $lang
procModuleAdminDeleteCategory()
Delete category.