diff --git a/ChangeLog b/ChangeLog index a35f0ed90..436439006 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,12 +5,21 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-05-18 Pete Kelly + * db_readdump.php3 & lib.inc.php3: finally fixed all the special characters + problems (Bug #421889) + +2001-05-18 Loïc Chapeaux + * sql.php3, lines 65: fixed a warning + * tbl_select.php3: fixed a bug if number of registrations to display is not + specified (bug #424278 and patch from Alain Brissaud) + 2001-05-15 Marc Delisle - * support key length in table copy/dump + * support key length in table copy/dump * doc. changes for Loïc 2001-05-15 Armel Fauveau - * Added "Bookmarked SQL-query" combo box when you click on a table (Feature #423065) + * Added "Bookmarked SQL-query" combo box when you click on a table (Feature #423065) 2001-05-11 Loïc Chapeaux * lib.inc.php3, lines 76, 81 and 612: fixed a bug if a field contains html diff --git a/db_readdump.php3 b/db_readdump.php3 index 20ef36d01..f9fa616de 100755 --- a/db_readdump.php3 +++ b/db_readdump.php3 @@ -3,67 +3,77 @@ @set_time_limit(10000); - require("grab_globals.inc.php3"); - -include("lib.inc.php3"); +require("lib.inc.php3"); + + +// set up default values +$view_bookmark = 0; +$sql_bookmark = isset($sql_bookmark) ? $sql_bookmark : ""; +$sql_query = isset($sql_query) ? $sql_query : ""; +$sql_file = isset($sql_file) ? $sql_file : "none"; + // Bookmark Support - -// Bookmark Support - if(!empty($id_bookmark)) { - switch($action_bookmark) { - case 0: - $sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark); - break; - case 1: - $sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark); - break; - case 2: - $sql_query = delete_bookmarks($db, $cfgBookmark, $id_bookmark); - break; - } -} - -// - -if(!empty($sql_file) && $sql_file != "none" && ereg("^php[0-9A-Za-z_.-]+$", basename($sql_file))) { - $sql_query = fread(fopen($sql_file, "r"), filesize($sql_file)); -} -else if (get_magic_quotes_gpc()) { - $sql_query = stripslashes($sql_query); -} - -$pieces = split_string($sql_query, ";"); - -if (count($pieces) == 1 && !empty($pieces[0]) && $action_bookmark==0) { - $sql_query = addslashes(trim($pieces[0])); - // Enforce reloading of the left frame when a table has to be created - if (eregi('^CREATE TABLE (.+)', $sql_query)) { - $reload = "true"; + switch($action_bookmark) { + case 0: + $sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark); + break; + + case 1: + $sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark); + $view_bookmark = 1; + break; + + case 2: + $sql_query = delete_bookmarks($db, $cfgBookmark, $id_bookmark); + break; } - include ("sql.php3"); - exit; } -include("header.inc.php3"); -for ($i=0; $i +?> \ No newline at end of file diff --git a/lib.inc.php3 b/lib.inc.php3 index 902167c30..48272278e 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -628,54 +628,37 @@ function show_message($message) { $strError

"; + echo "$strSQLQuery:

".htmlspecialchars($sql)."

"; + if(empty($error)) + echo "$strMySQLSaid ".mysql_error(); + else + echo "$strMySQLSaid ".htmlspecialchars($error); + echo "\n
$strBack"; + + include("footer.inc.php3"); + exit; +} + +// Split up large sql files into individual queries +// Version 2 18th May 2001 - Last Modified By Pete Kelly +function split_sql_file($sql, $delimiter) { $sql = trim($sql); $char = ""; $last_char = ""; $ret = array(); - $in_string = false; + $in_string = true; - $i = 0; - $in_string = FALSE; - $escaped = FALSE; - while($i < strlen($sql)) - { - if($sql[$i] == "#" and ($sql[$i-1] == "\n" or $i==0) and !$in_string) - { - $j=1; - while($sql[$i+$j] != "\n") - $j++; - $sql = substr($sql,0,$i) . substr($sql,$i+$j); - } - else - { - if($escaped) - $escaped = FALSE; - else - { - if($sql[$i] == "\\") - { - $escaped = TRUE; - } - else - { - if($sql[$i] == "'" or $sql[$i] == "\"") - { - if($in_string == $sql[$i]) - $in_string = FALSE; - else - $in_string = $sql[$i]; - } - } - } - } - $i++; - } - // $sql = ereg_replace("#[^\n]*\n", "", $sql); !! NOT !! - - - for($i=0; $i