mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-13 01:18:42 +01:00
Fix header generation (templates)
This commit is contained in:
parent
3f389090cc
commit
a33d7d1648
@ -19,14 +19,14 @@
|
|||||||
*/
|
*/
|
||||||
function generate_header()
|
function generate_header()
|
||||||
{
|
{
|
||||||
global $setting, $phpgw_setup, $phpgw_info, $header_template;
|
$setting = $GLOBALS['HTTP_POST_VARS']['setting'];
|
||||||
|
|
||||||
$header_template->set_file(array('header' => 'header.inc.php.template'));
|
$GLOBALS['header_template']->set_file(array('header' => 'header.inc.php.template'));
|
||||||
while(list($k,$v) = each($setting))
|
while(list($k,$v) = @each($setting))
|
||||||
{
|
{
|
||||||
$header_template->set_var(strtoupper($k),$v);
|
$GLOBALS['header_template']->set_var(strtoupper($k),$v);
|
||||||
}
|
}
|
||||||
return $header_template->parse('out','header');
|
return $GLOBALS['header_template']->parse('out','header');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_tpl_dir($app_name='setup')
|
function setup_tpl_dir($app_name='setup')
|
||||||
|
@ -26,20 +26,18 @@
|
|||||||
|
|
||||||
function check_form_values()
|
function check_form_values()
|
||||||
{
|
{
|
||||||
global $setting, $phpgw_setup;
|
if (! $GLOBALS['HTTP_POST_VARS']['setting']['config_pass'])
|
||||||
|
|
||||||
if (! $setting['config_pass'])
|
|
||||||
{
|
{
|
||||||
$errors .= "<br>You didn't enter a config password";
|
$errors .= "<br>You didn't enter a config password";
|
||||||
}
|
}
|
||||||
if (! $setting['HEADER_ADMIN_PASSWORD'])
|
if (! $GLOBALS['HTTP_POST_VARS']['setting']['HEADER_ADMIN_PASSWORD'])
|
||||||
{
|
{
|
||||||
$errors .= "<br>You didn't enter a header admin password";
|
$errors .= "<br>You didn't enter a header admin password";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($errors)
|
if ($errors)
|
||||||
{
|
{
|
||||||
$phpgw_setup->show_header('Error',True);
|
$GLOBALS['phpgw_setup']->show_header('Error',True);
|
||||||
echo $errors;
|
echo $errors;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -96,11 +94,11 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($action)
|
switch($HTTP_POST_VARS['action'])
|
||||||
{
|
{
|
||||||
case 'download':
|
case 'download':
|
||||||
check_form_values();
|
check_form_values();
|
||||||
$header_template = new Template('../');
|
$header_template = CreateObject('phpgwapi.Template','../');
|
||||||
header('Content-disposition: attachment; filename="header.inc.php"');
|
header('Content-disposition: attachment; filename="header.inc.php"');
|
||||||
header('Content-type: application/octet-stream');
|
header('Content-type: application/octet-stream');
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
@ -110,7 +108,7 @@
|
|||||||
break;
|
break;
|
||||||
case 'view':
|
case 'view':
|
||||||
check_form_values();
|
check_form_values();
|
||||||
$header_template = new Template('../');
|
$header_template = CreateObject('phpgwapi.Template','../');
|
||||||
$phpgw_setup->show_header('Generated header.inc.php', False, 'header');
|
$phpgw_setup->show_header('Generated header.inc.php', False, 'header');
|
||||||
echo '<br>Save this text as contents of your header.inc.php<br><hr>';
|
echo '<br>Save this text as contents of your header.inc.php<br><hr>';
|
||||||
$newheader = $phpgw_setup->generate_header();
|
$newheader = $phpgw_setup->generate_header();
|
||||||
@ -126,7 +124,7 @@
|
|||||||
break;
|
break;
|
||||||
case 'write config':
|
case 'write config':
|
||||||
check_form_values();
|
check_form_values();
|
||||||
$header_template = new Template('../');
|
$header_template = CreateObject('phpgwapi.Template','../');
|
||||||
if(is_writeable ('../header.inc.php')|| (!file_exists ('../header.inc.php') && is_writeable ('../')))
|
if(is_writeable ('../header.inc.php')|| (!file_exists ('../header.inc.php') && is_writeable ('../')))
|
||||||
{
|
{
|
||||||
$newheader = $phpgw_setup->generate_header();
|
$newheader = $phpgw_setup->generate_header();
|
||||||
|
Loading…
Reference in New Issue
Block a user