mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
cleaned up code, removed unneeded files. I have moved all the real processing to the functions.php where it belongs, and moved the display code to the index.php where it belongs
This commit is contained in:
parent
daa61a7a60
commit
e9b3af544d
@ -23,6 +23,14 @@
|
||||
}
|
||||
loaddb();
|
||||
|
||||
/* Guessing default paths. */
|
||||
$current_config["files_dir"] = ereg_replace("/setup","/files",dirname($SCRIPT_FILENAME));
|
||||
if (is_dir("/tmp")){
|
||||
$current_config["temp_dir"] = "/tmp";
|
||||
}else{
|
||||
$current_config["temp_dir"] = "/path/to/temp/dir";
|
||||
}
|
||||
|
||||
if ($submit) {
|
||||
@$db->query("delete from config");
|
||||
while ($newsetting = each($newsettings)) {
|
||||
|
@ -1,231 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Core Setup *
|
||||
* 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. *
|
||||
* -------------------------------------------- *
|
||||
* This file handles the setup for the core of phpGroupWare, *
|
||||
* it DOES NOT currently follow the Setup class' model because it wants *
|
||||
* to interct with the user. This will be fixed at some point in the *
|
||||
* (hopefully) near future. *
|
||||
* An upgrade or install of the core will _always_ happen before *
|
||||
* any of the additional applications are dealt with. *
|
||||
* *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
// $ok is chacked after including this file,
|
||||
// if false then no additional work is performed.
|
||||
// if true, ../index.php falls through to app setup
|
||||
$ok = true;
|
||||
|
||||
$basedir = $phpgw_info["server"]["server_root"]."/setup";
|
||||
|
||||
if (!isset($oldversion)){
|
||||
@$db->query("select app_version from applications where app_name='admin'");
|
||||
@$db->next_record();
|
||||
$oldversion = $db->f("app_version");
|
||||
}
|
||||
|
||||
if ($action != "Delete my old tables" && ! isset($oldversion)) {
|
||||
setup_header();
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
if (PHP_VERSION < "3.0.16") {
|
||||
echo "You appear to be running an old version of PHP. It its recommend that you upgrade "
|
||||
. "to a new version. Older version of PHP might not run phpGroupWare correctly, if at all.";
|
||||
}
|
||||
|
||||
/* Database setup */
|
||||
switch($action){
|
||||
case "regularversion":
|
||||
echo "<html><head><title>phpGroupWare Setup</title></head>\n";
|
||||
echo "<body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Analysis</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>You appear to be running version $oldversion of phpGroupWare.<br>\n";
|
||||
echo " We will automaticly update your tables/records to ".$phpgw_info["server"]["version"].", but we highly recommend backing up your tables incase the script causes damage to your data.\n";
|
||||
echo " These automated scripts can easily destroy your data. Please backup before going any further!</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>";
|
||||
echo " <form method=\"POST\" action=\"$PHP_SELF\">\n";
|
||||
echo " <input type=\"hidden\" name=\"oldversion\" value=\"".$oldversion."\">\n";
|
||||
echo " <input type=\"hidden\" name=\"useglobalconfigsettings\">\n";
|
||||
echo " <input type=\"submit\" name=\"action\" value=\"Upgrade\">\n";
|
||||
echo " <input type=\"submit\" name=\"action\" value=\"Delete my old tables\">\n";
|
||||
echo " </form>\n";
|
||||
echo " <form method=\"POST\" action=\"config.php\">\n";
|
||||
echo " <input type=\"submit\" name=\"action\" value=\"Dont touch my data\">\n";
|
||||
echo " </form>\n";
|
||||
echo " </td>";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</body></html>\n";
|
||||
// Prevent app setup from running
|
||||
$ok = false;
|
||||
|
||||
break;
|
||||
case "prebetaversion":
|
||||
echo "<html><head><title>phpGroupWare Setup</title></head>\n";
|
||||
echo "<body bgcolor='#ffffff'>\n";
|
||||
echo "<body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Analysis</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>You appear to be running a pre-beta version of phpGroupWare<br>\n";
|
||||
echo " We are providing an automated upgrade system, but we highly recommend backing up your tables incase the script causes damage to your data.<br>\n";
|
||||
echo " These automated scripts can easily destroy your data. Please backup before going any further!</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
?>
|
||||
<form method="POST" action="<?php $PHP_SELF?>">
|
||||
<table border="0" align="center">
|
||||
<tr bgcolor="486591">
|
||||
<td colspan="2"><font color="fefefe"> <b>Upgrade information</b></font></td>
|
||||
</tr>
|
||||
<tr bgcolor="e6e6e6">
|
||||
<td>Select your old version:</td>
|
||||
<td>
|
||||
<select name="oldversion">
|
||||
<option value="7122000">7122000</option>
|
||||
<option value="8032000">8032000</option>
|
||||
<option value="8072000">8072000</option>
|
||||
<option value="8212000">8212000</option>
|
||||
<option value="9052000">9052000</option>
|
||||
<option value="9072000">9072000</option>
|
||||
<option value="9262000">9262000</option>
|
||||
<option value="0_9_1">0.9.1</option>
|
||||
<option value="0_9_2">0.9.2</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="e6e6e6">
|
||||
<td>Port old globalconfig settings.</td>
|
||||
<td><input type="checkbox" name="useglobalconfigsettings"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center"><input type="submit" name="action" value="Upgrade"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center"><input type="submit" name="action" value="Delete my old tables"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
// Prevent app setup from running
|
||||
$ok = false;
|
||||
|
||||
break;
|
||||
case "Delete my old tables":
|
||||
echo "<html><head><title>phpGroupWare Setup</title></head>\n";
|
||||
echo "<body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Information</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>At your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format.</td>\n";
|
||||
echo " </tr>\n";
|
||||
$db->Halt_On_Error = "report";
|
||||
$currentver = "drop";
|
||||
include ($basedir."/sql/common_main.inc.php");
|
||||
$db->Halt_On_Error = "no";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Status</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>If you did not recieve any serious errors, your tables have been created.</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
break;
|
||||
case "Upgrade":
|
||||
echo "<html><head><title>phpGroupWare Setup</title></head>\n";
|
||||
echo "<body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Information</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>At your request, this script is going to attempt to upgrade your old tables to the new format.</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
$currentver = $oldversion;
|
||||
$db->Halt_On_Error = "report";
|
||||
include ($basedir."/sql/common_main.inc.php");
|
||||
$db->Halt_On_Error = "no";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Status</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>If you did not recieve any serious errors, your tables *should* have been ";
|
||||
echo " updated (no warranty on data integrity).</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
break;
|
||||
default:
|
||||
if (isset($oldversion)){
|
||||
if ($phpgw_info["server"]["version"] != $oldversion){
|
||||
Header("Location: $PHP_SELF?action=regularversion");
|
||||
$ok = false;
|
||||
}
|
||||
}else{
|
||||
@$db->query("select * from config");
|
||||
if (@$db->num_rows() == 0){
|
||||
@$db->query("select * from accounts");
|
||||
if (@$db->num_rows() == 0){
|
||||
echo "<html><head><title>phpGroupWare Setup</title></head>\n";
|
||||
echo "<body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Analysis</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>You appear to be running a new install of phpGroupWare, so the tables will be created for you.</td>\n";
|
||||
echo " </tr>\n";
|
||||
$db->Halt_On_Error = "report";
|
||||
$currentver = "new";
|
||||
include ($basedir."/sql/common_main.inc.php");
|
||||
$db->Halt_On_Error = "no";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Status</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>If you did not recieve any errors, your tables have been created.<br>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
}else{
|
||||
Header("Location: $PHP_SELF?action=prebetaversion");
|
||||
$ok = false;
|
||||
}
|
||||
}else{
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b> phpGroupware Core Analysis</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>Your database seems to be current.</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ok) {
|
||||
echo "</body></html>";
|
||||
}
|
||||
|
||||
// Leave php close tag off, don't want to mess up later Header() calls
|
@ -22,41 +22,32 @@
|
||||
}
|
||||
$phpgw_info["server"]["current_header_version"] = "1.4";
|
||||
|
||||
function show_header($title = "",$nologoutbutton = False) {
|
||||
function show_header($title = "",$nologoutbutton = False)
|
||||
{
|
||||
global $phpgw_info, $PHP_SELF;
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpGroupWare Setup
|
||||
<?php
|
||||
if ($title != ""){echo " - ".$title;} ?>
|
||||
</title>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
.link
|
||||
{
|
||||
color: #FFFFFF;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" marginright="0" marginbottom="0">
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version <?php
|
||||
echo $phpgw_info["server"]["version"]; ?> setup</font>
|
||||
echo '
|
||||
<html>
|
||||
<head>
|
||||
<title>phpGroupWare Setup';
|
||||
if ($title != ""){echo " - ".$title;}
|
||||
echo'</title>
|
||||
<style type="text/css"><!-- .link { color: #FFFFFF; } --></style>
|
||||
</head>
|
||||
<BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" marginright="0" marginbottom="0">
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version '.$phpgw_info["server"]["version"].' setup</font>
|
||||
</td>
|
||||
<td align="right" bgcolor="486591">
|
||||
<?php
|
||||
if ($nologoutbutton) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo '<a href="' . $PHP_SELF . '?FormLogout=True" class="link">Logout</a> ';
|
||||
}
|
||||
|
||||
echo "</td></tr></table>";
|
||||
<td align="right" bgcolor="486591">';
|
||||
if ($nologoutbutton) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo '<a href="' . $PHP_SELF . '?FormLogout=True" class="link">Logout</a> ';
|
||||
}
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
function loginForm($err=""){
|
||||
function loginForm($err="")
|
||||
{
|
||||
global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPW, $PHP_SELF;
|
||||
echo "<p><body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
@ -83,7 +74,44 @@
|
||||
echo "</table>\n";
|
||||
echo "</body></html>\n";
|
||||
}
|
||||
function auth(){
|
||||
|
||||
function check_header()
|
||||
{
|
||||
global $phpgw_domain, $phpgw_info, $stage, $header_msg;
|
||||
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)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generate_header(){
|
||||
Global $SCRIPT_FILENAME, $HTTP_POST_VARS, $k, $v;
|
||||
$ftemplate = fopen(dirname($SCRIPT_FILENAME)."/../header.inc.php.template","r");
|
||||
if($ftemplate){
|
||||
$ftemplate = fopen(dirname($SCRIPT_FILENAME)."/../header.inc.php.template","r");
|
||||
$template = fread($ftemplate,filesize(dirname($SCRIPT_FILENAME)."/../header.inc.php.template"));
|
||||
fclose($ftemplate);
|
||||
while(list($k,$v) = each($HTTP_POST_VARS)) {
|
||||
$template = ereg_replace("__".strtoupper($k)."__",$v,$template);
|
||||
}
|
||||
return $template;
|
||||
}else{
|
||||
echo "Could not open the header template for reading!<br>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
function auth()
|
||||
{
|
||||
global $phpgw_domain, $FormLogout, $FormDomain, $FormPW, $SetupPW, $SetupDomain, $db, $HTTP_POST_VARS, $login_msg;
|
||||
if (isset($FormLogout)) {
|
||||
setcookie("SetupPW"); // scrub the old one
|
||||
@ -114,7 +142,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function loaddb(){
|
||||
function loaddb()
|
||||
{
|
||||
global $phpgw_info, $phpgw_domain, $SetupDomain, $db;
|
||||
/* Database setup */
|
||||
$phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi";
|
||||
@ -128,174 +157,54 @@
|
||||
|
||||
}
|
||||
|
||||
function show_steps($stage, $note = False) {
|
||||
global $phpgw_info, $phpgw_domain, $SetupDomain, $oldversion, $currentver, $db, $subtitle, $submsg, $subaction;
|
||||
/* The stages are as follows:
|
||||
Stage 1.1 = header does not exists yet
|
||||
Stage 1.2 = header exists, but is the wrong version
|
||||
Stage 1.3 = header exists and is current
|
||||
Stage 2.1 = database does not exists yet
|
||||
Stage 2.2 = database exists pre-beta tables
|
||||
Stage 2.3 = database exists but no tables
|
||||
Stage 2.4 = database and tables exists but need upgrading
|
||||
Stage 2.5 = tables being modified in some way
|
||||
Stage 2.6 = database and tables exists and are current
|
||||
Stage 3.1 = configuration has not been done
|
||||
Stage 3.2 = configuration has been completed
|
||||
Stage 4.1 = install new language
|
||||
Stage 5.1 = something to do with the add-on applications
|
||||
Stage 5.2 =
|
||||
*/
|
||||
|
||||
echo '<table border="1" width="100%" cellspacing="0" cellpadding="2">';
|
||||
echo ' <tr><td align="left" WIDTH="20%" bgcolor="486591"><font color="fefefe">Step 1 - header.inc.php</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage == 1.1) {
|
||||
echo '<tr><td align="center">O</td><td><form action="./createheader.php" method=post>You have not created your header.inc.php yet.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
}elseif ($stage == 1.2) {
|
||||
echo '<tr><td align="center">O</td><td><form action="./createheader.php" method=post>Your header.inc.php is out of date. Please upgrade it.<br> <input type=submit value="Upgrade now"></form></td></tr>';
|
||||
}elseif ($stage >= 1.3) {
|
||||
echo '<tr><td align="center">X</td><td><form action="./createheader.php" method=post>
|
||||
Your header.inc.php is in place and current.<br> <input type=submit value="Edit existing header.inc.php"></form></td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 2 - database management</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 2.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 2.1) {
|
||||
echo '<tr><td align="center">O</td><td><form action="./tables.php" method=post>Your database does not exist.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
}elseif ($stage == 2.2) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo '
|
||||
You appear to be running a pre-beta version of phpGroupWare<br>
|
||||
We are providing an automated upgrade system, but we highly recommend backing up your tables incase the script causes damage to your data.<br>
|
||||
These automated scripts can easily destroy your data. Please backup before going any further!<br>
|
||||
<form method="post" action="tables.php">
|
||||
Select your old version:
|
||||
<select name="oldversion">
|
||||
<option value="7122000">7122000</option>
|
||||
<option value="8032000">8032000</option>
|
||||
<option value="8072000">8072000</option>
|
||||
<option value="8212000">8212000</option>
|
||||
<option value="9052000">9052000</option>
|
||||
<option value="9072000">9072000</option>
|
||||
<option value="9262000">9262000</option>
|
||||
<option value="0_9_1">0.9.1</option>
|
||||
<option value="0_9_2">0.9.2</option>
|
||||
</select>
|
||||
<input type="submit" name="action" value="Upgrade">
|
||||
<input type="submit" name="action" value="Delete my old tables">
|
||||
</form>';
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 2.3) {
|
||||
/* commented out because I cannot accuratly figure out if the DB exists */
|
||||
//echo '<tr><td align="center">O</td><td><form action="./tables.php" method=post>Your database exist, would you like to create your tables now?<br> <input type=submit value="Create tables"></form></td></tr>';
|
||||
echo '<tr><td align="center">O</td><td>Make sure that your database is created and the account permissions are set.<br>';
|
||||
if ($phpgw_domain[$SetupDomain]["db_type"] == "mysql"){
|
||||
echo "
|
||||
<br>Instructions for creating the database in MySQL:<br>
|
||||
Login to mysql -<br>
|
||||
<i>[user@server user]# mysql -u root -p</i><br>
|
||||
Create the empty database and grant user permissions -<br>
|
||||
<i>mysql> create database phpgroupware;</i><br>
|
||||
<i>mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i><br>
|
||||
";
|
||||
}elseif ($phpgw_domain[$SetupDomain]["db_type"] == "pgsql"){
|
||||
echo "
|
||||
<br>Instructions for creating the database in PostgreSQL:<br>
|
||||
Start the postmaster<br>
|
||||
<i>[user@server user]# postmaster -i -D /home/[username]/[dataDir]</i><br>
|
||||
Create the empty database -<br>
|
||||
<i>[user@server user]# createdb phpgroupware</i><br>
|
||||
";
|
||||
function check_db()
|
||||
{
|
||||
global $phpgw_info, $oldversion, $db, $stage, $header_msg;
|
||||
$db->Halt_On_Error = "no";
|
||||
$tables = $db->table_names();
|
||||
if (is_array($tables) && count($tables) > 0){
|
||||
/* tables exists. checking for post beta version */
|
||||
$db->query("select app_version from applications where app_name='admin'");
|
||||
$db->next_record();
|
||||
$oldversion = $db->f("app_version");
|
||||
if (isset($oldversion)){
|
||||
if ($oldversion == $phpgw_info["server"]["version"]){
|
||||
$db->query("select config_value from config where config_name='freshinstall'");
|
||||
$db->next_record();
|
||||
$configed = $db->f("config_value");
|
||||
if ($configed){
|
||||
$stage = 3.1;
|
||||
$header_msg = "Stage 3 (Needs Configuration)";
|
||||
}else{
|
||||
$stage = 3.2;
|
||||
$header_msg = "Stage 3 (Configuration OK)";
|
||||
}
|
||||
}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)";
|
||||
}
|
||||
echo '<form action="./tables.php" method=post>';
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"new\">\n";
|
||||
echo 'Once the database is setup correctly <br><input type=submit name="action" value="Create"> the tables</form></td></tr>';
|
||||
}elseif ($stage == 2.4) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo "You appear to be running version $oldversion of phpGroupWare.<br>\n";
|
||||
echo "We will automaticly update your tables/records to ".$phpgw_info["server"]["version"].", but we highly recommend backing up your tables in case the script causes damage to your data.\n";
|
||||
echo "These automated scripts can easily destroy your data. Please backup before going any further!\n";
|
||||
echo "<form method=\"POST\" action=\"tables.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"".$oldversion."\">\n";
|
||||
echo "<input type=\"hidden\" name=\"useglobalconfigsettings\">\n";
|
||||
echo "<input type=\"submit\" name=\"action\" value=\"Upgrade\">\n";
|
||||
echo "<input type=\"submit\" name=\"action\" value=\"Delete my old tables\">\n";
|
||||
echo "</form>\n";
|
||||
echo "<form method=\"POST\" action=\"config.php\">\n";
|
||||
echo "<input type=\"submit\" name=\"action\" value=\"Dont touch my data\">\n";
|
||||
echo "</form>\n";
|
||||
echo '</td></tr>';
|
||||
}
|
||||
if ($stage == 2.5) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo "<table width=\"100%\">\n";
|
||||
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\"> <b>$subtitle</b></font></td></tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\"><td>$submsg</td></tr>\n";
|
||||
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\"> <b>Table Change Messages</b></font></td></tr>\n";
|
||||
$db->Halt_On_Error = "report";
|
||||
include ("./sql/common_main.inc.php");
|
||||
$db->Halt_On_Error = "no";
|
||||
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\"> <b>Status</b></font></td></tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\"><td>If you did not recieve any errors, your tables have been $subaction.<br></tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<form method=\"POST\" action=\"tables.php\">\n";
|
||||
echo "<br><input type=\"submit\" value=\"Re-Check My Installation\">\n";
|
||||
echo '</form>';
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage >= 2.6) {
|
||||
echo '<tr><td align="center">X</td><td>Your tables are current.';
|
||||
echo "<form method=\"POST\" action=\"tables.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"new\">\n";
|
||||
echo "<br>Insanity: <input type=\"submit\" name=\"action\" value=\"Delete all my tables and data\">\n";
|
||||
echo '</form>';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 3 - Configuration</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 3.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 3.1) {
|
||||
echo '<tr><td align="center">O</td><td>Please phpGroupWare for your environment.';
|
||||
echo "<form method=\"POST\" action=\"config.php\"><input type=\"submit\" value=\"Configure Now\"></form>";
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 3.2) {
|
||||
echo '<tr><td align="center">X</td><td>Configuration completed.';
|
||||
echo "<form method=\"POST\" action=\"config.php\"><input type=\"submit\" value=\"Edit Current Configuration\"></form>";
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 4 - language management</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 4.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 4.1) {
|
||||
echo '<tr><td align="center">O</td><td>stage 4.1.<br></td></tr>';
|
||||
}elseif ($stage == 4.2) {
|
||||
echo '<tr><td align="center">O</td><td>stage 4.2.<br></td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 5 - Add-on Application Installation</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 5.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 5.1) {
|
||||
echo '<tr><td align="center">O</td><td>stage 5.1.<br></td></tr>';
|
||||
}elseif ($stage == 5.2) {
|
||||
echo '<tr><td align="center">O</td><td>stage 5.2.<br></td></tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
function generate_header(){
|
||||
Global $SCRIPT_FILENAME, $HTTP_POST_VARS, $k, $v;
|
||||
$ftemplate = fopen(dirname($SCRIPT_FILENAME)."/../header.inc.php.template","r");
|
||||
if($ftemplate){
|
||||
$ftemplate = fopen(dirname($SCRIPT_FILENAME)."/../header.inc.php.template","r");
|
||||
$template = fread($ftemplate,filesize(dirname($SCRIPT_FILENAME)."/../header.inc.php.template"));
|
||||
fclose($ftemplate);
|
||||
while(list($k,$v) = each($HTTP_POST_VARS)) {
|
||||
$template = ereg_replace("__".strtoupper($k)."__",$v,$template);
|
||||
}
|
||||
return $template;
|
||||
}else{
|
||||
echo "Could not open the header template for reading!<br>";
|
||||
exit;
|
||||
/* no tables, so checking if we can create them */
|
||||
|
||||
/* I cannot get either to work properly
|
||||
$isdb = $db->connect("kljkjh", "localhost", "phpgroupware", "phpgr0upwar3");
|
||||
*/
|
||||
|
||||
$db_rights = $db->query("CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )");
|
||||
|
||||
if (isset($db_rights)){
|
||||
//if (isset($isdb)){
|
||||
$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");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,140 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Setup *
|
||||
* 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$ */
|
||||
|
||||
// Include to check user authorization against the
|
||||
// password in ../header.inc.php to protect all of the setup
|
||||
// pages from unauthorized use.
|
||||
|
||||
$phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi";
|
||||
|
||||
function setup_header($title = "",$nologoutbutton = False) {
|
||||
global $phpgw_info, $PHP_SELF, $dontshowtheheaderagain;
|
||||
|
||||
// Ok, so it isn't the greatest idea, but it works for now. Setup needs to be rewritten.
|
||||
if ($dontshowtheheaderagain) {
|
||||
return False;
|
||||
}
|
||||
|
||||
$dontshowtheheaderagain = True;
|
||||
?>
|
||||
|
||||
<head>
|
||||
<title>phpGroupWare setup <?php echo $title; ?></title>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
.link
|
||||
{
|
||||
color: #FFFFFF;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" marginright="0" marginbottom="0">
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td align="left" bgcolor="486591"> <font color="fefefe">phpGroupWare version <?php
|
||||
echo $phpgw_info["server"]["version"]; ?> setup</font>
|
||||
</td>
|
||||
<td align="right" bgcolor="486591">
|
||||
<?php
|
||||
if ($nologoutbutton) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo '<a href="' . $PHP_SELF . '?FormLogout=True" class="link">Logout</a> ';
|
||||
}
|
||||
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
|
||||
function loginForm($err=""){
|
||||
global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPW, $PHP_SELF;
|
||||
|
||||
setup_header("Please login",True);
|
||||
echo "<p><body bgcolor='#ffffff'>\n";
|
||||
echo "<table border=\"0\" align=\"center\">\n";
|
||||
echo " <tr bgcolor=\"486591\">\n";
|
||||
echo " <td colspan=\"2\"><font color=\"fefefe\"> <b>Setup Login</b></font></td>\n";
|
||||
echo " </tr>\n";
|
||||
if ($err != "") {
|
||||
echo " <tr bgcolor='#e6e6e6'><td colspan='2'><font color='#ff0000'>".$err."</font></td></tr>\n";
|
||||
}
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td><form action='".$PHP_SELF."' method='POST'>\n";
|
||||
if (count($phpgw_domain) > 1){
|
||||
echo " <table><tr><td>Domain: </td><td><input type='text' name='FormDomain' value=''></td></tr>\n";
|
||||
echo " <tr><td>Password: </td><td><input type='password' name='FormPW' value=''></td></tr></table>\n";
|
||||
}else{
|
||||
echo " <input type='password' name='FormPW' value=''>\n";
|
||||
echo " <input type='hidden' name='FormDomain' value='".$phpgw_info["server"]["default_domain"]."'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='Login' value='Login'>\n";
|
||||
echo " </form></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</body></html>\n";
|
||||
}
|
||||
|
||||
function loaddb(){
|
||||
global $phpgw_domain, $phpgw_info, $FormLogout, $FormDomain, $SetupPW, $SetupDomain, $db, $PHP_SELF, $HTTP_POST_VARS;
|
||||
|
||||
/* This code makes sure the newer multi-domain supporting header.inc.php is being used */
|
||||
if (!isset($phpgw_domain)) {
|
||||
setup_header("Upgrade your header.inc.php");
|
||||
echo "<br><b>You will need to upgrade your header.inc.php before you can continue with this setup</b>";
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Based on authentication, the database will be loaded */
|
||||
reset($phpgw_domain);
|
||||
$default_domain = each($phpgw_domain);
|
||||
$phpgw_info["server"]["default_domain"] = $default_domain[0];
|
||||
unset ($default_domain); // we kill this for security reasons
|
||||
|
||||
if (isset($FormLogout)) {
|
||||
setcookie("SetupPW"); // scrub the old one
|
||||
setcookie("SetupDomain"); // scrub the old one
|
||||
loginForm("You have sucessfully logged out");
|
||||
exit;
|
||||
} elseif (isset($SetupPW)) {
|
||||
if ($SetupPW != $phpgw_domain[$SetupDomain]["config_passwd"]) {
|
||||
setcookie("SetupPW"); // scrub the old one
|
||||
setcookie("SetupDomain"); // scrub the old one
|
||||
loginForm("Invalid session cookie (cookies must be enabled)");
|
||||
exit;
|
||||
}
|
||||
} elseif (isset($FormPW)) {
|
||||
if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"]) {
|
||||
setcookie("SetupPW",$FormPW);
|
||||
setcookie("SetupDomain",$FormDomain);
|
||||
$SetupDomain = $FormDomain;
|
||||
}else{
|
||||
loginForm("Invalid password.");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
loginForm();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/* Database setup */
|
||||
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_domain[$SetupDomain]["db_type"].".inc.php");
|
||||
$db = new db;
|
||||
$db->Host = $phpgw_domain[$SetupDomain]["db_host"];
|
||||
$db->Type = $phpgw_domain[$SetupDomain]["db_type"];
|
||||
$db->Database = $phpgw_domain[$SetupDomain]["db_name"];
|
||||
$db->User = $phpgw_domain[$SetupDomain]["db_user"];
|
||||
$db->Password = $phpgw_domain[$SetupDomain]["db_pass"];
|
||||
}
|
||||
loaddb();
|
||||
?>
|
258
setup/index.php
258
setup/index.php
@ -18,74 +18,200 @@
|
||||
$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";
|
||||
|
||||
$tables = $db->table_names();
|
||||
if (is_array($tables) && count($tables) > 0){
|
||||
/* tables exists. checking for post beta version */
|
||||
$db->query("select app_version from applications where app_name='admin'");
|
||||
$db->next_record();
|
||||
$oldversion = $db->f("app_version");
|
||||
if (isset($oldversion)){
|
||||
if ($oldversion == $phpgw_info["server"]["version"]){
|
||||
$db->query("select config_value from config where config_name='freshinstall'");
|
||||
$db->next_record();
|
||||
$configed = $db->f("config_value");
|
||||
if ($configed){
|
||||
$stage = 3.1;
|
||||
$header_msg = "Stage 3 (Needs Configuration)";
|
||||
}else{
|
||||
$stage = 3.2;
|
||||
$header_msg = "Stage 3 (Configuration OK)";
|
||||
}
|
||||
}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 */
|
||||
/* processing and discovery phase */
|
||||
check_header();
|
||||
if ( $stage >= 1.2){
|
||||
if (!auth()){
|
||||
show_header("Please login",True);
|
||||
loginForm($login_msg);
|
||||
exit;
|
||||
}else{ /* authentication settled. Moving to the database portion. */
|
||||
loaddb();
|
||||
check_db();
|
||||
}
|
||||
}
|
||||
|
||||
/* I cannot get either to work properly
|
||||
$isdb = $db->connect("kljkjh", "localhost", "phpgroupware", "phpgr0upwar3");
|
||||
*/
|
||||
|
||||
$db_rights = $db->query("CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )");
|
||||
switch($action){
|
||||
case "Delete all my tables and data":
|
||||
$subtitle = "Deleting Tables";
|
||||
$submsg = "At your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format.";
|
||||
$subaction = "deleted";
|
||||
$currentver = "drop";
|
||||
$stage = 2.5;
|
||||
break;
|
||||
case "Upgrade":
|
||||
$subtitle = "Upgrading Tables";
|
||||
$submsg = "At your request, this script is going to attempt to upgrade your old tables to the new format.";
|
||||
$subaction = "upgraded";
|
||||
$currentver = "oldversion";
|
||||
$stage = 2.5;
|
||||
break;
|
||||
case "Create":
|
||||
$subtitle = "Creating Tables";
|
||||
$submsg = "At your request, this script is going to attempt to the tables for you.";
|
||||
$subaction = "created";
|
||||
$currentver = "new";
|
||||
$stage = 2.5;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Display code */
|
||||
|
||||
if (isset($db_rights)){
|
||||
//if (isset($isdb)){
|
||||
$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);
|
||||
if (PHP_VERSION < "3.0.16") {
|
||||
echo "You appear to be running an old version of PHP. It its recommend that you upgrade "
|
||||
. "to a new version. Older version of PHP might not run phpGroupWare correctly, if at all.";
|
||||
exit;
|
||||
}
|
||||
|
||||
/* The stages are as follows:
|
||||
Stage 1.1 = header does not exists yet
|
||||
Stage 1.2 = header exists, but is the wrong version
|
||||
Stage 1.3 = header exists and is current
|
||||
Stage 2.1 = database does not exists yet
|
||||
Stage 2.2 = database exists pre-beta tables
|
||||
Stage 2.3 = database exists but no tables
|
||||
Stage 2.4 = database and tables exists but need upgrading
|
||||
Stage 2.5 = tables being modified in some way
|
||||
Stage 2.6 = database and tables exists and are current
|
||||
Stage 3.1 = configuration has not been done
|
||||
Stage 3.2 = configuration has been completed
|
||||
Stage 4.1 = install new language
|
||||
Stage 5.1 = something to do with the add-on applications
|
||||
Stage 5.2 =
|
||||
*/
|
||||
|
||||
echo '<table border="1" width="100%" cellspacing="0" cellpadding="2">';
|
||||
echo ' <tr><td align="left" WIDTH="20%" bgcolor="486591"><font color="fefefe">Step 1 - header.inc.php</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage == 1.1) {
|
||||
echo '<tr><td align="center">O</td><td><form action="./createheader.php" method=post>You have not created your header.inc.php yet.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
}elseif ($stage == 1.2) {
|
||||
echo '<tr><td align="center">O</td><td><form action="./createheader.php" method=post>Your header.inc.php is out of date. Please upgrade it.<br> <input type=submit value="Upgrade now"></form></td></tr>';
|
||||
}elseif ($stage >= 1.3) {
|
||||
echo '<tr><td align="center">X</td><td><form action="./createheader.php" method=post>
|
||||
Your header.inc.php is in place and current.<br> <input type=submit value="Edit existing header.inc.php"></form></td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 2 - database management</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 2.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 2.1) {
|
||||
echo '<tr><td align="center">O</td><td><form action="index.php" method=post>Your database does not exist.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
}elseif ($stage == 2.2) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo '
|
||||
You appear to be running a pre-beta version of phpGroupWare<br>
|
||||
We are providing an automated upgrade system, but we highly recommend backing up your tables incase the script causes damage to your data.<br>
|
||||
These automated scripts can easily destroy your data. Please backup before going any further!<br>
|
||||
<form method="post" action="index.php">
|
||||
Select your old version:
|
||||
<select name="oldversion">
|
||||
<option value="7122000">7122000</option>
|
||||
<option value="8032000">8032000</option>
|
||||
<option value="8072000">8072000</option>
|
||||
<option value="8212000">8212000</option>
|
||||
<option value="9052000">9052000</option>
|
||||
<option value="9072000">9072000</option>
|
||||
<option value="9262000">9262000</option>
|
||||
<option value="0_9_1">0.9.1</option>
|
||||
<option value="0_9_2">0.9.2</option>
|
||||
</select>
|
||||
<input type="submit" name="action" value="Upgrade">
|
||||
<input type="submit" name="action" value="Delete all my tables and data">
|
||||
</form>';
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 2.3) {
|
||||
/* commented out because I cannot accuratly figure out if the DB exists */
|
||||
//echo '<tr><td align="center">O</td><td><form action="index.php" method=post>Your database exist, would you like to create your tables now?<br> <input type=submit value="Create tables"></form></td></tr>';
|
||||
echo '<tr><td align="center">O</td><td>Make sure that your database is created and the account permissions are set.<br>';
|
||||
if ($phpgw_domain[$SetupDomain]["db_type"] == "mysql"){
|
||||
echo "
|
||||
<br>Instructions for creating the database in MySQL:<br>
|
||||
Login to mysql -<br>
|
||||
<i>[user@server user]# mysql -u root -p</i><br>
|
||||
Create the empty database and grant user permissions -<br>
|
||||
<i>mysql> create database phpgroupware;</i><br>
|
||||
<i>mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i><br>
|
||||
";
|
||||
}elseif ($phpgw_domain[$SetupDomain]["db_type"] == "pgsql"){
|
||||
echo "
|
||||
<br>Instructions for creating the database in PostgreSQL:<br>
|
||||
Start the postmaster<br>
|
||||
<i>[user@server user]# postmaster -i -D /home/[username]/[dataDir]</i><br>
|
||||
Create the empty database -<br>
|
||||
<i>[user@server user]# createdb phpgroupware</i><br>
|
||||
";
|
||||
}
|
||||
echo '<form action="index.php" method=post>';
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"new\">\n";
|
||||
echo 'Once the database is setup correctly <br><input type=submit name="action" value="Create"> the tables</form></td></tr>';
|
||||
}elseif ($stage == 2.4) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo "You appear to be running version $oldversion of phpGroupWare.<br>\n";
|
||||
echo "We will automaticly update your tables/records to ".$phpgw_info["server"]["version"].", but we highly recommend backing up your tables in case the script causes damage to your data.\n";
|
||||
echo "These automated scripts can easily destroy your data. Please backup before going any further!\n";
|
||||
echo "<form method=\"POST\" action=\"index.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"".$oldversion."\">\n";
|
||||
echo "<input type=\"hidden\" name=\"useglobalconfigsettings\">\n";
|
||||
echo "<input type=\"submit\" name=\"action\" value=\"Upgrade\">\n";
|
||||
echo "<input type=\"submit\" name=\"action\" value=\"Delete all my tables and data\">\n";
|
||||
echo "</form>\n";
|
||||
echo "<form method=\"POST\" action=\"config.php\">\n";
|
||||
echo "<input type=\"submit\" name=\"action\" value=\"Dont touch my data\">\n";
|
||||
echo "</form>\n";
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 2.5) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo "<table width=\"100%\">\n";
|
||||
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\"> <b>$subtitle</b></font></td></tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\"><td>$submsg</td></tr>\n";
|
||||
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\"> <b>Table Change Messages</b></font></td></tr>\n";
|
||||
$db->Halt_On_Error = "report";
|
||||
include ("./sql/common_main.inc.php");
|
||||
$db->Halt_On_Error = "no";
|
||||
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\"> <b>Status</b></font></td></tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\"><td>If you did not recieve any errors, your tables have been $subaction.<br></tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<form method=\"POST\" action=\"index.php\">\n";
|
||||
echo "<br><input type=\"submit\" value=\"Re-Check My Installation\">\n";
|
||||
echo '</form>';
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage >= 2.6) {
|
||||
echo '<tr><td align="center">X</td><td>Your tables are current.';
|
||||
echo "<form method=\"POST\" action=\"index.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"new\">\n";
|
||||
echo "<br>Insanity: <input type=\"submit\" name=\"action\" value=\"Delete all my tables and data\">\n";
|
||||
echo '</form>';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 3 - Configuration</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 3.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 3.1) {
|
||||
echo '<tr><td align="center">O</td><td>Please phpGroupWare for your environment.';
|
||||
echo "<form method=\"POST\" action=\"config.php\"><input type=\"submit\" value=\"Configure Now\"></form>";
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 3.2) {
|
||||
echo '<tr><td align="center">X</td><td>Configuration completed.';
|
||||
echo "<form method=\"POST\" action=\"config.php\"><input type=\"submit\" value=\"Edit Current Configuration\"></form>";
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 4 - language management</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 4.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 4.1) {
|
||||
echo '<tr><td align="center">O</td><td>stage 4.1.<br></td></tr>';
|
||||
}elseif ($stage == 4.2) {
|
||||
echo '<tr><td align="center">O</td><td>stage 4.2.<br></td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 5 - Add-on Application Installation</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 5.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 5.1) {
|
||||
echo '<tr><td align="center">O</td><td>stage 5.1.<br></td></tr>';
|
||||
}elseif ($stage == 5.2) {
|
||||
echo '<tr><td align="center">O</td><td>stage 5.2.<br></td></tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo "</body></html>";
|
||||
?>
|
||||
|
@ -1,71 +0,0 @@
|
||||
<?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");
|
||||
include("../header.inc.php");
|
||||
|
||||
// Authorize the user to use setup app and load the database
|
||||
// Does not return unless user is authorized
|
||||
if (!auth()){
|
||||
Header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
loaddb();
|
||||
$db->Halt_On_Error = "no";
|
||||
//$db->Halt_On_Error = "report";
|
||||
|
||||
if (!isset($oldversion)){
|
||||
Header("Location: index.php");
|
||||
exit;
|
||||
// $db->query("select app_version from applications where app_name='admin'");
|
||||
// $db->next_record();
|
||||
// $oldversion = $db->f("app_version");
|
||||
}
|
||||
|
||||
if (PHP_VERSION < "3.0.16") {
|
||||
echo "You appear to be running an old version of PHP. It its recommend that you upgrade "
|
||||
. "to a new version. Older version of PHP might not run phpGroupWare correctly, if at all.";
|
||||
}
|
||||
/* Database setup */
|
||||
switch($action){
|
||||
case "Delete all my tables and data":
|
||||
$subtitle = "Deleting Tables";
|
||||
$submsg = "At your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format.";
|
||||
$subaction = "deleted";
|
||||
$currentver = "drop";
|
||||
break;
|
||||
case "Upgrade":
|
||||
$subtitle = "Upgrading Tables";
|
||||
$submsg = "At your request, this script is going to attempt to upgrade your old tables to the new format.";
|
||||
$subaction = "upgraded";
|
||||
// $currentver = $oldversion;
|
||||
$currentver = "oldversion";
|
||||
break;
|
||||
case "Create":
|
||||
$subtitle = "Creating Tables";
|
||||
$submsg = "At your request, this script is going to attempt to the tables for you.";
|
||||
$subaction = "created";
|
||||
$currentver = "new";
|
||||
break;
|
||||
}
|
||||
|
||||
$stage = 2.5;
|
||||
show_header($header_msg);
|
||||
show_steps($stage);
|
||||
echo "</body></html>";
|
||||
?>
|
Loading…
Reference in New Issue
Block a user