From e0db9156706c74d7a20bcb228b8b6bef0757cd5d Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Tue, 21 Aug 2001 18:48:50 +0000 Subject: [PATCH] Changes to allow register_globals to be off --- setup/applications.php | 17 +- setup/config.php | 6 +- setup/inc/class.schema_proc_mysql.inc.php | 3 +- setup/inc/class.setup.inc.php | 52 ++- setup/inc/class.setup_html.inc.php | 14 +- setup/inc/class.setup_process.inc.php | 6 +- setup/inc/functions.inc.php | 48 +- setup/index.php | 20 +- setup/lang.php | 8 +- setup/ldapimport.php | 16 +- setup/manageheader.php | 519 +++++++++++----------- setup/sqltoarray.php | 5 + setup/templates/default/lang_main.tpl | 2 +- setup/versions.inc.php | 38 +- 14 files changed, 434 insertions(+), 320 deletions(-) diff --git a/setup/applications.php b/setup/applications.php index 147bc95f48..02d51eade3 100644 --- a/setup/applications.php +++ b/setup/applications.php @@ -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) diff --git a/setup/config.php b/setup/config.php index d17adb40e6..8caef1c2d0 100644 --- a/setup/config.php +++ b/setup/config.php @@ -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 '
Updating: ' . $setting . '=' . $value; diff --git a/setup/inc/class.schema_proc_mysql.inc.php b/setup/inc/class.schema_proc_mysql.inc.php index f7d5d89bf9..ef6b5cd2e5 100644 --- a/setup/inc/class.schema_proc_mysql.inc.php +++ b/setup/inc/class.schema_proc_mysql.inc.php @@ -307,7 +307,8 @@ if ($DEBUG) { echo '
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; diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index 42affd1400..1d22058f2c 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -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' || diff --git a/setup/inc/class.setup_html.inc.php b/setup/inc/class.setup_html.inc.php index d1c92b9a89..74a034a150 100644 --- a/setup/inc/class.setup_html.inc.php +++ b/setup/inc/class.setup_html.inc.php @@ -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 = ''.lang('Logout').''; + $btn_logout = ''.lang('Logout').''; } $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']); diff --git a/setup/inc/class.setup_process.inc.php b/setup/inc/class.setup_process.inc.php index 2b1bdd5777..c087302d7f 100755 --- a/setup/inc/class.setup_process.inc.php +++ b/setup/inc/class.setup_process.inc.php @@ -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'); diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index 174acec503..647abdc61d 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -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 == "") { diff --git a/setup/index.php b/setup/index.php index ac43de09df..d43c9ab095 100644 --- a/setup/index.php +++ b/setup/index.php @@ -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; diff --git a/setup/lang.php b/setup/lang.php index fa67f415fa..7552242f8e 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -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); diff --git a/setup/ldapimport.php b/setup/ldapimport.php index 4354e4e862..9fd4378378 100644 --- a/setup/ldapimport.php +++ b/setup/ldapimport.php @@ -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 */ diff --git a/setup/manageheader.php b/setup/manageheader.php index 5b48032a91..3d0d2c4a74 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -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 .= "
You didn't enter a config password"; - } - if (! $setting['HEADER_ADMIN_PASSWORD']) - { - $errors .= "
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 .= "
You didn't enter a config password"; + } + if (! $setting['HEADER_ADMIN_PASSWORD']) + { + $errors .= "
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!
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.
WARNING!
If you are using virtual domain support, this will NOT copy those domains over. You will need to do this manually, MAKE BACKUPS!'; - $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!
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.
WARNING!
If you are using virtual domain support, this will NOT copy those domains over. You will need to do this manually, MAKE BACKUPS!'; + $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 '
Save this text as contents of your header.inc.php

'; - $newheader = $phpgw_setup->generate_header(); - echo '
';
-		echo htmlentities($newheader);
-		echo '

'; - echo '
'; - echo '
After retrieving the file put it into place as the header.inc.php, then click continue.
'; - echo ''; - echo ''; - echo '
'; - echo ''; - 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 '
Save this text as contents of your header.inc.php

'; + $newheader = $phpgw_setup->generate_header(); + echo '
';
+			echo htmlentities($newheader);
+			echo '

