2000-09-28 16:28:34 +02:00
< ? php
2000-09-28 02:50:18 +02:00
/************************************************************************** \
* 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 . *
\ **************************************************************************/
2000-09-28 03:15:51 +02:00
/* $Id$ */
2000-09-28 02:50:18 +02:00
$phpgw_info [ " flags " ] = array ( " noheader " => True , " nonavbar " => True , " currentapp " => " home " , " noapi " => True );
include ( " ../header.inc.php " );
$phpgw_info [ " server " ][ " api_dir " ] = $phpgw_info [ " server " ][ " include_root " ] . " /phpgwapi " ;
2000-09-28 16:28:34 +02:00
// Authorize the user to use setup app
2000-11-02 09:03:05 +01:00
include ( " inc/setup_auth.inc.php " );
2000-09-28 16:28:34 +02:00
// Does not return unless user is authorized
2000-09-28 02:50:18 +02:00
/* Database setup */
2000-10-05 18:42:53 +02:00
include ( $phpgw_info [ " server " ][ " api_dir " ] . " /phpgw_db_ " . $phpgw_info [ " server " ][ " db_type " ] . " .inc.php " );
2000-09-28 02:50:18 +02:00
2000-09-28 03:00:03 +02:00
$db = new db ;
2000-10-25 23:41:32 +02:00
$db -> Host = $phpgw_info [ " server " ][ " db_host " ];
$db -> Type = $phpgw_info [ " server " ][ " db_type " ];
$db -> Database = $phpgw_info [ " server " ][ " db_name " ];
$db -> User = $phpgw_info [ " server " ][ " db_user " ];
$db -> Password = $phpgw_info [ " server " ][ " db_pass " ];
2000-09-28 06:31:38 +02:00
// $db->Halt_On_Error = "report";
$db -> Halt_On_Error = " no " ;
2000-09-28 02:50:18 +02:00
2000-09-30 04:40:33 +02:00
if ( ! isset ( $oldversion )){
2000-10-18 01:16:47 +02:00
@ $db -> query ( " select app_version from applications where app_name='admin' " );
@ $db -> next_record ();
2000-09-30 04:40:33 +02:00
$oldversion = $db -> f ( " app_version " );
}
2000-10-04 21:40:09 +02:00
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. " ;
}
2000-09-30 04:40:33 +02:00
2000-09-28 10:17:06 +02:00
switch ( $msg ){
case " 1 " :
return " You have been successfully logged out " ;
break ;
case " 2 " :
return " Your old tables were deleted " ;
break ;
}
/* Database setup */
switch ( $action ){
2000-09-30 04:40:33 +02:00
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 " ;
2000-10-04 19:49:36 +02:00
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 " ;
2000-09-30 04:40:33 +02:00
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> " ;
2000-10-11 00:53:45 +02:00
echo " <form method= \" POST \" action= \" $PHP_SELF\ " > \n " ;
2000-09-30 04:40:33 +02:00
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= \" Dump 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 " ;
break ;
2000-09-29 23:16:29 +02:00
case " prebetaversion " :
2000-09-29 07:24:18 +02:00
echo " <html><head><title>phpGroupWare Setup</title></head> \n " ;
echo " <body bgcolor='#ffffff'> \n " ;
2000-09-28 10:17:06 +02:00
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 " ;
2000-09-28 11:28:22 +02:00
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 " ;
2000-09-30 04:40:33 +02:00
echo " These automated scripts can easily destroy your data. Please backup before going any further!</td> \n " ;
2000-09-28 10:17:06 +02:00
echo " </tr> \n " ;
echo " </table> \n " ;
?>
2000-10-11 00:53:45 +02:00
< form method = " POST " action = " <?php $PHP_SELF ?> " >
2000-09-28 10:17:06 +02:00
< table border = " 0 " align = " center " >
< tr bgcolor = " 486591 " >
< td colspan = " 2 " >< font color = " fefefe " >& nbsp ; < 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 >
2000-10-18 06:35:04 +02:00
< option value = " 0_9_1 " > 0.9 . 1 </ option >
2000-10-25 23:41:32 +02:00
< option value = " 0_9_2 " > 0.9 . 2 </ option >
2000-09-28 10:17:06 +02:00
</ 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 = " Dump my old tables " ></ td >
</ tr >
</ table >
</ form >
< ? php
break ;
case " Dump my old tables " :
2000-09-29 07:24:18 +02:00
echo " <html><head><title>phpGroupWare Setup</title></head> \n " ;
echo " <body bgcolor='#ffffff'> \n " ;
2000-09-28 10:17:06 +02:00
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 dropping your existing tables and re-creating them in the new format.</td> \n " ;
echo " </tr> \n " ;
2000-09-29 22:18:23 +02:00
$db -> Halt_On_Error = " report " ;
2000-11-02 10:01:06 +01:00
$currentver = " drop " ;
include ( " sql/common_main.inc.php " );
2000-09-29 22:18:23 +02:00
$db -> Halt_On_Error = " no " ;
2000-09-28 10:17:06 +02:00
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 " ;
2000-09-29 23:16:29 +02:00
echo " <td>If you did not recieve any serious errors, your tables have been created.<br> \n " ;
2000-09-28 10:17:06 +02:00
echo " <a href= \" config.php \" >Click here</a> to configure the environment.</td> \n " ;
echo " </tr> \n " ;
echo " </table> \n " ;
break ;
case " Upgrade " :
2000-09-29 07:24:18 +02:00
echo " <html><head><title>phpGroupWare Setup</title></head> \n " ;
echo " <body bgcolor='#ffffff'> \n " ;
2000-09-28 10:17:06 +02:00
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 " ;
2000-09-28 11:23:09 +02:00
echo " <td>At your request, this script is going to attempt to upgrade your old tables to the new format.</td> \n " ;
2000-09-28 10:17:06 +02:00
echo " </tr> \n " ;
echo " </table> \n " ;
2000-09-28 11:23:09 +02:00
$currentver = $oldversion ;
2000-09-29 22:18:23 +02:00
$db -> Halt_On_Error = " report " ;
2000-11-02 10:01:06 +01:00
include ( " sql/common_main.inc.php " );
2000-09-29 22:18:23 +02:00
$db -> Halt_On_Error = " no " ;
2000-09-28 10:17:06 +02:00
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 " ;
2000-09-29 23:16:29 +02:00
echo " <td>If you did not recieve any serious errors, your tables *should* have been updated (no warranty on data integrity).<br> \n " ;
2000-09-28 10:17:06 +02:00
echo " <a href= \" config.php \" >Click here</a> to configure the environment.</td> \n " ;
echo " </tr> \n " ;
echo " </table> \n " ;
break ;
default :
2000-09-30 04:40:33 +02:00
if ( isset ( $oldversion )){
2000-10-04 19:49:36 +02:00
if ( $phpgw_info [ " server " ][ " version " ] == $oldversion ){
2000-09-29 07:24:18 +02:00
echo " <html><head><title>phpGroupWare Setup</title></head> \n " ;
echo " <body bgcolor='#ffffff'> \n " ;
2000-09-28 10:17:06 +02:00
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 " ;
2000-10-31 21:08:02 +01:00
echo " <td>Your database is up to date with version $oldversion .<br> \n " ;
2000-09-30 04:40:33 +02:00
echo " <a href= \" config.php \" >Click here</a> to configure the environment.</td> \n " ;
2000-09-28 10:17:06 +02:00
echo " </tr> \n " ;
2000-09-30 04:40:33 +02:00
echo " </table> \n " ;
} else {
Header ( " Location: $PHP_SELF ?action=regularversion " );
}
} else {
2000-10-18 01:16:47 +02:00
@ $db -> query ( " select * from config " );
if ( @ $db -> num_rows () == 0 ){
@ $db -> query ( " select * from accounts " );
if ( @ $db -> num_rows () == 0 ){
2000-09-30 04:40:33 +02:00
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 " ;
2000-11-02 10:01:06 +01:00
$currentver = " new " ;
include ( " sql/common_main.inc.php " );
2000-09-30 04:40:33 +02:00
$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 " <a href= \" config.php \" >Click here</a> to configure the environment.</td> \n " ;
echo " </tr> \n " ;
echo " </table> \n " ;
} else {
Header ( " Location: $PHP_SELF ?action=prebetaversion " );
}
} else {
echo " <html><head><title>phpGroupWare Setup</title></head> \n " ;
echo " <body bgcolor='#ffffff'> \n " ;
echo " <table border= \" 0 \" align= \" center \" > \n " ;
2000-09-28 10:17:06 +02:00
echo " <tr bgcolor= \" 486591 \" > \n " ;
2000-09-30 04:40:33 +02:00
echo " <td colspan= \" 2 \" ><font color= \" fefefe \" > <b>Analysis</b></font></td> \n " ;
2000-09-28 10:17:06 +02:00
echo " </tr> \n " ;
echo " <tr bgcolor= \" e6e6e6 \" > \n " ;
2000-09-30 04:40:33 +02:00
echo " <td>Your database seems to be current.<br> \n " ;
2000-09-28 10:17:06 +02:00
echo " <a href= \" config.php \" >Click here</a> to configure the environment.</td> \n " ;
echo " </tr> \n " ;
echo " </table> \n " ;
}
}
2000-09-30 04:40:33 +02:00
}
2000-09-28 06:30:28 +02:00
2000-09-28 16:28:34 +02:00
echo " </body></html> " ;
2000-09-28 10:17:06 +02:00
//db->disconnect();
2000-10-11 00:53:45 +02:00
?>