diff --git a/ChangeLog b/ChangeLog index dd0cb5c42..11d13f25a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ $Source$ libraries\transformations.lib.php, libraries\transformations\text_plain__external.inc.php: fixed bug #1409972 PHP 5.1.2 compatibility + * libraries\url_generating.lib.php: + fixed bug: undefined index server ($GLOBALS['server']) 2006-01-18 Michal Čihař * Documentation.html: Add info about Apache CGI and http auth (patch diff --git a/libraries/url_generating.lib.php b/libraries/url_generating.lib.php index 46a8af7e8..7a03da405 100644 --- a/libraries/url_generating.lib.php +++ b/libraries/url_generating.lib.php @@ -29,58 +29,58 @@ * * @author nijel */ -function PMA_generate_common_hidden_inputs( $db = '', $table = '', $indent = 0, $skip = array() ) +function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $skip = array()) { - if ( is_array( $db ) ) { + if (is_array($db)) { $params =& $db; - $_indent = empty( $table ) ? $indent : $table; - $_skip = empty( $indent ) ? $skip : $indent; + $_indent = empty($table) ? $indent : $table; + $_skip = empty($indent) ? $skip : $indent; $indent =& $_indent; $skip =& $_skip; } else { $params = array(); - if ( isset($db) && strlen($db) ) { + if (isset($db) && strlen($db)) { $params['db'] = $db; } - if ( isset($table) && strlen($table) ) { + if (isset($table) && strlen($table)) { $params['table'] = $table; } } - if ( ! empty( $GLOBALS['server'] ) - && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault'] ) { + if (! empty($GLOBALS['server']) + && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']) { $params['server'] = $GLOBALS['server']; } - if ( empty( $_COOKIE['pma_lang'] ) - && ! empty( $GLOBALS['lang'] ) ) { + if (empty($_COOKIE['pma_lang']) + && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } - if ( empty( $_COOKIE['pma_charset'] ) - && ! empty( $GLOBALS['convcharset'] ) ) { + if (empty($_COOKIE['pma_charset']) + && ! empty($GLOBALS['convcharset'])) { $params['convcharset'] = $GLOBALS['convcharset']; } - if ( empty( $_COOKIE['pma_collation_connection'] ) - && ! empty( $GLOBALS['collation_connection'] ) ) { + if (empty($_COOKIE['pma_collation_connection']) + && ! empty($GLOBALS['collation_connection'])) { $params['collation_connection'] = $GLOBALS['collation_connection']; } - if ( ! is_array($skip) ) { - if ( isset( $params[$skip] ) ) { - unset( $params[$skip] ); + if (! is_array($skip)) { + if (isset($params[$skip])) { + unset($params[$skip]); } } else { - foreach ( $skip as $skipping ) { - if ( isset( $params[$skipping] ) ) { - unset( $params[$skipping] ); + foreach ($skip as $skipping) { + if (isset($params[$skipping])) { + unset($params[$skipping]); } } } - $spaces = str_repeat( ' ', $indent ); + $spaces = str_repeat(' ', $indent); $return = ''; - foreach ( $params as $key => $val ) { - $return .= $spaces . '' . "\n"; + foreach ($params as $key => $val) { + $return .= $spaces . '' . "\n"; } return $return; @@ -91,7 +91,7 @@ function PMA_generate_common_hidden_inputs( $db = '', $table = '', $indent = 0, * * * // note the ? - * echo 'script.php?' . PMA_generate_common_url( 'mysql', 'rights' ); + * echo 'script.php?' . PMA_generate_common_url('mysql', 'rights'); * // produces with cookies enabled: * // script.php?db=mysql&table=rights * // with cookies disabled: @@ -101,7 +101,7 @@ function PMA_generate_common_hidden_inputs( $db = '', $table = '', $indent = 0, * $params['db'] = 'mysql'; * $params['table'] = 'rights'; * // note the missing ? - * echo 'script.php' . PMA_generate_common_url( $params ); + * echo 'script.php' . PMA_generate_common_url($params); * // produces with cookies enabled: * // script.php?myparam=myvalue&db=mysql&table=rights * // with cookies disabled: @@ -136,16 +136,16 @@ function PMA_generate_common_hidden_inputs( $db = '', $table = '', $indent = 0, */ function PMA_generate_common_url ($db = '', $table = '', $delim = '&') { - if ( is_array( $db ) ) { + if (is_array($db)) { $params =& $db; - $delim = empty( $table ) ? $delim : $table; + $delim = empty($table) ? $delim : $table; $questionmark = '?'; } else { $params = array(); - if ( isset($db) && strlen($db) ) { + if (isset($db) && strlen($db)) { $params['db'] = $db; } - if ( isset($table) && strlen($table) ) { + if (isset($table) && strlen($table)) { $params['table'] = $table; } $questionmark = ''; @@ -153,50 +153,50 @@ function PMA_generate_common_url ($db = '', $table = '', $delim = '&') // use seperators defined by php, but prefer ';' // as recommended by W3C - $php_arg_separator_input = ini_get( 'arg_separator.input' ); - if ( strpos( $php_arg_separator_input, ';' ) !== false ) { + $php_arg_separator_input = ini_get('arg_separator.input'); + if (strpos($php_arg_separator_input, ';') !== false) { $separator = ';'; - } elseif ( strlen( $php_arg_separator_input ) > 0 ) { + } elseif (strlen($php_arg_separator_input) > 0) { $separator = $php_arg_separator_input{0}; } else { $separator = '&'; } // check wether to htmlentity the separator or not - if ( $delim === '&' ) { - $delim = htmlentities( $separator ); + if ($delim === '&') { + $delim = htmlentities($separator); } else { $delim = $separator; } - if ( $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault'] - && ! empty( $GLOBALS['server'] ) ) { + if (isset($GLOBALS['server']) + && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']) { $params['server'] = $GLOBALS['server']; } - if ( empty( $_COOKIE['pma_lang'] ) - && ! empty( $GLOBALS['lang'] ) ) { + if (empty($_COOKIE['pma_lang']) + && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } - if ( empty( $_COOKIE['pma_charset'] ) - && ! empty( $GLOBALS['convcharset'] ) ) { + if (empty($_COOKIE['pma_charset']) + && ! empty($GLOBALS['convcharset'])) { $params['convcharset'] = $GLOBALS['convcharset']; } - if ( empty( $_COOKIE['pma_collation_connection'] ) - && ! empty( $GLOBALS['collation_connection'] ) ) { + if (empty($_COOKIE['pma_collation_connection']) + && ! empty($GLOBALS['collation_connection'])) { $params['collation_connection'] = $GLOBALS['collation_connection']; } $param_strings = array(); - foreach ( $params as $key => $val ) { - $param_strings[] = urlencode( $key ) . '=' . urlencode( $val ); + foreach ($params as $key => $val) { + $param_strings[] = urlencode($key) . '=' . urlencode($val); } - if ( empty( $param_strings ) ) { + if (empty($param_strings)) { return ''; } - return $questionmark . implode( $delim, $param_strings ); + return $questionmark . implode($delim, $param_strings); } ?>