Changes to allow register_globals to be off

This commit is contained in:
Miles Lott 2001-08-21 18:48:50 +00:00
parent dddf896338
commit e0db915670
14 changed files with 434 additions and 320 deletions

View File

@ -109,18 +109,23 @@
//var_dump($setup_info);exit;
@ksort($setup_info);
if ($cancel)
if ($HTTP_POST_VARS['cancel'])
{
Header("Location: index.php");
exit;
}
if ($submit)
if ($HTTP_POST_VARS['submit'])
{
$phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]["db_type"] . ')');
$setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':');
$setup_tpl->pparse('out','header');
$appname = $HTTP_POST_VARS['appname'];
$remove = $HTTP_POST_VARS['remove'];
$install = $HTTP_POST_VARS['install'];
$upgrade = $HTTP_POST_VARS['upgrade'];
while (list($appname,$key) = @each($remove))
{
$terror = array();
@ -202,8 +207,9 @@
$phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]["db_type"] . ')');
}
if($detail)
if($HTTP_GET_VARS['detail'])
{
$detail = $HTTP_GET_VARS['detail'];
@ksort($setup_info[$detail]);
@reset($setup_info[$detail]);
$setup_tpl->set_var('description',lang('App details') . ':');
@ -238,8 +244,11 @@
$setup_tpl->pparse('out','footer');
exit;
}
elseif ($resolve)
elseif ($HTTP_GET_VARS['resolve'])
{
$resolve = $HTTP_GET_VARS['resolve'];
$version = $HTTP_GET_VARS['version'];
$notables = $HTTP_GET_VARS['notables'];
$setup_tpl->set_var('description',lang('Problem resolution'). ':');
$setup_tpl->pparse('out','header');
if ($badinstall)

View File

@ -52,7 +52,7 @@
$current_config['temp_dir'] = '/path/to/temp/dir';
}
if ($cancel)
if ($HTTP_POST_VARS['cancel'])
{
Header('Location: index.php');
exit;
@ -69,13 +69,15 @@
$configtbl = 'phpgw_config';
}
if ($submit && $newsettings)
if ($HTTP_POST_VARS['submit'] && $HTTP_POST_VARS['newsettings'])
{
$phpgw_setup->db->transaction_begin();
/* This is only temp: */
$phpgw_setup->db->query("DELETE FROM $configtbl WHERE config_name='useframes'");
$phpgw_setup->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) values ('phpgwapi','useframes','never')");
$newsettings = $HTTP_POST_VARS['newsettings'];
while (list($setting,$value) = @each($newsettings))
{
// echo '<br>Updating: ' . $setting . '=' . $value;

View File

@ -307,7 +307,8 @@
if ($DEBUG) { echo '<br>AlterColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL))
{
return !!($oProc->m_odb->query("ALTER TABLE $sTableName MODIFY $sColumnName " . $sNewColumnSQL));
/* return !!($oProc->m_odb->query("ALTER TABLE $sTableName MODIFY $sColumnName " . $sNewColumnSQL)); */
return !!($oProc->m_odb->query("ALTER TABLE $sTableName CHANGE $sColumnName $sColumnName " . $sNewColumnSQL));
}
return false;

View File

@ -27,21 +27,29 @@
*/
function loaddb()
{
global $phpgw_info, $phpgw_domain, $ConfigDomain;
/* Database setup */
if (!isset($phpgw_info["server"]["api_inc"]))
{
$phpgw_info["server"]["api_inc"] = PHPGW_SERVER_ROOT . "/phpgwapi/inc";
}
include($phpgw_info["server"]["api_inc"] . "/class.db_".$phpgw_domain[$ConfigDomain]["db_type"].".inc.php");
$this->db = new db;
$this->db->Host = $phpgw_domain[$ConfigDomain]["db_host"];
$this->db->Type = $phpgw_domain[$ConfigDomain]["db_type"];
$this->db->Database = $phpgw_domain[$ConfigDomain]["db_name"];
$this->db->User = $phpgw_domain[$ConfigDomain]["db_user"];
$this->db->Password = $phpgw_domain[$ConfigDomain]["db_pass"];
global $HTTP_POST_VARS, $HTTP_COOKIE_VARS;
//$phpgw_schema_proc = new phpgw_schema_proc($phpgw_domain[$ConfigDomain]["db_type"]);
$ConfigDomain = $HTTP_COOKIE_VARS['ConfigDomain'] ? $HTTP_COOKIE_VARS['ConfigDomain'] : $HTTP_POST_VARS['ConfigDomain'];
if(empty($ConfigDomain))
{
/* This is to fix the reading of this value immediately after the cookie was set on login */
$ConfigDomain = $HTTP_POST_VARS['FormDomain'];
}
$phpgw_domain = $GLOBALS['phpgw_domain'];
$phpgw_info = $GLOBALS['phpgw_info'];
/* Database setup */
if (!isset($phpgw_info['server']['api_inc']))
{
$phpgw_info['server']['api_inc'] = PHPGW_SERVER_ROOT . '/phpgwapi/inc';
}
include($phpgw_info['server']['api_inc'] . '/class.db_'.$phpgw_domain[$ConfigDomain]['db_type'].'.inc.php');
$this->db = new db;
$this->db->Host = $phpgw_domain[$ConfigDomain]['db_host'];
$this->db->Type = $phpgw_domain[$ConfigDomain]['db_type'];
$this->db->Database = $phpgw_domain[$ConfigDomain]['db_name'];
$this->db->User = $phpgw_domain[$ConfigDomain]['db_user'];
$this->db->Password = $phpgw_domain[$ConfigDomain]['db_pass'];
}
/*!
@ -51,7 +59,21 @@
*/
function auth($auth_type = "Config")
{
global $phpgw_domain, $phpgw_info, $HTTP_POST_VARS, $FormLogout, $ConfigLogin, $HeaderLogin, $FormDomain, $FormPW, $ConfigDomain, $ConfigPW, $HeaderPW, $ConfigLang;
global $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_COOKIE_VARS;
$phpgw_domain = $GLOBALS['phpgw_domain'];
$phpgw_info = $GLOBALS['phpgw_info'];
$FormLogout = $HTTP_GET_VARS['FormLogout'];
$ConfigLogin = $HTTP_POST_VARS['ConfigLogin'] ? $HTTP_POST_VARS['ConfigLogin'] : $HTTP_COOKIE_VARS['ConfigLogin'];
$HeaderLogin = $HTTP_POST_VARS['HeaderLogin'] ? $HTTP_POST_VARS['HeaderLogin'] : $HTTP_COOKIE_VARS['HeaderLogin'];
$FormDomain = $HTTP_POST_VARS['FormDomain'];
$FormPW = $HTTP_POST_VARS['FormPW'];
$ConfigDomain = $HTTP_POST_VARS['ConfigDomain'] ? $HTTP_POST_VARS['ConfigDomain'] : $HTTP_COOKIE_VARS['ConfigDomain'];
$ConfigPW = $HTTP_POST_VARS['ConfigPW'] ? $HTTP_POST_VARS['ConfigPW'] : $HTTP_COOKIE_VARS['ConfigPW'];
$HeaderPW = $HTTP_POST_VARS['HeaderPW'];
$ConfigLang = $HTTP_POST_VARS['ConfigLang'] ? $HTTP_POST_VARS['ConfigLang'] : $HTTP_COOKIE_VARS['ConfigLang'];
if (isset($FormLogout))
{
if ($FormLogout == 'config' ||

View File

@ -52,7 +52,7 @@
function show_header($title = '',$nologoutbutton = False, $logoutfrom = 'config', $configdomain = '')
{
global $phpgw_info, $setup_tpl, $PHP_SELF;
global $phpgw_info, $setup_tpl, $HTTP_SERVER_VARS;
$setup_tpl->set_var('lang_charset',lang('charset'));
if ($nologoutbutton)
@ -61,7 +61,7 @@
}
else
{
$btn_logout = '<a href="'.$PHP_SELF.'?FormLogout='.$logoutfrom.'" class="link">'.lang('Logout').'</a>';
$btn_logout = '<a href="'.basename($HTTP_SERVER_VARS['REQUEST_URI']).'?FormLogout='.$logoutfrom.'" class="link">'.lang('Logout').'</a>';
}
$setup_tpl->set_var('lang_setup', lang('setup'));
@ -82,7 +82,7 @@
function show_footer()
{
global $phpgw_info, $setup_tpl, $PHP_SELF;
global $phpgw_info, $setup_tpl;
$setup_tpl->pparse('out','T_footer');
unset($setup_tpl);
@ -90,7 +90,7 @@
function show_alert_msg($alert_word='Setup alert',$alert_msg='setup alert (generic)')
{
global $phpgw_info, $setup_tpl, $PHP_SELF;
global $phpgw_info, $setup_tpl;
$setup_tpl->set_var('V_alert_word',$alert_word);
$setup_tpl->set_var('V_alert_msg',$alert_msg);
@ -100,7 +100,7 @@
function make_frm_btn_simple($pre_frm_blurb='',$frm_method='POST',$frm_action='',$input_type='submit',$input_value='',$post_frm_blurb='')
{
// are these golbals necessary?
global $phpgw_info, $setup_tpl, $PHP_SELF;
global $phpgw_info, $setup_tpl;
// a simple form has simple components
$simple_form =
@ -115,7 +115,7 @@
function make_href_link_simple($pre_link_blurb='',$href_link='',$href_text='default text',$post_link_blurb='')
{
// are these golbals necessary?
global $phpgw_info, $setup_tpl, $PHP_SELF;
global $phpgw_info, $setup_tpl;
// a simple href link has simple components
$simple_link =
@ -127,7 +127,7 @@
function login_form()
{
global $phpgw_info, $phpgw_domain, $setup_tpl, $PHP_SELF;
global $phpgw_info, $phpgw_domain, $setup_tpl;
// begin use TEMPLATE login_main.tpl
$setup_tpl->set_var('ConfigLoginMSG',$phpgw_info['setup']['ConfigLoginMSG']);

View File

@ -34,7 +34,11 @@
*/
function init_process()
{
global $phpgw_domain,$ConfigDomain;
global $HTTP_POST_VARS, $HTTP_COOKIE_VARS;
$ConfigDomain = $HTTP_COOKIE_VARS['ConfigDomain'] ? $HTTP_COOKIE_VARS['ConfigDomain'] : $HTTP_POST_VARS['ConfigDomain'];
$phpgw_domain = $GLOBALS['phpgw_domain'];
$phpgw_info = $GLOBALS['phpgw_info'];
$this->oProc = CreateObject('setup.schema_proc',$phpgw_domain[$ConfigDomain]['db_type']);
//$this->oProc = CreateObject('setup.schema_proc','pgsql');

View File

@ -32,7 +32,52 @@
define('PHPGW_INCLUDE_ROOT','..');
}
function CreateObject($classname, $constructor_param = "")
function CreateObject($class,
$p1='_UNDEF_',$p2='_UNDEF_',$p3='_UNDEF_',$p4='_UNDEF_',
$p5='_UNDEF_',$p6='_UNDEF_',$p7='_UNDEF_',$p8='_UNDEF_',
$p9='_UNDEF_',$p10='_UNDEF_',$p11='_UNDEF_',$p12='_UNDEF_',
$p13='_UNDEF_',$p14='_UNDEF_',$p15='_UNDEF_',$p16='_UNDEF_')
{
global $phpgw_info, $phpgw, $phpgw_domain;
/* error_reporting(0); */
list($appname,$classname) = explode(".", $class);
if (!isset($GLOBALS['phpgw_info']['flags']['included_classes'][$classname]) ||
!$GLOBALS['phpgw_info']['flags']['included_classes'][$classname])
{
$GLOBALS['phpgw_info']['flags']['included_classes'][$classname] = True;
include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
}
if ($p1 == '_UNDEF_' && $p1 != 1)
{
eval('$obj = new ' . $classname . ';');
}
else
{
$input = array($p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9,$p10,$p11,$p12,$p13,$p14,$p15,$p16);
$i = 1;
$code = '$obj = new ' . $classname . '(';
while (list($x,$test) = each($input))
{
if (($test == '_UNDEF_' && $test != 1 ) || $i == 17)
{
break;
}
else
{
$code .= '$p' . $i . ',';
}
$i++;
}
$code = substr($code,0,-1) . ');';
eval($code);
}
/* error_reporting(E_ERROR | E_WARNING | E_PARSE); */
return $obj;
}
function oldCreateObject($classname, $constructor_param = "")
{
global $phpgw, $phpgw_info, $phpgw_domain;
$classpart = explode (".", $classname);
@ -42,7 +87,6 @@
{
$phpgw_info["flags"]["included_classes"][$classname] = True;
include(PHPGW_INCLUDE_ROOT."/".$appname."/inc/class.".$classname.".inc.php");
// include("/var/www/phpgroupware/".$appname."/inc/class.".$classname.".inc.php");
}
if ($constructor_param == "")
{

View File

@ -52,7 +52,7 @@
$phpgw_info['setup']['stage']['header'] = $phpgw_setup->check_header();
if ($phpgw_info['setup']['stage']['header'] != '10')
{
Header("Location: manageheader.php");
Header('Location: manageheader.php');
exit;
}
elseif (!$phpgw_setup->auth('Config'))
@ -145,7 +145,7 @@
$setup_tpl->set_var('notcomplete',lang('not complete'));
$setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly'));
$setup_tpl->set_var('createdb',lang('Or we can attempt to create the database for you:'));
switch ($phpgw_domain[$ConfigDomain]["db_type"])
switch ($phpgw_domain[$ConfigDomain]['db_type'])
{
case 'mysql':
$setup_tpl->set_var('instr',lang('mysqlinstr'));
@ -197,24 +197,24 @@
// FIXME : CAPTURE THIS OUTPUT
$phpgw_setup->db->Halt_On_Error = 'report';
switch ($phpgw_info["setup"]["currentver"]["phpgwapi"])
switch ($phpgw_info['setup']['currentver']['phpgwapi'])
{
case "dbcreate":
case 'dbcreate':
$phpgw_setup->db->create_database($db_root, $db_pass);
break;
case "drop":
case 'drop':
$setup_info = $phpgw_setup->get_versions($setup_info);
$setup_info = $phpgw_setup->process_droptables($setup_info);
break;
case "new":
case 'new':
$setup_info = $phpgw_setup->process_pass($setup_info,'new',$DEBUG);
$included = True;
include('lang.php');
$phpgw_info["setup"]["currentver"]["phpgwapi"] = "oldversion";
$phpgw_info['setup']['currentver']['phpgwapi'] = 'oldversion';
break;
case "oldversion":
case 'oldversion':
$setup_info = $phpgw_setup->process_pass($setup_info,'upgrade',$DEBUG);
$phpgw_info["setup"]["currentver"]["phpgwapi"] = "oldversion";
$phpgw_info['setup']['currentver']['phpgwapi'] = 'oldversion';
break;
}
@ -246,7 +246,7 @@
// Config Section
$setup_tpl->set_var('config_step_text',lang('Step 2 - Configuration'));
$phpgw_info["setup"]["stage"]["config"] = $phpgw_setup->check_config();
$phpgw_info['setup']['stage']['config'] = $phpgw_setup->check_config();
// begin DEBUG code
//$phpgw_info['setup']['stage']['config'] = 10;

View File

@ -42,8 +42,10 @@
$submit = True;
}
if ($submit)
if ($HTTP_POST_VARS['submit'])
{
$lang_selected = $HTTP_POST_VARS['lang_selected'];
$upgrademethod = $HTTP_POST_VARS['upgrademethod'];
$phpgw_setup->db->transaction_begin();
if (count($lang_selected))
{
@ -134,13 +136,13 @@
}
else
{
if ($cancel)
if ($HTTP_POST_VARS['cancel'])
{
Header("Location: index.php");
exit;
}
if (! $included)
if (!$included)
{
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);

View File

@ -310,11 +310,25 @@
$acl->delete('phpgw_group',$thisacctid,1);
$acl->add('phpgw_group',$thisacctid,1);
// Now add the acl to let them change their password
/* Now add the acl to let them change their password */
$acl->delete('preferences','changepassword',1);
$acl->add('preferences','changepassword',1);
$acl->save_repository();
/* Add prefs for selected apps here, since they are per-user.
App access is added below.
*/
$pref = CreateObject('phpgwapi.preferences',$tmpid);
$pref->db = $phpgw_setup->db;
$pref->account_id = intval($tmpid);
$pref->read_repository();
@reset($s_apps);
while (list($key,$app) = each($s_apps))
{
$phpgw->common->hook_single('add_def_pref',$app);
}
$pref->save_repository();
}
}
/* Now give this group some rights */

View File

@ -11,47 +11,47 @@
/* $Id$ */
$phpgw_info['flags'] = array(
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => "home",
'currentapp' => 'home',
'noapi' => True
);
include('./inc/functions.inc.php');
include('./inc/functions.inc.php');
include('../phpgwapi/setup/setup.inc.php');
$phpgw_info['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
unset($setup_info);
#include("../version.inc.php");
include('../phpgwapi/setup/setup.inc.php');
$phpgw_info['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
unset($setup_info);
#include('../version.inc.php');
function check_form_values()
{
global $setting, $phpgw_setup;
if (! $setting['config_pass'])
function check_form_values()
{
$errors .= "<br>You didn't enter a config password";
}
if (! $setting['HEADER_ADMIN_PASSWORD'])
{
$errors .= "<br>You didn't enter a header admin password";
}
global $setting, $phpgw_setup;
if ($errors)
{
$phpgw_setup->show_header('Error',True);
echo $errors;
exit;
if (! $setting['config_pass'])
{
$errors .= "<br>You didn't enter a config password";
}
if (! $setting['HEADER_ADMIN_PASSWORD'])
{
$errors .= "<br>You didn't enter a header admin password";
}
if ($errors)
{
$phpgw_setup->show_header('Error',True);
echo $errors;
exit;
}
}
}
/* authentication phase */
$phpgw_info["setup"]["stage"]["header"] = $phpgw_setup->check_header();
$phpgw_info['setup']['stage']['header'] = $phpgw_setup->check_header();
// added these to let the app work, need to templatize still
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
@ -60,297 +60,298 @@ $setup_tpl->set_file(array(
'T_setup_main' => 'setup_main.tpl',
'T_setup_db_blocks' => 'setup_db_blocks.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_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
switch($phpgw_info['setup']['stage']['header'])
{
case '1':
$phpgw_info['setup']['HeaderFormMSG'] = 'Create your header.inc.php';
$phpgw_info['setup']['PageMSG'] = 'You have not created your header.inc.php yet!<br> You can create it now.';
break;
case '2':
$phpgw_info['setup']['HeaderFormMSG'] = 'Your header admin password is NOT set. Please set it now!';
$phpgw_info['setup']['PageMSG'] = 'Your header admin password is NOT set. Please set it now!';
break;
case '3':
$phpgw_info['setup']['HeaderFormMSG'] = 'Your header.inc.php needs upgrading.';
$phpgw_info['setup']['PageMSG'] = 'Your header.inc.php needs upgrading.<br><blink><font color=CC0000><b>WARNING!</b></font></blink><br>If you are using virtual domain support, this will <b>NOT</b> copy those domains over. You will need to do this manually, <b>MAKE BACKUPS!</b>';
$phpgw_info['setup']['HeaderLoginMSG'] = 'Your header.inc.php needs upgrading.';
if (!$phpgw_setup->auth('Header'))
{
$phpgw_setup->show_header('Please login',True);
$phpgw_setup->login_form();
exit;
}
break;
case '10':
if (!$phpgw_setup->auth('Header'))
{
$phpgw_setup->show_header('Please login',True);
$phpgw_setup->login_form();
exit;
}
$phpgw_info['setup']['HeaderFormMSG'] = 'Edit your header.inc.php';
$phpgw_info['setup']['PageMSG'] = 'Edit your existing header.inc.php';
break;
}
switch($phpgw_info['setup']['stage']['header'])
{
case '1':
$phpgw_info['setup']['HeaderFormMSG'] = 'Create your header.inc.php';
$phpgw_info['setup']['PageMSG'] = 'You have not created your header.inc.php yet!<br> You can create it now.';
break;
case '2':
$phpgw_info['setup']['HeaderFormMSG'] = 'Your header admin password is NOT set. Please set it now!';
$phpgw_info['setup']['PageMSG'] = 'Your header admin password is NOT set. Please set it now!';
break;
case '3':
$phpgw_info['setup']['HeaderFormMSG'] = 'Your header.inc.php needs upgrading.';
$phpgw_info['setup']['PageMSG'] = 'Your header.inc.php needs upgrading.<br><blink><font color=CC0000><b>WARNING!</b></font></blink><br>If you are using virtual domain support, this will <b>NOT</b> copy those domains over. You will need to do this manually, <b>MAKE BACKUPS!</b>';
$phpgw_info['setup']['HeaderLoginMSG'] = 'Your header.inc.php needs upgrading.';
if (!$phpgw_setup->auth('Header'))
{
$phpgw_setup->show_header('Please login',True);
$phpgw_setup->login_form();
exit;
}
break;
case '10':
if (!$phpgw_setup->auth('Header'))
{
$phpgw_setup->show_header('Please login',True);
$phpgw_setup->login_form();
exit;
}
$phpgw_info['setup']['HeaderFormMSG'] = 'Edit your header.inc.php';
$phpgw_info['setup']['PageMSG'] = 'Edit your existing header.inc.php';
break;
}
switch($action)
{
case 'download':
check_form_values();
$header_template = new Template('../');
header('Content-disposition: attachment; filename="header.inc.php"');
header('Content-type: application/octet-stream');
header('Pragma: no-cache');
header('Expires: 0');
$newheader = $phpgw_setup->generate_header();
echo $newheader;
break;
case 'view':
check_form_values();
$header_template = new Template('../');
$phpgw_setup->show_header('Generated header.inc.php', False, 'header');
echo '<br>Save this text as contents of your header.inc.php<br><hr>';
$newheader = $phpgw_setup->generate_header();
echo '<pre>';
echo htmlentities($newheader);
echo '</pre><hr>';
echo '<form action="index.php" method=post>';
echo '<br> After retrieving the file put it into place as the header.inc.php, then click continue.<br>';
echo '<input type=hidden name="FormLogout" value="header">';
echo '<input type=submit name="junk" value="continue">';
echo '</form>';
echo '</body></html>';
break;
case 'write config':
check_form_values();
$header_template = new Template('../');
if(is_writeable ('../header.inc.php')|| (!file_exists ('../header.inc.php') && is_writeable ('../')))
{
switch($action)
{
case 'download':
check_form_values();
$header_template = new Template('../');
header('Content-disposition: attachment; filename="header.inc.php"');
header('Content-type: application/octet-stream');
header('Pragma: no-cache');
header('Expires: 0');
$newheader = $phpgw_setup->generate_header();
$fsetup = fopen('../header.inc.php','wb');
fwrite($fsetup,$newheader);
fclose($fsetup);
$phpgw_setup->show_header('Saved header.inc.php', False, 'header');
echo $newheader;
break;
case 'view':
check_form_values();
$header_template = new Template('../');
$phpgw_setup->show_header('Generated header.inc.php', False, 'header');
echo '<br>Save this text as contents of your header.inc.php<br><hr>';
$newheader = $phpgw_setup->generate_header();
echo '<pre>';
echo htmlentities($newheader);
echo '</pre><hr>';
echo '<form action="index.php" method=post>';
echo '<br>Created header.inc.php! ';
echo '<br> After retrieving the file put it into place as the header.inc.php, then click continue.<br>';
echo '<input type=hidden name="FormLogout" value="header">';
echo '<input type=submit name="junk" value="continue">';
echo '</form>';
echo '</body></html>';
break;
}
else
{
$phpgw_setup->show_header('Error generating header.inc.php', False, 'header');
echo 'Could not open header.inc.php for writing!<br>' . "\n";
echo 'Please check read/write permissions on directories or back up and use another option.<br>';
echo '</td></tr></table></body></html>';
}
break;
default:
$phpgw_setup->show_header($phpgw_info['setup']['HeaderFormMSG'], False, 'header');
echo $phpgw_info['setup']['PageMSG'];
case 'write config':
check_form_values();
$header_template = new Template('../');
if(is_writeable ('../header.inc.php')|| (!file_exists ('../header.inc.php') && is_writeable ('../')))
{
$newheader = $phpgw_setup->generate_header();
$fsetup = fopen('../header.inc.php','wb');
fwrite($fsetup,$newheader);
fclose($fsetup);
$phpgw_setup->show_header('Saved header.inc.php', False, 'header');
echo '<form action="index.php" method=post>';
echo '<br>Created header.inc.php! ';
echo '<input type=hidden name="FormLogout" value="header">';
echo '<input type=submit name="junk" value="continue">';
echo '</form>';
echo '</body></html>';
break;
}
else
{
$phpgw_setup->show_header('Error generating header.inc.php', False, 'header');
echo 'Could not open header.inc.php for writing!<br>' . "\n";
echo 'Please check read/write permissions on directories or back up and use another option.<br>';
echo '</td></tr></table></body></html>';
}
break;
default:
$phpgw_setup->show_header($phpgw_info['setup']['HeaderFormMSG'], False, 'header');
echo $phpgw_info['setup']['PageMSG'];
/*
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">';
echo ' <tr><td align="center" WIDTH="20%" bgcolor="486591" colspan=2><font color="fefefe">Analysis</td></tr>';
echo '</table>';
*/
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">';
echo '<tr bgcolor="486591"><td align="center" colspan=2><font color="fefefe"> Analysis </font></td></tr><tr><td colspan=2>';
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">';
echo '<tr bgcolor="486591"><td align="center" colspan=2><font color="fefefe"> Analysis </font></td></tr><tr><td colspan=2>';
// Hardly try to find what DB-support is compiled in
// this dont work with PHP 3.0.10 and lower !
$supported_db = array();
if (extension_loaded('mysql') || function_exists('mysql_connect'))
{
echo 'You appear to have MySQL support enabled<br>' . "\n";
$supported_db[] = 'mysql';
}
else
{
echo 'No MySQL support found. Disabling<br>' . "\n";
}
if (extension_loaded('pgsql') || function_exists('pg_connect'))
{
echo 'You appear to have Postgres-DB support enabled<br>' . "\n";
$supported_db[] = 'pgsql';
}
else
{
echo 'No Postgres-DB support found. Disabling<br>' . "\n";
}
if (extension_loaded('mssql') || function_exists('mssql_connect'))
{
echo 'You appear to have Microsoft SQL Server support enabled<br>' . "\n";
$supported_db[] = 'mssql';
}
else
{
echo 'No Microsoft SQL Server support found. Disabling<br>' . "\n";
}
if (extension_loaded('oci8'))
{
echo 'You appear to have Oracle V8 (OCI) support enabled<br>' . "\n";
$supported_db[] = 'oracle';
}
else
{
if(extension_loaded('oracle'))
$supported_db = array();
if (extension_loaded('mysql') || function_exists('mysql_connect'))
{
echo 'You appear to have Oracle support enabled<br>' . "\n";
echo 'You appear to have MySQL support enabled<br>' . "\n";
$supported_db[] = 'mysql';
}
else
{
echo 'No MySQL support found. Disabling<br>' . "\n";
}
if (extension_loaded('pgsql') || function_exists('pg_connect'))
{
echo 'You appear to have Postgres-DB support enabled<br>' . "\n";
$supported_db[] = 'pgsql';
}
else
{
echo 'No Postgres-DB support found. Disabling<br>' . "\n";
}
if (extension_loaded('mssql') || function_exists('mssql_connect'))
{
echo 'You appear to have Microsoft SQL Server support enabled<br>' . "\n";
$supported_db[] = 'mssql';
}
else
{
echo 'No Microsoft SQL Server support found. Disabling<br>' . "\n";
}
if (extension_loaded('oci8'))
{
echo 'You appear to have Oracle V8 (OCI) support enabled<br>' . "\n";
$supported_db[] = 'oracle';
}
else
{
echo 'No Oracle-DB support found. Disabling<br>' . "\n";
if(extension_loaded('oracle'))
{
echo 'You appear to have Oracle support enabled<br>' . "\n";
$supported_db[] = 'oracle';
}
else
{
echo 'No Oracle-DB support found. Disabling<br>' . "\n";
}
}
}
if(!count($supported_db))
{
echo '<b><p align=center><font size=+2 color=red>did not found any valid DB support !<br>try to configure your php to support one of the above mentioned dbs or install phpgroupware by hand </font></p></b><td></tr></table></body></html>';
exit;
}
$no_guess = false;
if(file_exists('../header.inc.php') && is_file('../header.inc.php'))
{
echo 'Found existing configuration file. Loading settings from the file...<br>' . "\n";
$phpgw_info['flags']['noapi'] = True;
include('../header.inc.php');
$no_guess = true;
/* This code makes sure the newer multi-domain supporting header.inc.php is being used */
if (!isset($phpgw_domain))
if(!count($supported_db))
{
echo 'Your using an old configuration file format...<br>' . "\n";
echo 'Importing old settings into the new format....<br>' . "\n";
echo '<b><p align=center><font size=+2 color=red>did not found any valid DB support !<br>try to configure your php to support one of the above mentioned dbs or install phpgroupware by hand </font></p></b><td></tr></table></body></html>';
exit;
}
$no_guess = false;
if(file_exists('../header.inc.php') && is_file('../header.inc.php'))
{
echo 'Found existing configuration file. Loading settings from the file...<br>' . "\n";
$phpgw_info['flags']['noapi'] = True;
include('../header.inc.php');
$no_guess = true;
/* This code makes sure the newer multi-domain supporting header.inc.php is being used */
if (!isset($phpgw_domain))
{
echo 'Your using an old configuration file format...<br>' . "\n";
echo 'Importing old settings into the new format....<br>' . "\n";
}
else
{
if ($phpgw_info['server']['header_version'] != $phpgw_info['server']['current_header_version'])
{
echo 'Your using an old header.inc.php version...<br>' . "\n";
echo 'Importing old settings into the new format....<br>' . "\n";
}
reset($phpgw_domain);
$default_domain = each($phpgw_domain);
$phpgw_info['server']['default_domain'] = $default_domain[0];
unset ($default_domain); // we kill this for security reasons
$phpgw_info['server']['db_host'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_host'];
$phpgw_info['server']['db_name'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_name'];
$phpgw_info['server']['db_user'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_user'];
$phpgw_info['server']['db_pass'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_pass'];
$phpgw_info['server']['db_type'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_type'];
$phpgw_info['server']['config_passwd'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['config_passwd'];
}
if (defined('PHPGW_SERVER_ROOT'))
{
$phpgw_info['server']['server_root'] = PHPGW_SERVER_ROOT;
$phpgw_info['server']['include_root'] = PHPGW_INCLUDE_ROOT;
}
elseif (!isset($phpgw_info['server']['include_root']) && $phpgw_info['server']['header_version'] <= 1.6)
{
$phpgw_info['server']['include_root'] = $phpgw_info['server']['server_root'];
}
elseif (!isset($phpgw_info['server']['header_version']) && $phpgw_info['server']['header_version'] <= 1.6)
{
$phpgw_info['server']['include_root'] = $phpgw_info['server']['server_root'];
}
}
else
{
if ($phpgw_info['server']['header_version'] != $phpgw_info['server']['current_header_version'])
{
echo 'Your using an old header.inc.php version...<br>' . "\n";
echo 'Importing old settings into the new format....<br>' . "\n";
}
reset($phpgw_domain);
$default_domain = each($phpgw_domain);
$phpgw_info['server']['default_domain'] = $default_domain[0];
unset ($default_domain); // we kill this for security reasons
$phpgw_info['server']['db_host'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_host'];
$phpgw_info['server']['db_name'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_name'];
$phpgw_info['server']['db_user'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_user'];
$phpgw_info['server']['db_pass'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_pass'];
$phpgw_info['server']['db_type'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_type'];
$phpgw_info['server']['config_passwd'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['config_passwd'];
}
if (defined('PHPGW_SERVER_ROOT'))
{
$phpgw_info['server']['server_root'] = PHPGW_SERVER_ROOT;
$phpgw_info['server']['include_root'] = PHPGW_INCLUDE_ROOT;
}
elseif (!isset($phpgw_info['server']['include_root']) && $phpgw_info['server']['header_version'] <= 1.6)
{
$phpgw_info['server']['include_root'] = $phpgw_info['server']['server_root'];
}
elseif (!isset($phpgw_info['server']['header_version']) && $phpgw_info['server']['header_version'] <= 1.6)
{
$phpgw_info['server']['include_root'] = $phpgw_info['server']['server_root'];
}
}
else
{
echo 'sample configuration not found. using built in defaults<br>' . "\n";
$phpgw_info['server']['server_root'] = '/path/to/phpgroupware';
$phpgw_info['server']['include_root'] = '/path/to/phpgroupware';
/* This is the basic include needed on each page for phpGroupWare application compliance */
$phpgw_info['flags']['htmlcompliant'] = True;
echo 'sample configuration not found. using built in defaults<br>' . "\n";
$phpgw_info['server']['server_root'] = '/path/to/phpgroupware';
$phpgw_info['server']['include_root'] = '/path/to/phpgroupware';
/* This is the basic include needed on each page for phpGroupWare application compliance */
$phpgw_info['flags']['htmlcompliant'] = True;
/* These are the settings for the database system */
$phpgw_info['server']['db_host'] = 'localhost';
$phpgw_info['server']['db_name'] = 'phpgroupware';
$phpgw_info['server']['db_user'] = 'phpgroupware';
$phpgw_info['server']['db_pass'] = 'your_password';
$phpgw_info['server']['db_type'] = 'mysql'; //mysql, pgsql (for postgresql), or oracle
/* These are the settings for the database system */
$phpgw_info['server']['db_host'] = 'localhost';
$phpgw_info['server']['db_name'] = 'phpgroupware';
$phpgw_info['server']['db_user'] = 'phpgroupware';
$phpgw_info['server']['db_pass'] = 'your_password';
$phpgw_info['server']['db_type'] = 'mysql'; //mysql, pgsql (for postgresql), or oracle
/* These are a few of the advanced settings */
$phpgw_info['server']['config_passwd'] = 'changeme';
$phpgw_info['server']['mcrypt_enabled'] = False;
$phpgw_info['server']['mcrypt_version'] = '2.6.3';
$phpgw_info['server']['config_passwd'] = 'changeme';
$phpgw_info['server']['mcrypt_enabled'] = False;
$phpgw_info['server']['mcrypt_version'] = '2.6.3';
srand((double)microtime()*1000000);
$random_char = array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
srand((double)microtime()*1000000);
$random_char = array(
'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
for ($i=0; $i<30; $i++)
{
$phpgw_info['server']['mcrypt_iv'] .= $random_char[rand(1,count($random_char))];
for ($i=0; $i<30; $i++)
{
$phpgw_info['server']['mcrypt_iv'] .= $random_char[rand(1,count($random_char))];
}
}
}
// now guessing better settings then the default ones
if(!$no_guess)
{
echo 'Now guessing better values for defaults <br>' . "\n";
$this_dir = dirname($SCRIPT_FILENAME);
$updir = ereg_replace("/setup",'',$this_dir);
$phpgw_info['server']['server_root'] = $updir;
$phpgw_info['server']['include_root'] = $updir;
}
if(!$no_guess)
{
echo 'Now guessing better values for defaults <br>' . "\n";
$this_dir = dirname($SCRIPT_FILENAME);
$updir = ereg_replace('/setup','',$this_dir);
$phpgw_info['server']['server_root'] = $updir;
$phpgw_info['server']['include_root'] = $updir;
}
?>
</td></tr>
<tr bgcolor=486591><th colspan=2><font color="fefefe">Settings</font></th></tr>
<form action="<?php echo $PHP_SELF ?>" method=post>
<input type=hidden name="setting[write_config]" value=true>
<tr><td colspan=2><b>Server Root</b><br><input type=text name="setting[server_root]" size=80 value="<?php echo $phpgw_info["server"]["server_root"] ?>"></td></tr>
<tr><td colspan=2><b>Include Root (this should be the same as Server Root unless you know what you are doing)</b><br><input type=text name="setting[include_root]" size=80 value="<?php echo $phpgw_info["server"]["include_root"] ?>"></td></tr>
<tr><td colspan=2><b>Admin password to header manager </b><br><input type=text name="setting[HEADER_ADMIN_PASSWORD]" size=80 value="<?php echo $phpgw_info["server"]["header_admin_password"] ?>"></td></tr>
<tr bgcolor="486591"><th colspan="2"><font color="fefefe">Settings</font></th></tr>
<form action="manageheader.php" method="post">
<input type="hidden" name="setting[write_config]" value="true">
<tr><td colspan="2"><b>Server Root</b><br><input type="text" name="setting[server_root]" size="80" value="<?php echo $phpgw_info['server']['server_root'] ?>"></td></tr>
<tr><td colspan="2"><b>Include Root (this should be the same as Server Root unless you know what you are doing)</b><br><input type="text" name="setting[include_root]" size="80" value="<?php echo $phpgw_info['server']['include_root'] ?>"></td></tr>
<tr><td colspan="2"><b>Admin password to header manager </b><br><input type="text" name="setting[HEADER_ADMIN_PASSWORD]" size="80" value="<?php echo $phpgw_info['server']['header_admin_password'] ?>"></td></tr>
<br><br>
<tr><td><b>DB Host</b><br><input type=text name="setting[db_host]" value="<?php echo $phpgw_info["server"]["db_host"] ?>"></td><td>Hostname/IP of Databaseserver</td></tr>
<tr><td><b>DB Name</b><br><input type=text name="setting[db_name]" value="<?php echo $phpgw_info["server"]["db_name"] ?>"></td><td>Name of Database</td></tr>
<tr><td><b>DB User</b><br><input type=text name="setting[db_user]" value="<?php echo $phpgw_info["server"]["db_user"] ?>"></td><td>Name of DB User as phpgroupware has to connect as</td></tr>
<tr><td><b>DB Password</b><br><input type=text name="setting[db_pass]" value="<?php echo $phpgw_info["server"]["db_pass"] ?>"></td><td>Password of DB User</td></tr>
<tr><td><b>DB Host</b><br><input type="text" name="setting[db_host]" value="<?php echo $phpgw_info['server']['db_host'] ?>"></td><td>Hostname/IP of Databaseserver</td></tr>
<tr><td><b>DB Name</b><br><input type="text" name="setting[db_name]" value="<?php echo $phpgw_info['server']['db_name'] ?>"></td><td>Name of Database</td></tr>
<tr><td><b>DB User</b><br><input type="text" name="setting[db_user]" value="<?php echo $phpgw_info['server']['db_user'] ?>"></td><td>Name of DB User as phpgroupware has to connect as</td></tr>
<tr><td><b>DB Password</b><br><input type="text" name="setting[db_pass]" value="<?php echo $phpgw_info['server']['db_pass'] ?>"></td><td>Password of DB User</td></tr>
<tr><td><b>DB Type</b><br><select name="setting[db_type]">
<?php
$selected = "";
$selected = '';
$found_dbtype = false;
while(list($k,$v) = each($supported_db))
{
if($v == $phpgw_info["server"]["db_type"])
if($v == $phpgw_info['server']['db_type'])
{
$selected = " selected ";
$selected = ' selected ';
$found_dbtype = true;
}
else
{
$selected = "";
$selected = '';
}
print "<option $selected value=\"$v\">$v\n";
print '<option ' . $selected . ' value="' . $v . '">' . $v . "\n";
}
?>
</select>
</td><td>What Database do you want to use with PHPGroupWare?
<tr><td><b>Configuration Password</b><br><input type=text name="setting[config_pass]" value="<?php echo $phpgw_info["server"]["config_passwd"] ?>"></td><td>Password needed for configuration</td></tr>
<tr><td><b>Configuration Password</b><br><input type=text name="setting[config_pass]" value="<?php echo $phpgw_info['server']['config_passwd'] ?>"></td><td>Password needed for configuration</td></tr>
<tr><td colspan=2><b>Enable MCrypt</b><br>
<select name="setting[enable_mcrypt]">
<?php if($phpgw_info["server"]["mcrypt_enabled"] == True) { ?>
<option value=True selected>True
<option value=False>False
<option value="True" selected>True
<option value="False">False
<?php } else { ?>
<option value=True>True
<option value=False selected>False
<option value="True">True
<option value="False" selected>False
<?php } ?>
</select>
</td></tr>
<tr><td><b>MCrypt version</b><br><input type=text name="setting[mcrypt_version]" value="<?php echo $phpgw_info["server"]["versions"]["mcrypt"] ?>"></td><td>Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use</td></tr>
<tr><td><b>MCrypt initilazation vector</b><br><input type=text name="setting[mcrypt_iv]" value="<?php echo $phpgw_info["server"]["mcrypt_iv"] ?>" size="30"></td><td>It should be around 30 bytes in length.<br>Note: The default has been randomly generated.</td></tr>
<tr><td><b>MCrypt version</b><br><input type="text" name="setting[mcrypt_version]" value="<?php echo $phpgw_info['server']['versions']['mcrypt'] ?>"></td><td>Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use</td></tr>
<tr><td><b>MCrypt initilazation vector</b><br><input type="text" name="setting[mcrypt_iv]" value="<?php echo $phpgw_info['server']['mcrypt_iv'] ?>" size="30"></td><td>It should be around 30 bytes in length.<br>Note: The default has been randomly generated.</td></tr>
<tr><td><b>Domain select box on login</b><br>
<select name="setting[domain_selectbox]">
<option value="True"<?php echo ($phpgw_info["server"]["domain_selectbox"]?" selected":""); ?>>True</option>
<option value="False"<?php echo (! $phpgw_info["server"]["domain_selectbox"]?" selected":""); ?>>False</option>
<option value="True"<?php echo ($phpgw_info['server']['domain_selectbox']?' selected':''); ?>>True</option>
<option value="False"<?php echo (! $phpgw_info['server']['domain_selectbox']?' selected':''); ?>>False</option>
</select></td><td></td>
</tr>
</table>
@ -374,15 +375,15 @@ switch($action)
echo '<form action="index.php" method=post>';
echo '<br> After retrieving the file put it into place as the header.inc.php, then click continue.<br>';
echo '<input type=hidden name="FormLogout" value="header">';
//echo '<input type=hidden name="FormLogout" value="config">';
//echo '<input type=hidden name="ConfigLogin" value="Login">';
//echo '<input type=hidden name="FormPW" value="'.$phpgw_domain[$phpgw_info["server"]["default_domain"]]["config_passwd"].'">';
//echo '<input type=hidden name="FormDomain" value="'.$phpgw_info["server"]["default_domain"].'">';
//echo '<input type=hidden name="FormLogout" value="config">';
//echo '<input type=hidden name="ConfigLogin" value="Login">';
//echo '<input type=hidden name="FormPW" value="'.$phpgw_domain[$phpgw_info["server"]["default_domain"]]["config_passwd"].'">';
//echo '<input type=hidden name="FormDomain" value="'.$phpgw_info["server"]["default_domain"].'">';
echo '<input type=submit name="junk" value="continue">';
echo '</form>';
echo '</body>';
echo '</html>';
break; // ending the switch default
}
}
?>

View File

@ -21,6 +21,11 @@
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$download = $HTTP_POST_VARS['download'] ? $HTTP_POST_VARS['download'] : $HTTP_GET_VARS['download'];
$submit = $HTTP_POST_VARS['submit'] ? $HTTP_POST_VARS['submit'] : $HTTP_GET_VARS['submit'];
$showall = $HTTP_POST_VARS['showall'] ? $HTTP_POST_VARS['showall'] : $HTTP_GET_VARS['showall'];
$appname = $HTTP_POST_VARS['appname'] ? $HTTP_POST_VARS['appname'] : $HTTP_GET_VARS['appname'];
if ($download)
{
$setup_tpl->set_file(array(

View File

@ -15,7 +15,7 @@
<tr bgcolor="e6e6e6">
<td {td_align}>
{select_box_desc}
<form action="lang.php">
<form method="POST" action="lang.php">
{hidden_var1}
<select name="lang_selected[]" multiple size="10">
{select_box_langs}

View File

@ -2,38 +2,48 @@ addressbook 0.9.13.002
admin 0.9.13.002
bookkeeping 0.4
bookmarks 0.8.1
brewer 0.0.1
calendar 0.9.13.002
cart 0.8.1
ccs 0.0.0
chat 0.0.0
chora 0.0.4
comic 0.0.1
developer_tools 0.8.1
dj 0.0.3
eldaptir 0.0.4
email 0.9.11
filemanager 0.9.11
forum 0.8.1
eldaptir 0.0.6
email 0.9.13.002
filemanager 0.9.13.002
forum 0.9.13.001
ftp 0.8.1
headlines 0.8.1
hr 0.8.1
infolog 0.9.11
inv 0.8.3.009
manual 0.0.0
mediadb 0.0.3
manual 0.9.13.002
mediadb 0.0.4
messenger 0.8.1
news_admin 0.0.1
nntp 0.9.11
myadmin 0.9.13.002
news_admin 0.8.1.002
nntp 0.9.13.002
notes 0.9.13.002
phpgwapi 0.9.13.002
phpwebhosting 0.9.13.001
phpsysinfo 1.7
phpwebhosting 0.9.13.005
polls 0.8.1
preferences 0.9.13.002
projects 0.8.5.001
skel 0.0.1.000
projects 0.8.5.004
qmailldap 0.0.1
registration 0.8.1
skel 0.0.1.001
soap 0.0.1
squirrelmail 0.8.1
stocks 0.8.1
timetrack 0.9.11
todo 0.9.13.002
transy 0.9.11
syncml-server 0.9.13.001
timetrack 0.9.13
todo 0.9.13.004
transy 0.9.13.002
transy3 0.9.13.002
transyold 0.9.13.002
tts 0.0.1
weather 0.0.0