<?php
/*
** Aratix
** Version 0.2.2beta9 (Anubis)
**
** Autor: Manuel Burghammer
** E-Mail: hide@address.com
** Homepage: http://www.xitara.net
**
** File: index.php - Version 0.2.2 build 2
** Position: /setup/
** Last Modified: 03.04.2006 - 23:01:25
*/
define('ARATIX_SETUP', 1);
$debug_level = 0;
//php_sapi_name() feststellen ob CGI oder nicht
$current_path = dirname(__FILE__) . "/../";
if(($page = $_GET['page']) != $_GET['database'] || $_GET['page'] == ""){
if($_GET['database'] == "" && $page == "")
$page = "index";
else if($page == "")
$page = $_GET['database'];
}
include $current_path . 'inc/init.inc.php';
if(!isset($debug))
$debug = new Debug($debug_level);
// if(file_exists($current_path . "inc/mysql.conf.php")){
// include($current_path . "inc/mysql.conf.php");
// $db->connect($db_host, $db_user, $db_pass);
// $db->select_db($db_base);
// }
$content->template_dir = $current_path . "setup/templates";
$content->compile_dir = $current_path . "setup/templates_c";
echo <<<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Aratix - Setup</title>
<link rel="stylesheet" type="text/css" href="css/global.css" />
</head>
<body>
EOF;
if(get('language'))
$content->assign("language", get('language'));
if($page == get('database')){
if(is_writeable('../inc'))
$content->assign("can_write", TRUE);
else
$content->assign("can_write", FALSE);
}
if(file_exists('../inc/config.inc.php'))
$content->assign("file_written_config", TRUE);
if(get('db_pref') && !file_exists('../inc/config.inc.php')){
$file = implode(file('config.inc'));
$file = ereg_replace("{PREFIX}", get('db_pref'), $file);
$file = ereg_replace("{DATABASE}", get('database'), $file);
$handle = fopen('../inc/config.inc.php', 'w');
fwrite($handle, $file);
fclose($handle);
chmod('../inc/config.inc.php', 0644);
if($handle)
$content->assign("file_written_config", TRUE);
else
$error_flag = TRUE;
}
if(get('database'))
include(get('database') . ".inc.php");
else if(get('page'))
include(get('page') . ".inc.php");
$content->display('header.tpl');
$content->display($page . '.tpl');
$content->display('footer.tpl');
echo <<<EOF
</body>
</html>
EOF;
?>