예제 #1
0
if (isset($_GET['step']) && $_GET['step'] == 2 || isset($_GET['unattended'])) {
    //unset session, if any
    //    unset($_SESSION);
    //    session_destroy();
    /** HTML_QuickForm Class*/
    require_once 'HTML/QuickForm.php';
    /** HTML_QuickForm Smarty renderer class*/
    require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
    /**ADODB database abstraction class*/
    require_once $path . 'adodb/adodb.inc.php';
    /**ADODB exceptions class*/
    require_once $path . 'adodb/adodb-exceptions.inc.php';
    /**Various tools*/
    require_once $path . 'tools.php';
    if ($_GET['upgrade']) {
        $currentVersion = Installation::checkCurrentVersion();
        $smarty->assign("T_CURRENT_VERSION", $currentVersion);
    }
    //Initialize ADODB
    $ADODB_CACHE_DIR = $path . "adodb/cache";
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $form = new HTML_QuickForm("info_form", "post", $_SERVER['PHP_SELF'] . "?step=2" . ($_GET['upgrade'] ? '&upgrade=1' : ''), "", "class = 'indexForm'", true);
    $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
    //Register this rule for checking user input with our function, eF_checkParameter
    $form->addElement('select', 'db_type', null, array('mysql' => 'MySQL', 'mssql' => 'MSSQL'));
    $form->addRule('db_type', 'Invalid database type', 'checkParameter', 'string');
    //The database type can only be string and is mandatory
    $form->setDefaults(array('db_type' => 'mysql'));
    $form->freeze(array('db_type'));
    //Freeze this element, since it can't change for now
    $form->addElement('text', 'db_host', null, 'class = "inputText"');