} $count = count($conf_ids); $tpl_updated = false; $theme_updated = false; $startmod_updated = false; $lang_updated = false; if ($count > 0) { for ($i = 0; $i < $count; $i++) { $config =& $config_handler->getConfig($conf_ids[$i]); $new_value =& $_POST[$config->getVar('conf_name')]; if (is_array($new_value) || $new_value != $config->getVar('conf_value')) { // if language has been changed if (!$lang_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'language') { // regenerate admin menu file $xoopsConfig['language'] = $_POST[$config->getVar('conf_name')]; xoops_module_write_admin_menu(xoops_module_get_admin_menu()); $lang_updated = true; } // if default theme has been changed if (!$theme_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'theme_set') { $member_handler =& xoops_gethandler('member'); $member_handler->updateUsersByField('theme', $_POST[$config->getVar('conf_name')]); $theme_updated = true; } // if default template set has been changed if (!$tpl_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'template_set') { // clear cached/compiled files and regenerate them if default theme has been changed if ($xoopsConfig['template_set'] != $_POST[$config->getVar('conf_name')]) { $newtplset = $_POST[$config->getVar('conf_name')]; // clear all compiled and cachedfiles $xoopsTpl->clear_compiled_tpl();
/** * Function icms_cp_header * * @since ImpressCMS 1.2 * @version $Id: cp_functions.php 12115 2012-11-18 16:10:55Z fiammy $ * * @author rowd (from the XOOPS Community) * @author nekro (aka Gustavo Pilla)<*****@*****.**> */ function icms_cp_header() { global $icmsConfig, $icmsConfigPlugins, $icmsConfigPersona, $icmsModule, $xoopsModule, $xoopsTpl, $xoopsOption, $icmsTheme, $xoTheme, $icmsConfigMultilang, $icmsAdminTpl; icms::$logger->stopTime('Module init'); icms::$logger->startTime('ImpressCMS CP Output Init'); if (!headers_sent()) { header('Content-Type:text/html; charset=' . _CHARSET); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header('Cache-Control: no-store, no-cache, must-revalidate'); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } $icmsAdminTpl = new icms_view_Tpl(); $icmsAdminTpl->assign('xoops_url', ICMS_URL); $icmsAdminTpl->assign('icms_sitename', $icmsConfig['sitename']); if (@$xoopsOption['template_main']) { if (false === strpos($xoopsOption['template_main'], ':')) { $xoopsOption['template_main'] = 'db:' . $xoopsOption['template_main']; } } $xoopsThemeFactory = new icms_view_theme_Factory(); $xoopsThemeFactory->allowedThemes = $icmsConfig['theme_set_allowed']; // The next 2 lines are for compatibility only... to implement the admin theme ;) // TODO: Remove all this after a few versions!! if (isset($icmsConfig['theme_admin_set'])) { $xoopsThemeFactory->defaultTheme = $icmsConfig['theme_admin_set']; } $icmsTheme = $xoTheme =& $xoopsThemeFactory->createInstance(array('contentTemplate' => @$xoopsOption['template_main'], 'canvasTemplate' => 'theme' . (file_exists(ICMS_THEME_PATH . '/' . $icmsConfig['theme_admin_set'] . '/theme_admin.html') || file_exists(ICMS_MODULES_PATH . '/system/themes/' . $icmsConfig['theme_admin_set'] . '/theme_admin.html') ? '_admin' : '') . '.html', 'plugins' => array('icms_view_PageBuilder'), 'folderName' => $icmsConfig['theme_admin_set'])); $icmsAdminTpl = $xoTheme->template; // ################# Preload Trigger startOutputInit ############## icms::$preload->triggerEvent('adminHeader'); $xoTheme->addScript(ICMS_URL . '/include/xoops.js', array('type' => 'text/javascript')); $xoTheme->addScript('', array('type' => 'text/javascript'), 'startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList;'); /** @todo Remove icms.css in 2.0 */ icms_core_Debug::setDeprecated("Elements from icms.css need to be moved to your theme", sprintf(_CORE_REMOVE_IN_VERSION, '2.0')); $xoTheme->addStylesheet(ICMS_URL . '/icms' . (defined('_ADM_USE_RTL') && _ADM_USE_RTL ? '_rtl' : '') . '.css', array('media' => 'screen')); // JQuery UI Dialog $xoTheme->addScript(ICMS_URL . '/libraries/jquery/jquery.js', array('type' => 'text/javascript')); if (!empty($_SESSION['redirect_message'])) { $xoTheme->addScript(ICMS_URL . '/libraries/jquery/jgrowl.js', array('type' => 'text/javascript')); $xoTheme->addStylesheet(ICMS_URL . '/libraries/jquery/jgrowl' . (defined('_ADM_USE_RTL') && _ADM_USE_RTL ? '_rtl' : '') . '.css', array('media' => 'screen')); $xoTheme->addScript('', array('type' => 'text/javascript'), ' if (!window.console || !console.firebug) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {}; } (function($) { $(document).ready(function() { $.jGrowl("' . $_SESSION['redirect_message'] . '", { life:5000 , position: "center", speed: "slow" }); }); })(jQuery); '); unset($_SESSION['redirect_message']); } $xoTheme->addScript(ICMS_URL . '/libraries/jquery/ui/ui.min.js', array('type' => 'text/javascript')); $xoTheme->addScript(ICMS_URL . '/libraries/jquery/helptip.js', array('type' => 'text/javascript')); $xoTheme->addStylesheet(ICMS_URL . '/libraries/jquery/ui/css/ui-smoothness/ui.css', array('media' => 'screen')); $xoTheme->addStylesheet(ICMS_LIBRARIES_URL . '/jquery/colorbox/colorbox.css'); $xoTheme->addScript(ICMS_LIBRARIES_URL . '/jquery/colorbox/jquery.colorbox-min.js'); /* $jscript = ''; if(class_exists('icms_form_elements_Dhtmltextarea')){ foreach ($icmsConfigPlugins['sanitizer_plugins'] as $key) { if( empty( $key ) ) continue; if(file_exists(ICMS_ROOT_PATH.'/plugins/textsanitizer/'.$key.'/'.$key.'.js')){ $xoTheme->addScript(ICMS_URL.'/plugins/textsanitizer/'.$key.'/'.$key.'.js', array('type' => 'text/javascript')); }else{ $extension = include_once ICMS_ROOT_PATH.'/plugins/textsanitizer/'.$key.'/'.$key.'.php'; $func = 'render_'.$key; if ( function_exists($func) ) { @list($encode, $jscript) = $func($ele_name); if (!empty($jscript)) { if(!file_exists(ICMS_ROOT_PATH.'/'.$jscript)){ $xoTheme->addScript('', array('type' => 'text/javascript'), $jscript); }else{ $xoTheme->addScript($jscript, array('type' => 'text/javascript')); } } } } } } */ $style_info = ''; if (!empty($icmsConfigPlugins['sanitizer_plugins'])) { foreach ($icmsConfigPlugins['sanitizer_plugins'] as $key) { if (empty($key)) { continue; } if (file_exists(ICMS_ROOT_PATH . '/plugins/textsanitizer/' . $key . '/' . $key . '.css')) { $xoTheme->addStylesheet(ICMS_URL . '/plugins/textsanitizer/' . $key . '/' . $key . '.css', array('media' => 'screen')); } else { $extension = (include_once ICMS_ROOT_PATH . '/plugins/textsanitizer/' . $key . '/' . $key . '.php'); $func = 'style_' . $key; if (function_exists($func)) { $style_info = $func(); if (!empty($style_info)) { if (!file_exists(ICMS_ROOT_PATH . '/' . $style_info)) { $xoTheme->addStylesheet('', array('media' => 'screen'), $style_info); } else { $xoTheme->addStylesheet($style_info, array('media' => 'screen')); } } } } } } /** * Loading admin dropdown menus */ if (!file_exists(ICMS_CACHE_PATH . '/adminmenu_' . $icmsConfig['language'] . '.php')) { xoops_module_write_admin_menu(impresscms_get_adminmenu()); } $file = file_get_contents(ICMS_CACHE_PATH . "/adminmenu_" . $icmsConfig['language'] . ".php"); $admin_menu = eval('return ' . $file . ';'); $moduleperm_handler = icms::handler('icms_member_groupperm'); $module_handler = icms::handler('icms_module'); foreach ($admin_menu as $k => $navitem) { //Getting array of allowed modules to use in admin home if ($navitem['id'] == 'modules') { $perm_itens = array(); foreach ($navitem['menu'] as $item) { $module = $module_handler->getByDirname($item['dir']); $admin_perm = $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), icms::$user->getGroups()); if ($admin_perm) { if ($item['dir'] != 'system') { $perm_itens[] = $item; } } } $navitem['menu'] = $mods = $perm_itens; } //end if ($navitem['id'] == 'opsystem') { $groups = icms::$user->getGroups(); $all_ok = false; if (!in_array(ICMS_GROUP_ADMIN, $groups)) { $sysperm_handler = icms::handler('icms_member_groupperm'); $ok_syscats =& $sysperm_handler->getItemIds('system_admin', $groups); } else { $all_ok = true; } $perm_itens = array(); /** * Allow easely change the order of system dropdown menu. * $adminmenuorder = 1; Alphabetically order; * $adminmenuorder = 0; Indice key order; * To change the order when using Indice key order just change the order of the array in the file modules/system/menu.php and after update the system module * * @todo: Create a preference option to set this value and improve the way to change the order. */ $adminmenuorder = 1; $adminsubmenuorder = 1; $adminsubsubmenuorder = 1; if ($adminmenuorder == 1) { foreach ($navitem['menu'] as $k => $sortarray) { $column[] = $sortarray['title']; if (isset($sortarray['subs']) && count($sortarray['subs']) > 0 && $adminsubmenuorder) { asort($navitem['menu'][$k]['subs']); } if (isset($sortarray['subs']) && count($sortarray['subs']) > 0) { foreach ($sortarray['subs'] as $k2 => $sortarray2) { if (isset($sortarray2['subs']) && count($sortarray2['subs']) > 0 && $adminsubsubmenuorder) { asort($navitem['menu'][$k]['subs'][$k2]['subs']); //Sorting submenus of preferences } } } } //sort arrays after loop array_multisort($column, SORT_ASC, $navitem['menu']); } foreach ($navitem['menu'] as $item) { foreach ($item['subs'] as $key => $subitem) { if ($all_ok == false && !in_array($subitem['id'], $ok_syscats)) { // remove the subitem unset($item['subs'][$key]); } } // only add the item (first layer: groups) if it has subitems if (count($item['subs']) > 0) { $perm_itens[] = $item; } } //Getting array of allowed system prefs $navitem['menu'] = $sysprefs = $perm_itens; } $icmsAdminTpl->append('navitems', $navitem); } if (count($sysprefs) > 0) { $icmsAdminTpl->assign('systemadm', 1); } else { $icmsAdminTpl->assign('systemadm', 0); } if (count($mods) > 0) { $icmsAdminTpl->assign('modulesadm', 1); } else { $icmsAdminTpl->assign('modulesadm', 0); } /** * Loading options of the current module. */ if ($icmsModule) { if ($icmsModule->getVar('dirname') == 'system') { if (isset($sysprefs) && count($sysprefs) > 0) { // remove the grouping for the system module preferences (first layer) $sysprefs_tmp = array(); foreach ($sysprefs as $pref) { $sysprefs_tmp = array_merge($sysprefs_tmp, $pref['subs']); } $sysprefs = $sysprefs_tmp; unset($sysprefs_tmp); for ($i = count($sysprefs) - 1; $i >= 0; $i = $i - 1) { if (isset($sysprefs[$i])) { $reversed_sysprefs[] = $sysprefs[$i]; } } foreach ($reversed_sysprefs as $k) { $icmsAdminTpl->append('mod_options', array('title' => $k['title'], 'link' => $k['link'], 'icon' => isset($k['icon']) && $k['icon'] != '' ? $k['icon'] : '')); } } } else { foreach ($mods as $mod) { if ($mod['dir'] == $icmsModule->getVar('dirname')) { $m = $mod; //Getting info of the current module break; } } if (isset($m['subs']) && count($m['subs']) > 0) { for ($i = count($m['subs']) - 1; $i >= 0; $i = $i - 1) { if (isset($m['subs'][$i])) { $reversed_module_admin_menu[] = $m['subs'][$i]; } } foreach ($reversed_module_admin_menu as $k) { $icmsAdminTpl->append('mod_options', array('title' => $k['title'], 'link' => $k['link'], 'icon' => isset($k['icon']) && $k['icon'] != '' ? $k['icon'] : '')); } } } $icmsAdminTpl->assign('modpath', ICMS_URL . '/modules/' . $icmsModule->getVar('dirname')); $icmsAdminTpl->assign('modname', $icmsModule->getVar('name')); $icmsAdminTpl->assign('modid', $icmsModule->getVar('mid')); $icmsAdminTpl->assign('moddir', $icmsModule->getVar('dirname')); $icmsAdminTpl->assign('lang_prefs', _PREFERENCES); } if (@is_object($xoTheme->plugins['icms_view_PageBuilder'])) { $aggreg =& $xoTheme->plugins['icms_view_PageBuilder']; $icmsAdminTpl->assign_by_ref('xoAdminBlocks', $aggreg->blocks); // Backward compatibility code for pre 2.0.14 themes $icmsAdminTpl->assign_by_ref('xoops_lblocks', $aggreg->blocks['canvas_left']); $icmsAdminTpl->assign_by_ref('xoops_rblocks', $aggreg->blocks['canvas_right']); $icmsAdminTpl->assign_by_ref('xoops_ccblocks', $aggreg->blocks['page_topcenter']); $icmsAdminTpl->assign_by_ref('xoops_clblocks', $aggreg->blocks['page_topleft']); $icmsAdminTpl->assign_by_ref('xoops_crblocks', $aggreg->blocks['page_topright']); $icmsAdminTpl->assign('xoops_showlblock', !empty($aggreg->blocks['canvas_left'])); $icmsAdminTpl->assign('xoops_showrblock', !empty($aggreg->blocks['canvas_right'])); $icmsAdminTpl->assign('xoops_showcblock', !empty($aggreg->blocks['page_topcenter']) || !empty($aggreg->blocks['page_topleft']) || !empty($aggreg->blocks['page_topright'])); /** * Send to template some ml infos */ $icmsAdminTpl->assign('lang_prefs', _PREFERENCES); $icmsAdminTpl->assign('ml_is_enabled', $icmsConfigMultilang['ml_enable']); $icmsAdminTpl->assign('adm_left_logo', $icmsConfigPersona['adm_left_logo']); $icmsAdminTpl->assign('adm_left_logo_url', $icmsConfigPersona['adm_left_logo_url']); $icmsAdminTpl->assign('adm_left_logo_alt', $icmsConfigPersona['adm_left_logo_alt']); $icmsAdminTpl->assign('adm_right_logo', $icmsConfigPersona['adm_right_logo']); $icmsAdminTpl->assign('adm_right_logo_url', $icmsConfigPersona['adm_right_logo_url']); $icmsAdminTpl->assign('adm_right_logo_alt', $icmsConfigPersona['adm_right_logo_alt']); $icmsAdminTpl->assign('show_impresscms_menu', $icmsConfigPersona['show_impresscms_menu']); } }
$xoopsOption['pagetype'] = 'admin'; include 'mainfile.php'; include ICMS_ROOT_PATH . '/include/cp_functions.php'; // test to see if the system module should be updated, added in 1.2 if (icms_getModuleInfo('system')->getDBVersion() < ICMS_SYSTEM_DBVERSION) { redirect_header('modules/system/admin.php?fct=modulesadmin&op=update&module=system', 1, _CO_ICMS_UPDATE_NEEDED); } $op = isset($_GET['rssnews']) ? (int) $_GET['rssnews'] : 0; if (!empty($_GET['op'])) { $op = (int) $_GET['op']; } if (!empty($_POST['op'])) { $op = (int) $_POST['op']; } if (!file_exists(ICMS_CACHE_PATH . '/adminmenu_' . $icmsConfig['language'] . '.php')) { xoops_module_write_admin_menu(impresscms_get_adminmenu()); } switch ($op) { case 1: icms_cp_header(); showRSS(); break; /* case 2: xoops_module_write_admin_menu(impresscms_get_adminmenu()); redirect_header('javascript:history.go(-1)', 1, _AD_LOGINADMIN); break;*/ /* case 2: xoops_module_write_admin_menu(impresscms_get_adminmenu()); redirect_header('javascript:history.go(-1)', 1, _AD_LOGINADMIN); break;*/ default:
$msgs .= '<br /><span style="font-size:smaller;">' . $mod->getVar('name') . '</span><br /><br />' . _MD_AM_RUSUREUPD; icms_cp_header(); if (icms_getModuleInfo('system')->getDBVersion() < 14 && (!is_writable(ICMS_PLUGINS_PATH) || !is_dir(ICMS_ROOT_PATH . '/plugins/preloads') || !is_writable(ICMS_ROOT_PATH . '/plugins/preloads'))) { icms_core_Message::error(sprintf(_MD_AM_PLUGINSFOLDER_UPDATE_TEXT, ICMS_PLUGINS_PATH, ICMS_ROOT_PATH . '/plugins/preloads'), _MD_AM_PLUGINSFOLDER_UPDATE_TITLE, TRUE); } if (icms_getModuleInfo('system')->getDBVersion() < 37 && !is_writable(ICMS_IMANAGER_FOLDER_PATH)) { icms_core_Message::error(sprintf(_MD_AM_IMAGESFOLDER_UPDATE_TEXT, str_ireplace(ICMS_ROOT_PATH, "", ICMS_IMANAGER_FOLDER_PATH)), _MD_AM_IMAGESFOLDER_UPDATE_TITLE, TRUE); } icms_core_Message::confirm(array('module' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _MD_AM_UPDATE); icms_cp_footer(); exit; } if ($op == 'update_ok') { $ret = array(); $ret[] = icms_module_update($module); $contents = impresscms_get_adminmenu(); if (!xoops_module_write_admin_menu($contents)) { $ret[] = "<p>" . _MD_AM_FAILWRITE . "</p>"; } icms_cp_header(); if (count($ret) > 0) { foreach ($ret as $msg) { if ($msg != '') { echo $msg; } } } echo "<br /><a href='admin.php?fct=modulesadmin'>" . _MD_AM_BTOMADMIN . "</a>"; icms_cp_footer(); exit; }
function altsys_adminmenu_hack_ft_noimg_x20() { // read if (!file_exists(ALTSYS_ADMINMENU_FILE)) { redirect_header(XOOPS_URL . '/admin.php', 1, 'Rebuild adminmenu'); exit; } $not_inside_cp_functions = true; include ALTSYS_ADMINMENU_FILE; // check previous hack if (!empty($altsys_adminmenu_ft_hacked)) { if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_NOIMG) { // skip return; } else { // rebuild adminmenu require_once XOOPS_ROOT_PATH . '/include/cp_functions.php'; xoops_module_write_admin_menu(xoops_module_get_admin_menu()); // backup $xoops_admin_menu_dv $backup_admin_menu_dv = $xoops_admin_menu_dv; // include new adminmenu include ALTSYS_ADMINMENU_FILE; // restore $xoops_admin_menu_dv $xoops_admin_menu_dv = $backup_admin_menu_dv; } } $module_handler =& xoops_gethandler('module'); $mids = array_keys($xoops_admin_menu_ft); foreach ($mids as $mid) { $module =& $module_handler->get($mid); $xoops_admin_menu_ft[$mid] = preg_replace('/\\<img src\\=.*$/', $module->getVar('name') . '</a>', $xoops_admin_menu_ft[$mid]); $xoops_admin_menu_ft[$mid] = '<div style="text-align:' . _GLOBAL_LEFT . ';background-color:#CCC;" title="' . $module->getVar('dirname') . '">' . $xoops_admin_menu_ft[$mid] . '</div>'; $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]); } // write back altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG)); }