function update_locally() { global $xoopsSecurity, $xoopsLogger, $xoopsConfig; $xoopsLogger->activated = false; if (!$xoopsSecurity->check()) { jsonReturn(__('Wrong action!', 'rmcommon'), 1, array(), 0); } $dir = RMHttpRequest::post('module', 'string', ''); $type = RMHttpRequest::post('type', 'string', ''); if ('' == $dir || '' == $type) { jsonReturn(__('Data not valid!', 'rmcommon')); } if ('module' == $type) { if (!is_dir(XOOPS_ROOT_PATH . '/modules/' . $dir)) { jsonReturn(__('Module does not exists!', 'rmcommon')); } xoops_loadLanguage('admin', 'system'); $file = XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/admin/modulesadmin.php'; if (file_exists($file)) { include_once $file; } else { include_once str_replace($xoopsConfig['language'], 'english', $file); } include_once XOOPS_ROOT_PATH . '/modules/system/admin/modulesadmin/modulesadmin.php'; $log = xoops_module_update($dir); jsonReturn(__('Module updated locally', 'rmcommon'), 0, array('log' => $log)); } elseif ('plugin' == $type) { if (!is_dir(XOOPS_ROOT_PATH . '/modules/rmcommon/plugins/' . $dir)) { jsonReturn(__('Plugin does not exists!', 'rmcommon')); } $plugin = new RMPlugin($dir); if ($plugin->isNew()) { jsonReturn(__('Plugin does not exists!', 'rmcommon')); } if (!$plugin->on_update()) { jsonReturn(sprintf(__('Plugins manager could not update the plugin: %s', 'rmcommon'), $plugin->errors())); } jsonReturn(__('Plugin updated locally', 'rmcommon'), 0); } }
function module_update_now() { global $xoopsSecurity, $xoopsConfig; $mod = rmc_server_var($_POST, 'module', ''); if (!$xoopsSecurity->check()) { redirectMsg('modules.php', __('Sorry, this operation could not be completed!', 'rmcommon'), 1); die; } $module_handler = xoops_gethandler('module'); $module = $module_handler->getByDirname($mod); if (!$module) { redirectMsg('modules.php', sprintf(__('Module %s is not installed yet!', 'rmcommon'), $mod), 1); die; } $file = XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/admin/modulesadmin.php'; if (file_exists($file)) { include_once $file; } else { include_once str_replace($xoopsConfig['language'], 'english', $file); } include_once XOOPS_ROOT_PATH . '/modules/system/admin/modulesadmin/modulesadmin.php'; RMEvents::get()->run_event('rmcommon.updating.module', $module); $module_log = xoops_module_update($mod); $module_log = RMEvents::get()->run_event('rmcommon.module.updated', $module_log, $module_log); RMFunctions::create_toolbar(); RMTemplate::get()->add_style('modules.css', 'rmcommon'); xoops_cp_header(); $log_title = sprintf(__('Update log for %s', 'rmcommon'), $module ? $module->getInfo('name') : $mod); $action = rmc_server_var($_POST, 'action', ''); include RMTemplate::get()->get_template('rmc_mod_log.php', 'module', 'rmcommon'); xoops_cp_footer(); }
// Define Stylesheet $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); // Define Breadcrumb and tips $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UPDATE); $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#update'); $xoBreadCrumb->render(); // Display message xoops_confirm(array('module' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _AM_SYSTEM_MODULES_UPDATE); // Call Footer xoops_cp_footer(); break; case 'update_ok': //-------------------------- $ret = array(); $ret[] = xoops_module_update($module); // Flush cache files for cpanel GUIs xoops_load('cpanel', 'system'); XoopsSystemCpanel::flush(); //Set active modules in cache folder xoops_setActiveModules(); // Define main template $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; // Call Header xoops_cp_header(); // Define Stylesheet $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); // Define Breadcrumb and tips $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UPDATE); $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#update');