$temp_name = $module->getVar('name'); $module->loadInfoAsVar($dirname); $module->setVar('name', $temp_name); xoops_cp_header(); if (!$module_handler->insert($module)) { echo '<p>Could not update ' . $module->getVar('name') . '</p>'; echo "<br /><a href='admin.php?fct=modulesadmin'>" . _MD_AM_BTOMADMIN . "</a>"; } else { $newmid = $module->getVar('mid'); $msgs = array(); $msgs[] = 'Module data updated.'; $msgs[] = '@TODO-2.3: Delete cached output from the templates cache on module ins/upd/uninst... :-)'; // Clear the db: resource handler cache global $xoops; @unlink($xoops->path('var/Caches/xoops_template_Smarty/dbhandler-list.php')); $contents = xoops_module_get_admin_menu(); if (!xoops_module_write_admin_menu($contents)) { $msgs[] = '<p><span style="color:#ff0000;">' . _MD_AM_FAILWRITE . '</span></p>'; } $blocks = $module->getInfo('blocks'); $msgs[] = 'Rebuilding blocks...'; if ($blocks != false) { $count = count($blocks); $showfuncs = array(); $funcfiles = array(); for ($i = 1; $i <= $count; $i++) { if (isset($blocks[$i]['show_func']) && $blocks[$i]['show_func'] != '' && isset($blocks[$i]['file']) && $blocks[$i]['file'] != '') { $editfunc = isset($blocks[$i]['edit_func']) ? $blocks[$i]['edit_func'] : ''; $showfuncs[] = $blocks[$i]['show_func']; $funcfiles[] = $blocks[$i]['file']; $content = '';
} $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 altsys_adminmenu_hack_ft_xcsty_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_XCSTY && empty($altsys_adminmenu_dv_updated)) { // skip return; } else { // rebuild adminmenu require_once XOOPS_ROOT_PATH . '/include/cp_functions.php'; $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb'); fwrite($fp, xoops_module_get_admin_menu()); fclose($fp); // 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); $submenuitems = array(); if (preg_match('/popUpL\\d+/', $xoops_admin_menu_ft[$mid], $regs)) { $popup = $regs[0]; preg_match_all('#\\<a href.*' . $popup . '\\(\\).*\\</a>#U', $xoops_admin_menu_dv, $regs); foreach ($regs[0] as $submenuitem) { $submenuitems[] = str_replace($popup . '();', '', $submenuitem); } } else { return; } // module icon if (preg_match('#\\<img .*/\\>#U', $xoops_admin_menu_ft[$mid], $regs)) { $icon_img = str_replace("alt=''", 'alt="' . $module->getVar('name') . '"', $regs[0]); } else { $icon_img = ''; } // version number $icon_img .= '<span class="version" style="">' . sprintf('%.2f', $module->getVar('version') / 100.0) . '</span>'; $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]); $newline = "\n" . '<!-- ' . $popup . ' --><div id="adminmenu_ft' . $mid . '" style="text-align:' . _GLOBAL_LEFT . ';background-color:#CCC;" title="' . $module->getVar('dirname') . '"><a id="adminmenu_ftpoint' . $mid . '" href="javascript:void(0);" onclick="submenuToggle(' . $mid . ');">+</a> ' . $newline . '>' . $module->getVar('name') . '</a></div><div id="adminmenu_ftsub' . $mid . '" style="display:none;"><ul>'; foreach ($submenuitems as $submenuitem) { $newline .= '<li>' . $submenuitem . '</li>'; } $newline .= '</ul>' . $icon_img . '</div>'; $xoops_admin_menu_ft[$mid] = $newline; } $xoops_admin_menu_js = "\n\tfunction submenuToggle(mid) {\n\t\tel = xoopsGetElementById('adminmenu_ftsub'+mid).style;\n\t\tif (el.display == 'block') {\n\t\t\tel.display = 'none';\n\t\t\txoopsGetElementById('adminmenu_ftpoint'+mid).innerHTML = '+' ;\n\t\t} else {\n\t\t\tel.display = 'block';\n\t\t\txoopsGetElementById('adminmenu_ftpoint'+mid).innerHTML = '-' ;\n\t\t}\n\t}"; // write back altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY)); }