From 87764fc85951851628ddfd8a8f5fff90ca274696 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Tue, 27 Sep 2005 16:26:18 +0000 Subject: [PATCH] introducing sessions --- ChangeLog | 3 ++ libraries/auth/cookie.auth.lib.php | 3 +- libraries/common.lib.php | 31 +++++++++++++---- libraries/grab_globals.lib.php | 2 ++ libraries/session.inc.php | 54 ++++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 libraries/session.inc.php diff --git a/ChangeLog b/ChangeLog index dd92e49d8..68802427d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,9 @@ $Source$ * libraries/sql_query_form.lib.php: completed function docblocks * css/phpmyadmin.css.php: partially fixed bug: odd display of navtabs in Gecko-Browsers + * libraries/session.inc.php, libraries/grab_globals.lib.php, + libraries/common.lib.php, libraries/auth/cookie.auth.lib.php: + introducing sessions 2005-09-27 Michal Čihař * lang/czech: Update. diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index bf8c506af..8047faff7 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -598,7 +598,8 @@ function PMA_auth_set_user() header('Refresh: 0; url=' . $cfg['PmaAbsoluteUri'] . 'index.php?' . PMA_generate_common_url('', '', '&')); } else { - header('Location: ' . $cfg['PmaAbsoluteUri'] . 'index.php?' . PMA_generate_common_url('', '', '&')); + header( 'Location: ' . $cfg['PmaAbsoluteUri'] . 'index.php?' + . PMA_generate_common_url('', '', '&') . '&' . SID ); } exit(); } // end if diff --git a/libraries/common.lib.php b/libraries/common.lib.php index fb915f831..70b5f4d6a 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -107,7 +107,10 @@ if (file_exists('./config.inc.php')) { . '&char=' . urlencode( $charset ) . '&dir=' . urlencode( $text_dir ) . '&type=' . urlencode( $strError ) - . '&error=' . urlencode( strtr($strConfigFileError, array('
' => '[br]')) . '[br][br]' . '[a@./config.inc.php@_blank]config.inc.php[/a]' ) + . '&error=' . urlencode( + strtr( $strConfigFileError, array( '
' => '[br]' ) ) + . '[br][br]' . '[a@./config.inc.php@_blank]config.inc.php[/a]' ) + . '&' . SID ); exit(); } @@ -129,7 +132,10 @@ if (!function_exists('preg_replace')) { . '&char=' . urlencode( $charset ) . '&dir=' . urlencode( $text_dir ) . '&type=' . urlencode( $strError ) - . '&error=' . urlencode( strtr(sprintf($strCantLoad, 'pcre'), array('
' => '[br]'))) + . '&error=' . urlencode( + strtr( sprintf( $strCantLoad, 'pcre' ), + array('
' => '[br]') ) ) + . '&' . SID ); exit(); } @@ -1166,7 +1172,10 @@ if ($is_minimum_common == FALSE) { . '&char=' . urlencode( $charset ) . '&dir=' . urlencode( $text_dir ) . '&type=' . urlencode( $strError ) - . '&error=' . urlencode( strtr($strPmaUriError, array('' => '[tt]', '' => '[/tt]'))) + . '&error=' . urlencode( + strtr( $strPmaUriError, + array( '' => '[tt]', '' => '[/tt]' ) ) ) + . '&' . SID ); exit(); } @@ -1241,7 +1250,14 @@ if ($is_minimum_common == FALSE) { // if ($cfg['ForceSLL'] && !$is_https) { - header('Location: ' . preg_replace('/^http/', 'https', $cfg['PmaAbsoluteUri']) . (isset($_SERVER['REQUEST_URI']) ? preg_replace('@' . $pma_uri_parts['path'] . '@', '', $_SERVER['REQUEST_URI']) : '' )); + header( + 'Location: ' . preg_replace( + '/^http/', 'https', $cfg['PmaAbsoluteUri'] ) + . ( isset( $_SERVER['REQUEST_URI'] ) + ? preg_replace( '@' . $pma_uri_parts['path'] . '@', + '', $_SERVER['REQUEST_URI'] ) + : '' ) + . '&' . SID ); exit; } @@ -1308,7 +1324,10 @@ if ($is_minimum_common == FALSE) { . '&char=' . urlencode( $charset ) . '&dir=' . urlencode( $text_dir ) . '&type=' . urlencode( $strError ) - . '&error=' . urlencode( $strInvalidAuthMethod . ' ' . $cfg['Server']['auth_type'] ) + . '&error=' . urlencode( + $strInvalidAuthMethod . ' ' + . $cfg['Server']['auth_type'] ) + . '&' . SID ); exit(); } @@ -1508,7 +1527,7 @@ if ($is_minimum_common == FALSE) { echo '' . "\n"; } else { - header('Location: ' . $uri); + header( 'Location: ' . $uri . '&' . SID ); } } diff --git a/libraries/grab_globals.lib.php b/libraries/grab_globals.lib.php index ff666b2cd..774ebd88a 100644 --- a/libraries/grab_globals.lib.php +++ b/libraries/grab_globals.lib.php @@ -12,6 +12,8 @@ * loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+ */ +require_once './libraries/session.inc.php'; + function PMA_gpc_extract($array, &$target, $sanitize = TRUE) { if (!is_array($array)) { return FALSE; diff --git a/libraries/session.inc.php b/libraries/session.inc.php new file mode 100644 index 000000000..2ad8cbeb7 --- /dev/null +++ b/libraries/session.inc.php @@ -0,0 +1,54 @@ + \ No newline at end of file