diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index d16af85341..c404dc5bed 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -25,7 +25,7 @@ // 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")) { + if(file_exists("../version.inc.php")) { include("../version.inc.php"); // To set the current core version }else{ $phpgw_info["server"]["versions"]["phpgwapi"] = "Undetected"; @@ -35,8 +35,5 @@ include("./inc/phpgw_setup.inc.php"); include("./inc/phpgw_schema_proc.inc.php"); - include("./inc/phpgw_template.inc.php"); - $phpgw_setup = new phpgw_setup; - $phpgw_setup->template = new Template("../"); ?> \ No newline at end of file diff --git a/setup/inc/phpgw_setup.inc.php b/setup/inc/phpgw_setup.inc.php index b86e06b43d..c76c944bfb 100644 --- a/setup/inc/phpgw_setup.inc.php +++ b/setup/inc/phpgw_setup.inc.php @@ -14,35 +14,26 @@ class phpgw_setup { var $db; - var $template; function show_header($title = "",$nologoutbutton = False, $logoutfrom = "config") { global $phpgw_info, $PHP_SELF; - echo ' - - - phpGroupWare Setup - '; - if ($title != ""){echo " - ".$title;} - echo' - - - - - - - -
 phpGroupWare version '.$phpgw_info["server"]["versions"]["phpgwapi"].' setup - - '; - if ($nologoutbutton) { - echo " "; - } else { - echo 'Logout '; - } - echo "
"; + echo "\n\n"; + echo " phpGroupWare Setup"; if ($title != ""){echo " - ".$title;}; echo "\n"; + echo " \n"; + echo "\n"; + echo ""; + echo ""; + echo " "; + echo " "; + } else { + echo "Logout "; + } + echo "
 phpGroupWare version ".$phpgw_info["server"]["versions"]["phpgwapi"]." setup"; + if ($nologoutbutton) { + echo " 
"; } + function login_form() { global $phpgw_info, $phpgw_domain, $PHP_SELF; @@ -57,15 +48,15 @@ echo " \n"; echo "
\n"; if (count($phpgw_domain) > 1){ - echo " \n"; - echo "
Domain:
Password:
\n"; + echo " \n"; + echo "
Domain:
Password:
\n"; }else{ reset($phpgw_domain); $default_domain = each($phpgw_domain); - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; } - echo " \n"; + echo " \n"; echo "
\n"; echo " \n"; } @@ -73,11 +64,11 @@ echo " \n"; echo "  Header Admin Login\n"; echo " \n"; - echo " ".$phpgw_info["setup"]["HeaderLoginMSG"]."\n"; + echo " ".$phpgw_info["setup"]["HeaderLoginMSG"]."\n"; echo " \n"; - echo "
\n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; echo "
\n"; echo " \n"; @@ -88,33 +79,36 @@ function check_header() { global $phpgw_domain, $phpgw_info; - if(!file_exists("../header.inc.php") || !is_file("../header.inc.php")) { + if(!file_exists("../header.inc.php")) { $phpgw_info["setup"]["header_msg"] = "Stage One"; - return 1; + return "1"; }else{ include("../header.inc.php"); if (!isset($phpgw_info["server"]["header_admin_password"])){ $phpgw_info["setup"]["header_msg"] = "Stage One (No header admin password set)"; - return 2; - }elseif (!isset($phpgw_domain) || $phpgw_info["server"]["versions"]["header"] != $phpgw_info["server"]["versions"]["current_header"]) { + return "2"; + }elseif (!isset($phpgw_domain)) { $phpgw_info["setup"]["header_msg"] = "Stage One (Upgrade your header.inc.php)"; - return 3; + return "3"; + }elseif ($phpgw_info["server"]["versions"]["header"] != $phpgw_info["server"]["versions"]["current_header"]) { + $phpgw_info["setup"]["header_msg"] = "Stage One (Upgrade your header.inc.php)"; + return "3"; }else{ /* header.inc.php part settled. Moving to authentication */ $phpgw_info["setup"]["header_msg"] = "Stage One (Completed)"; - return 10; + return "10"; } } } function generate_header() { - global $setting, $phpgw_setup, $phpgw_info; + global $setting, $phpgw_setup, $phpgw_info, $header_template; - $phpgw_setup->template->set_file(array("header" => "header.inc.php.template")); + $header_template->set_file(array("header" => "header.inc.php.template")); while(list($k,$v) = each($setting)) { - $phpgw_setup->template->set_var(strtoupper($k),$v); + $header_template->set_var(strtoupper($k),$v); } - return $phpgw_setup->template->parse("out","header"); + return $header_template->parse("out","header"); } function auth($auth_type = "Config") @@ -318,42 +312,5 @@ } */ } - - function setup_header($title = "",$nologoutbutton = False) { - global $phpgw_info, $PHP_SELF; - - // Ok, so it isn't the greatest idea, but it works for now. Setup needs to be rewritten. - if ($phpgw_info["setup"]["dontshowtheheaderagain"]) { - return False; - } - - $phpgw_info["setup"]["dontshowtheheaderagain"] = True; -?> - - phpGroupWare setup <?php echo $title; ?> - - - - - - -
 phpGroupWare version setup - -Logout '; - } - echo "
