/** * Connects to the database */ private static function _database_connect() { $params = self::$_data['database']; self::$_connection = mysql_connect($params['host'], $params['user'], $params['pass'], TRUE); if (!self::$_connection) { self::$_errors[] = sprintf("Connection error: <strong>%s</strong>", mysql_error()); return FALSE; } $database_name = $params['database']; if (!mysql_select_db($database_name)) { if (self::_execute_query(sprintf("CREATE DATABASE %s", self::_escape_str($database_name)))) { mysql_select_db($database_name, self::$_connection); } else { self::$_errors[] = sprintf("Error creating database: %s", mysql_error()); } } }
<?php /** * This file acts as the bootstrap for the installer. * It forwards all HTTP requests to the Install_Wizard class * * @copyright Ushahidi Inc <http://www.ushahidi.com> */ // Define absolute paths for the root and installation directories define('ROOT_DIR', realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR); define('INSTALLER_DIR', ROOT_DIR . 'installer' . DIRECTORY_SEPARATOR); define('INSTALLER_PAGES', INSTALLER_DIR . 'pages' . DIRECTORY_SEPARATOR); require INSTALLER_DIR . 'wizard.php'; require INSTALLER_DIR . 'utils.php'; // Bootstrap the installer Installer_Wizard::init(); if ($_POST) { if (isset($_POST['previous'])) { Installer_Wizard::previous(); } else { // Show the next step Installer_Wizard::next(); } }