egroupware/setup/index.php

88 lines
3.5 KiB
PHP

<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
// Idea: This is so I don't forget. When they are preforming a new install, after config,
// forward them right to index.php. Create a session for them and have a nice little intro
// page explaining what to do from there (ie, create there own account)
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", "noapi" => True);
include("./inc/functions.inc.php");
if(!file_exists("../header.inc.php") || !is_file("../header.inc.php")) {
$stage = 1.1;
$header_msg = "Stage One";
}else{
include("../header.inc.php");
if (!isset($phpgw_domain) || $phpgw_info["server"]["header_version"] != $phpgw_info["server"]["current_header_version"]) {
$stage = 1.2;
$header_msg = "Stage One (Upgrade your header.inc.php)";
}else{ /* header.inc.php part settled. Moving to authentication */
$stage = 1.3;
$header_msg = "Stage One (Completed)";
if (!auth()){
show_header("Please login",True);
loginForm($login_msg);
exit;
}else{ /* authentication settled. Moving to the database portion. */
loaddb();
$db->Halt_On_Error = "no";
$db->query("show tables");
if ($db->num_rows()){
/* tables exists. checking for post beta version */
$db->free();
$db->query("select app_version from applications where app_name='admin'");
$db->next_record();
$oldversion = $db->f("app_version");
$db->free();
if (isset($oldversion)){
if ($oldversion == $phpgw_info["server"]["version"]){
$stage = 2.5;
$header_msg = "Stage 2 (Tables are Current)";
}else{
$stage = 2.4;
$header_msg = "Stage 2 (Tables need upgrading)";
}
}else{
$stage = 2.2;
$header_msg = "Stage 2 (Tables appear to be pre-beta)";
}
}else{
/* no tables, so checking if we can create them */
$db->free();
$isdb = $db->connect("kljkjh", "localhost", "phpgroupware", "phpgr0upwar3");
echo "isdb: ".$isdb."<br>\n";
$db->free();
$db_rights = $db->query("CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )");
echo "db_rights: ".$db_rights."<br>\n";
if (isset($db_rights)){
$stage = 2.3;
$header_msg = "Stage 2 (Create tables)";
}else{
$stage = 2.1;
$header_msg = "Stage 2 (Create Database)";
}
$db->query("DROP TABLE phpgw_testrights");
}
} /* from authentication check */
} /* from header version check */
} /* From header.inc.php not existing */
show_header($header_msg);
show_steps($stage);
?>
</body>
</html>