Cleaning up setup

This commit is contained in:
jengo 2000-11-17 15:49:03 +00:00
parent 8ed5524101
commit e339bcabf6
2 changed files with 60 additions and 58 deletions

View File

@ -15,54 +15,58 @@
// password in ../header.inc.php to protect all of the setup
// pages from unauthorized use.
function setup_header()
function setup_header($title = "")
{
global $phpgw_info;
echo '<title>phpGroupWare - setup</title><BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" '
echo '<title>phpGroupWare setup ' . $title . '</title><BODY BGCOLOR="FFFFFF" margintop="0" marginleft="0" '
. 'marginright="0" marginbottom="0"><table border="0" width="100%"><tr>'
. '<td align="left" bgcolor="486591">&nbsp;<font color="fefefe">phpGroupWare version '
. $phpgw_info["server"]["version"] . ' setup</font></td></tr></table>';
}
function loginForm($err="") {
global $PHP_SELF;
echo "<html><head><title>phpGroupWare Setup - please Login</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\">&nbsp;<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";
echo " <input type='password' name='FormPW' value=''>\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 loginForm($err="")
{
global $PHP_SELF;
setup_header("Please login");
if (isset($FormPW) ) {
if ($FormPW != $phpgw_info["server"]["config_passwd"]) {
loginForm("Invalid password.");
exit;
}
// Valid login, fall through and set the cookie
$SetupCookie = $FormPW;
} else if (isset($SetupCookie)) {
if ($SetupCookie != $phpgw_info["server"]["config_passwd"]) {
setcookie("SetupCookie",""); // scrub the old one
loginForm("Invalid session cookie (cookies must be enabled)");
exit;
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\">&nbsp;<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";
echo " <input type='password' name='FormPW' value=''>\n";
echo " <input type='submit' name='Login' value='Login'>\n";
echo " </form></td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "</body></html>\n";
}
} else {
loginForm();
exit;
}
// Auth ok.
setcookie("SetupCookie","$SetupCookie");
?>
if (isset($FormPW)) {
if ($FormPW != $phpgw_info["server"]["config_passwd"]) {
loginForm("Invalid password.");
exit;
}
// Valid login, fall through and set the cookie
$SetupCookie = $FormPW;
} else if (isset($SetupCookie)) {
if ($SetupCookie != $phpgw_info["server"]["config_passwd"]) {
setcookie("SetupCookie",""); // scrub the old one
loginForm("Invalid session cookie (cookies must be enabled)");
exit;
}
} else {
loginForm();
exit;
}
// Auth ok.
setcookie("SetupCookie","$SetupCookie");
?>

View File

@ -62,20 +62,23 @@
* for applications to inteact with the user, this is how it is. *
* *
\**********************************************************************/
setup_header();
echo "<br>";
$ok = true;
$baseDir = $phpgw_info["server"]["server_root"];
include("./inc/core_setup.inc.php");
if (!$ok) {
exit;
} else {
echo "<table border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='0'>\n";
echo "<table width=\"70%\" border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='0'>\n";
echo "<tr bgcolor='#486591'>";
echo "<th><font color='#fefefe'>phpGroupWare Core Staus</font></th>";
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>Core version $curversion. No updates needed.</td></tr>\n";
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
@ -204,11 +207,6 @@
}
}
// Initial HTML output
echo "<html><head><title>Setup phpGroupWare</title></head>\n";
echo "<body bgcolor='#ffffff'>\n";
// 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
@ -287,16 +285,16 @@
echo "<form action='".$PHP_SELF."' method='POST'>\n";
echo "<table border='0' align='center' bgcolor='#e6e6e6' cellpadding='3' cellspacing='1'>\n";
echo "<tr bgcolor='#486591'><th colspan='7'><font size='+1' color='#fefefe'>Application Setup</font></th></tr>\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 "<th><font color='#fefefe'>Application</font></th>";
echo "<th><font color='#fefefe'>Installed Version</font></th>";
echo "<th><font color='#fefefe'>Detected Version</font></th>";
echo "<th><font color='#fefefe'>Install</font></th>";
echo "<th><font color='#fefefe'>Upgrade</font></th>";
echo "<th><font color='#fefefe'>Remove</font></th>";
echo "<th><font color='#fefefe'>Do Nothing</font></th>";
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;