"; - } } ?> \ No newline at end of file diff --git a/setup/index.php b/setup/index.php index 7a1ac4c6b0..2300569d89 100644 --- a/setup/index.php +++ b/setup/index.php @@ -69,139 +69,153 @@ $phpgw_info["server"]["app_images"] = "templates/default/images"; - echo ''; - -/* - echo ' '; - if ($phpgw_info["setup"]["stage"]["header"] <= 1) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["header"] == 2 || $phpgw_info["setup"]["stage"] == 3) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["header"] == 10) { - echo ''; - } -*/ + echo "
Step 0 - header.inc.php 
O
You have not created your header.inc.php yet.
O
Your header.inc.php is out of date. Please upgrade it.
X
- Your header.inc.php is in place and current.
"; echo ' '; - if ($phpgw_info["setup"]["stage"]["header"] < 10) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["db"] <= 1) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["db"] == 2) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["db"] == 3) { - /* commented out because I cannot accuratly figure out if the DB exists */ - //echo ''; - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["db"] == 4) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["db"] == 5) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["db"] == 10) { - echo ''; + switch($phpgw_info["setup"]["stage"]["db"]){ + case 1: + echo ''; + case 2: + echo ''; + break; + case 3: + /* commented out because I cannot accuratly figure out if the DB exists */ + //echo ''; + echo ''; + break; + case 4: + echo ''; + break; + case 5: + echo ''; + break; + case 10: + echo ''; + break; + default: + echo ''; + break; } + echo ' '; - if ($phpgw_info["setup"]["stage"]["db"] < 10) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["config"] <= 1) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["config"] == 10) { - echo ''; + switch($phpgw_info["setup"]["stage"]["config"]){ + case 1: + echo ''; + break; + case 10: + echo ''; + break; + default: + echo ''; + break; } + echo ' '; - if ($phpgw_info["setup"]["stage"]["config"] < 10) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["lang"] <= 1) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["lang"] == 10) { - echo ''; + switch($phpgw_info["setup"]["stage"]["lang"]){ + case 1: + echo ''; + break; + case 10: + echo ''; + break; + default: + echo ''; + break; } + echo ' '; - if ($phpgw_info["setup"]["stage"]["lang"] < 10) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["apps"] <= 1) { - echo ''; - }elseif ($phpgw_info["setup"]["stage"]["apps"] == 10) { - echo ''; + switch($phpgw_info["setup"]["stage"]["apps"]){ + case 1: + echo ''; + break; + case 10: + echo ''; + break; + default: + echo ''; + break; } echo '
Step 1 - database management 
ONot ready for this stage yet.
O
Your database does not exist.
O'; - echo ' - You appear to be running a pre-beta version of phpGroupWare
- We are providing an automated upgrade system, but we highly recommend backing up your tables incase the script causes damage to your data.
- These automated scripts can easily destroy your data. Please backup before going any further!
-
- Select your old version: - - - -
'; - echo '
O
Your database exist, would you like to create your tables now?
OMake sure that your database is created and the account permissions are set.
'; - if ($phpgw_domain[$SetupDomain]["db_type"] == "mysql"){ - echo " -
Instructions for creating the database in MySQL:
- Login to mysql -
- [user@server user]# mysql -u root -p
- Create the empty database and grant user permissions -
- mysql> create database phpgroupware;
- mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';
- "; - }elseif ($phpgw_domain[$SetupDomain]["db_type"] == "pgsql"){ - echo " -
Instructions for creating the database in PostgreSQL:
- Start the postmaster
- [user@server user]# postmaster -i -D /home/[username]/[dataDir]
- Create the empty database -
- [user@server user]# createdb phpgroupware
- "; - } - echo '
'; - echo "\n"; - echo 'Once the database is setup correctly
the tables
O'; - echo "You appear to be running version ".$phpgw_info["setup"]["oldver"]["phpgwapi"]." of phpGroupWare.
\n"; - echo "We will automaticly update your tables/records to ".$phpgw_info["server"]["versions"]["phpgwapi"].", 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 "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
\n"; - echo "
\n"; - echo "\n"; - echo "
\n"; - echo '
O'; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - $phpgw_setup->db->Halt_On_Error = "report"; - include ("./sql/common_main.inc.php"); - $phpgw_setup->db->Halt_On_Error = "no"; - echo " \n"; - echo " \n"; - echo "
 $subtitle
