Example #1
0
            exit_with_message($msg->_('first-manager-created'));
        } else {
            include 'newmanager.html.php';
        }
    } else {
        // database hasn't been created yet
        $fields = array('root_username' => '', 'db_name' => '', 'db_username' => '');
        if (req_data('POST', 'action') === 'setupdb') {
            $model = new Model($first_run = true);
            $GLOBALS['dbsetuperror'] = '';
            $db_data = array();
            foreach ($fields as $f => $v) {
                $db_data[$f] = $fields[$f] = trim(req_data('POST', $f));
            }
            $db_data['db_password'] = req_data('POST', 'db_password');
            $db_data['root_password'] = req_data('POST', 'root_password');
            try {
                $model->setup_database($db_data);
            } catch (Exception $e) {
                $GLOBALS['dbsetuperror'] = 'Error: ' . $e->getMessage();
                include 'setupdb.html.php';
                exit;
            }
            // No errror...
            // Send the user one level up
            header('Location: ..');
        } else {
            include 'setupdb.html.php';
        }
    }
}