'; echo '
'; - echo '
Created header.inc.php! '; + echo '
After retrieving the file put it into place as the header.inc.php, then click continue.
'; echo ''; echo ''; echo '
'; echo ''; break; - } - else - { - $phpgw_setup->show_header('Error generating header.inc.php', False, 'header'); - echo 'Could not open header.inc.php for writing!
' . "\n"; - echo 'Please check read/write permissions on directories or back up and use another option.
'; - echo ''; - } - 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 '
'; + echo '
Created header.inc.php! '; + echo ''; + echo ''; + echo '
'; + echo ''; + break; + } + else + { + $phpgw_setup->show_header('Error generating header.inc.php', False, 'header'); + echo 'Could not open header.inc.php for writing!
' . "\n"; + echo 'Please check read/write permissions on directories or back up and use another option.
'; + echo ''; + } + break; + default: + $phpgw_setup->show_header($phpgw_info['setup']['HeaderFormMSG'], False, 'header'); + echo $phpgw_info['setup']['PageMSG']; /* echo ''; echo ' '; echo '
Analysis
'; */ - echo ''; - echo '
Analysis
'; + echo ''; + echo '
Analysis
'; // 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
' . "\n"; - $supported_db[] = 'mysql'; - } - else - { - echo 'No MySQL support found. Disabling
' . "\n"; - } - if (extension_loaded('pgsql') || function_exists('pg_connect')) - { - echo 'You appear to have Postgres-DB support enabled
' . "\n"; - $supported_db[] = 'pgsql'; - } - else - { - echo 'No Postgres-DB support found. Disabling
' . "\n"; - } - if (extension_loaded('mssql') || function_exists('mssql_connect')) - { - echo 'You appear to have Microsoft SQL Server support enabled
' . "\n"; - $supported_db[] = 'mssql'; - } - else - { - echo 'No Microsoft SQL Server support found. Disabling
' . "\n"; - } - if (extension_loaded('oci8')) - { - echo 'You appear to have Oracle V8 (OCI) support enabled
' . "\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
' . "\n"; + echo 'You appear to have MySQL support enabled
' . "\n"; + $supported_db[] = 'mysql'; + } + else + { + echo 'No MySQL support found. Disabling
' . "\n"; + } + if (extension_loaded('pgsql') || function_exists('pg_connect')) + { + echo 'You appear to have Postgres-DB support enabled
' . "\n"; + $supported_db[] = 'pgsql'; + } + else + { + echo 'No Postgres-DB support found. Disabling
' . "\n"; + } + if (extension_loaded('mssql') || function_exists('mssql_connect')) + { + echo 'You appear to have Microsoft SQL Server support enabled
' . "\n"; + $supported_db[] = 'mssql'; + } + else + { + echo 'No Microsoft SQL Server support found. Disabling
' . "\n"; + } + if (extension_loaded('oci8')) + { + echo 'You appear to have Oracle V8 (OCI) support enabled
' . "\n"; $supported_db[] = 'oracle'; } else { - echo 'No Oracle-DB support found. Disabling
' . "\n"; + if(extension_loaded('oracle')) + { + echo 'You appear to have Oracle support enabled
' . "\n"; + $supported_db[] = 'oracle'; + } + else + { + echo 'No Oracle-DB support found. Disabling
' . "\n"; + } } - } - if(!count($supported_db)) - { - echo '

did not found any valid DB support !
try to configure your php to support one of the above mentioned dbs or install phpgroupware by hand

'; - 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...
' . "\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...
' . "\n"; - echo 'Importing old settings into the new format....
' . "\n"; + echo '

did not found any valid DB support !
try to configure your php to support one of the above mentioned dbs or install phpgroupware by hand

'; + 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...
' . "\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...
' . "\n"; + echo 'Importing old settings into the new format....
' . "\n"; + } + else + { + if ($phpgw_info['server']['header_version'] != $phpgw_info['server']['current_header_version']) + { + echo 'Your using an old header.inc.php version...
' . "\n"; + echo 'Importing old settings into the new format....
' . "\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...
' . "\n"; - echo 'Importing old settings into the new format....
' . "\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
' . "\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 + echo 'sample configuration not found. using built in defaults
' . "\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 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
' . "\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
' . "\n"; + $this_dir = dirname($SCRIPT_FILENAME); + $updir = ereg_replace('/setup','',$this_dir); + $phpgw_info['server']['server_root'] = $updir; + $phpgw_info['server']['include_root'] = $updir; + } ?> - Settings -
- - Server Root
"> - Include Root (this should be the same as Server Root unless you know what you are doing)
"> - Admin password to header manager
"> + Settings + + + Server Root
+ Include Root (this should be the same as Server Root unless you know what you are doing)
+ Admin password to header manager


- DB Host
">Hostname/IP of Databaseserver - DB Name
">Name of Database - DB User
">Name of DB User as phpgroupware has to connect as - DB Password
">Password of DB User + DB Host
Hostname/IP of Databaseserver + DB Name
Name of Database + DB User
Name of DB User as phpgroupware has to connect as + DB Password
Password of DB User DB Type
What Database do you want to use with PHPGroupWare? - Configuration Password
">Password needed for configuration + Configuration Password
Password needed for configuration Enable MCrypt
- MCrypt version
">Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use - MCrypt initilazation vector
" size="30">It should be around 30 bytes in length.
Note: The default has been randomly generated. + MCrypt version
Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use + MCrypt initilazation vector
It should be around 30 bytes in length.
Note: The default has been randomly generated. Domain select box on login
@@ -374,15 +375,15 @@ switch($action) echo ''; echo '
After retrieving the file put it into place as the header.inc.php, then click continue.
'; echo ''; - //echo ''; - //echo ''; - //echo ''; - //echo ''; + //echo ''; + //echo ''; + //echo ''; + //echo ''; echo ''; echo '
'; echo ''; echo ''; break; // ending the switch default -} + } ?> diff --git a/setup/sqltoarray.php b/setup/sqltoarray.php index baa0b861b8..406b98f955 100644 --- a/setup/sqltoarray.php +++ b/setup/sqltoarray.php @@ -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( diff --git a/setup/templates/default/lang_main.tpl b/setup/templates/default/lang_main.tpl index 855b8dd1ca..f516bcfabb 100644 --- a/setup/templates/default/lang_main.tpl +++ b/setup/templates/default/lang_main.tpl @@ -15,7 +15,7 @@ {select_box_desc} -
+ {hidden_var1}