예제 #1
0
 $tpl->assign('drivers', $drivers);
 if (!empty($db_driver) && !empty($db_server) && !empty($db_name) && !empty($db_user)) {
     // Test the given settings, bypass platform initially
     include_once DEVBLOCKS_PATH . "libs/adodb5/adodb.inc.php";
     $ADODB_CACHE_DIR = APP_PATH . "/tmp/cache";
     @($db =& ADONewConnection($db_driver));
     @$db->Connect($db_server, $db_user, $db_pass, $db_name);
     $tpl->assign('db_driver', $db_driver);
     $tpl->assign('db_server', $db_server);
     $tpl->assign('db_name', $db_name);
     $tpl->assign('db_user', $db_user);
     $tpl->assign('db_pass', $db_pass);
     // If passed, write config file and continue
     if (!is_null($db) && $db->IsConnected()) {
         // [TODO] Write database settings to framework.config.php
         $result = CerberusInstaller::saveFrameworkConfig($db_driver, $db_server, $db_name, $db_user, $db_pass);
         // [JAS]: If we didn't save directly to the config file, user action required
         if (0 != strcasecmp($result, 'config')) {
             $tpl->assign('result', $result);
             $tpl->assign('config_path', realpath(APP_PATH . "/framework.config.php"));
             $tpl->assign('template', 'steps/step_config_file.tpl.php');
         } else {
             // skip the config writing step
             $tpl->assign('step', STEP_INIT_DB);
             $tpl->display('steps/redirect.tpl.php');
             exit;
         }
     } else {
         // If failed, re-enter
         $tpl->assign('failed', true);
         $tpl->assign('template', 'steps/step_database.tpl.php');