From 04342d35edbe366829f6e8b7a1c7523df36e9509 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Tue, 18 Dec 2001 02:20:31 +0000 Subject: [PATCH] Cleanup includes; move auth() call to top after main include (functions.inc.php); --- setup/applications.php | 23 ++++++++--------------- setup/applist.php | 8 ++++++++ setup/config.php | 20 ++++++++++---------- setup/lang.php | 1 - setup/ldap.php | 2 -- setup/ldapexport.php | 3 +-- setup/ldapimport.php | 3 +-- setup/ldapmodify.php | 3 +-- setup/schematoy.php | 23 ++++++++--------------- setup/setup_demo.php | 1 - setup/sqltoarray.php | 23 ++++++++--------------- 11 files changed, 45 insertions(+), 65 deletions(-) diff --git a/setup/applications.php b/setup/applications.php index 6b53a364cc..3d762d3483 100644 --- a/setup/applications.php +++ b/setup/applications.php @@ -25,6 +25,14 @@ ); include ('./inc/functions.inc.php'); + // Check header and authentication + if (!$phpgw_setup->auth('Config')) + { + Header('Location: index.php'); + exit; + } + // Does not return unless user is authorized + $ConfigDomain = $HTTP_COOKIE_VARS['ConfigDomain'] ? $HTTP_COOKIE_VARS['ConfigDomain'] : $HTTP_POST_VARS['ConfigDomain']; $tpl_root = $phpgw_setup->setup_tpl_dir('setup'); @@ -51,21 +59,6 @@ $setup_tpl->set_block('T_setup_main','submit','submit'); $setup_tpl->set_block('T_setup_main','footer','footer'); - // Check header and authentication - $GLOBALS['phpgw_info']['setup']['stage']['header'] = $phpgw_setup->check_header(); - if ($GLOBALS['phpgw_info']['setup']['stage']['header'] != '10') - { - Header("Location: manageheader.php"); - exit; - } - elseif (!$phpgw_setup->auth('Config')) - { - $phpgw_setup->show_header(lang('Please login'),True); - $phpgw_setup->login_form(); - $phpgw_setup->show_footer(); - exit; - } - $bgcolor = array('#DDDDDD','#EEEEEE'); function parsedep($depends,$main=True) diff --git a/setup/applist.php b/setup/applist.php index 46f8c5a777..9b0b2d0026 100644 --- a/setup/applist.php +++ b/setup/applist.php @@ -20,6 +20,14 @@ include('./inc/functions.inc.php'); include('./inc/xml_functions.inc.php'); + // Check header and authentication + if (!$phpgw_setup->auth('Config')) + { + Header('Location: index.php'); + exit; + } + // Does not return unless user is authorized + $tpl_root = $phpgw_setup->setup_tpl_dir('setup'); $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); $setup_tpl->set_file(array( diff --git a/setup/config.php b/setup/config.php index da16954f54..e484310fad 100644 --- a/setup/config.php +++ b/setup/config.php @@ -18,7 +18,16 @@ 'noapi' => True ); include('./inc/functions.inc.php'); - include('../header.inc.php'); + + /* + Authorize the user to use setup app and load the database + Does not return unless user is authorized + */ + if (!$phpgw_setup->auth('Config')) + { + Header('Location: index.php'); + exit; + } $tpl_root = $phpgw_setup->setup_tpl_dir('setup'); $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); @@ -33,15 +42,6 @@ /* Following to ensure windows file paths are saved correctly */ set_magic_quotes_runtime(0); - /* - Authorize the user to use setup app and load the database - Does not return unless user is authorized - */ - if (!$phpgw_setup->auth('Config')) - { - Header('Location: index.php'); - exit; - } $phpgw_setup->loaddb(); /* Guessing default values. */ diff --git a/setup/lang.php b/setup/lang.php index ff1de9b9e5..a6201f1ff9 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -20,7 +20,6 @@ 'noapi' => True ); include('./inc/functions.inc.php'); - include('../header.inc.php'); // Authorize the user to use setup app and load the database // Does not return unless user is authorized if (!$phpgw_setup->auth('Config')) diff --git a/setup/ldap.php b/setup/ldap.php index fd8da01640..87c553c116 100644 --- a/setup/ldap.php +++ b/setup/ldap.php @@ -17,8 +17,6 @@ 'currentapp' => 'home', 'noapi' => True ); - - include('../header.inc.php'); include('./inc/functions.inc.php'); // Authorize the user to use setup app and load the database diff --git a/setup/ldapexport.php b/setup/ldapexport.php index 2ae05147fa..ed4e12e4f4 100644 --- a/setup/ldapexport.php +++ b/setup/ldapexport.php @@ -17,8 +17,6 @@ 'currentapp' => 'home', 'noapi' => True ); - - include('../header.inc.php'); include('./inc/functions.inc.php'); // Authorize the user to use setup app and load the database @@ -28,6 +26,7 @@ exit; } // Does not return unless user is authorized + class phpgw { var $common; diff --git a/setup/ldapimport.php b/setup/ldapimport.php index 9fd4378378..a84c9a5984 100644 --- a/setup/ldapimport.php +++ b/setup/ldapimport.php @@ -17,8 +17,6 @@ 'currentapp' => 'home', 'noapi' => True ); - - include('../header.inc.php'); include('./inc/functions.inc.php'); // Authorize the user to use setup app and load the database @@ -28,6 +26,7 @@ exit; } // Does not return unless user is authorized + class phpgw { var $common; diff --git a/setup/ldapmodify.php b/setup/ldapmodify.php index 6c267dd81e..c08b588f2d 100644 --- a/setup/ldapmodify.php +++ b/setup/ldapmodify.php @@ -17,8 +17,6 @@ 'currentapp' => 'home', 'noapi' => True ); - - include('../header.inc.php'); include('./inc/functions.inc.php'); /* Authorize the user to use setup app and load the database */ @@ -28,6 +26,7 @@ exit; } /* Does not return unless user is authorized */ + class phpgw { var $common; diff --git a/setup/schematoy.php b/setup/schematoy.php index 482b7353c4..431e96200e 100644 --- a/setup/schematoy.php +++ b/setup/schematoy.php @@ -20,6 +20,14 @@ ); include ('./inc/functions.inc.php'); + // Check header and authentication + if (!$phpgw_setup->auth('Config')) + { + Header('Location: index.php'); + exit; + } + // Does not return unless user is authorized + $tpl_root = $GLOBALS['phpgw_setup']->setup_tpl_dir('setup'); $GLOBALS['setup_tpl'] = CreateObject('phpgwapi.Template',$tpl_root); $GLOBALS['setup_tpl']->set_file(array( @@ -44,21 +52,6 @@ $GLOBALS['setup_tpl']->set_block('T_setup_main','submit','submit'); $GLOBALS['setup_tpl']->set_block('T_setup_main','footer','footer'); - // Check header and authentication - $GLOBALS['phpgw_info']['setup']['stage']['header'] = $GLOBALS['phpgw_setup']->check_header(); - if ($GLOBALS['phpgw_info']['setup']['stage']['header'] != '10') - { - Header("Location: manageheader.php"); - exit; - } - elseif (!$GLOBALS['phpgw_setup']->auth('Config')) - { - $GLOBALS['phpgw_setup']->show_header(lang('Please login'),True); - $GLOBALS['phpgw_setup']->login_form(); - $GLOBALS['phpgw_setup']->show_footer(); - exit; - } - $bgcolor = array('DDDDDD','EEEEEE'); function parsedep($depends,$main=True) diff --git a/setup/setup_demo.php b/setup/setup_demo.php index 9649986c05..bad80d380e 100644 --- a/setup/setup_demo.php +++ b/setup/setup_demo.php @@ -20,7 +20,6 @@ 'noapi' => True ); include('./inc/functions.inc.php'); - include('../header.inc.php'); // Authorize the user to use setup app and load the database // Does not return unless user is authorized diff --git a/setup/sqltoarray.php b/setup/sqltoarray.php index 10a8a40771..98f5467daa 100644 --- a/setup/sqltoarray.php +++ b/setup/sqltoarray.php @@ -19,6 +19,14 @@ ); include ('./inc/functions.inc.php'); + // Check header and authentication + if (!$phpgw_setup->auth('Config')) + { + Header('Location: index.php'); + exit; + } + // Does not return unless user is authorized + $tpl_root = $phpgw_setup->setup_tpl_dir('setup'); $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); @@ -61,21 +69,6 @@ $setup_tpl->set_block('sqlarr','sqlfooter','sqlfooter'); } - // Check header and authentication - $GLOBALS['phpgw_info']['setup']['stage']['header'] = $phpgw_setup->check_header(); - if ($GLOBALS['phpgw_info']['setup']['stage']['header'] != '10') - { - Header("Location: manageheader.php"); - exit; - } - elseif (!$phpgw_setup->auth('Config')) - { - $phpgw_setup->show_header(lang('Please login'),True); - $phpgw_setup->login_form(); - $phpgw_setup->show_footer(); - exit; - } - $phpgw_setup->loaddb(); function parse_vars($table,$term)