fixed problems with database portions of this program. I am done with the core portion of the changes to the table management. Some changes to the db files are still going to be require

This commit is contained in:
seek3r 2000-12-01 18:25:01 +00:00
parent 04f3839dae
commit 2caf561422
9 changed files with 435 additions and 664 deletions

View File

@ -11,14 +11,17 @@
/* $Id$ */
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True,
"currentapp" => "home", "noapi" => True);
$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
include("./inc/setup_auth.inc.php");
// Does not return unless user is authorized
if (!auth()){
Header("Location: index.php");
exit;
}
loaddb();
if ($newsettings["auth_type"] != "ldap") {
setup_header();
}

View File

@ -2,207 +2,206 @@
include("./inc/functions.inc.php");
include("../version.inc.php");
if ($download) {
header("Content-disposition: attachment; filename=header.inc.php");
header("Content-type: application/octet-stream");
header("Pragma: no-cache");
header("Expires: 0");
echo $newheader;
exit;
}elseif ($view) {
show_header("Generated header.inc.php");
echo "<br>Save this text as contents of your header.inc.php<br><hr>";
$newheader = generate_header();
echo "<pre>";
echo htmlentities($newheader);
echo "</pre></body></html>";
exit;
}elseif ($createfile) {
if(!is_writeable ($server_root."/header.inc.php")){
show_header("Error generating header.inc.php");
echo "Could not open header.inc.php for writing!<br>\n";
echo "Please check read/write permissions on directories or back up and use another option.<br>";
echo "</td></tr></table></body></html>";
exit;
}else{
show_header("Saved header.inc.php");
switch($action){
case "download":
header("Content-disposition: attachment; filename=header.inc.php");
header("Content-type: application/octet-stream");
header("Pragma: no-cache");
header("Expires: 0");
echo $newheader;
break;
case "view":
show_header("Generated header.inc.php");
echo "<br>Save this text as contents of your header.inc.php<br><hr>";
$newheader = generate_header();
$fsetup = fopen($server_root."/header.inc.php","w");
fwrite($fsetup,$newheader);
fclose($fsetup);
echo "Created header.inc.php!<br>";
exit;
}
}else{
show_header("Create/Edit your header.inc.php");
echo '<table>
<tr bgcolor="486591"><th colspan=2><font color="fefefe"> Analysis </font></th></tr>
<tr><td colspan=2>';
// Hardly try to find what DB-support is compiled in
// this dont work with PHP 3.0.10 and lower !
$supported_db = array();
if(extension_loaded("mysql")) {
echo "You appear to have MySQL support enabled<br>\n";
$supported_db[] = "mysql";
} else {
echo "No MySQL support found. Disabling<br>\n";
}
if(extension_loaded("pgsql")) {
echo "You appear to have Postgres-DB support enabled<br>\n";
$supported_db[] = "pgsql";
} else {
echo "No Postgres-DB support found. Disabling<br>\n";
}
if(extension_loaded("oci8")) {
echo "You appear to have Oracle V8 (OCI) support enabled<br>\n";
$supported_db[] = "oracle";
} else {
if(extension_loaded("oracle")) {
echo "You appear to have Oracle support enabled<br>\n";
$supported_db[] = "oracle";
} else {
echo "No Oracle-DB support found. Disabling<br>\n";
}
}
if(!count($supported_db)) {
echo "<b><p align=center><font size=+2 color=red>did not found any valid DB support !<br>try to configure your php to support one of the above mentioned dbs or install phpgroupware by hand </font></p></b><td></tr></table></body></html>";
exit;
}
$no_guess = false;
if(file_exists("../header.inc.php") && is_file("../header.inc.php")) {
echo "Found existing configuration file. Loading settings from the file...<br>\n";
$phpgw_info["flags"]["noapi"] = True;
include("../header.inc.php");
$no_guess = true;
/* This code makes sure the newer multi-domain supporting header.inc.php is being used */
if (!isset($phpgw_domain)) {
echo "Your using an old configuration file format...<br>\n";
echo "Importing old settings into the new format....<br>\n";
}else{
if ($phpgw_info["server"]["header_version"] != $phpgw_info["server"]["current_header_version"]) {
echo "Your using an old header.inc.php version...<br>\n";
echo "Importing old settings into the new format....<br>\n";
echo "<pre>";
echo htmlentities($newheader);
echo "</pre></body></html>";
break;
case "write config":
if(!is_writeable ($server_root."/header.inc.php")){
show_header("Error generating header.inc.php");
echo "Could not open header.inc.php for writing!<br>\n";
echo "Please check read/write permissions on directories or back up and use another option.<br>";
echo "</td></tr></table></body></html>";
}else{
show_header("Saved header.inc.php");
$newheader = generate_header();
$fsetup = fopen($server_root."/header.inc.php","w");
fwrite($fsetup,$newheader);
fclose($fsetup);
echo "Created header.inc.php!<br>";
}
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
$phpgw_info["server"]["db_host"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_host"];
$phpgw_info["server"]["db_name"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_name"];
$phpgw_info["server"]["db_user"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_user"];
$phpgw_info["server"]["db_pass"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_pass"];
$phpgw_info["server"]["db_type"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_type"];
$phpgw_info["server"]["config_passwd"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["config_passwd"];
}
} else {
echo "sample configuration not found. using built in defaults<br>\n";
$phpgw_info["server"]["server_root"] = "/path/to/phpgroupware";
$phpgw_info["server"]["include_root"] = "/path/to/phpgroupware/inc";
/* This is the basic include needed on each page for phpGroupWare application compliance */
$phpgw_info["flags"]["htmlcompliant"] = True;
/* These are the settings for the database system */
$phpgw_info["server"]["db_host"] = "localhost";
$phpgw_info["server"]["db_name"] = "phpgroupware";
$phpgw_info["server"]["db_user"] = "phpgroupware";
$phpgw_info["server"]["db_pass"] = "your_password";
$phpgw_info["server"]["db_type"] = "mysql"; //mysql, pgsql (for postgresql), or oracle
/* These are a few of the advanced settings */
$phpgw_info["server"]["config_passwd"] = "changeme";
$phpgw_info["server"]["mcrypt_enabled"] = False;
$phpgw_info["server"]["mcrypt_version"] = "2.6.3";
$phpgw_info["server"]["mcrypt_iv"] = "cwjasud83l;la-0d.e/lc;[-%kl)ls,lf0;sa-;921kx;90flwl,skfcujd,wsodsp";
}
// now guessing better settings then the default ones
if(!$no_guess) {
echo "Now guessing better values for defaults <br>\n";
$this_dir = dirname($SCRIPT_FILENAME);
$updir = ereg_replace("/setup","",$this_dir);
$phpgw_info["server"]["server_root"] = $updir;
$phpgw_info["server"]["include_root"] = $updir."/inc";
}
?>
</td></tr>
<tr bgcolor=486591><th colspan=2><font color="fefefe">Settings</font></th></tr>
<form action="<? echo $PHP_SELF ?>" method=post>
<input type=hidden name=write_config value=true>
<tr><td colspan=2><b>Server Root</b><br><input type=text name=server_root size=80 value="<? echo $phpgw_info["server"]["server_root"] ?>"></td></tr>
<tr><td colspan=2><b>Include Root</b><br><input type=text name=include_root size=80 value="<? echo $phpgw_info["server"]["include_root"] ?>"></td></tr>
<tr><td colspan=2><b>htmlcompliant<br>
<select name=htmlcompliant >
<?
if($phpgw_info["flags"]["htmlcompliant"] == True) {
?>
<option value=True selected>True
<option value=False>False
<?
} else {
?>
<option value=True>True
<option value=False selected>False
<?
}
?>
</select>
</td></tr>
<tr><td><b>DB Host</b><br><input type=text name=db_host value="<? echo $phpgw_info["server"]["db_host"] ?>"></td><td>Hostname/IP of Databaseserver</td></tr>
<tr><td><b>DB Name</b><br><input type=text name=db_name value="<? echo $phpgw_info["server"]["db_name"] ?>"></td><td>Name of Database</td></tr>
<tr><td><b>DB User</b><br><input type=text name=db_user value="<? echo $phpgw_info["server"]["db_user"] ?>"></td><td>Name of DB User as phpgroupware has to connect as</td></tr>
<tr><td><b>DB Password</b><br><input type=text name=db_pass value="<? echo $phpgw_info["server"]["db_pass"] ?>"></td><td>Password of DB User</td></tr>
<tr><td><b>DB Type</b><br><select name=db_type>
<?
$selected = "";
$found_dbtype = false;
while(list($k,$v) = each($supported_db)) {
if($v == $phpgw_info["server"]["db_type"]) {
$selected = " selected ";
$found_dbtype = true;
} else {
$selected = "";
}
print "<option $selected value=\"$v\">$v\n";
}
?>
</select>
</td><td>What Database do you want to use with PHPGroupWare?
<tr><td><b>Configuration Password</b><br><input type=text name=config_pass value="<? echo $phpgw_info["server"]["config_passwd"] ?>"></td><td>Password needed for configuration</td></tr>
<tr><td colspan=2><b>Enable MCrypt<br>
<select name=enable_mcrypt >
<? if($phpgw_info["flags"]["mcrypt_enabled"] == True) { ?>
<option value=True selected>True
<option value=False>False
<? } else { ?>
<option value=True>True
<option value=False selected>False
<? } ?>
</select>
</td></tr>
<tr><td><b>MCrypt version</b><br><input type=text name=mcrypt_version value="<? echo $phpgw_info["server"]["mcrypt_version"] ?>"></td><td>Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use</td></tr>
<tr><td><b>MCrypt initilazation vector</b><br><input type=text name=mcrypt_iv value="<? echo $phpgw_info["server"]["mcrypt_iv"] ?>"></td><td>It should be around 30 bytes in length</td></tr>
</table>
<?
if(!$found_dbtype) {
echo "<br><font color=red>Warning!<br>The db_type in defaults (".$phpgw_info["server"]["db_type"].") is not supported on this server. using first supported type.</font>";
}
?>
<br>
<form>
<?php
if(is_writeable ($server_root."/header.inc.php")){
echo '<input type=submit name="createfile" value="write config">';
}else{
echo 'Cannot create the header.inc.php due to file permission restrictions.<br> Instead you can ';
echo'<input type=submit name="download" value="download">or <input type=submit name="view" value="view"> the file.';
echo'<br> After retrieving the file put it into place as the header.inc.php, then click continue.<br>';
echo'<input type=submit name="continue" value="continue">';
}
?>
</form>
</body>
</html>
<?php } ?>
break;
default:
show_header("Create/Edit your header.inc.php");
echo '<table>
<tr bgcolor="486591"><th colspan=2><font color="fefefe"> Analysis </font></th></tr>
<tr><td colspan=2>';
// Hardly try to find what DB-support is compiled in
// this dont work with PHP 3.0.10 and lower !
$supported_db = array();
if(extension_loaded("mysql")) {
echo "You appear to have MySQL support enabled<br>\n";
$supported_db[] = "mysql";
} else {
echo "No MySQL support found. Disabling<br>\n";
}
if(extension_loaded("pgsql")) {
echo "You appear to have Postgres-DB support enabled<br>\n";
$supported_db[] = "pgsql";
} else {
echo "No Postgres-DB support found. Disabling<br>\n";
}
if(extension_loaded("oci8")) {
echo "You appear to have Oracle V8 (OCI) support enabled<br>\n";
$supported_db[] = "oracle";
} else {
if(extension_loaded("oracle")) {
echo "You appear to have Oracle support enabled<br>\n";
$supported_db[] = "oracle";
} else {
echo "No Oracle-DB support found. Disabling<br>\n";
}
}
if(!count($supported_db)) {
echo "<b><p align=center><font size=+2 color=red>did not found any valid DB support !<br>try to configure your php to support one of the above mentioned dbs or install phpgroupware by hand </font></p></b><td></tr></table></body></html>";
exit;
}
$no_guess = false;
if(file_exists("../header.inc.php") && is_file("../header.inc.php")) {
echo "Found existing configuration file. Loading settings from the file...<br>\n";
$phpgw_info["flags"]["noapi"] = True;
include("../header.inc.php");
$no_guess = true;
/* This code makes sure the newer multi-domain supporting header.inc.php is being used */
if (!isset($phpgw_domain)) {
echo "Your using an old configuration file format...<br>\n";
echo "Importing old settings into the new format....<br>\n";
}else{
if ($phpgw_info["server"]["header_version"] != $phpgw_info["server"]["current_header_version"]) {
echo "Your using an old header.inc.php version...<br>\n";
echo "Importing old settings into the new format....<br>\n";
}
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
$phpgw_info["server"]["db_host"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_host"];
$phpgw_info["server"]["db_name"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_name"];
$phpgw_info["server"]["db_user"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_user"];
$phpgw_info["server"]["db_pass"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_pass"];
$phpgw_info["server"]["db_type"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["db_type"];
$phpgw_info["server"]["config_passwd"] = $phpgw_domain[$phpgw_info["server"]["default_domain"]]["config_passwd"];
}
} else {
echo "sample configuration not found. using built in defaults<br>\n";
$phpgw_info["server"]["server_root"] = "/path/to/phpgroupware";
$phpgw_info["server"]["include_root"] = "/path/to/phpgroupware/inc";
/* This is the basic include needed on each page for phpGroupWare application compliance */
$phpgw_info["flags"]["htmlcompliant"] = True;
/* These are the settings for the database system */
$phpgw_info["server"]["db_host"] = "localhost";
$phpgw_info["server"]["db_name"] = "phpgroupware";
$phpgw_info["server"]["db_user"] = "phpgroupware";
$phpgw_info["server"]["db_pass"] = "your_password";
$phpgw_info["server"]["db_type"] = "mysql"; //mysql, pgsql (for postgresql), or oracle
/* These are a few of the advanced settings */
$phpgw_info["server"]["config_passwd"] = "changeme";
$phpgw_info["server"]["mcrypt_enabled"] = False;
$phpgw_info["server"]["mcrypt_version"] = "2.6.3";
$phpgw_info["server"]["mcrypt_iv"] = "cwjasud83l;la-0d.e/lc;[-%kl)ls,lf0;sa-;921kx;90flwl,skfcujd,wsodsp";
}
// now guessing better settings then the default ones
if(!$no_guess) {
echo "Now guessing better values for defaults <br>\n";
$this_dir = dirname($SCRIPT_FILENAME);
$updir = ereg_replace("/setup","",$this_dir);
$phpgw_info["server"]["server_root"] = $updir;
$phpgw_info["server"]["include_root"] = $updir."/inc";
}
?>
</td></tr>
<tr bgcolor=486591><th colspan=2><font color="fefefe">Settings</font></th></tr>
<form action="<? echo $PHP_SELF ?>" method=post>
<input type=hidden name=write_config value=true>
<tr><td colspan=2><b>Server Root</b><br><input type=text name=server_root size=80 value="<? echo $phpgw_info["server"]["server_root"] ?>"></td></tr>
<tr><td colspan=2><b>Include Root</b><br><input type=text name=include_root size=80 value="<? echo $phpgw_info["server"]["include_root"] ?>"></td></tr>
<tr><td colspan=2><b>htmlcompliant<br>
<select name=htmlcompliant >
<?
if($phpgw_info["flags"]["htmlcompliant"] == True) {
?>
<option value=True selected>True
<option value=False>False
<?
} else {
?>
<option value=True>True
<option value=False selected>False
<?
}
?>
</select>
</td></tr>
<tr><td><b>DB Host</b><br><input type=text name=db_host value="<? echo $phpgw_info["server"]["db_host"] ?>"></td><td>Hostname/IP of Databaseserver</td></tr>
<tr><td><b>DB Name</b><br><input type=text name=db_name value="<? echo $phpgw_info["server"]["db_name"] ?>"></td><td>Name of Database</td></tr>
<tr><td><b>DB User</b><br><input type=text name=db_user value="<? echo $phpgw_info["server"]["db_user"] ?>"></td><td>Name of DB User as phpgroupware has to connect as</td></tr>
<tr><td><b>DB Password</b><br><input type=text name=db_pass value="<? echo $phpgw_info["server"]["db_pass"] ?>"></td><td>Password of DB User</td></tr>
<tr><td><b>DB Type</b><br><select name=db_type>
<?
$selected = "";
$found_dbtype = false;
while(list($k,$v) = each($supported_db)) {
if($v == $phpgw_info["server"]["db_type"]) {
$selected = " selected ";
$found_dbtype = true;
} else {
$selected = "";
}
print "<option $selected value=\"$v\">$v\n";
}
?>
</select>
</td><td>What Database do you want to use with PHPGroupWare?
<tr><td><b>Configuration Password</b><br><input type=text name=config_pass value="<? echo $phpgw_info["server"]["config_passwd"] ?>"></td><td>Password needed for configuration</td></tr>
<tr><td colspan=2><b>Enable MCrypt<br>
<select name=enable_mcrypt >
<? if($phpgw_info["flags"]["mcrypt_enabled"] == True) { ?>
<option value=True selected>True
<option value=False>False
<? } else { ?>
<option value=True>True
<option value=False selected>False
<? } ?>
</select>
</td></tr>
<tr><td><b>MCrypt version</b><br><input type=text name=mcrypt_version value="<? echo $phpgw_info["server"]["mcrypt_version"] ?>"></td><td>Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use</td></tr>
<tr><td><b>MCrypt initilazation vector</b><br><input type=text name=mcrypt_iv value="<? echo $phpgw_info["server"]["mcrypt_iv"] ?>"></td><td>It should be around 30 bytes in length</td></tr>
</table>
<?
if(!$found_dbtype) {
echo "<br><font color=red>Warning!<br>The db_type in defaults (".$phpgw_info["server"]["db_type"].") is not supported on this server. using first supported type.</font>";
}
echo "<br>";
echo "<form>";
if(is_writeable ($server_root."/header.inc.php")){
echo '<input type=submit name="action" value="write config">';
}else{
echo 'Cannot create the header.inc.php due to file permission restrictions.<br> Instead you can ';
echo'<input type=submit name="action" value="download">or <input type=submit name="action" value="view"> the file.</form>';
echo '<form action="index.php" method=post>';
echo'<br> After retrieving the file put it into place as the header.inc.php, then click continue.<br>';
echo'<input type=submit name="junk" value="continue">';
}
echo "</form>";
echo "</body>";
echo "</html>";
}
?>

View File

@ -25,6 +25,7 @@
function show_header($title = "",$nologoutbutton = False) {
global $phpgw_info, $PHP_SELF;
?>
<html>
<head>
<title>phpGroupWare Setup
<?php
@ -126,8 +127,7 @@
}
function show_steps($stage, $note = False) {
global $phpgw_info, $phpgw_domain, $SetupDomain, $PHP_SELF;
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
@ -136,7 +136,8 @@
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 = database and tables exists and are current
Stage 2.5 = tables being modified in some way
Stage 2.6 = database and tables exists and are current
Stage 3 =
Stage 4 =
Stage 5 =
@ -158,10 +159,31 @@
}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><form action="./tables.php" method=post>Your database exist but your pre-beta tables need upgrading.<br> <input type=submit value="Create one now"></form></td></tr>';
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>';
/* 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 "
@ -181,13 +203,48 @@
<i>[user@server user]# createdb phpgroupware</i><br>
";
}
echo '<form action="./tables.php" method=post>Once the database is setup correctly <br><input type=submit value="Create the tables"></form></td></tr>';
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><form action="./tables.php" method=post>Your database exist but your tables need upgrading.<br> <input type=submit value="upgrade now"></form></td></tr>';
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=\"$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></tr>';
}elseif ($stage == 2.5) {
echo '<tr><td align="center">X</td><td>Your tables are current.</td></tr>';
echo '<tr><td align="center">O</td><td>';
echo "<table width=\"100%\">\n";
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\">&nbsp;<b>$subtitle</b></font></td></tr>\n";
echo " <tr bgcolor=\"e6e6e6\"><td>$submsg</td></tr>\n";
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\">&nbsp;<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\">&nbsp;<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\">, then re-create the tables.\n";
echo '</form>';
echo '</td></tr>';
}
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 3 - language management</td><td align="right" bgcolor="486591">&nbsp;</td></tr>';
if ($stage < 3.1) {
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
@ -196,7 +253,6 @@
}elseif ($stage == 3.2) {
echo '<tr><td align="center">O</td><td>stage 3.2.<br></td></tr>';
}
echo '</table>';
}

View File

@ -44,10 +44,12 @@
$db->query("select app_version from applications where app_name='admin'");
$db->next_record();
$oldversion = $db->f("app_version");
echo "oldversion: $oldversion<br>\n";
$db->free();
if (isset($oldversion)){
if ($oldversion == $phpgw_info["server"]["version"]){
$stage = 2.5;
$stage = 2.6;
$header_msg = "Stage 2 (Tables are Current)";
}else{
$stage = 2.4;
@ -83,6 +85,5 @@
} /* From header.inc.php not existing */
show_header($header_msg);
show_steps($stage);
?>
</body>
</html>
echo "</body></html>";
?>

View File

@ -18,30 +18,25 @@
}
if ($currentver == "drop"){
include("./sql/".$phpgw_domain[$SetupDomain]["db_type"]."_droptables.inc.php");
$currentver = "new";
// $currentver = "new";
}
if ($currentver == "new") {
include("./sql/".$phpgw_domain[$SetupDomain]["db_type"]."_newtables.inc.php");
include("./sql/common_default_records.inc.php");
$included = True;
include($phpgw_info["server"]["server_root"] . "/setup/lang.php");
if ($currentver == "7122000" || $currentver == "8032000" || $currentver == "8072000" || $currentver == "8212000" || $currentver == "9052000" || $currentver == "9072000") {
include("./sql/".$phpgw_domain[$SetupDomain]["db_type"]."_upgrade_prebeta.inc.php");
}
include("./sql/".$phpgw_domain[$SetupDomain]["db_type"]."_upgrade_beta.inc.php");
}
echo "<table border=\"0\" align=\"center\">\n";
echo " <tr bgcolor=\"486591\">\n";
echo " <td colspan=\"2\"><font color=\"fefefe\">&nbsp;<b>Table Changes</b></font></td>\n";
echo " </tr>\n";
if ($currentver == "7122000" || $currentver == "8032000" || $currentver == "8072000" || $currentver == "8212000" || $currentver == "9052000" || $currentver == "9072000") {
include("./sql/".$phpgw_domain[$SetupDomain]["db_type"]."_upgrade_prebeta.inc.php");
}
include("./sql/".$phpgw_domain[$SetupDomain]["db_type"]."_upgrade_beta.inc.php");
if (!$tablechanges == True){
echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>No table changes were needed. The script only updated your version setting.</td>\n";
echo " </tr>\n";
}
echo "</table>\n";
?>
?>

View File

@ -23,10 +23,9 @@
$db->query("DROP TABLE profiles");
$db->query("DROP TABLE addressbook");
$db->query("DROP TABLE todo");
$db->query("DROP TABLE webcal_entry");
$db->query("DROP TABLE webcal_entry_repeats");
$db->query("DROP TABLE webcal_entry_user");
$db->query("DROP TABLE webcal_entry_groups");
$db->query("DROP TABLE calendar_entry");
$db->query("DROP TABLE calendar_entry_repeats");
$db->query("DROP TABLE calendar_entry_user");
$db->query("DROP TABLE newsgroups");
$db->query("DROP TABLE news_msg");
$db->query("DROP TABLE lang");

View File

@ -291,6 +291,7 @@
)";
$db->query($sql);
$currentver = "0.9.6";
$currentver = "0.9.7pre2";
$oldversion = $currentver;
update_version_table();
?>

View File

@ -555,18 +555,21 @@
{
global $currentver, $oldversion, $phpgw_info, $db;
$currentver = "0.9.6";
update_version_table();
echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from $oldversion to $currentver is completed.</td>\n";
echo " </tr>\n";
if ($currentver == "0.9.5" || ereg ("^0\.9\.6pre", $currentver)){
$currentver = "0.9.6";
update_version_table();
echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from $oldversion to $currentver is completed.</td>\n";
echo " </tr>\n";
}
}
function v0_9_6to0_9_7(){
global $currentver, $oldversion, $phpgw_info, $db;
if ($currentver == "0.9.6" || ereg ("^0\.9\.7pre", $currentver)){
echo "<tr><td>\n";
if ($currentver == "0.9.6") {
// upgrade code starts here
@ -575,105 +578,108 @@
update_version_table();
}
if ($currentver == "0.9.7pre1") {
$db2 = $db;
$sql = "CREATE TABLE calendar_entry (
cal_id int(11) DEFAULT '0' NOT NULL auto_increment,
cal_owner int(11) DEFAULT '0' NOT NULL,
cal_group varchar(255),
cal_datetime int(11),
cal_mdatetime int(11),
cal_duration int(11) DEFAULT '0' NOT NULL,
cal_priority int(11) DEFAULT '2' NOT NULL,
cal_type varchar(10),
cal_access varchar(10),
cal_name varchar(80) NOT NULL,
cal_description text,
PRIMARY KEY (cal_id)
)";
$db->query($sql,__LINE__,__FILE__);
$db->query("SELECT count(*) FROM webcal_entry",__LINE__,__FILE__);
$db->next_record();
if($db->f(0)) {
$db->query("SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id",__LINE__,__FILE__);
while($db->next_record()) {
$cal_id = $db->f("cal_id");
$cal_owner = $db->f("cal_owner");
$cal_duration = $db->f("cal_duration");
$cal_priority = $db->f("cal_priority");
$cal_type = $db->f("cal_type");
$cal_access = $db->f("cal_access");
$cal_name = $db->f("cal_name");
$cal_description = $db->f("cal_description");
$datetime = mktime(intval(strrev(substr(strrev($db->f("cal_time")),4))),intval(strrev(substr(strrev($db->f("cal_time")),2,2))),intval(strrev(substr(strrev($db->f("cal_time")),0,2))),intval(substr($db->f("cal_date"),4,2)),intval(substr($db->f("cal_date"),6,2)),intval(substr($db->f("cal_date"),0,4)));
$moddatetime = mktime(intval(strrev(substr(strrev($db->f("cal_mod_time")),4))),intval(strrev(substr(strrev($db->f("cal_mod_time")),2,2))),intval(strrev(substr(strrev($db->f("cal_mod_time")),0,2))),intval(substr($db->f("cal_mod_date"),4,2)),intval(substr($db->f("cal_mod_date"),6,2)),intval(substr($db->f("cal_mod_date"),0,4)));
$db2->query("SELECT groups FROM webcal_entry_groups WHERE cal_id=".$cal_id,__LINE__,__FILE__);
$db2->next_record();
$cal_group = $db2->f("groups");
$db2->query("INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) "
."VALUES(".$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__);
}
}
$db->query("DROP TABLE webcal_entry_groups");
$db->query("DROP TABLE webcal_entry");
$sql = "CREATE TABLE calendar_entry_user (
cal_id int(11) DEFAULT '0' NOT NULL,
cal_login int(11) DEFAULT '0' NOT NULL,
cal_status char(1) DEFAULT 'A',
PRIMARY KEY (cal_id, cal_login)
)";
$db->query($sql,__LINE__,__FILE__);
$db->query("SELECT count(*) FROM webcal_entry_user",__LINE__,__FILE__);
$db->next_record();
if($db->f(0)) {
$db->query("SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id",__LINE__,__FILE__);
while($db->next_record()) {
$cal_id = $db->f("cal_id");
$cal_login = $db->f("cal_login");
$cal_status = $db->f("cal_status");
$db2->query("INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES(".$cal_id.",".$cal_login.",'".$cal_status."')",__LINE__,__FILE__);
}
}
$db->query("DROP TABLE webcal_entry_user",__LINE__,__FILE__);
$sql = "CREATE TABLE calendar_entry_repeats (
cal_id int(11) DEFAULT 0 NOT NULL,
cal_type enum('daily','weekly','monthlyByDay','monthlyByDate','yearly') DEFAULT 'daily' NOT NULL,
cal_use_end int DEFAULT '0',
cal_end int(11),
cal_frequency int DEFAULT '1',
cal_days char(7)
)";
$db->query($sql,__LINE__,__FILE__);
$db->query("SELECT count(*) FROM webcal_entry_repeats",__LINE__,__FILE__);
$db->next_record();
if($db->f(0)) {
$db->query("SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id",__LINE__,__FILE__);
while($db->next_record()) {
$cal_id = $db->f("cal_id");
$cal_type = $db->f("cal_type");
if(isset($db->Record["cal_end"])) {
$enddate = mktime(0,0,0,intval(substr($db->f("cal_end"),4,2)),intval(substr($db->f("cal_end"),6,2)),intval(substr($db->f("cal_end"),0,4)));
$useend = 1;
} else {
$enddate = 0;
$useend = 0;
}
$cal_frequency = $db->f("cal_frequency");
$cal_days = $db->f("cal_days");
$db2->f("INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES(".$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__);
}
}
$db->query("DROP TABLE webcal_entry_repeats",__LINE__,__FILE__);
$db->query("UPDATE applications SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__);
$db2 = $db;
$sql = "CREATE TABLE calendar_entry (
cal_id int(11) DEFAULT '0' NOT NULL auto_increment,
cal_owner int(11) DEFAULT '0' NOT NULL,
cal_group varchar(255),
cal_datetime int(11),
cal_mdatetime int(11),
cal_duration int(11) DEFAULT '0' NOT NULL,
cal_priority int(11) DEFAULT '2' NOT NULL,
cal_type varchar(10),
cal_access varchar(10),
cal_name varchar(80) NOT NULL,
cal_description text,
PRIMARY KEY (cal_id)
)";
$db->query($sql,__LINE__,__FILE__);
$db->query("SELECT count(*) FROM webcal_entry",__LINE__,__FILE__);
$db->next_record();
if($db->f(0)) {
$db->query("SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id",__LINE__,__FILE__);
while($db->next_record()) {
$cal_id = $db->f("cal_id");
$cal_owner = $db->f("cal_owner");
$cal_duration = $db->f("cal_duration");
$cal_priority = $db->f("cal_priority");
$cal_type = $db->f("cal_type");
$cal_access = $db->f("cal_access");
$cal_name = $db->f("cal_name");
$cal_description = $db->f("cal_description");
$datetime = mktime(intval(strrev(substr(strrev($db->f("cal_time")),4))),intval(strrev(substr(strrev($db->f("cal_time")),2,2))),intval(strrev(substr(strrev($db->f("cal_time")),0,2))),intval(substr($db->f("cal_date"),4,2)),intval(substr($db->f("cal_date"),6,2)),intval(substr($db->f("cal_date"),0,4)));
$moddatetime = mktime(intval(strrev(substr(strrev($db->f("cal_mod_time")),4))),intval(strrev(substr(strrev($db->f("cal_mod_time")),2,2))),intval(strrev(substr(strrev($db->f("cal_mod_time")),0,2))),intval(substr($db->f("cal_mod_date"),4,2)),intval(substr($db->f("cal_mod_date"),6,2)),intval(substr($db->f("cal_mod_date"),0,4)));
$db2->query("SELECT groups FROM webcal_entry_groups WHERE cal_id=".$cal_id,__LINE__,__FILE__);
$db2->next_record();
$cal_group = $db2->f("groups");
$db2->query("INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) "
."VALUES(".$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__);
}
}
$db->query("DROP TABLE webcal_entry_groups");
$db->query("DROP TABLE webcal_entry");
$sql = "CREATE TABLE calendar_entry_user (
cal_id int(11) DEFAULT '0' NOT NULL,
cal_login int(11) DEFAULT '0' NOT NULL,
cal_status char(1) DEFAULT 'A',
PRIMARY KEY (cal_id, cal_login)
)";
$db->query($sql,__LINE__,__FILE__);
$db->query("SELECT count(*) FROM webcal_entry_user",__LINE__,__FILE__);
$db->next_record();
if($db->f(0)) {
$db->query("SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id",__LINE__,__FILE__);
while($db->next_record()) {
$cal_id = $db->f("cal_id");
$cal_login = $db->f("cal_login");
$cal_status = $db->f("cal_status");
$db2->query("INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES(".$cal_id.",".$cal_login.",'".$cal_status."')",__LINE__,__FILE__);
}
}
$db->query("DROP TABLE webcal_entry_user",__LINE__,__FILE__);
$sql = "CREATE TABLE calendar_entry_repeats (
cal_id int(11) DEFAULT 0 NOT NULL,
cal_type enum('daily','weekly','monthlyByDay','monthlyByDate','yearly') DEFAULT 'daily' NOT NULL,
cal_use_end int DEFAULT '0',
cal_end int(11),
cal_frequency int DEFAULT '1',
cal_days char(7)
)";
$db->query($sql,__LINE__,__FILE__);
$db->query("SELECT count(*) FROM webcal_entry_repeats",__LINE__,__FILE__);
$db->next_record();
if($db->f(0)) {
$db->query("SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id",__LINE__,__FILE__);
while($db->next_record()) {
$cal_id = $db->f("cal_id");
$cal_type = $db->f("cal_type");
if(isset($db->Record["cal_end"])) {
$enddate = mktime(0,0,0,intval(substr($db->f("cal_end"),4,2)),intval(substr($db->f("cal_end"),6,2)),intval(substr($db->f("cal_end"),0,4)));
$useend = 1;
} else {
$enddate = 0;
$useend = 0;
}
$cal_frequency = $db->f("cal_frequency");
$cal_days = $db->f("cal_days");
$db2->f("INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES(".$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__);
}
}
$db->query("DROP TABLE webcal_entry_repeats",__LINE__,__FILE__);
$db->query("UPDATE applications SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__);
$currentver = "0.9.7pre2";
update_version_table();
}
echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from $oldversion to $currentver is completed.</td>\n";
echo " </tr>\n";
if ($oldversion != $currentver){
echo " </tr><td>\n";
echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from $oldversion to $currentver is completed.</td>\n";
echo " </tr>\n";
}
}
}

View File

@ -20,340 +20,51 @@
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;
}
echo "keep going";
exit;
// Does not return unless user is authorized
// $db->Halt_On_Error = "report";
loaddb();
$db->Halt_On_Error = "no";
//$db->Halt_On_Error = "report";
if (!isset($oldversion)){
@$db->query("select app_version from applications where app_name='admin'");
@$db->next_record();
$oldversion = $db->f("app_version");
}
/**********************************************************************\
* First order of business is to upgrade or install the core. *
* if $ok is set to false after this include, the setup stops here *
* otherwise, we display the app setup form. *
* This is sorta kludgy still, but until I can figure out a clean way *
* for applications to inteact with the user, this is how it is. *
* *
\**********************************************************************/
/* Commenting out the following header since it breaks necessary
redirections in the setup code (core_setup.inc.php). -mr_e
echo ' <table border="0" width="100%"><tr>'
. '<td align="left" bgcolor="486591">&nbsp;<font color="fefefe">phpGroupWare version '
. $phpgw_info["server"]["version"] . ' setup</font></td><td align="right" bgcolor="486591">';
echo "<form action='".$PHP_SELF."' method='POST'>\n";
echo " <input type='hidden' name='FormLogout' value='True'>\n";
echo " <input type='submit' name='Logout' value='Logout'>\n";
echo " </form>\n";
echo "</td></tr></table>";
*/
$ok = true;
$baseDir = $phpgw_info["server"]["server_root"];
include("inc/core_setup.inc.php");
if (!$ok) {
Header("Location: index.php");
exit;
} else {
setup_header();
echo "<p><table width=\"70%\" border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='0'>\n";
echo "<tr bgcolor='#486591'>";
echo "<th align=\"center\"><font color='#fefefe'>phpGroupWare Core Staus</font></th>";
echo "</tr>\n";
$db->query("select app_version from applications where app_name='admin'");
$db->next_record();
$curversion = $db->f("app_version");
echo "<tr><td align=\"center\">Core version $curversion. No updates needed.</td></tr>\n";
echo "</table>\n\n";
}
// Remove the appName from all users and groupws on the system
function removeAppPerms($appName) {
global $db;
// $db->query("select app_version from applications where app_name='admin'");
// $db->next_record();
// $oldversion = $db->f("app_version");
}
/**********************************************************************\
* See the Developers HOWTO and the example app in phpgwapps for more *
* info on how to integrate your application with this system. *
\**********************************************************************/
// Called by the app setup classes to add/remove lang records
// it acts correctly according to the current action,
// for an install/upgrade it removes the old record & installes the new one
// for an uninstall it removes the record (as long is as it NOT in common)
//
// TODO: This mechanism is VERY TEMPORARY until jengo and blinky can figure
// out a clean way to use transy for this!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function do_lang($msg_id,$app,$lang,$content) {
global $db,$currentAction;
$msg_id = strtolower($msg_id);
$act = strtolower($currentAction);
//echo "Do Lang: $act, $msg_id, $app, $lang, $content<br>\n";
// Remove the old one
if ($act == "uninstall" || $act == "upgrade") {
if ($app == "common") {
echo "<!-- Not touching message_id '".$msg_id."' as it is in app common. -->\n";
} else {
$sql = "DELETE FROM lang WHERE message_id='" . $msg_id . "' AND app_name='". $app ."'";
$db->query($sql);
}
}
// Add the new one
// By setting $content == "", it allows you to prune old messages from the system
if ($content != "" && $act == "install") {
$sql = "INSERT INTO lang(message_id,app_name,lang,content) VALUES(";
$sql .= "'".$msg_id."',";
$sql .= "'".$app."',";
$sql .= "'".$lang."',";
$sql .= "'".$content."')";
$db->query($sql);
}
if ($content != "" && $act == "upgrade") {
$sql = "UPDATE lang SET ";
$sql .= "content='".$content."' WHERE";
$sql .= " message_id ='".$msg_id."'";
$sql .= " AND app_name = '".$app."'";
$sql .= " AND lang = '".$lang."'";
$db->query($sql);
}
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.";
}
/**********************************************************************\
* *
\**********************************************************************/
/**********************************************************************\
* Apps should call this function to report errors if possible to *
* display them in a nice and controlled format *
\**********************************************************************/
function error($msg) {
global $error_count;
++$error_count;
echo "<tr><td><font color='#ff0000'>".$msg."</font></td></tr>\n";
/* 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;
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;
}
/**********************************************************************\
* Apps should call this function to report warnings if possible to *
* display them in a nice and controlled format *
\**********************************************************************/
function warn($msg) {
echo "<tr><td><font color='#ff00ff'>".$msg."</font></td></tr>\n";
}
/**********************************************************************\
* Applications (and the core) inherit from this class which provides *
* all the hooks that setup needs to call for the app. *
* *
* Applications should call warn() or error() to communicate with *
* the user. *
\**********************************************************************/
// Template for the app-specific setup classes
class Setup {
// Is *ANY* version of the app currently installed ?
function is_installed() {
return false;
}
// Is the app installed and up to date?
function is_current() {
return true;
}
// Can the installed version be upgraded to the
// new one?
function can_upgrade() {
return false;
}
// If this application dpends on any other apps
// this shouldd return an array of the app names (the directory name)
// or return false if it can stand alone
function dependant_apps() {
return false;
}
// Called to actually upgrade the app
function upgrade() {
return true;
}
function install() {
return false;
}
// Called to uninstall the app
// You should remove all tables and files you created,
// and return the system to the state it was before upgrade/install was called
function uninstall() {
}
}
// Loop through all the directories looking for possible 3rd party apps
$baseDir = $phpgw_info["server"]["server_root"];
$setupFile = "/inc/setup.inc.php"; // File to look for to identify apps
$dh = opendir($baseDir);
while ($dir = readdir($dh)) {
$fp = $baseDir . "/" . $dir;
if ($dir[0] != '.' && is_dir($fp)) {
$fp .= $setupFile;
if (is_file($fp) && $dir != "setup") {
//echo "found a setup! in $fp<br>\n";
$detectedApps[$dir]["path"] = $fp;
$detectedApps[$dir]["name"] = $dir;
$detectedApps[$dir]["dir"] = $baseDir."/".$dir;
}
}
}
closedir($dh);
while ($detectedApps && list($name,$app) = each($detectedApps)) {
include($app["path"]);
$detectedApps[$name]["setup"] = new $classname($app["dir"]);
}
// If the user wanted to upgrade/install/remove an app, now is the time
if ((isset($submit) && $submit == "Perform Actions") &&
is_array($appAction)) {
echo "<p>\n";
echo "<table border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='0'>\n";
echo "<tr bgcolor='#486591'>";
echo "<th><font color='#fefefe'>Making Application Changes</font></th>";
echo "</tr>\n";
reset($detectedApps);
$numAltered = 0;
while ($detectedApps && list($name,$a) = each($detectedApps)) {
$app = $a["setup"];
switch ($appAction[$name]) {
case "ignore":
break;
case "upgrade":
$currentAction = "upgrade";
if ($app->upgrade()) {
echo "<tr><td><b>$name</b> upgraded.</td></tr>\n";
} else {
echo "<tr bgcolor='#ff4444'><td><b>$name</b> - upgrade failed!</td></tr>\n";
}
++$numAltered;
break;
case "install":
$currentAction = "install";
if ($app->install()) {
echo "<tr><td><b>$name</b> installed.</td></tr>\n";
} else {
echo "<tr bgcolor='#ff4444'><td><b>$name</b> - install failed!</td></tr>\n";
}
++$numAltered;
break;
case "uninstall":
$currentAction = "uninstall";
if ($app->uninstall()) {
echo "<tr><td><b>$name</b> uninstalled.</td></tr>\n";
removeAppPerms($name);
} else {
echo "<tr bgcolor='#ff4444'><td><b>$name</b> - uninstall failed!</td></tr>\n";
}
++$numAltered;
break;
}
}
if ($numAltered == 0) {
echo "<tr><td>No applications altered.</td></tr>\n";
}
echo "</table>\n";
}
echo "<form action='".$PHP_SELF."' method='POST'>\n";
echo "<table border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='1' width=\"70%\">\n";
echo "<tr bgcolor='#486591'><th colspan='7'><font color='#fefefe'>Application Setup</font></th></tr>\n";
echo "<tr bgcolor='#486591'>";
echo "<td align=\"center\"><font color='#fefefe'>Application</font></td>";
echo "<td align=\"center\"><font color='#fefefe'>Installed Version</font></td>";
echo "<td align=\"center\"><font color='#fefefe'>Detected Version</font></td>";
echo "<td align=\"center\"><font color='#fefefe'>Install</font></td>";
echo "<td align=\"center\"><font color='#fefefe'>Upgrade</font></td>";
echo "<td align=\"center\"><font color='#fefefe'>Remove</font></td>";
echo "<td align=\"center\"><font color='#fefefe'>Do Nothing</font></td>";
echo "</tr>\n";
$numApps = 0;
if (isSet($detectedApps)) reset($detectedApps);
while ($detectedApps && list($name,$a) = each($detectedApps)) {
$app = $a["setup"];
echo "<tr>";
echo " <td>".$name."</td>\n";
if (is_object($a["setup"])) {
$installed = $app->is_installed();
$code = $app->code_version();
}
if (!$installed) {
echo " <td>-not yet installed-</td>\n";
} else if ($installed == "0.0.0" || $installed == "0.0") {
echo " <td>Pre-Beta</td>";
} else {
echo " <td>".$installed."</td>\n";
}
echo " <td>".$code."</td>\n";
if ($installed && $app->is_current()) {
echo " <td>N/A</td>"; // Can't install
echo " <td>N/A</td>"; // Can't upgrade
echo " <td><input type='radio' name='appAction[".$name."]' value='uninstall'>"; // Can remove
echo " <td><input type='radio' name='appAction[".$name."]' value='ignore' checked>"; // Can ignore
} else if ($installed) {
echo " <td>N/A</td>"; // Can't install
echo " <td><input type='radio' name='appAction[".$name."]' value='upgrade' checked>"; // Can upgrade
echo " <td><input type='radio' name='appAction[".$name."]' value='uninstall'>"; // Can remove
echo " <td><input type='radio' name='appAction[".$name."]' value='ignore'>"; // Can ignore
} else {
echo " <td><input type='radio' name='appAction[".$name."]' value='install' checked>"; // Can install
echo " <td>N/A</td>"; // Can't upgrade
echo " <td>N/A</td>"; // Can't remove
echo " <td><input type='radio' name='appAction[".$name."]' value='ignore'>"; // Can ignore
}
echo "</tr>\n";
++$numApps;
}
if ($numApps) {
echo "<tr><td colspan='7' align='right'><input type='submit' name='submit' value='Perform Actions'></td></tr>\n";
} else {
echo "<tr><td colspan='7' align='right'>Found no non-core applications. ";
echo "Visit <a href='http://phpgroupware.org/'>phpGroupWare.org</a> to obtain add-on applications.</td></tr>\n";
}
echo "</table>\n";
echo "</form>\n";
echo "Applications not in the table above are either part of the phpGroupWare core, or ";
echo "have not been upgraded to the new phpGroupWare application setup code.";
echo "<p>When you are done installing and upgrading applications, you should ";
echo "continue to the <a href='config.php'>Configuration Page</a>";
echo "<br>or skip to <a href='lang.php'>Configure multi-language support</a>.\n";
echo "<br><br>or for a drastic measure, you can delete all your tables and data and recreate the new empty tables.\n";
echo " <form method=\"POST\" action=\"$PHP_SELF\">\n";
echo " <input type=\"submit\" name=\"action\" value=\"Delete my old tables\">\n";
echo " </form>\n";
?>
</body>
</html>
$stage = 2.5;
show_header($header_msg);
show_steps($stage);
echo "</body></html>";
?>