<?php

/* SYSTEM $Id: domodsql.php,v 1.11 2005/03/23 00:30:24 ajdonnison Exp $ */
##
## Activate or move a module entry
##
$cmd = dPgetParam($_GET, 'cmd', '0');
$mod_id = intval(dPgetParam($_GET, 'mod_id', '0'));
$mod_directory = dPgetParam($_GET, 'mod_directory', '0');
$obj = new CModule();
if ($mod_id) {
    $obj->load($mod_id);
} else {
    $obj->mod_directory = $mod_directory;
}
$ok = @(include_once "{$dPconfig['root_dir']}/modules/{$obj->mod_directory}/setup.php");
if (!$ok) {
    if ($obj->mod_type != 'core') {
        $AppUI->setMsg('Module setup file could not be found', UI_MSG_ERROR);
        if ($cmd == 'remove') {
            $sql = "DELETE FROM modules WHERE mod_id = {$mod_id}";
            db_exec($sql);
            echo db_error();
            $AppUI->setMsg('Module has been removed from the modules list - please check your database for additional tables that may need to be removed', UI_MSG_ERROR);
        }
        $AppUI->redirect();
    }
}
$setupclass = $config['mod_setup_class'];
if (!$setupclass) {
    if ($obj->mod_type != 'core') {
示例#2
0
                CAppUI::setMsg("Installation de '%s' à la version %s", UI_MSG_OK, $module->mod_name, $setup->mod_version);
            } else {
                CAppUI::setMsg("Installation de '{$module->mod_name}' à la version {$module->mod_version} sur {$setup->mod_version}", UI_MSG_WARNING, true);
            }
        } else {
            CAppUI::setMsg("Module '%s' non mis à jour", UI_MSG_WARNING, $module->mod_name);
        }
    }
    // In case the setup has added some user prefs
    CAppUI::buildPrefs();
    error_reporting($old_er);
    CAppUI::redirect();
}
$module = new CModule();
if ($mod_id) {
    $module->load($mod_id);
    $module->checkModuleFiles();
} else {
    $module->mod_version = "all";
    $module->mod_name = $mod_name;
}
if (!class_exists($setupclass = "CSetup{$module->mod_name}")) {
    if ($module->mod_type != "core" && !$module->_files_missing) {
        CAppUI::setMsg("CModule-msg-no-setup", UI_MSG_ERROR);
        CAppUI::redirect();
    }
}
if ($module->mod_type == "core" && in_array($cmd, array("remove", "install", "toggle"))) {
    CAppUI::setMsg("Core modules can't be uninstalled or disactivated", UI_MSG_ERROR);
    CAppUI::redirect();
}