mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 12:21:26 +02:00
Move newconfig to config
This commit is contained in:
parent
9c4a32e183
commit
ecc16190b3
282
setup/config.php
282
setup/config.php
@ -33,29 +33,6 @@
|
|||||||
$tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
|
$tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
|
||||||
$setup_tpl = CreateObject('setup.Template',$tpl_root);
|
$setup_tpl = CreateObject('setup.Template',$tpl_root);
|
||||||
|
|
||||||
// test if $path lies within the webservers document-root
|
|
||||||
//
|
|
||||||
function in_docroot($path)
|
|
||||||
{
|
|
||||||
$docroots = array(PHPGW_SERVER_ROOT,$_SERVER['DOCUMENT_ROOT']);
|
|
||||||
|
|
||||||
foreach ($docroots as $docroot)
|
|
||||||
{
|
|
||||||
$len = strlen($docroot);
|
|
||||||
|
|
||||||
if ($docroot == substr($path,0,$len))
|
|
||||||
{
|
|
||||||
$rest = substr($path,$len);
|
|
||||||
|
|
||||||
if (!strlen($rest) || $rest[0] == DIRECTORY_SEPARATOR)
|
|
||||||
{
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
$setup_tpl->set_file(array(
|
$setup_tpl->set_file(array(
|
||||||
'T_head' => 'head.tpl',
|
'T_head' => 'head.tpl',
|
||||||
'T_footer' => 'footer.tpl',
|
'T_footer' => 'footer.tpl',
|
||||||
@ -82,10 +59,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$newsettings = $_POST['newsettings'];
|
$newsettings = $_POST['newsettings'];
|
||||||
$files_in_docroot = in_docroot($newsettings['files_dir']);
|
|
||||||
|
|
||||||
if(@get_var('submit',Array('POST')) && @$newsettings && !$files_in_docroot)
|
if(@get_var('submit',Array('POST')) && @$newsettings)
|
||||||
{
|
{
|
||||||
|
/* Load hook file with functions to validate each config (one/none/all) */
|
||||||
|
$GLOBALS['phpgw_setup']->hook('config_validate','setup');
|
||||||
|
|
||||||
$datetime = CreateObject('phpgwapi.datetime');
|
$datetime = CreateObject('phpgwapi.datetime');
|
||||||
switch((int)$newsettings['daytime_port'])
|
switch((int)$newsettings['daytime_port'])
|
||||||
{
|
{
|
||||||
@ -110,50 +89,76 @@
|
|||||||
|
|
||||||
while(list($setting,$value) = @each($newsettings))
|
while(list($setting,$value) = @each($newsettings))
|
||||||
{
|
{
|
||||||
/* echo '<br>Updating: ' . $setting . '=' . $value; */
|
if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && @function_exists($setting))
|
||||||
/* Don't erase passwords, since we also do not print them below */
|
|
||||||
if($value || (!ereg('passwd',$setting) && !ereg('password',$setting) && !ereg('root_pw',$setting)))
|
|
||||||
{
|
{
|
||||||
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM $configtbl WHERE config_name='" . $setting . "'");
|
call_user_func($setting,$newsettings);
|
||||||
|
if($GLOBALS['config_error'])
|
||||||
|
{
|
||||||
|
$GLOBALS['error'] .= '<br>' . lang($GLOBALS['config_error']) . ' ';
|
||||||
|
$GLOBALS['config_error'] = '';
|
||||||
|
/* Bail out, stop writing config data */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* echo '<br>Updating: ' . $setting . '=' . $value; */
|
||||||
|
/* Don't erase passwords, since we also do not print them below */
|
||||||
|
if($value || (!stristr($setting,'passwd') && !stristr($setting,'password') && !stristr($setting,'root_pw')))
|
||||||
|
{
|
||||||
|
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM $configtbl WHERE config_name='" . $setting . "'");
|
||||||
|
}
|
||||||
|
if($value)
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) VALUES ('phpgwapi','" . $GLOBALS['phpgw_setup']->db->db_addslashes($setting)
|
||||||
|
. "','" . $GLOBALS['phpgw_setup']->db->db_addslashes($value) . "')");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if($value)
|
else
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) VALUES ('phpgwapi','" . $GLOBALS['phpgw_setup']->db->db_addslashes($setting)
|
if($value || (!stristr($setting,'passwd') && !stristr($setting,'password') && !stristr($setting,'root_pw')))
|
||||||
|
{
|
||||||
|
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM $configtbl WHERE config_name='" . $setting . "'");
|
||||||
|
}
|
||||||
|
if($value)
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) VALUES ('phpgwapi','" . $GLOBALS['phpgw_setup']->db->db_addslashes($setting)
|
||||||
. "','" . $GLOBALS['phpgw_setup']->db->db_addslashes($value) . "')");
|
. "','" . $GLOBALS['phpgw_setup']->db->db_addslashes($value) . "')");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw_setup']->db->transaction_commit();
|
if(!$GLOBALS['error'])
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw_setup']->db->transaction_commit();
|
||||||
|
|
||||||
/* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */
|
/* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */
|
||||||
$tablenames = $GLOBALS['phpgw_setup']->db->table_names();
|
$tablenames = $GLOBALS['phpgw_setup']->db->table_names();
|
||||||
while(list($key,$val) = @each($tablenames))
|
while(list($key,$val) = @each($tablenames))
|
||||||
{
|
{
|
||||||
$tables[] = $val['table_name'];
|
$tables[] = $val['table_name'];
|
||||||
}
|
}
|
||||||
if(in_array('phpgw_app_sessions',$tables))
|
if(in_array('phpgw_app_sessions',$tables))
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw_setup']->db->lock(array('phpgw_app_sessions'));
|
$GLOBALS['phpgw_setup']->db->lock(array('phpgw_app_sessions'));
|
||||||
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_app_sessions WHERE sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'",__LINE__,__FILE__);
|
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_app_sessions WHERE sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'",__LINE__,__FILE__);
|
||||||
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_app_sessions WHERE app = 'phpgwapi' and location = 'phpgw_info_cache'",__LINE__,__FILE__);
|
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_app_sessions WHERE app = 'phpgwapi' and location = 'phpgw_info_cache'",__LINE__,__FILE__);
|
||||||
$GLOBALS['phpgw_setup']->db->unlock();
|
$GLOBALS['phpgw_setup']->db->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($newsettings['auth_type'] == 'ldap')
|
if($newsettings['auth_type'] == 'ldap')
|
||||||
{
|
{
|
||||||
Header('Location: '.$newsettings['webserver_url'].'/setup/ldap.php');
|
Header('Location: '.$newsettings['webserver_url'].'/setup/ldap.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Header('Location: index.php');
|
Header('Location: index.php');
|
||||||
exit;
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($newsettings['auth_type'] != 'ldap')
|
$GLOBALS['phpgw_setup']->html->show_header(lang('Configuration'),False,'config',$GLOBALS['phpgw_setup']->ConfigDomain . '(' . $phpgw_domain[$GLOBALS['phpgw_setup']->ConfigDomain]['db_type'] . ')');
|
||||||
{
|
|
||||||
$GLOBALS['phpgw_setup']->html->show_header(lang('Configuration'),False,'config',$GLOBALS['phpgw_setup']->ConfigDomain . '(' . $phpgw_domain[$GLOBALS['phpgw_setup']->ConfigDomain]['db_type'] . ')');
|
|
||||||
}
|
|
||||||
|
|
||||||
@$GLOBALS['phpgw_setup']->db->query("SELECT * FROM $configtbl");
|
@$GLOBALS['phpgw_setup']->db->query("SELECT * FROM $configtbl");
|
||||||
while(@$GLOBALS['phpgw_setup']->db->next_record())
|
while(@$GLOBALS['phpgw_setup']->db->next_record())
|
||||||
@ -161,25 +166,6 @@
|
|||||||
$GLOBALS['current_config'][$GLOBALS['phpgw_setup']->db->f('config_name')] = $GLOBALS['phpgw_setup']->db->f('config_value');
|
$GLOBALS['current_config'][$GLOBALS['phpgw_setup']->db->f('config_name')] = $GLOBALS['phpgw_setup']->db->f('config_value');
|
||||||
}
|
}
|
||||||
|
|
||||||
// are we here because of an error: files-dir in docroot
|
|
||||||
if (is_array($_POST['newsettings']) && $files_in_docroot)
|
|
||||||
{
|
|
||||||
echo '<p align="center"><font color="red"><b>'.lang('Path to user and group files HAS TO BE OUTSIDE of the webservers document-root!!!')."</b></font></p>\n";
|
|
||||||
|
|
||||||
foreach($_POST['newsettings'] as $key => $val)
|
|
||||||
{
|
|
||||||
$GLOBALS['current_config'][$key] = $val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($GLOBALS['error'] == 'badldapconnection')
|
|
||||||
{
|
|
||||||
/* Please check the number and dial again :) */
|
|
||||||
$GLOBALS['phpgw_setup']->html->show_alert_msg('Error',
|
|
||||||
lang('There was a problem trying to connect to your LDAP server. <br>'
|
|
||||||
.'please check your LDAP server configuration') . '.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$setup_tpl->pparse('out','T_config_pre_script');
|
$setup_tpl->pparse('out','T_config_pre_script');
|
||||||
|
|
||||||
/* Now parse each of the templates we want to show here */
|
/* Now parse each of the templates we want to show here */
|
||||||
@ -194,80 +180,89 @@
|
|||||||
$GLOBALS['phpgw']->common = CreateObject('phpgwapi.common');
|
$GLOBALS['phpgw']->common = CreateObject('phpgwapi.common');
|
||||||
$GLOBALS['phpgw']->db = $GLOBALS['phpgw_setup']->db;
|
$GLOBALS['phpgw']->db = $GLOBALS['phpgw_setup']->db;
|
||||||
|
|
||||||
/*$cfg_apps = array('phpgwapi','admin','preferences');
|
$t = CreateObject('setup.Template',$GLOBALS['phpgw']->common->get_tpl_dir('setup'));
|
||||||
while(list(,$cfg_app) = each($cfg_apps))
|
|
||||||
{*/
|
|
||||||
$t = CreateObject('setup.Template',$GLOBALS['phpgw']->common->get_tpl_dir('setup'));
|
|
||||||
|
|
||||||
$t->set_unknowns('keep');
|
$t->set_unknowns('keep');
|
||||||
$t->set_file(array('config' => 'config.tpl'));
|
$t->set_file(array('config' => 'config.tpl'));
|
||||||
$t->set_block('config','body','body');
|
$t->set_block('config','body','body');
|
||||||
|
|
||||||
$vars = $t->get_undefined('body');
|
$vars = $t->get_undefined('body');
|
||||||
$GLOBALS['phpgw_setup']->hook('config','setup');
|
$GLOBALS['phpgw_setup']->hook('config','setup');
|
||||||
|
|
||||||
while(list($null,$value) = each($vars))
|
while(list($null,$value) = each($vars))
|
||||||
|
{
|
||||||
|
$valarray = explode('_',$value);
|
||||||
|
$type = $valarray[0];
|
||||||
|
$new = $newval = '';
|
||||||
|
|
||||||
|
while($chunk = next($valarray))
|
||||||
{
|
{
|
||||||
$valarray = explode('_',$value);
|
$new[] = $chunk;
|
||||||
$type = $valarray[0];
|
}
|
||||||
$new = $newval = '';
|
$newval = implode(' ',$new);
|
||||||
|
|
||||||
while($chunk = next($valarray))
|
switch ($type)
|
||||||
{
|
{
|
||||||
$new[] = $chunk;
|
case 'lang':
|
||||||
}
|
$t->set_var($value,lang($newval));
|
||||||
$newval = implode(' ',$new);
|
break;
|
||||||
|
case 'value':
|
||||||
switch ($type)
|
$newval = str_replace(' ','_',$newval);
|
||||||
{
|
/* Don't show passwords in the form */
|
||||||
case 'lang':
|
if(strstr($value,'passwd') || strstr($value,'password') || strstr($value,'root_pw'))
|
||||||
$t->set_var($value,lang($newval));
|
{
|
||||||
break;
|
|
||||||
case 'value':
|
|
||||||
$newval = str_replace(' ','_',$newval);
|
|
||||||
/* Don't show passwords in the form */
|
|
||||||
if(strstr($value,'passwd') || strstr($value,'password') || strstr($value,'root_pw'))
|
|
||||||
{
|
|
||||||
$t->set_var($value,'');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$t->set_var($value,@$current_config[$newval]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'selected':
|
|
||||||
$configs = array();
|
|
||||||
$config = '';
|
|
||||||
$newvals = explode(' ',$newval);
|
|
||||||
$setting = end($newvals);
|
|
||||||
for($i=0;$i<(count($newvals) - 1); $i++)
|
|
||||||
{
|
|
||||||
$configs[] = $newvals[$i];
|
|
||||||
}
|
|
||||||
$config = implode('_',$configs);
|
|
||||||
/* echo $config . '=' . $current_config[$config]; */
|
|
||||||
if(@$current_config[$config] == $setting)
|
|
||||||
{
|
|
||||||
$t->set_var($value,' selected');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$t->set_var($value,'');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'hook':
|
|
||||||
$newval = str_replace(' ','_',$newval);
|
|
||||||
$t->set_var($value,$newval($current_config));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$t->set_var($value,'');
|
$t->set_var($value,'');
|
||||||
break;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
$t->set_var($value,@$current_config[$newval]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'selected':
|
||||||
|
$configs = array();
|
||||||
|
$config = '';
|
||||||
|
$newvals = explode(' ',$newval);
|
||||||
|
$setting = end($newvals);
|
||||||
|
for($i=0;$i<(count($newvals) - 1); $i++)
|
||||||
|
{
|
||||||
|
$configs[] = $newvals[$i];
|
||||||
|
}
|
||||||
|
$config = implode('_',$configs);
|
||||||
|
/* echo $config . '=' . $current_config[$config]; */
|
||||||
|
if(@$current_config[$config] == $setting)
|
||||||
|
{
|
||||||
|
$t->set_var($value,' selected');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$t->set_var($value,'');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'hook':
|
||||||
|
$newval = str_replace(' ','_',$newval);
|
||||||
|
$t->set_var($value,$newval($current_config));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$t->set_var($value,'');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($GLOBALS['error'])
|
||||||
|
{
|
||||||
|
if($GLOBALS['error'] == 'badldapconnection')
|
||||||
|
{
|
||||||
|
/* Please check the number and dial again :) */
|
||||||
|
$GLOBALS['phpgw_setup']->html->show_alert_msg('Error',
|
||||||
|
lang('There was a problem trying to connect to your LDAP server. <br>'
|
||||||
|
.'please check your LDAP server configuration') . '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$t->pfp('out','body');
|
$GLOBALS['phpgw_setup']->html->show_alert_msg('Error',$GLOBALS['error']);
|
||||||
unset($t);
|
}
|
||||||
//}
|
|
||||||
|
$t->pfp('out','body');
|
||||||
|
unset($t);
|
||||||
|
|
||||||
$setup_tpl->set_var('more_configs',lang('Please login to egroupware and run the admin application for additional site configuration') . '.');
|
$setup_tpl->set_var('more_configs',lang('Please login to egroupware and run the admin application for additional site configuration') . '.');
|
||||||
|
|
||||||
@ -277,4 +272,3 @@
|
|||||||
|
|
||||||
$GLOBALS['phpgw_setup']->html->show_footer();
|
$GLOBALS['phpgw_setup']->html->show_footer();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -1,274 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**************************************************************************\
|
|
||||||
* eGroupWare - Setup *
|
|
||||||
* http://www.egroupware.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. *
|
|
||||||
\**************************************************************************/
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
$phpgw_info = array();
|
|
||||||
$GLOBALS['phpgw_info']['flags'] = array(
|
|
||||||
'noheader' => True,
|
|
||||||
'nonavbar' => True,
|
|
||||||
'currentapp' => 'home',
|
|
||||||
'noapi' => True
|
|
||||||
);
|
|
||||||
include('./inc/functions.inc.php');
|
|
||||||
|
|
||||||
/*
|
|
||||||
Authorize the user to use setup app and load the database
|
|
||||||
Does not return unless user is authorized
|
|
||||||
*/
|
|
||||||
if(!$GLOBALS['phpgw_setup']->auth('Config') || @$_POST['cancel'])
|
|
||||||
{
|
|
||||||
Header('Location: index.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$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_config_pre_script' => 'config_pre_script.tpl',
|
|
||||||
'T_config_post_script' => 'config_post_script.tpl'
|
|
||||||
));
|
|
||||||
|
|
||||||
/* Following to ensure windows file paths are saved correctly */
|
|
||||||
set_magic_quotes_runtime(0);
|
|
||||||
|
|
||||||
$GLOBALS['phpgw_setup']->loaddb();
|
|
||||||
|
|
||||||
/* Check api version, use correct table */
|
|
||||||
$setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions();
|
|
||||||
|
|
||||||
if($GLOBALS['phpgw_setup']->alessthanb($setup_info['phpgwapi']['currentver'], '0.9.10pre7'))
|
|
||||||
{
|
|
||||||
$configtbl = 'config';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$configtbl = 'phpgw_config';
|
|
||||||
}
|
|
||||||
|
|
||||||
$newsettings = $_POST['newsettings'];
|
|
||||||
|
|
||||||
if(@get_var('submit',Array('POST')) && @$newsettings)
|
|
||||||
{
|
|
||||||
/* Load hook file with functions to validate each config (one/none/all) */
|
|
||||||
$GLOBALS['phpgw_setup']->hook('config_validate','setup');
|
|
||||||
|
|
||||||
$datetime = CreateObject('phpgwapi.datetime');
|
|
||||||
switch((int)$newsettings['daytime_port'])
|
|
||||||
{
|
|
||||||
case 13:
|
|
||||||
$newsettings['tz_offset'] = $datetime->getntpoffset();
|
|
||||||
break;
|
|
||||||
case 80:
|
|
||||||
$newsettings['tz_offset'] = $datetime->gethttpoffset();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$newsettings['tz_offset'] = $datetime->getbestguess();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
unset($datetime);
|
|
||||||
|
|
||||||
print_debug('TZ_OFFSET',$newsettings['tz_offset']);
|
|
||||||
|
|
||||||
$GLOBALS['phpgw_setup']->db->transaction_begin();
|
|
||||||
/* This is only temp: */
|
|
||||||
$GLOBALS['phpgw_setup']->db->query("DELETE FROM $configtbl WHERE config_name='useframes'");
|
|
||||||
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) values ('phpgwapi','useframes','never')");
|
|
||||||
|
|
||||||
while(list($setting,$value) = @each($newsettings))
|
|
||||||
{
|
|
||||||
if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && @function_exists($setting))
|
|
||||||
{
|
|
||||||
call_user_func($setting,$newsettings);
|
|
||||||
if($GLOBALS['config_error'])
|
|
||||||
{
|
|
||||||
$GLOBALS['error'] .= '<br>' . lang($GLOBALS['config_error']) . ' ';
|
|
||||||
$GLOBALS['config_error'] = '';
|
|
||||||
/* Bail out, stop writing config data */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* echo '<br>Updating: ' . $setting . '=' . $value; */
|
|
||||||
/* Don't erase passwords, since we also do not print them below */
|
|
||||||
if($value || (!stristr($setting,'passwd') && !stristr($setting,'password') && !stristr($setting,'root_pw')))
|
|
||||||
{
|
|
||||||
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM $configtbl WHERE config_name='" . $setting . "'");
|
|
||||||
}
|
|
||||||
if($value)
|
|
||||||
{
|
|
||||||
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) VALUES ('phpgwapi','" . $GLOBALS['phpgw_setup']->db->db_addslashes($setting)
|
|
||||||
. "','" . $GLOBALS['phpgw_setup']->db->db_addslashes($value) . "')");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if($value || (!stristr($setting,'passwd') && !stristr($setting,'password') && !stristr($setting,'root_pw')))
|
|
||||||
{
|
|
||||||
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM $configtbl WHERE config_name='" . $setting . "'");
|
|
||||||
}
|
|
||||||
if($value)
|
|
||||||
{
|
|
||||||
$GLOBALS['phpgw_setup']->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) VALUES ('phpgwapi','" . $GLOBALS['phpgw_setup']->db->db_addslashes($setting)
|
|
||||||
. "','" . $GLOBALS['phpgw_setup']->db->db_addslashes($value) . "')");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!$GLOBALS['error'])
|
|
||||||
{
|
|
||||||
$GLOBALS['phpgw_setup']->db->transaction_commit();
|
|
||||||
|
|
||||||
/* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */
|
|
||||||
$tablenames = $GLOBALS['phpgw_setup']->db->table_names();
|
|
||||||
while(list($key,$val) = @each($tablenames))
|
|
||||||
{
|
|
||||||
$tables[] = $val['table_name'];
|
|
||||||
}
|
|
||||||
if(in_array('phpgw_app_sessions',$tables))
|
|
||||||
{
|
|
||||||
$GLOBALS['phpgw_setup']->db->lock(array('phpgw_app_sessions'));
|
|
||||||
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_app_sessions WHERE sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'",__LINE__,__FILE__);
|
|
||||||
@$GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_app_sessions WHERE app = 'phpgwapi' and location = 'phpgw_info_cache'",__LINE__,__FILE__);
|
|
||||||
$GLOBALS['phpgw_setup']->db->unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
if($newsettings['auth_type'] == 'ldap')
|
|
||||||
{
|
|
||||||
Header('Location: '.$newsettings['webserver_url'].'/setup/ldap.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Header('Location: index.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$GLOBALS['phpgw_setup']->html->show_header(lang('Configuration'),False,'config',$GLOBALS['phpgw_setup']->ConfigDomain . '(' . $phpgw_domain[$GLOBALS['phpgw_setup']->ConfigDomain]['db_type'] . ')');
|
|
||||||
|
|
||||||
@$GLOBALS['phpgw_setup']->db->query("SELECT * FROM $configtbl");
|
|
||||||
while(@$GLOBALS['phpgw_setup']->db->next_record())
|
|
||||||
{
|
|
||||||
$GLOBALS['current_config'][$GLOBALS['phpgw_setup']->db->f('config_name')] = $GLOBALS['phpgw_setup']->db->f('config_value');
|
|
||||||
}
|
|
||||||
|
|
||||||
$setup_tpl->pparse('out','T_config_pre_script');
|
|
||||||
|
|
||||||
/* Now parse each of the templates we want to show here */
|
|
||||||
class phpgw
|
|
||||||
{
|
|
||||||
var $common;
|
|
||||||
var $accounts;
|
|
||||||
var $applications;
|
|
||||||
var $db;
|
|
||||||
}
|
|
||||||
$GLOBALS['phpgw'] = new phpgw;
|
|
||||||
$GLOBALS['phpgw']->common = CreateObject('phpgwapi.common');
|
|
||||||
$GLOBALS['phpgw']->db = $GLOBALS['phpgw_setup']->db;
|
|
||||||
|
|
||||||
$t = CreateObject('setup.Template',$GLOBALS['phpgw']->common->get_tpl_dir('setup'));
|
|
||||||
|
|
||||||
$t->set_unknowns('keep');
|
|
||||||
$t->set_file(array('config' => 'config.tpl'));
|
|
||||||
$t->set_block('config','body','body');
|
|
||||||
|
|
||||||
$vars = $t->get_undefined('body');
|
|
||||||
$GLOBALS['phpgw_setup']->hook('config','setup');
|
|
||||||
|
|
||||||
while(list($null,$value) = each($vars))
|
|
||||||
{
|
|
||||||
$valarray = explode('_',$value);
|
|
||||||
$type = $valarray[0];
|
|
||||||
$new = $newval = '';
|
|
||||||
|
|
||||||
while($chunk = next($valarray))
|
|
||||||
{
|
|
||||||
$new[] = $chunk;
|
|
||||||
}
|
|
||||||
$newval = implode(' ',$new);
|
|
||||||
|
|
||||||
switch ($type)
|
|
||||||
{
|
|
||||||
case 'lang':
|
|
||||||
$t->set_var($value,lang($newval));
|
|
||||||
break;
|
|
||||||
case 'value':
|
|
||||||
$newval = str_replace(' ','_',$newval);
|
|
||||||
/* Don't show passwords in the form */
|
|
||||||
if(strstr($value,'passwd') || strstr($value,'password') || strstr($value,'root_pw'))
|
|
||||||
{
|
|
||||||
$t->set_var($value,'');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$t->set_var($value,@$current_config[$newval]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'selected':
|
|
||||||
$configs = array();
|
|
||||||
$config = '';
|
|
||||||
$newvals = explode(' ',$newval);
|
|
||||||
$setting = end($newvals);
|
|
||||||
for($i=0;$i<(count($newvals) - 1); $i++)
|
|
||||||
{
|
|
||||||
$configs[] = $newvals[$i];
|
|
||||||
}
|
|
||||||
$config = implode('_',$configs);
|
|
||||||
/* echo $config . '=' . $current_config[$config]; */
|
|
||||||
if(@$current_config[$config] == $setting)
|
|
||||||
{
|
|
||||||
$t->set_var($value,' selected');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$t->set_var($value,'');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'hook':
|
|
||||||
$newval = str_replace(' ','_',$newval);
|
|
||||||
$t->set_var($value,$newval($current_config));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$t->set_var($value,'');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($GLOBALS['error'])
|
|
||||||
{
|
|
||||||
if($GLOBALS['error'] == 'badldapconnection')
|
|
||||||
{
|
|
||||||
/* Please check the number and dial again :) */
|
|
||||||
$GLOBALS['phpgw_setup']->html->show_alert_msg('Error',
|
|
||||||
lang('There was a problem trying to connect to your LDAP server. <br>'
|
|
||||||
.'please check your LDAP server configuration') . '.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$GLOBALS['phpgw_setup']->html->show_alert_msg('Error',$GLOBALS['error']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$t->pfp('out','body');
|
|
||||||
unset($t);
|
|
||||||
|
|
||||||
$setup_tpl->set_var('more_configs',lang('Please login to egroupware and run the admin application for additional site configuration') . '.');
|
|
||||||
|
|
||||||
$setup_tpl->set_var('lang_submit',lang('Save'));
|
|
||||||
$setup_tpl->set_var('lang_cancel',lang('Cancel'));
|
|
||||||
$setup_tpl->pparse('out','T_config_post_script');
|
|
||||||
|
|
||||||
$GLOBALS['phpgw_setup']->html->show_footer();
|
|
||||||
?>
|
|
Loading…
x
Reference in New Issue
Block a user