array(
'nocachecontrol' => True,
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
));
include('./inc/functions.inc.php');
// some constanst for pre php4.3
if (!defined('PHP_SHLIB_SUFFIX'))
{
define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so');
}
if (!defined('PHP_SHLIB_PREFIX'))
{
define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '');
}
/**
* checks if a named extension is loaded or loadable
*/
function check_load_extension($extension)
{
return extension_loaded($extension) ||
function_exists('dl') && @dl(PHP_SHLIB_PREFIX.$extension.'.'.PHP_SHLIB_SUFFIX);
}
$GLOBALS['egw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
$GLOBALS['egw_info']['server']['versions']['phpgwapi'] = $setup_info['phpgwapi']['version'];
unset($setup_info);
/* Fetch the current real path.
* If this is in the server document root, then it is probably ok.
* Otherwise, don't guess, just show the usual instructive default.
*/
$realpath = realpath('..');
if(!ereg('^' . $_SERVER['DOCUMENT_ROOT'],$realpath))
{
if(strtoupper(substr(PHP_OS, 0,3)) == 'WIN')
{
$realpath = 'Drive:/Path/to/egroupware';
}
else
{
$realpath = '/path/to/egroupware';
}
}
$adddomain = get_var('adddomain',Array('POST'));
$db_fullnames = array(
'pgsql' => 'PostgreSQL',
'mysql' => 'MySQL',
'mysqli' => 'MySQLi (php5)',
'mssql' => 'MS SQL Server',
'odbc_mssql' => 'MS SQL Server via ODBC',
'oracle' => 'Oracle',
'odbc_oracle' => 'Oracle via ODBC',
'sapdb' => 'SAP/Max DB via ODBC',
);
$default_db_ports = array(
'pgsql' => 5432,
'mysql' => 3306,
'mysqli' => 3306,
'mssql' => 1433,
'odbc_mssql' => '',
'oracle' => 1521,
'odbc_oracle' => '',
'sapdb' => '',
);
function check_form_values()
{
// PHP will automatically replace any dots in incoming
// variable names with underscores.
$errors = '';
$domains = get_var('domains',Array('POST'));
@reset($domains);
while(list($k,$v) = @each($domains))
{
$variableName = str_replace('.','_',$k);
$deletedomain = get_var('deletedomain',Array('POST'));
if(isset($deletedomain[$variableName]))
{
continue;
}
$dom = get_var('setting_'.$variableName,Array('POST'));
if(!$dom['config_pass'] && !$dom['config_password'])
{
$errors .= ' ' . lang("You didn't enter a config password for domain %1",$v);
}
if(!$dom['config_user'])
{
$errors .= ' ' . lang("You didn't enter a config username for domain %1",$v);
}
}
$setting = get_var('setting',Array('POST'));
if(!$setting['HEADER_ADMIN_PASSWORD'] && !$setting['HEADER_ADMIN_PASS'])
{
$errors .= ' ' . lang("You didn't enter a header admin password");
}
if(!$setting['HEADER_ADMIN_USER'])
{
$errors .= ' ' . lang("You didn't enter a header admin username");
}
if($errors)
{
$GLOBALS['egw_setup']->html->show_header('Error',True);
echo $errors;
echo '
';
$GLOBALS['egw_setup']->html->show_footer();
exit;
}
}
/* authentication phase */
$GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header();
// added these to let the app work, need to templatize still
$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
$setup_tpl = CreateObject('setup.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
'T_setup_manage' => 'manageheader.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
$setup_tpl->set_block('T_setup_manage','manageheader','manageheader');
$setup_tpl->set_block('T_setup_manage','domain','domain');
/* Detect current mode */
switch($GLOBALS['egw_info']['setup']['stage']['header'])
{
case '1':
$GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php');
$GLOBALS['egw_info']['setup']['PageMSG'] = lang('You have not created your header.inc.php yet! You can create it now.');
break;
case '2':
$GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Your header admin password is NOT set. Please set it now!');
$GLOBALS['egw_info']['setup']['PageMSG'] = lang('Your header admin password is NOT set. Please set it now!');
break;
case '3':
$GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('You need to add some domains to your header.inc.php.');
$GLOBALS['egw_info']['setup']['PageMSG'] = lang('You need to add some domains to your header.inc.php.');
$GLOBALS['egw_info']['setup']['HeaderLoginMSG'] = lang('You need to add some domains to your header.inc.php.');
if(!$GLOBALS['egw_setup']->auth('Header'))
{
$GLOBALS['egw_setup']->html->show_header('Please login',True);
$GLOBALS['egw_setup']->html->login_form();
$GLOBALS['egw_setup']->html->show_footer();
exit;
}
break;
case '4':
$GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Your header.inc.php needs upgrading.');
$GLOBALS['egw_info']['setup']['PageMSG'] = lang('Your header.inc.php needs upgrading.
'
. lang('Did not find any valid DB support!')
. " \n"
. lang('Try to configure your php to support one of the above mentioned DBMS, or install eGroupWare by hand.')
. '