mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-13 15:32:15 +09:00
issue 92 add Theme
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8656 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
5a60bfa3d6
commit
ab85943d7e
8 changed files with 446 additions and 0 deletions
|
|
@ -79,5 +79,70 @@
|
|||
|
||||
header('Location: '.getNotEncodedUrl('', 'module','admin'));
|
||||
}
|
||||
|
||||
function procAdminInsertThemeInfo(){
|
||||
$vars = Context::getRequestVars();
|
||||
$theme_file = _XE_PATH_.'files/theme/theme_info.php';
|
||||
|
||||
$theme_output = sprintf('$theme_info->theme=\'%s\';', $vars->themeItem);
|
||||
$theme_output = $theme_output.sprintf('$theme_info->layout=%s;', $vars->layout);
|
||||
|
||||
$site_info = Context::get('site_module_info');
|
||||
|
||||
$args->site_srl = $site_info->site_srl;
|
||||
$args->layout_srl = $vars->layout;
|
||||
// layout submit
|
||||
$output = executeQuery('layout.updateAllLayoutInSiteWithTheme', $args);
|
||||
if (!$output->toBool()) return $output;
|
||||
|
||||
$skin_args->site_srl = $site_info->site_srl;
|
||||
|
||||
foreach($vars as $key=>$val){
|
||||
$pos = strpos($key, '-skin');
|
||||
if ($pos === false) continue;
|
||||
if ($val != '__skin_none__'){
|
||||
$module = substr($key, 0, $pos);
|
||||
$theme_output = $theme_output.sprintf('$theme_info->skin_info[%s]=\'%s\';', $module, $val);
|
||||
$skin_args->skin = $val;
|
||||
$skin_args->module = $module;
|
||||
if ($module == 'page')
|
||||
{
|
||||
$article_output = executeQueryArray('page.getArticlePageSrls');
|
||||
if (count($article_output->data)>0){
|
||||
$article_module_srls = array();
|
||||
foreach($article_output->data as $val){
|
||||
$article_module_srls[] = $val->module_srl;
|
||||
}
|
||||
$skin_args->module_srls = implode(',', $article_module_srls);
|
||||
}
|
||||
}
|
||||
$skin_output = executeQuery('module.updateAllModuleSkinInSiteWithTheme', $skin_args);
|
||||
if (!$skin_output->toBool()) return $skin_output;
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_config = $oModuleModel->getModuleConfig($module, $site_info->site_srl);
|
||||
$module_config->skin = $val;
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModuleConfig($module, $module_config, $site_info->site_srl);
|
||||
}
|
||||
}
|
||||
|
||||
$theme_buff = sprintf(
|
||||
'<?php '.
|
||||
'if(!defined("__ZBXE__")) exit(); '.
|
||||
'%s'.
|
||||
'?>',
|
||||
$theme_output
|
||||
);
|
||||
// Save File
|
||||
FileHandler::writeFile($theme_file, $theme_buff);
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminTheme');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
else return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue