mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
moving new setup program into place. Its not done yet, but Im moving as fast as I can
This commit is contained in:
parent
dbdf4c5f64
commit
9ca2298a8e
198
setup/inc/functions.inc.php
Normal file
198
setup/inc/functions.inc.php
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<?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.
|
||||||
|
|
||||||
|
if(file_exists("../version.inc.php") || is_file("../version.inc.php")) {
|
||||||
|
include("../version.inc.php"); // To set the current core version
|
||||||
|
}else{
|
||||||
|
$phpgw_info["server"]["version"] = "Undetected";
|
||||||
|
}
|
||||||
|
$phpgw_info["server"]["current_header_version"] = "1.4";
|
||||||
|
|
||||||
|
function show_header($title = "",$nologoutbutton = False) {
|
||||||
|
global $phpgw_info, $PHP_SELF;
|
||||||
|
?>
|
||||||
|
<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>
|
||||||
|
</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;
|
||||||
|
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 auth(){
|
||||||
|
global $phpgw_domain, $FormLogout, $FormDomain, $FormPW, $SetupPW, $SetupDomain, $db, $HTTP_POST_VARS, $login_msg;
|
||||||
|
if (isset($FormLogout)) {
|
||||||
|
setcookie("SetupPW"); // scrub the old one
|
||||||
|
setcookie("SetupDomain"); // scrub the old one
|
||||||
|
$login_msg = "You have sucessfully logged out";
|
||||||
|
return False;
|
||||||
|
} elseif (isset($SetupPW)) {
|
||||||
|
if ($SetupPW != $phpgw_domain[$SetupDomain]["config_passwd"]) {
|
||||||
|
setcookie("SetupPW"); // scrub the old one
|
||||||
|
setcookie("SetupDomain"); // scrub the old one
|
||||||
|
$login_msg = "Invalid session cookie (cookies must be enabled)";
|
||||||
|
return False;
|
||||||
|
}else{
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
} elseif (isset($FormPW)) {
|
||||||
|
if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"]) {
|
||||||
|
setcookie("SetupPW",$FormPW);
|
||||||
|
setcookie("SetupDomain",$FormDomain);
|
||||||
|
$SetupDomain = $FormDomain;
|
||||||
|
return True;
|
||||||
|
}else{
|
||||||
|
$login_msg = "Invalid password";
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loaddb(){
|
||||||
|
global $phpgw_info, $phpgw_domain, $SetupDomain, $db;
|
||||||
|
/* Database setup */
|
||||||
|
$phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi";
|
||||||
|
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"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_steps($stage, $note = False) {
|
||||||
|
global $phpgw_info, $PHP_SELF;
|
||||||
|
|
||||||
|
/* 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 = database and tables exists and are current
|
||||||
|
Stage 3 =
|
||||||
|
Stage 4 =
|
||||||
|
Stage 5 =
|
||||||
|
*/
|
||||||
|
|
||||||
|
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><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>';
|
||||||
|
}elseif ($stage == 2.3) {
|
||||||
|
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>';
|
||||||
|
}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>';
|
||||||
|
}elseif ($stage == 2.5) {
|
||||||
|
echo '<tr><td align="center">X</td><td>Your tables are current.</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 3 - language management</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>stage 3.1.<br></td></tr>';
|
||||||
|
}elseif ($stage == 3.2) {
|
||||||
|
echo '<tr><td align="center">O</td><td>stage 3.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
353
setup/tables.php
Normal file
353
setup/tables.php
Normal file
@ -0,0 +1,353 @@
|
|||||||
|
<?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("../header.inc.php");
|
||||||
|
include("../version.inc.php"); // To set the current core version
|
||||||
|
|
||||||
|
// Authorize the user to use setup app and load the database
|
||||||
|
include("./inc/setup_auth.inc.php");
|
||||||
|
// Does not return unless user is authorized
|
||||||
|
|
||||||
|
// $db->Halt_On_Error = "report";
|
||||||
|
$db->Halt_On_Error = "no";
|
||||||
|
|
||||||
|
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"> <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) {
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************\
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************\
|
||||||
|
* *
|
||||||
|
\**********************************************************************/
|
||||||
|
|
||||||
|
/**********************************************************************\
|
||||||
|
* 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";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************\
|
||||||
|
* 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>
|
Loading…
Reference in New Issue
Block a user