Exemplo n.º 1
0
function module_uninstall_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');
    if (!$module_handler->getByDirname($mod)) {
        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.uninstalling.module', $mod);
    $module_log = xoops_module_uninstall($mod);
    $module_log = RMEvents::get()->run_event('rmcommon.module.uninstalled', $module_log, $mod);
    RMFunctions::create_toolbar();
    RMTemplate::get()->add_style('modules.css', 'rmcommon');
    xoops_cp_header();
    $module = new XoopsModule();
    $module->loadInfo($mod, false);
    $log_title = sprintf(__('Uninstall 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();
}
Exemplo n.º 2
0
function module_uninstall_now()
{
    global $xoopsSecurity, $xoopsConfig, $rmTpl, $xoopsDB;
    $dir = RMHttpRequest::post('module', 'string', '');
    if (!$xoopsSecurity->check()) {
        redirectMsg('modules.php', __('Sorry, this operation could not be completed!', 'rmcommon'), 1);
        die;
    }
    $module_handler = xoops_gethandler('module');
    if (!($mod = $module_handler->getByDirname($dir))) {
        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.uninstalling.module', $mod);
    $module_log = xoops_module_uninstall($dir);
    // Remove comments
    $sql = "DELETE FROM " . $xoopsDB->prefix("mod_rmcommon_comments") . " WHERE id_obj='{$dir}'";
    if ($xoopsDB->queryF($sql)) {
        $module_log .= '<br><span class="text-success"><span class="fa fa-check"></span> Comments deleted successfully!</span>';
    } else {
        $module_log .= '<br><span class="text-danger"><span class="fa fa-exclamation-triangle"></span> Comments could not be deleted: ' . $xoopsDB->error() . '</span>';
    }
    // Remove notifications
    $sql = "DELETE FROM " . $xoopsDB->prefix("mod_rmcommon_notifications") . " WHERE element='{$dir}' AND `type`='module'";
    if ($xoopsDB->queryF($sql)) {
        $module_log .= '<br><span class="text-success"><span class="fa fa-check"></span> Notifications deleted successfully!</span>';
    } else {
        $module_log .= '<br><span class="text-danger"><span class="fa fa-exclamation-triangle"></span> Notifications could not be deleted: ' . $xoopsDB->error() . '</span>';
    }
    $module_log = RMEvents::get()->run_event('rmcommon.module.uninstalled', $module_log, $mod);
    //RMFunctions::create_toolbar();
    RMTemplate::get()->add_style('modules.min.css', 'rmcommon');
    RMBreadCrumb::get()->add_crumb(__('Modules Management', 'rmcommon'), 'modules.php');
    RMBreadCrumb::get()->add_crumb(sprintf(__('%s install log', 'rmcommon'), $mod->getVar('name')));
    $rmTpl->assign('xoops_pagetitle', sprintf(__('%s install log', 'rmcommon'), $mod->getVar('name')));
    xoops_cp_header();
    $module = new XoopsModule();
    $module->loadInfo($mod, false);
    $log_title = sprintf(__('Uninstall log for %s', 'rmcommon'), $module ? $module->getInfo('name') : $mod);
    $action = rmc_server_var($_POST, 'action', '');
    include RMTemplate::get()->get_template('rmc-modules-log.php', 'module', 'rmcommon');
    xoops_cp_footer();
}