// Define neccessary variables and constantes for the system
$queries_count = 0;
define('DB_PREFIX', $d_pre);
// Initialize a connection to the mysql database
$sqlConnection = new Sql($d_user, $d_pw, $d_server);
$sqlConnection->Connect($d_base);
// Load all configuration saved in the mysql database
$config = new Config(&$sqlConnection);
$config->LoadAll();
// Initialize the translation of short texts in the system
$translation = new Language(&$sqlConnection);
$translation->AddSources(__ROOT__ . '/lang');
// Create a new user class
$user = new Account(&$sqlConnection, &$translation, &$config);
// Load the comascript interpreter for the html output, set document and style information
$output = new ComaLate();
$output->SetDoctype(DOCTYPE_XHTML_TRANSITIONAL);
$styleName = $config->Get('style', 'default');
$headerStyleName = GetPostOrGet('style');
if (!empty($headerStyleName)) {
    $styleName = $headerStyleName;
}
$output->LoadTemplate('./styles/', $styleName);
$output->SetMeta('generator', 'ComaCMS v0.2 (http://comacms.berlios.de)');
// Set page conditions
$output->SetCondition('notinadmin', true);
// Try to get a name of the requested page
if (!isset($page) && substr($_SERVER['PHP_SELF'], -9) == 'index.php') {
    $page = $config->Get('default_page', 'home');
} elseif (!isset($page)) {
    $page = '';
include 'classes/config.php';
include 'classes/user.php';
include 'classes/inlinemenu.php';
include 'classes/module.php';
include 'functions.php';
include 'lib/comalate/comalate.class.php';
$lib = new ComaLib();
$extern_page = GetPostOrGet('page');
$queries_count = 0;
define('DB_PREFIX', $d_pre);
$sqlConnection = new Sql($d_user, $d_pw, $d_server);
$sqlConnection->Connect($d_base);
$config = new Config();
$config->LoadAll();
$user = new User($sqlConnection);
$output = new ComaLate();
$styleName = $config->Get('style', 'default');
$headerStyleName = GetPostOrGet('style');
if (!empty($headerStyleName)) {
    $styleName = $headerStyleName;
}
$output->LoadTemplate('./styles/', $styleName);
$output->SetMeta('generator', 'ComaCMS v0.2 (http://comacms.berlios.de)');
$output->SetCondition('notinadmin', true);
if (!isset($extern_page) && endsWith($_SERVER['PHP_SELF'], 'index.php')) {
    $extern_page = $config->Get('default_page', 'home');
} elseif (!isset($extern_page)) {
    $extern_page = '';
}
if (startsWith($extern_page, 'a:')) {
    header('Location: admin.php?page=' . substr($extern_page, 2));
require_once __ROOT__ . '/classes/comalib.php';
require_once __ROOT__ . '/classes/sql.php';
require_once __ROOT__ . '/functions.php';
require_once __ROOT__ . '/lib/comalate/comalate.class.php';
require_once __ROOT__ . '/install/install.class.php';
// ComaLib
$lib = new ComaLib();
// SqlConnection to prevent errors
$sqlConnection = new Sql('', '', '');
// Get style for the page
$extern_style = GetPostOrGet('style');
if (empty($extern_style)) {
    $extern_style = 'comacms';
}
// ComaLate for output replacements and template support
$output = new ComaLate();
$output->LoadTemplate('../styles/', $extern_style);
$output->AddCssFile('./install.css');
$output->SetMeta('generator', 'ComaCMS v0.2 (http://comacms.berlios.de)');
$output->SetCondition('notinadmin', true);
$output->SetCondition('notathome', true);
$output->Title = 'ComaCMS - Installation';
// Get the actual subpage of the installation
$extern_page = 1;
$extern_page = GetPostOrGet('page');
// Check external page
if (!is_numeric($extern_page)) {
    $extern_page = 1;
}
// Local language variable
$language = '';