From 4b4afd3c23ab7ddcbabc3e60c93fcf6a95a715af Mon Sep 17 00:00:00 2001 From: Miles Lott <milosch@alumni.egroupware.org> Date: Wed, 22 Oct 2003 11:28:17 +0000 Subject: [PATCH] Add another case for manageheader when domains are not defined in header.inc.php, also some formatting updates --- phpgwapi/inc/class.setup.inc.php | 30 ++++----- phpgwapi/inc/class.setup_detection.inc.php | 10 +-- phpgwapi/inc/class.setup_html.inc.php | 15 ++--- setup/lang/phpgw_en.lang | 1 + setup/manageheader.php | 72 ++++++++++++++++------ 5 files changed, 83 insertions(+), 45 deletions(-) diff --git a/phpgwapi/inc/class.setup.inc.php b/phpgwapi/inc/class.setup.inc.php index d9d092ccc1..5a3fa96036 100644 --- a/phpgwapi/inc/class.setup.inc.php +++ b/phpgwapi/inc/class.setup.inc.php @@ -1,17 +1,17 @@ <?php /**************************************************************************\ - * phpGroupWare - Setup * - * http://www.phpgroupware.org * - * -------------------------------------------- * - * This file written by Joseph Engo<jengo@phpgroupware.org> * - * and Dan Kuykendall<seek3r@phpgroupware.org> * - * and Mark Peters<skeeter@phpgroupware.org> * - * and Miles Lott<milosch@phpgroupware.org> * - * -------------------------------------------- * + * phpGroupWare - Setup * + * http://www.phpgroupware.org * + * -------------------------------------------- * + * This file written by Joseph Engo<jengo@phpgroupware.org> * + * and Dan Kuykendall<seek3r@phpgroupware.org> * + * and Mark Peters<skeeter@phpgroupware.org> * + * and Miles Lott<milosch@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. * + * option) any later version. * \**************************************************************************/ /* $Id$ */ @@ -26,8 +26,8 @@ var $lang = ''; var $html = ''; var $appreg = ''; - - /* table name vars */ + + /* table name vars */ var $tbl_apps; var $tbl_config; var $tbl_hooks; @@ -39,7 +39,7 @@ $this->appreg = CreateObject('phpgwapi.app_registry'); /* The setup application needs these */ - $this->html = $html ? CreateObject('phpgwapi.setup_html') : ''; + $this->html = $html ? CreateObject('phpgwapi.setup_html') : ''; $this->translation = $translation ? CreateObject('phpgwapi.setup_translation') : ''; // $this->tbl_apps = $this->get_apps_table_name(); @@ -57,7 +57,7 @@ $GLOBALS['phpgw_info']['server']['db_type'] = $GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_type']; - $this->db = CreateObject('phpgwapi.db'); + $this->db = CreateObject('phpgwapi.db'); $this->db->Host = $GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_host']; $this->db->Type = $GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_type']; $this->db->Database = $GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_name']; @@ -352,9 +352,9 @@ if ($setup_info[$appname]['tables_use_prefix'] == True) { echo $setup_info[$appname]['name'] . ' uses tables_use_prefix, storing ' - . $setup_info[$appname]['tables_prefix'] + . $setup_info[$appname]['tables_prefix'] . ' as prefix for ' . $setup_info[$appname]['name'] . " tables\n"; - + $sql = "INSERT INTO phpgw_config (config_app,config_name,config_value) " ."VALUES ('".$setup_info[$appname]['name']."','" .$appname."_tables_prefix','".$setup_info[$appname]['tables_prefix']."');"; diff --git a/phpgwapi/inc/class.setup_detection.inc.php b/phpgwapi/inc/class.setup_detection.inc.php index 0a0dd16d02..d3e2526e15 100644 --- a/phpgwapi/inc/class.setup_detection.inc.php +++ b/phpgwapi/inc/class.setup_detection.inc.php @@ -229,20 +229,20 @@ } else { - if (!isset($GLOBALS['phpgw_info']['server']['header_admin_password'])) + if(!@isset($GLOBALS['phpgw_info']['server']['header_admin_password'])) { $GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage One (No header admin password set)'; return '2'; } - elseif (!isset($GLOBALS['phpgw_domain'])) + elseif(!@isset($GLOBALS['phpgw_domain'])) { - $GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage One (Upgrade your header.inc.php)'; + $GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage One (Add domains to your header.inc.php)'; return '3'; } - elseif (@$GLOBALS['phpgw_info']['server']['versions']['header'] != @$GLOBALS['phpgw_info']['server']['versions']['current_header']) + elseif(@$GLOBALS['phpgw_info']['server']['versions']['header'] != @$GLOBALS['phpgw_info']['server']['versions']['current_header']) { $GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage One (Upgrade your header.inc.php)'; - return '3'; + return '4'; } } /* header.inc.php part settled. Moving to authentication */ diff --git a/phpgwapi/inc/class.setup_html.inc.php b/phpgwapi/inc/class.setup_html.inc.php index 63ad55e2e5..e19ef8af26 100644 --- a/phpgwapi/inc/class.setup_html.inc.php +++ b/phpgwapi/inc/class.setup_html.inc.php @@ -75,13 +75,14 @@ function show_header($title='',$nologoutbutton=False, $logoutfrom='config', $configdomain='') { $GLOBALS['setup_tpl']->set_var('lang_charset',lang('charset')); - $style = array('th_bg' => '#486591', - 'th_text' => '#FFFFFF', - 'row_on' => '#DDDDDD', - 'row_off' => '#EEEEEE', - 'banner_bg' => '#4865F1', - 'msg' => '#FF0000', - ); + $style = array( + 'th_bg' => '#486591', + 'th_text' => '#FFFFFF', + 'row_on' => '#DDDDDD', + 'row_off' => '#EEEEEE', + 'banner_bg' => '#4865F1', + 'msg' => '#FF0000', + ); $GLOBALS['setup_tpl']->set_var($style); if ($nologoutbutton) { diff --git a/setup/lang/phpgw_en.lang b/setup/lang/phpgw_en.lang index 1414202ea8..ea002347bb 100644 --- a/setup/lang/phpgw_en.lang +++ b/setup/lang/phpgw_en.lang @@ -374,6 +374,7 @@ you have not created your header.inc.php yet!<br> you can create it now. setup e you have successfully logged out setup en You have successfully logged out you must enter a username for the admin setup en You must enter a username for the admin you need to select your current charset! setup en You need to select your current charset! +you need to add some domains to your header.inc.php. setup en You need to add some domains to your header.inc.php. you should either uninstall and then reinstall it, or attempt manual repairs setup en You should either uninstall and then reinstall it, or attempt manual repairs you're using an old configuration file format... setup en You're using an old configuration file format... you're using an old header.inc.php version... setup en You're using an old header.inc.php version... diff --git a/setup/manageheader.php b/setup/manageheader.php index d22421978a..26cc04036f 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -96,10 +96,22 @@ $GLOBALS['phpgw_info']['setup']['PageMSG'] = lang('Your header admin password is NOT set. Please set it now!'); break; case '3': + $GLOBALS['phpgw_info']['setup']['HeaderFormMSG'] = lang('You need to add some domains to your header.inc.php.'); + $GLOBALS['phpgw_info']['setup']['PageMSG'] = lang('You need to add some domains to your header.inc.php.'); + $GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = lang('You need to add some domains to your header.inc.php.'); + if(!$GLOBALS['phpgw_setup']->auth('Header')) + { + $GLOBALS['phpgw_setup']->html->show_header('Please login',True); + $GLOBALS['phpgw_setup']->html->login_form(); + $GLOBALS['phpgw_setup']->html->show_footer(); + exit; + } + break; + case '4': $GLOBALS['phpgw_info']['setup']['HeaderFormMSG'] = lang('Your header.inc.php needs upgrading.'); $GLOBALS['phpgw_info']['setup']['PageMSG'] = lang('Your header.inc.php needs upgrading.<br><blink><b class="msg">WARNING!</b></blink><br><b>MAKE BACKUPS!</b>'); $GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = lang('Your header.inc.php needs upgrading.'); - if (!$GLOBALS['phpgw_setup']->auth('Header')) + if(!$GLOBALS['phpgw_setup']->auth('Header')) { $GLOBALS['phpgw_setup']->html->show_header('Please login',True); $GLOBALS['phpgw_setup']->html->login_form(); @@ -108,7 +120,7 @@ } break; case '10': - if (!$GLOBALS['phpgw_setup']->auth('Header')) + if(!$GLOBALS['phpgw_setup']->auth('Header')) { $GLOBALS['phpgw_setup']->html->show_header('Please login',True); $GLOBALS['phpgw_setup']->html->login_form(); @@ -187,7 +199,7 @@ $detected = ''; - if (!get_var('ConfigLang',array('POST','COOKIE'))) + if(!get_var('ConfigLang',array('POST','COOKIE'))) { $detected .= '<br><form action="manageheader.php" method="Post">Please Select your language '.lang_select(True,'en')."</form>\n"; } @@ -201,7 +213,7 @@ $detected .= '<tr class="th"><td colspan="2">' . lang('Analysis') . '</td></tr><tr><td colspan="2">'. "\n"; $supported_db = array(); - if (extension_loaded('mysql') || function_exists('mysql_connect')) + if(extension_loaded('mysql') || function_exists('mysql_connect')) { $detected .= lang('You appear to have MySQL support enabled') . '<br>' . "\n"; $supported_db[] = 'mysql'; @@ -210,7 +222,7 @@ { $detected .= lang('No MySQL support found. Disabling') . '<br>' . "\n"; } - if (extension_loaded('pgsql') || function_exists('pg_connect')) + if(extension_loaded('pgsql') || function_exists('pg_connect')) { $detected .= lang('You appear to have Postgres-DB support enabled') . '<br>' . "\n"; $supported_db[] = 'pgsql'; @@ -219,7 +231,7 @@ { $detected .= lang('No Postgres-DB support found. Disabling') . '<br>' . "\n"; } - if (extension_loaded('mssql') || function_exists('mssql_connect')) + if(extension_loaded('mssql') || function_exists('mssql_connect')) { $detected .= lang('You appear to have Microsoft SQL Server support enabled') . '<br>' . "\n"; $supported_db[] = 'mssql'; @@ -228,7 +240,7 @@ { $detected .= lang('No Microsoft SQL Server support found. Disabling') . '<br>' . "\n"; } - if (extension_loaded('oci8')) + if(extension_loaded('oci8')) { $detected .= lang('You appear to have Oracle V8 (OCI) support enabled') . '<br>' . "\n"; $supported_db[] = 'oracle'; @@ -256,7 +268,7 @@ exit; } - if (!function_exists('version_compare')) + if(!function_exists('version_compare')) { $detected .= '<b><p align="center" class="msg">' . lang('You appear to be using PHP earlier than 4.1.0. phpGroupWare now requires 4.1.0 or later'). "\n" @@ -272,7 +284,7 @@ } /* - if (extension_loaded('xml') || function_exists('xml_parser_create')) + if(extension_loaded('xml') || function_exists('xml_parser_create')) { $detected .= lang('You appear to have XML support enabled') . '<br>' . "\n"; $xml_enabled = 'True'; @@ -292,8 +304,32 @@ /* This code makes sure the newer multi-domain supporting header.inc.php is being used */ if(!isset($GLOBALS['phpgw_domain'])) { - $detected .= lang("You're using an old configuration file format...") . '<br>' . "\n"; - $detected .= lang('Importing old settings into the new format....') . '<br>' . "\n"; + $detected .= lang('You need to add some domains to your header.inc.php.') . '<br>' . "\n"; + $GLOBALS['phpgw_domain']['default'] = array(); + $setup_tpl->set_var('lang_domain',lang('Domain')); + $setup_tpl->set_var('lang_delete',lang('Delete')); + $setup_tpl->set_var('db_domain','default'); + $setup_tpl->set_var('db_host','localhost'); + $setup_tpl->set_var('db_name','egroupware'); + $setup_tpl->set_var('db_user','egroupware'); + $setup_tpl->set_var('db_pass','your_password'); + $setup_tpl->set_var('db_type','mysql'); + $setup_tpl->set_var('config_pass','changeme'); + while(list($k,$v) = @each($supported_db)) + { + if($v == $GLOBALS['phpgw_domain'][$key]['db_type']) + { + $selected = ' selected '; + $found_dbtype = true; + } + else + { + $selected = ''; + } + $dbtype_options .= '<option ' . $selected . 'value="' . $v . '">' . $v . "\n"; + } + $setup_tpl->set_var('dbtype_options',$dbtype_options); + $setup_tpl->parse('domains','domain',True); } else { @@ -349,10 +385,12 @@ } $setup_tpl->set_var('domain',''); } - if (defined('PHPGW_SERVER_ROOT')) + if(defined('PHPGW_SERVER_ROOT')) { - $GLOBALS['phpgw_info']['server']['server_root'] = PHPGW_SERVER_ROOT; - $GLOBALS['phpgw_info']['server']['include_root'] = PHPGW_INCLUDE_ROOT; + $GLOBALS['phpgw_info']['server']['server_root'] = PHPGW_SERVER_ROOT == '..' + ? '/path/to/egroupware' : PHPGW_SERVER_ROOT; + $GLOBALS['phpgw_info']['server']['include_root'] = PHPGW_INCLUDE_ROOT == '..' + ? '/path/to/egroupware' : PHPGW_INCLUDE_ROOT; } elseif(!@isset($GLOBALS['phpgw_info']['server']['include_root']) && @$GLOBALS['phpgw_info']['server']['header_version'] <= 1.6) { @@ -542,12 +580,10 @@ $setup_tpl->set_var('lang_finaldescr',lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".')); $setup_tpl->set_var('lang_continue',lang('Continue')); - $setup_tpl->pfp('out','manageheader'); - + $GLOBALS['phpgw_setup']->html->show_footer(); - + break; // ending the switch default } ?> -