$submsg
 Table Change Messages
 Status
If you did not recieve any errors, your tables have been $subaction.
\n"; - echo "
\n"; - echo "
\n"; - echo '
'; - echo '
XYour tables are current.'; - echo "
\n"; - echo "\n"; - echo "
Insanity: \n"; - echo '
'; - echo '
O
Your database does not exist.
O'; + echo ' + You appear to be running a pre-beta version of phpGroupWare
+ We are providing an automated upgrade system, but we highly recommend backing up your tables incase the script causes damage to your data.
+ These automated scripts can easily destroy your data. Please backup before going any further!
+
+ Select your old version: + + + +
+ '; + echo '
O
Your database exist, would you like to create your tables now?
OMake sure that your database is created and the account permissions are set.
'; + switch ($phpgw_domain[$SetupDomain]["db_type"]){ + case "mysql": + echo " +
Instructions for creating the database in MySQL:
+ Login to mysql -
+ [user@server user]# mysql -u root -p
+ Create the empty database and grant user permissions -
+ mysql> create database phpgroupware;
+ mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';
+ "; + break; + case "pgsql": + echo " +
Instructions for creating the database in PostgreSQL:
+ Start the postmaster
+ [user@server user]# postmaster -i -D /home/[username]/[dataDir]
+ Create the empty database -
+ [user@server user]# createdb phpgroupware
+ "; + break; + } + echo '
'; + echo "\n"; + echo 'Once the database is setup correctly
the tables
O'; + echo "You appear to be running version ".$phpgw_info["setup"]["oldver"]["phpgwapi"]." of phpGroupWare.
\n"; + echo "We will automaticly update your tables/records to ".$phpgw_info["server"]["versions"]["phpgwapi"].", 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 "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + echo '
O'; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + $phpgw_setup->db->Halt_On_Error = "report"; + include ("./sql/common_main.inc.php"); + $phpgw_setup->db->Halt_On_Error = "no"; + echo " \n"; + echo " \n"; + echo "
 $subtitle
$submsg
 Table Change Messages
 Status
If you did not recieve any errors, your tables have been $subaction.
\n"; + echo "
\n"; + echo "
\n"; + echo '
'; + echo '
XYour tables are current.'; + echo "
\n"; + echo "\n"; + echo "
Insanity: \n"; + echo '
'; + echo '
O
Your database does not exist.
Step 2 - Configuration 
ONot ready for this stage yet.
OPlease configure phpGroupWare for your environment.'; - echo "
"; - echo '
XConfiguration completed.'; - echo "
"; - echo '
Click Here to setup 1 admin account and 3 demo accounts.
This will delete all existing accounts'; - echo '
OPlease configure phpGroupWare for your environment.'; + echo "
"; + echo '
XConfiguration completed.'; + echo "
"; + echo '
Click Here to setup 1 admin account and 3 demo accounts.
This will delete all existing accounts'; + echo '
ONot ready for this stage yet.
Step 3 - language management 
ONot ready for this stage yet.
OYou are ready for this stage, but this stage is not yet written.
OThis stage is completed
OYou are ready for this stage, but this stage is not yet written.
OThis stage is completed
ONot ready for this stage yet.
Step 4 - Add-on Application Installation 
ONot ready for this stage yet.
OYou are ready for this stage, but this stage is not yet written.
OThis stage is completed
OYou are ready for this stage, but this stage is not yet written.
OThis stage is completed
ONot ready for this stage yet.
'; echo ""; diff --git a/setup/manageheader.php b/setup/manageheader.php index 84b3ae3ff3..4807df7ccc 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -37,6 +37,8 @@ switch($action){ case "download": + include("./inc/phpgw_template.inc.php"); + $header_template = new Template("../"); header("Content-disposition: attachment; filename=\"header.inc.php\""); header("Content-type: application/octet-stream"); header("Pragma: no-cache"); @@ -45,6 +47,8 @@ echo $newheader; break; case "view": + include("./inc/phpgw_template.inc.php"); + $header_template = new Template("../"); $phpgw_setup->show_header("Generated header.inc.php", False, "header"); echo "
Save this text as contents of your header.inc.php

"; $newheader = $phpgw_setup->generate_header(); @@ -53,8 +57,9 @@ echo ""; break; case "write config": + include("./inc/phpgw_template.inc.php"); + $header_template = new Template("../"); if(is_writeable ("../header.inc.php")|| (!file_exists ("../header.inc.php") && is_writeable ("../"))){ - $phpgw_setup->show_header("Saved header.inc.php", False, "header"); $newheader = $phpgw_setup->generate_header(); $fsetup = fopen("../header.inc.php","w"); fwrite($fsetup,$newheader); @@ -250,5 +255,7 @@ echo ""; echo ""; echo ""; + + break; // ending the switch default } ?>