From 90b75b3c01d14907b1621ae258e1e2cd4decbc50 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Fri, 30 Aug 2002 12:02:03 +0000 Subject: [PATCH] =?UTF-8?q?For=20Lo=EF=BF=BDc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 7 +++++++ libraries/display_tbl.lib.php3 | 26 +++++++++++++------------- libraries/sqlvalidator.lib.php3 | 2 +- tbl_relation.php3 | 5 +++-- user_details.php3 | 9 ++++++--- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index c058206be..99b5b3df2 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-08-30 Loïc Chapeaux + * tbl_relation.php3, line 324; user_details.php3; lines 262-269: + fixed some warnings. + * libraries/display_tbl.lib.php3: fixed first part of bug + #601776 (Undefined variables). + * libraries/sqlvalidator.lib.php3: removed trailing spaces. + 2002-08-29 Robin Johnson * libraries/sqlvalidator.lib.php3: - Fix for bug in Alex's fix for bug #594947 diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index 602135d41..f027b8c09 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -555,12 +555,12 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ if ($is_display['sort_lnk'] == '1') { // Defines the url used to append/modify a sorting order // 2.1.1 Checks if an hard coded 'order by' clause exists - if (eregi('(.*)( ORDER BY (.*))', $sql_query, $regs1)) { - if (eregi('((.*)( ASC| DESC)( |$))(.*)', $regs1[2], $regs2)) { + if (eregi('(.*)([[:space:]]ORDER BY[[:space:]](.*))', $sql_query, $regs1)) { + if (eregi('((.*)([[:space:]]ASC|[[:space:]]DESC)([[:space:]]|$))(.*)', $regs1[2], $regs2)) { $unsorted_sql_query = trim($regs1[1] . ' ' . $regs2[5]); $sql_order = trim($regs2[1]); } - else if (eregi('((.*)) (LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE)', $regs1[2], $regs3)) { + else if (eregi('((.*))[[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE)', $regs1[2], $regs3)) { $unsorted_sql_query = trim($regs1[1] . ' ' . $regs3[3]); $sql_order = trim($regs3[1]) . ' ASC'; } else { @@ -575,7 +575,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ if (empty($sql_order)) { $is_in_sort = FALSE; } else { - $is_in_sort = eregi(' (`?)' . str_replace('\\', '\\\\', $fields_meta[$i]->name) . '(`?)[ ,$]', $sql_order); + $is_in_sort = eregi('[[:space:]](`?)' . str_replace('\\', '\\\\', $fields_meta[$i]->name) . '(`?)[ ,$]', $sql_order); } // 2.1.3 Checks if the table name is required (it's the case // for a query with a "JOIN" statement and if the column @@ -596,15 +596,15 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ' . $cfg['Order']; $order_img = ''; } - else if (substr($sql_order, -3) == 'ASC' && $is_in_sort) { + else if (eregi('[[:space:]]ASC$', $sql_order)) { $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' DESC'; $order_img = ' '. $GLOBALS['strAscending'] . ''; } - else if (substr($sql_order, -4) == 'DESC' && $is_in_sort) { + else if (eregi('[[:space:]]DESC$', $sql_order)) { $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ASC'; $order_img = ' '. $GLOBALS['strDescending'] . ''; } - if (eregi('(.*)( LIMIT (.*)| PROCEDURE (.*)| FOR UPDATE| LOCK IN SHARE MODE)', $unsorted_sql_query, $regs3)) { + if (eregi('(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))', $unsorted_sql_query, $regs3)) { $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2]; } else { $sorted_sql_query = $unsorted_sql_query . $sort_order; @@ -833,15 +833,15 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ // to fix the bug where float fields (primary or not) // can't be matched because of the imprecision of - // floating comparison, use CONCAT + // floating comparison, use CONCAT // (also, the syntax "CONCAT(field) IS NULL" // that we need on the next "if" will work) - if ($meta->type=='real') { - $condition = ' CONCAT(' . PMA_backquote($meta->name) . ') '; + if ($meta->type == 'real') { + $condition = ' CONCAT(' . PMA_backquote($meta->name) . ') '; } else { $condition = ' ' . PMA_backquote($meta->name) . ' '; - } // end if + } // end if... else... // loic1: To fix bug #474943 under php4, the row // pointer will depend on whether the "is_null" @@ -871,7 +871,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ } else { $uva_condition = $uva_nonprimary_condition; } - $uva_condition = urlencode(ereg_replace(' ?AND$', '', $uva_condition)); + $uva_condition = urlencode(ereg_replace('[[:space:]]?AND$', '', $uva_condition)); } // end if (1.1) // 1.2 Defines the urls for the modify/delete link(s) @@ -917,7 +917,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ . '&goto=' . urlencode($lnk_goto); $js_conf = 'DELETE FROM ' . PMA_jsFormat($table) . ' WHERE ' . trim(PMA_jsFormat(urldecode($uva_condition), FALSE)) - . ((PMA_MYSQL_INT_VERSION >= 32207) ? ' LIMIT 1' : ''); + . ((PMA_MYSQL_INT_VERSION >= 32207) ? ' LIMIT 1' : ''); $del_str = $GLOBALS['strDelete']; } else if ($is_display['del_lnk'] == 'kp') { // kill process case $lnk_goto = 'sql.php3' diff --git a/libraries/sqlvalidator.lib.php3 b/libraries/sqlvalidator.lib.php3 index eff81d3d6..2f75df41f 100644 --- a/libraries/sqlvalidator.lib.php3 +++ b/libraries/sqlvalidator.lib.php3 @@ -93,7 +93,7 @@ if (!defined('PMA_SQL_VALIDATOR_INCLUDED')) { } } // end if - + /* else { // The service is not available so note that properly diff --git a/tbl_relation.php3 b/tbl_relation.php3 index 32b288bb3..e735fb666 100644 --- a/tbl_relation.php3 +++ b/tbl_relation.php3 @@ -288,7 +288,8 @@ if ($col_rs && mysql_num_rows($col_rs) > 0) {