True,
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include('./inc/functions.inc.php');
$GLOBALS['phpgw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
unset($setup_info);
#include('../version.inc.php');
$adddomain = get_var('adddomain',Array('POST'));
if(@$adddomain)
{
}
function check_form_values()
{
$errors = '';
$domains = get_var('domains',Array('POST'));
@reset($domains);
while(list($k,$v) = @each($domains))
{
$deletedomain = get_var('deletedomain',Array('POST'));
if(isset($deletedomain[$v]))
{
continue;
}
$dom = get_var('setting_'.$v,Array('POST'));
if(!$dom['config_pass'])
{
$errors .= '
' . lang("You didn't enter a config password for domain x",$v);
}
}
$setting = get_var('setting',Array('POST'));
if(!$setting['HEADER_ADMIN_PASSWORD'])
{
$errors .= '
' . lang("You didn't enter a header admin password");
}
if($errors)
{
$GLOBALS['phpgw_setup']->html->show_header('Error',True);
echo $errors;
exit;
}
}
/* authentication phase */
$GLOBALS['phpgw_info']['setup']['stage']['header'] = $GLOBALS['phpgw_setup']->detection->check_header();
// added these to let the app work, need to templatize still
$tpl_root = $GLOBALS['phpgw_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['phpgw_info']['setup']['stage']['header'])
{
case '1':
$GLOBALS['phpgw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php');
$GLOBALS['phpgw_info']['setup']['PageMSG'] = lang('You have not created your header.inc.php yet!
You can create it now.');
break;
case '2':
$GLOBALS['phpgw_info']['setup']['HeaderFormMSG'] = lang('Your header admin password is NOT set. Please set it now!');
$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('Your header.inc.php needs upgrading.');
$GLOBALS['phpgw_info']['setup']['PageMSG'] = lang('Your header.inc.php needs upgrading.
MAKE BACKUPS!');
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = lang('Your header.inc.php needs upgrading.');
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 '10':
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;
}
$GLOBALS['phpgw_info']['setup']['HeaderFormMSG'] = lang('Edit your header.inc.php');
$GLOBALS['phpgw_info']['setup']['PageMSG'] = lang('Edit your existing header.inc.php');
break;
}
switch(@get_var('action',Array('POST')))
{
case 'download':
check_form_values();
$header_template = CreateObject('setup.Template','../');
$b = CreateObject('phpgwapi.browser');
$b->content_header('header.inc.php','application/octet-stream');
/*
header('Content-disposition: attachment; filename="header.inc.php"');
header('Content-type: application/octet-stream');
header('Pragma: no-cache');
header('Expires: 0');
*/
$newheader = $GLOBALS['phpgw_setup']->html->generate_header();
echo $newheader;
break;
case 'view':
check_form_values();
$header_template = CreateObject('setup.Template','../');
$GLOBALS['phpgw_setup']->html->show_header('Generated header.inc.php', False, 'header');
echo '
' . lang('Save this text as contents of your header.inc.php') . '
'; echo htmlentities($newheader); echo '