From aa1398fd6ba86294e8aae585119c39637948e680 Mon Sep 17 00:00:00 2001 From: skeeter Date: Mon, 29 Apr 2002 19:49:24 +0000 Subject: [PATCH] Converting to get_var() for all HTTP_*_VARS. --- setup/applications.php | 30 +++++++++++++++--------------- setup/config.php | 13 ++++++------- setup/index.php | 2 +- setup/lang.php | 8 ++++---- setup/ldap.php | 8 ++++---- setup/manageheader.php | 20 ++++++++++++-------- setup/schematoy.php | 14 +++++++------- setup/setup_demo.php | 16 ++++++++-------- setup/sqltoarray.php | 8 ++++---- 9 files changed, 61 insertions(+), 58 deletions(-) diff --git a/setup/applications.php b/setup/applications.php index 5728143944..718bc37a74 100644 --- a/setup/applications.php +++ b/setup/applications.php @@ -38,7 +38,7 @@ } // Does not return unless user is authorized - $ConfigDomain = $HTTP_COOKIE_VARS['ConfigDomain'] ? $HTTP_COOKIE_VARS['ConfigDomain'] : $HTTP_POST_VARS['ConfigDomain']; + $ConfigDomain = get_var('ConfigDomain',Array('POST','COOKIE')); $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup'); $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); @@ -109,22 +109,22 @@ //var_dump($setup_info);exit; @ksort($setup_info); - if(@$HTTP_POST_VARS['cancel']) + if(@get_var('cancel',Array('POST'))) { Header("Location: index.php"); exit; } - if(@$HTTP_POST_VARS['submit']) + if(@get_var('submit',Array('POST'))) { $GLOBALS['phpgw_setup']->html->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']; + $appname = get_var('appname',Array('POST')); + $remove = get_var('remove',Array('POST')); + $install = get_var('install',Array('POST')); + $upgrade = get_var('upgrade',Array('POST')); while (list($appname,$key) = @each($remove)) { @@ -220,9 +220,10 @@ $GLOBALS['phpgw_setup']->html->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')'); } - if(@$HTTP_GET_VARS['detail']) + $detail = get_var('detail',Array('GET')); + $resolve = get_var('resolve',Array('GET')); + if(@$detail) { - $detail = $HTTP_GET_VARS['detail']; @ksort($setup_info[$detail]); @reset($setup_info[$detail]); $setup_tpl->set_var('description',lang('App details') . ':'); @@ -258,15 +259,14 @@ $setup_tpl->pparse('out','footer'); exit; } - elseif (@$HTTP_GET_VARS['resolve']) + elseif (@$resolve) { - $resolve = $HTTP_GET_VARS['resolve']; - $version = $HTTP_GET_VARS['version']; - $notables = $HTTP_GET_VARS['notables']; + $version = get_var('version',Array('GET')); + $notables = get_var('notables',Array('GET')); $setup_tpl->set_var('description',lang('Problem resolution'). ':'); $setup_tpl->pparse('out','header'); - if($HTTP_GET_VARS['post']) + if(get_var('post',Array('GET'))) { echo '"' . $setup_info[$resolve]['title'] . '" ' . lang('may be broken') . ' '; echo lang('because an application it depends upon was upgraded'); @@ -275,7 +275,7 @@ echo '
'; echo lang('However, the application may still work') . '.'; } - elseif ($HTTP_GET_VARS['badinstall']) + elseif(get_var('badinstall',Array('GET'))) { echo '"' . $setup_info[$resolve]['title'] . '" ' . lang('is broken') . ' '; echo lang('because of a failed upgrade or install') . '.'; diff --git a/setup/config.php b/setup/config.php index ecc1aa8df2..23d7ba4844 100644 --- a/setup/config.php +++ b/setup/config.php @@ -57,7 +57,7 @@ $GLOBALS['current_config']['temp_dir'] = '/path/to/temp/dir'; } - if(@$GLOBALS['HTTP_POST_VARS']['cancel']) + if(@get_var('cancel',Array('POST'))) { Header('Location: index.php'); exit; @@ -74,15 +74,14 @@ $configtbl = 'phpgw_config'; } - if(@$GLOBALS['HTTP_POST_VARS']['submit'] && @$GLOBALS['HTTP_POST_VARS']['newsettings']) + $newsettings = get_var('newsettings',Array('POST')); + if(@get_var('submit',Array('POST')) && @$newsettings) { $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')"); - $newsettings = $GLOBALS['HTTP_POST_VARS']['newsettings']; - while(list($setting,$value) = @each($newsettings)) { /* echo '
Updating: ' . $setting . '=' . $value; */ @@ -141,7 +140,7 @@ $GLOBALS['current_config']['files_dir'] = $GLOBALS['phpgw_info']['server']['server_root'] . '/files'; } - if($error == 'badldapconnection') + if($GLOBALS['error'] == 'badldapconnection') { /* Please check the number and dial again :) */ $GLOBALS['phpgw_setup']->html->show_alert_msg('Error', @@ -205,7 +204,7 @@ } else { - $t->set_var($value,$current_config[$newval]); + $t->set_var($value,@$current_config[$newval]); } break; case 'selected': @@ -219,7 +218,7 @@ } $config = implode('_',$configs); /* echo $config . '=' . $current_config[$config]; */ - if($current_config[$config] == $setting) + if(@$current_config[$config] == $setting) { $t->set_var($value,' selected'); } diff --git a/setup/index.php b/setup/index.php index 02cc6ea7bb..8b0d07f5a6 100644 --- a/setup/index.php +++ b/setup/index.php @@ -95,7 +95,7 @@ //$action = 'Upgrade'; // end DEBUG code - switch(@$GLOBALS['HTTP_POST_VARS']['action']) + switch(@get_var('action',Array('POST'))) { case 'Uninstall all applications': $subtitle = lang('Deleting Tables'); diff --git a/setup/lang.php b/setup/lang.php index 5cb420b299..df2790ede6 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -58,10 +58,10 @@ $langstbl = 'phpgw_languages'; } - if (@$GLOBALS['HTTP_POST_VARS']['submit']) + if (@get_var('submit',Array('POST'))) { - $lang_selected = $HTTP_POST_VARS['lang_selected']; - $upgrademethod = $HTTP_POST_VARS['upgrademethod']; + $lang_selected = get_var('lang_selected',Array('POST')); + $upgrademethod = get_var('upgrademethod',Array(POST')); $GLOBALS['phpgw_setup']->db->transaction_begin(); if (count($lang_selected)) { @@ -153,7 +153,7 @@ } else { - if (@$GLOBALS['HTTP_POST_VARS']['cancel']) + if (@get_var('cancel',Array('POST'))) { Header('Location: index.php'); exit; diff --git a/setup/ldap.php b/setup/ldap.php index a47132f616..5b7a370660 100644 --- a/setup/ldap.php +++ b/setup/ldap.php @@ -11,7 +11,7 @@ /* $Id$ */ - $phpgw_info = array(); + $GLOBALS['phpgw_info'] = array(); $GLOBALS['phpgw_info']['flags'] = array( 'noheader' => True, 'nonavbar' => True, @@ -28,7 +28,7 @@ } // Does not return unless user is authorized - if ($HTTP_POST_VARS['cancel']) + if (get_var('cancel',Array('POST'))) { Header('Location: index.php'); exit; @@ -45,10 +45,10 @@ $GLOBALS['phpgw_setup']->html->show_header(lang('LDAP Config'),'','config',$ConfigDomain); - if ($error) + if ($GLOBALS['error']) { //echo '
Error: '.$error.'
'; - $GLOBALS['phpgw_setup']->html->show_alert_msg('Error',$error); + $GLOBALS['phpgw_setup']->html->show_alert_msg('Error',$GLOBALS['error']); } $setup_tpl->set_block('ldap','header','header'); diff --git a/setup/manageheader.php b/setup/manageheader.php index c6529fad77..e59eb06d62 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -25,28 +25,32 @@ unset($setup_info); #include('../version.inc.php'); - if(@$GLOBALS['HTTP_POST_VARS']['adddomain']) + $adddomain = get_var('adddomain',Array('POST')); + if(@$adddomain) { } function check_form_values() { $errors = ''; - @reset($GLOBALS['HTTP_POST_VARS']['domains']); - while(list($k,$v) = @each($GLOBALS['HTTP_POST_VARS']['domains'])) + $domains = get_var('domains',Array('POST')); + @reset($domains); + while(list($k,$v) = @each($domains)) { - if(isset($GLOBALS['HTTP_POST_VARS']['deletedomain'][$v])) + $deletedomain = get_var('deletedomain',Array('POST')); + if(isset($deletedomain[$v])) { continue; } - $dom = $GLOBALS['HTTP_POST_VARS']["setting_$v"]; + $dom = get_var('setting_'.$v,Array('POST')); if(!$dom['config_pass']) { $errors .= '
' . lang("You didn't enter a config password for domain x",$v); } } - if(!$GLOBALS['HTTP_POST_VARS']['setting']['HEADER_ADMIN_PASSWORD']) + $setting = get_var('setting',Array('POST')); + if(!$setting['HEADER_ADMIN_PASSWORD']) { $errors .= '
' . lang("You didn't enter a header admin password"); } @@ -114,7 +118,7 @@ break; } - switch(@$GLOBALS['HTTP_POST_VARS']['action']) + switch(@$get_var('action',Array('POST'))) { case 'download': check_form_values(); @@ -284,7 +288,7 @@ unset($default_domain); // we kill this for security reasons $GLOBALS['phpgw_info']['server']['config_passwd'] = $GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']]['config_passwd']; - if(@$GLOBALS['HTTP_POST_VARS']['adddomain']) + if(@$adddomain) { $GLOBALS['phpgw_domain'][lang('new')] = array(); } diff --git a/setup/schematoy.php b/setup/schematoy.php index 5841ab335f..d2f9558969 100644 --- a/setup/schematoy.php +++ b/setup/schematoy.php @@ -99,22 +99,22 @@ //var_dump($GLOBALS['setup_info']);exit; @ksort($GLOBALS['setup_info']); - if ($HTTP_POST_VARS['cancel']) + if (get_var('cancel',Array('POST'))) { Header('Location: index.php'); exit; } - $ConfigDomain = $HTTP_COOKIE_VARS['ConfigDomain'] ? $HTTP_COOKIE_VARS['ConfigDomain'] : $HTTP_POST_VARS['ConfigDomain']; + $ConfigDomain = get_var('ConfigDomain',Array('POST','COOKIE')); $GLOBALS['phpgw_setup']->html->show_header(lang("Developers' Table Schema Toy"),False,'config',$ConfigDomain); - if ($HTTP_POST_VARS['submit']) + if(get_var('submit',Array('POST'))) { $GLOBALS['setup_tpl']->set_var('description',lang('App process') . ':'); $GLOBALS['setup_tpl']->pparse('out','header'); - $appname = $HTTP_POST_VARS['appname']; - $install = $HTTP_POST_VARS['install']; + $appname = get_var('appname',Array('POST')); + $install = get_var('install',Array('POST')); while (list($appname,$key) = @each($install)) { @@ -169,9 +169,9 @@ $GLOBALS['setup_tpl']->pparse('out','footer'); exit; } - if($HTTP_POST_VARS['detail']) + $detail = get_var('detail',Array('POST')); + if($detail) { - $detail = $HTTP_POST_VARS['detail']; @ksort($GLOBALS['setup_info'][$detail]); @reset($GLOBALS['setup_info'][$detail]); $GLOBALS['setup_tpl']->set_var('description',lang('App details') . ':'); diff --git a/setup/setup_demo.php b/setup/setup_demo.php index 60bf92009c..76acc8bd34 100644 --- a/setup/setup_demo.php +++ b/setup/setup_demo.php @@ -23,7 +23,7 @@ // Authorize the user to use setup app and load the database // Does not return unless user is authorized - if(!$GLOBALS['phpgw_setup']->auth('Config') || $HTTP_POST_VARS['cancel']) + if(!$GLOBALS['phpgw_setup']->auth('Config') || get_var('cancel',Array('POST'))) { Header('Location: index.php'); exit; @@ -45,7 +45,7 @@ return $GLOBALS['phpgw']->accounts->name2id($username); } - if(!$HTTP_POST_VARS['submit']) + if(!get_var('submit',Array('POST'))) { $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup'); $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); @@ -82,11 +82,11 @@ else { /* Posted admin data */ - $passwd = $HTTP_POST_VARS['passwd']; - $passwd2 = $HTTP_POST_VARS['passwd2']; - $username = $HTTP_POST_VARS['username']; - $fname = $HTTP_POST_VARS['fname']; - $lname = $HTTP_POST_VARS['lname']; + $passwd = get_var('passwd',Array('POST')); + $passwd2 = get_var('passwd2',Array('POST')); + $username = get_var('username',Array('POST')); + $fname = get_var('fname',Array('POST')); + $lname = get_var('lname',Array('POST')); if($passwd != $passwd2) { @@ -160,7 +160,7 @@ $GLOBALS['phpgw_setup']->db->query("INSERT INTO phpgw_acl(acl_appname,acl_location,acl_account,acl_rights) VALUES('manual','run'," . $defaultgroupid . ", 1)"); /* Creation of the demo accounts is optional - the checkbox is on by default. */ - if($HTTP_POST_VARS['create_demo']) + if(get_var('create_demo',Array('POST'))) { /* Create records for demo accounts */ $accountid = add_account('demo','Demo','Account','guest'); diff --git a/setup/sqltoarray.php b/setup/sqltoarray.php index 4878b00528..f243489c4f 100644 --- a/setup/sqltoarray.php +++ b/setup/sqltoarray.php @@ -31,10 +31,10 @@ $tpl_root = $GLOBALS['phpgw_setup']->html->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']; + $download = get_var('download',Array('GET','POST')); + $submit = get_var('submit',Array('GET','POST')); + $showall = get_var('showall',Array('GET','POST')); + $appname = get_var('appname',Array('GET','POST')); if ($download) { $setup_tpl->set_file(array(