From 0ab0ad63b11fb9d5aa245e9814b3e673947a3e77 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 30 Jul 2001 21:21:19 +0000 Subject: [PATCH] merge Loic's version --- ChangeLog | 81 +- Documentation.html | 6 + README | 4 +- config.inc.php3 | 267 ++-- db_create.php3 | 22 +- db_details.php3 | 213 ++-- db_printview.php3 | 88 +- db_readdump.php3 | 152 ++- defines.inc.php3 | 91 +- footer.inc.php3 | 23 +- functions.js | 13 +- grab_globals.inc.php3 | 40 +- header.inc.php3 | 24 +- index.php3 | 42 +- ldi_check.php3 | 136 +- ldi_table.php3 | 140 ++- left.js | 1 + left.php3 | 14 +- lib.inc.php3 | 2644 +++++++++++++++++++++++---------------- main.php3 | 111 +- ob_lib.inc.php3 | 7 +- select_lang.inc.php3 | 58 +- sql.php3 | 366 +++--- tbl_addfield.php3 | 227 ++-- tbl_alter.php3 | 94 +- tbl_change.php3 | 447 ++++--- tbl_copy.php3 | 116 +- tbl_create.php3 | 212 ++-- tbl_dump.php3 | 369 +++--- tbl_printview.php3 | 242 ++-- tbl_properties.inc.php3 | 449 ++++--- tbl_properties.php3 | 251 ++-- tbl_qbe.php3 | 1204 +++++++++++------- tbl_rename.php3 | 46 +- tbl_replace.php3 | 259 ++-- tbl_select.php3 | 278 ++-- user_details.php3 | 26 +- 37 files changed, 5108 insertions(+), 3655 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8aaa50db2..edb52aad3 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,47 +5,74 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-07-28 Marc Delisle + * lib.inc.php3: establish constraints for the code, to get + PHP3 compatibility + * tbl_qbe.php3: add checks for unset variables + +2001-07-27 Marc Delisle + * tbl_select.php3 and dynamic field size + +2001-07-25 Marc Delisle + * Backport fixes from cvs made after the fork, to Loïc's version + 2001-07-24 Marc Delisle - * updates to french - * new slovak translation thanks to lubos klokner - * main.php3: bug 443710 Create New Database option: was working + * updates to french + * select_lang.inc.php3, lang/: new slovak translation + thanks to lubos klokner + * main.php3: bug 443710 Create New Database option: was working only if stduser has Global privileges on all databases. - * footer.inc.php3: if new cfgOBGzip is not defined + * footer.inc.php3: if new cfgOBGzip is not defined 2001-07-24 Steve ALberty - * tbl_copy.php3: fix parameter count, thanks Marc - * Documentation.html: order $cfg sequence and add description - of cfgSkipLockedTables and cfgLeftWidth + * tbl_copy.php3: fix parameter count, thanks Marc + * Documentation.html: order $cfg sequence and add description + of cfgSkipLockedTables and cfgLeftWidth 2001-07-24 Geert Lund - * danish language file code cleanup (only changed order of stings) - * added $strQBEDel and $strQBEIns strings to all language files - * tbl_qbe.php3: added language support (stripped all static text) (Feat.req.: #443959) - * upated slovak-iso.inc.php3 to include english strings to be translated for the tbl_qbe.php3 + * danish language file code cleanup (only changed order of strings) + * added $strQBEDel and $strQBEIns strings to all language files + * tbl_qbe.php3: added language support (stripped all static text) (Feat. +req.: #443959) + * updated slovak-iso.inc.php3 to include english strings to be translated + for the tbl_qbe.php3 2001-07-23 Marc Delisle - * updates to italian thanks to Alessandro Astarita - * updates to catala thanks to Jordi Bruguera - * updates to spanish thanks to Gabriel Ginard - * updates to czech-iso and czech-win1250,thanks to Michal Cihar (nijel) - * config.inc.php3, Documentation.html, footer.inc.php3, - header.inc.php3, ob_lib.inc.php3: + * updates to italian thanks to Alessandro Astarita + * updates to catala thanks to Jordi Bruguera + * updates to spanish thanks to Gabriel Ginard + * updates to czech-iso and czech-win1250,thanks to Michal Cihar (nijel) + * config.inc.php3, Documentation.html, footer.inc.php3, + header.inc.php3 bug 443318 Undefined variable: ob_mode - fix thanks to Jeremy Brand - + fix thanks to Jeremy Brand + 2001-07-23 Steve Alberty - * tbl_properties.php3: correct small display bugs - * sql.php3: complement list of 'show' options to - suppress 'insert new row' + * tbl_properties.php3: correct small display bugs + * sql.php3: complement list of 'show' options to + suppress 'insert new row' 2001-07-22 Olivier Müller - * releasing 2.2.0rc3 + * releasing 2.2.0rc3 2001-07-21 Steve Alberty - * config.inc.php3,index.php3: add $cfgLeftWidth to configure - individual left frame width - * db_details.php3,tbl_properties.php3: fix incorrect size - calculation with merge tables BUG: #442948 + * config.inc.php3,index.php3: add $cfgLeftWidth to configure + individual left frame width + * db_details.php3,tbl_properties.php3: fix incorrect size + calculation with merge tables BUG: #442948 + +2001-07-21 Loïc Chapeaux + Started a new dev. version (or the next RC?): + * added the ability to use special characters in databases, tables and + fields' names with the help of backquotes. + * added a checkbox to let the user choose whether he wants backotes or + not in the dumps he requires. + * navigation bar only shows what can be done. + * fixed bug #439565 (Bug with &# characters type), at least I + hope so. + * except 'users_details.php3' I've got to work on, all the scripts + validates CSS2 now and, as far as possible, XHTML1.0. + They have been rewriiten according to the PEAR standards. 2001-07-21 Loïc Chapeaux * ob.lib.inc.php3, lines 50-54 & 73-76: fixed a bug with php3. diff --git a/Documentation.html b/Documentation.html index 79b404246..c0df9c833 100755 --- a/Documentation.html +++ b/Documentation.html @@ -582,6 +582,12 @@

FAQ - Frequently Asked Questions

+

+ The error message "Warning: Cannot add header information - headers already sent by ..." is displayed, what's the problem? +
+ Look at the end of your config.inc.php or .php3 file, there must be no + blank lines or spaces after the ?>. +

I can't insert new rows into a table - MySQL brings up a SQL-error. diff --git a/README b/README index ce3780716..3d3cae2a4 100755 --- a/README +++ b/README @@ -5,8 +5,8 @@ phpMyAdmin - Readme A set of PHP-scripts to adminstrate MySQL over the WWW. - Version 2.2.0rc3 - 22/07/2001 - ----------------------------- + Version 2.2.0 - xx/07/2001 + -------------------------- http://phpwizard.net/projects/phpMyAdmin/ http://phpmyadmin.sourceforge.net/ diff --git a/config.inc.php3 b/config.inc.php3 index cea666f35..0abcbcfcb 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -1,11 +1,13 @@ diff --git a/db_create.php3 b/db_create.php3 index a267d9fa6..936dc6563 100755 --- a/db_create.php3 +++ b/db_create.php3 @@ -2,13 +2,23 @@ /* $Id$ */ -require("./grab_globals.inc.php3"); - -require("./header.inc.php3"); +/** + * Gets some core libraries + */ +require('./grab_globals.inc.php3'); +require('./header.inc.php3'); -$result = mysql_query("CREATE DATABASE " . db_name($db)) or mysql_die(); -$message = "$strDatabase " . db_name($db) . " $strHasBeenCreated"; -require("./db_details.php3"); +/** + * Executes the db creation sql query + */ +$result = mysql_query('CREATE DATABASE ' . backquote($db)) or mysql_die(); + + +/** + * Displays the result and moves back to the calling page + */ +$message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated; +require('./db_details.php3'); ?> diff --git a/db_details.php3 b/db_details.php3 index 6045ea63a..9bcfdda78 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -1,8 +1,9 @@ 0 && MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 3) { // Special speedup for newer MySQL Versions (in 4.0 format changed) - if ($cfgSkipLockedTables == true && MYSQL_MAJOR_VERSION == 3.23 && intval(MYSQL_MINOR_VERSION) >= 30) { - $query = 'SHOW OPEN TABLES FROM ' . db_name($db); + if ($cfgSkipLockedTables == TRUE && MYSQL_MAJOR_VERSION == 3.23 && intval(MYSQL_MINOR_VERSION) >= 30) { + $query = 'SHOW OPEN TABLES FROM ' . backquote($db); $result = mysql_query($query); // Blending out tables in use - if ($result != false && mysql_num_rows($result) > 0) { + if ($result != FALSE && mysql_num_rows($result) > 0) { while ($tmp = mysql_fetch_array($result)) { // if in use memorize tablename if (preg_match('/in_use=[1-9]+/', $tmp['Comment'])) { - $sot_cache[$tmp[0]] = true; + $sot_cache[$tmp[0]] = TRUE; } } mysql_free_result($result); if (isset($sot_cache)) { - $query = 'SHOW TABLES FROM ' . db_name($db); + $query = 'SHOW TABLES FROM ' . backquote($db); $result = mysql_query($query); - if ($result != false && mysql_num_rows($result) > 0) { + if ($result != FALSE && mysql_num_rows($result) > 0) { while ($tmp = mysql_fetch_array($result)) { if (!isset($sot_cache[$tmp[0]])) { - $sts_result = mysql_query('SHOW TABLE STATUS FROM ' . db_name($db) . ' LIKE \'' . addslashes($tmp[0]) . '\''); + $sts_result = mysql_query('SHOW TABLE STATUS FROM ' . backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\''); $sts_tmp = mysql_fetch_array($sts_result); $tbl_cache[] = $sts_tmp; } else { // table in use @@ -49,14 +51,14 @@ if ($num_tables > 0 && MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION } } mysql_free_result($result); - $sot_ready = true; + $sot_ready = TRUE; } } } } if (!isset($sot_ready)) { - $result = mysql_query('SHOW TABLE STATUS FROM ' . db_name($db)); - if ($result != false && mysql_num_rows($result) > 0) { + $result = mysql_query('SHOW TABLE STATUS FROM ' . backquote($db)); + if ($result != FALSE && mysql_num_rows($result) > 0) { while ($sts_tmp = mysql_fetch_array($result)) { $tbl_cache[] = $sts_tmp; } @@ -87,46 +89,57 @@ else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) { - -   + +   - &pos=0"> + + - + + - + + - + + - &zero_rows="> + + - &zero_rows="> + + - 0) { - list($formated_size, $unit) = format_byte_down($tblsize, 3, 1); + list($formated_size, $unit) = format_byte_down($tblsize, 3, 1); } else { - list($formated_size, $unit) = format_byte_down($tblsize, 3, 0); + list($formated_size, $unit) = format_byte_down($tblsize, 3, 0); } } else if (isset($mergetable)) // MyISAM MERGE Table @@ -139,21 +152,22 @@ else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) { $formated_size="unknown"; $unit=""; } - ?> + ?> - "; - echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; + echo number_format($sts_data['Rows'], 0, $number_decimal_separator, + $number_thousands_separator) . "\n"; if (isset($mergetable)) echo ""; ?>    - + - + ?> @@ -165,17 +179,17 @@ else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) { - + - + @@ -200,9 +214,14 @@ else { @@ -210,22 +229,22 @@ else { - &pos=0"> + - + - + - + - &zero_rows="> + - &zero_rows="> + @@ -240,17 +259,25 @@ else {


- @@ -261,7 +288,7 @@ if ($num_tables > 0) { ?>
  • -
    +
  • 0) { - + +  :
    -
    -
    +   +
    $strOr $strLocationTextfile"; ?> :
    @@ -309,7 +325,7 @@ if ($cfgBookmark['db'] && $cfgBookmark['table']) { echo ' ' . "\n"; echo ' ' . $strSubmit . "\n"; @@ -334,7 +350,7 @@ if ($num_tables > 0) { ?>
  • -
    +
  • @@ -342,14 +358,16 @@ if ($num_tables > 0) {

    + 1) { + $colspan = ' colspan="2"'; echo "\n"; ?> - - - - - - + + > - - + = 3.23 && intval(MYSQL_MINOR_VERSION) >= 6) { + ?> - - + + + > 0) { - @@ -442,7 +470,7 @@ if ($num_tables > 0) { ' . "\n"; +echo ' ' . $strCreateNewTable . htmlspecialchars($db) . ' :
    ' . "\n"; echo ' ' . $strName . ' : ' . "\n"; echo ' ' . '' . "\n"; // echo ' ' . $strNumberIndexes. ' : ' . "\n"; @@ -457,7 +485,8 @@ echo ' ' . ' ' . "\n";
  • - + +
  • @@ -467,6 +496,6 @@ echo ' ' . ' ' . "\n"; /** * Displays the footer */ -require('./footer.inc.php3'); echo "\n"; +require('./footer.inc.php3'); ?> diff --git a/db_printview.php3 b/db_printview.php3 index f55c44688..2576443e3 100755 --- a/db_printview.php3 +++ b/db_printview.php3 @@ -2,50 +2,70 @@ /* $Id$ */ -require("./grab_globals.inc.php3"); - - -if(!isset($message)) -{ - include("./header.inc.php3"); -} -else -{ +/** + * Gets the variables sent or posted to this script, then displays headers + */ +require('./grab_globals.inc.php3'); +if (!isset($message)) { + include('./header.inc.php3'); +} else { show_message($message); } -$tables = mysql_list_tables($db); + +/** + * Get the list and count of the tables + */ +$tables = mysql_list_tables($db); $num_tables = @mysql_numrows($tables); -if($num_tables == 0) -{ + +/** + * If there is at least one table, displays the printer friendly view, else + * an error message + */ +// No table +if ($num_tables == 0) { echo $strNoTablesFound; } -else -{ +// At least one table +else { $i = 0; - - echo "
    +
    + -    +
    + +
    + +
    +
    - -    - + >
    - -    + > + + +
    + >
    \n"; - echo ''; - echo ""; - while($i < $num_tables) - { - $table = mysql_tablename($tables, $i); - $query = "?server=$server&lang=$lang&db=$db&table=$table&goto=db_details.php3"; - $bgcolor = $cfgBgcolorOne; - $i % 2 ? 0: $bgcolor = $cfgBgcolorTwo; + ?> + + +
    ' . UCFirst($strTable) . '$strRecords
    + + + + + - - - - - + + + +\n"; -} + } // end while + echo "\n"; + ?> +
     
    +   + +   +
    + diff --git a/db_readdump.php3 b/db_readdump.php3 index 63277cbb0..0b4f5298d 100755 --- a/db_readdump.php3 +++ b/db_readdump.php3 @@ -1,81 +1,117 @@ diff --git a/defines.inc.php3 b/defines.inc.php3 index 34a290b2f..314f3d5a1 100755 --- a/defines.inc.php3 +++ b/defines.inc.php3 @@ -1,51 +1,60 @@ 0){ - $row = mysql_fetch_array($result); - define("MYSQL_MAJOR_VERSION", (double)substr($row["version"], 0, 4)); - define("MYSQL_MINOR_VERSION", (double)substr($row["version"], 5)); -} -else{ - $result = @mysql_query("SHOW VARIABLES like 'version'"); - if ($result!=false && @mysql_num_rows($result)>0){ - $row = mysql_fetch_row($result); - define("MYSQL_MAJOR_VERSION", (double)substr($row[1], 0, 4)); - define("MYSQL_MINOR_VERSION", (double)substr($row[1], 5)); - } - else{ - define("MYSQL_MAJOR_VERSION", 3.21); - define("MYSQL_MINOR_VERSION", 0); - } +if (isset($match) && !empty($match[1])) { + if (!isset($match[2])) { + $match[2] = 0; + } + if (!isset($match[3])) { + $match[3] = 0; + } + define('PMA_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3])); + unset($match); +} else { + define('PMA_INT_VERSION', FALSE); } -/* ------------------------- */ +if (defined('PHP_OS') && eregi('win', PHP_OS)) { + define('PMA_WINDOWS', TRUE); +} else { + define('PMA_WINDOWS', FALSE); +} + +// MySQL Version +//$result = @mysql_query('SELECT VERSION() AS version'); +$result = mysql_query('SELECT VERSION() AS version'); +if ($result != FALSE && @mysql_num_rows($result) > 0) { + $result = mysql_query('SELECT VERSION() AS version') or mysql_die(); + $row = mysql_fetch_array($result); + define('MYSQL_MAJOR_VERSION', (double)substr($row['version'], 0, 4)); + define('MYSQL_MINOR_VERSION', (double)substr($row['version'], 5)); +} else { + $result = @mysql_query('SHOW VARIABLES like \'version\''); + if ($result != FALSE && @mysql_num_rows($result) > 0){ + $row = mysql_fetch_row($result); + define('MYSQL_MAJOR_VERSION', (double)substr($row[1], 0, 4)); + define('MYSQL_MINOR_VERSION', (double)substr($row[1], 5)); + } else { + define('MYSQL_MAJOR_VERSION', 3.21); + define('MYSQL_MINOR_VERSION', 0); + } +} ?> diff --git a/footer.inc.php3 b/footer.inc.php3 index adefe05f6..1c070c5dc 100755 --- a/footer.inc.php3 +++ b/footer.inc.php3 @@ -1,9 +1,18 @@ - - - - + + + +/** + * Sends bufferized data + */ +if (isset($cfgOBGzip) && isset($ob_mode)) { + out_buffer_post($ob_mode); +} +?> diff --git a/functions.js b/functions.js index 09f047f55..741ea8ef3 100755 --- a/functions.js +++ b/functions.js @@ -1,9 +1,6 @@ /* $Id$ */ -var isFormElementInRange; - - /** * Ensures a value submitted in a form is numeric and is in a range * @@ -16,23 +13,21 @@ var isFormElementInRange; */ function checkFormElementInRange(theForm, theFieldName, min, max) { - isFormElementInRange = true; var theField = theForm.elements[theFieldName]; var val = parseInt(theField.value); + var isRange = (typeof(min) != 'undefined' && typeof(max) != 'undefined'); // It's not a number if (isNaN(val)) { - alert(errorMsg1); - isFormElementInRange = false; theField.select(); + alert(errorMsg1); theField.focus(); return false; } // It's a number but it is not between min and max - else if (val < min || val > max) { - alert(val + errorMsg2); - isFormElementInRange = false; + else if (isRange && (val < min || val > max)) { theField.select(); + alert(val + errorMsg2); theField.focus(); return false; } diff --git a/grab_globals.inc.php3 b/grab_globals.inc.php3 index dc438056d..5d7cc1112 100644 --- a/grab_globals.inc.php3 +++ b/grab_globals.inc.php3 @@ -1,26 +1,32 @@ + if (!empty($HTTP_POST_VARS)) { + while(list($name, $value) = each($HTTP_POST_VARS)) { + $$name = $value; + } + } // end if + + if (!empty($HTTP_POST_FILES)) { + while(list($name, $value) = each($HTTP_POST_FILES)) { + $$name = $value['tmp_name']; + } + } // end if + +} // end __LIB_GRAB_GLOBALS__ +?> \ No newline at end of file diff --git a/header.inc.php3 b/header.inc.php3 index 0a16fcbfb..0f4acbd6a 100755 --- a/header.inc.php3 +++ b/header.inc.php3 @@ -1,18 +1,23 @@ + + phpMyAdmin