phpGroupWare version setup Logout '; } echo "
"; } function loginForm($err=""){ global $phpgw_info, $phpgw_domain, $SetupDomain, $SetupPW, $PHP_SELF; echo "

\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; if ($err != "") { echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo "
 Setup Login
".$err."
\n"; if (count($phpgw_domain) > 1){ echo " \n"; echo "
Domain:
Password:
\n"; }else{ echo " \n"; echo " \n"; } echo " \n"; echo "
\n"; echo "\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, $phpgw_domain, $SetupDomain, $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 ''; echo ' '; if ($stage == 1.1) { echo ''; }elseif ($stage == 1.2) { echo ''; }elseif ($stage >= 1.3) { echo ''; } echo ' '; if ($stage < 2.1) { echo ''; }elseif ($stage == 2.1) { echo ''; }elseif ($stage == 2.2) { echo ''; }elseif ($stage == 2.3) { /* commented out because I cannot accuratly figure out if the DB exists */ // echo ''; echo ''; }elseif ($stage == 2.4) { echo ''; }elseif ($stage == 2.5) { echo ''; } echo ' '; if ($stage < 3.1) { echo ''; }elseif ($stage == 3.1) { echo ''; }elseif ($stage == 3.2) { echo ''; } echo '
Step 1 - 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.
Step 2 - database management 
ONot ready for this stage yet.
O
Your database does not exist.
O
Your database exist but your pre-beta tables need upgrading.
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 '
Once the database is setup correctly
O
Your database exist but your tables need upgrading.
XYour tables are current.
Step 3 - language management 
ONot ready for this stage yet.
Ostage 3.1.
Ostage 3.2.
'; } 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!
"; exit; } } ?>