diff --git a/ChangeLog b/ChangeLog index f5f3ffec7..1335a6664 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ $Source$ 2002-10-13 Robin Johnson * libraries/sqlparser.lib.php3: bug #621357 + * libraries/commom.inc.php3, string.lib.php3, sqlparser.lib.php3: + - Fixed MB bug 2002-10-11 Marc Delisle * libraries/common.lib.php3: bug 620624 diff --git a/config.inc.php3 b/config.inc.php3 index 0a1450828..13e8124ed 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -44,7 +44,7 @@ $cfg['PmaAbsoluteUri'] = ''; * You should use this if and ONLY if the PmaAbsoluteUri auto-detection * works perfectly. */ -$cfg['PmaAbsoluteUri_DisableWarning'] = FALSE; +$cfg['PmaAbsoluteUri_DisableWarning'] = TRUE; /** * Disable the default warning that is displayed on the DB Details Structure page if @@ -63,12 +63,12 @@ $i++; $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port $cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket -$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') -$cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings +$cfg['Servers'][$i]['connect_type'] = 'socket'; // How to connect to MySQL server ('tcp' or 'socket') +$cfg['Servers'][$i]['controluser'] = 'phpMyAdmin'; // MySQL control user settings // (this user must have read-only -$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user" +$cfg['Servers'][$i]['controlpass'] = 'phpmyadmin'; // access to the "mysql/user" // and "mysql/db" tables) -$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)? +$cfg['Servers'][$i]['auth_type'] = 'cookie'; // Authentication method (config, http or cookie based)? $cfg['Servers'][$i]['user'] = 'root'; // MySQL user $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed // with 'config' auth_type) @@ -79,10 +79,10 @@ $cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only // of db-names $cfg['Servers'][$i]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname -$cfg['Servers'][$i]['pmadb'] = ''; // Database used for Relation, Bookmark and PDF Features +$cfg['Servers'][$i]['pmadb'] = 'phpMyAdmin'; // Database used for Relation, Bookmark and PDF Features // - leave blank for no support -$cfg['Servers'][$i]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support -$cfg['Servers'][$i]['relation'] = ''; // table to describe the relation between links (see doc) +$cfg['Servers'][$i]['bookmarktable'] = 'bookmark'; // Bookmark table - leave blank for no bookmark support +$cfg['Servers'][$i]['relation'] = 'PMA_relation'; // table to describe the relation between links (see doc) // - leave blank for no relation-links support $cfg['Servers'][$i]['table_info'] = ''; // table to describe the display fields // - leave blank for no display fields support @@ -181,18 +181,18 @@ $cfg['LeftDisplayLogo'] = TRUE; // display logo at top of left frame $cfg['ShowStats'] = TRUE; // allow to display statistics and space usage in // the pages about database details and table // properties -$cfg['ShowMysqlInfo'] = FALSE; // whether to display the "MySQL runtime -$cfg['ShowMysqlVars'] = FALSE; // information", "MySQL system variables", "PHP -$cfg['ShowPhpInfo'] = FALSE; // information" and "change password" links for -$cfg['ShowChgPassword'] = FALSE; // simple users or not +$cfg['ShowMysqlInfo'] = TRUE; // whether to display the "MySQL runtime +$cfg['ShowMysqlVars'] = TRUE; // information", "MySQL system variables", "PHP +$cfg['ShowPhpInfo'] = TRUE; // information" and "change password" links for +$cfg['ShowChgPassword'] = TRUE; // simple users or not $cfg['SuggestDBName'] = TRUE; // suggest a new DB name if possible (false = keep empty) // In browse mode... $cfg['ShowBlob'] = FALSE; // display blob field contents $cfg['NavigationBarIconic'] = TRUE; // do not display text inside navigation bar buttons -$cfg['ShowAll'] = FALSE; // allows to display all the rows +$cfg['ShowAll'] = TRUE; // allows to display all the rows $cfg['MaxRows'] = 30; // maximum number of rows to display -$cfg['Order'] = 'ASC'; // default for 'ORDER BY' clause (valid +$cfg['Order'] = 'SMART'; // default for 'ORDER BY' clause (valid // values are 'ASC', 'DESC' or 'SMART' -ie // descending order for fields of type // TIME, DATE, DATETIME & TIMESTAMP, @@ -347,7 +347,7 @@ $cfg['CharTextareaRows'] = 2; // textarea size (rows) for CHAR/VAR $cfg['LimitChars'] = 50; // max field data length in browse mode $cfg['ModifyDeleteAtLeft'] = TRUE; // show edit/delete links on left side of browse // (or at the top with vertical browse) -$cfg['ModifyDeleteAtRight'] = FALSE; // show edit/delete links on right side of browse +$cfg['ModifyDeleteAtRight'] = TRUE; // show edit/delete links on right side of browse // (or at the bottom with vertical browse) $cfg['DefaultDisplay'] = 'horizontal'; // default display direction (horizontal|vertical) $cfg['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate) @@ -360,7 +360,7 @@ $cfg['RepeatCells'] = 100; // repeat header names every X cells $cfg['SQLQuery']['Edit'] = TRUE; // Edit link to change a query $cfg['SQLQuery']['Explain'] = TRUE; // EXPLAIN on SELECT queries $cfg['SQLQuery']['ShowAsPHP'] = TRUE; // Wrap a query in PHP -$cfg['SQLQuery']['Validate'] = FALSE; // Validate a query (see $cfg['SQLValidator'] as well) +$cfg['SQLQuery']['Validate'] = TRUE; // Validate a query (see $cfg['SQLValidator'] as well) /** @@ -409,7 +409,7 @@ $cfg['SQP']['fmtColor'] = array( // Syntax colouring data * Mimer SQL Validator, Copyright 2002 Upright Database Technology. * All rights reserved. */ -$cfg['SQLValidator']['use'] = FALSE; // Make the SQL Validator available +$cfg['SQLValidator']['use'] = TRUE; // Make the SQL Validator available $cfg['SQLValidator']['username'] = ''; // If you have a custom username, specify it here (defaults to anonymous) $cfg['SQLValidator']['password'] = ''; // Password for username diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 94bec2fc1..08a26f705 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -1496,6 +1496,7 @@ if (typeof(document.getElementById) != 'undefined' && strpos(' ' . $lang, 'ja-') && file_exists('./libraries/kanji-encoding.lib.php3')) { include('./libraries/kanji-encoding.lib.php3'); + define('PMA_MULTIBYTE_ENCODING',1); } // end if } // $__PMA_COMMON_LIB__ diff --git a/libraries/kanji-encoding.lib.php3 b/libraries/kanji-encoding.lib.php3 index 49081c558..b1a0ec7b1 100644 --- a/libraries/kanji-encoding.lib.php3 +++ b/libraries/kanji-encoding.lib.php3 @@ -148,5 +148,6 @@ if (!defined('PMA_ENCODING_LIB_INCLUDED')) { PMA_internal_enc_check(); + } // $__PMA_ENCODING_LIB_INCLUDED ?> diff --git a/libraries/sqlparser.lib.php3 b/libraries/sqlparser.lib.php3 index 90e8e9e50..96e8866df 100644 --- a/libraries/sqlparser.lib.php3 +++ b/libraries/sqlparser.lib.php3 @@ -32,17 +32,6 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { define('PMA_SQP_LIB_INCLUDED', 1); - if(defined('PMA_MULTIBYTE_ENCODING')) { - $GLOBALS['PMA_SQP_strlen'] = 'mb_strlen'; - $GLOBALS['PMA_SQP_strpos'] = 'mb_strpos'; - $GLOBALS['PMA_SQP_strrpos'] = 'mb_strrpos'; - $GLOBALS['PMA_SQP_substr'] = 'mb_substr'; - } else { - $GLOBALS['PMA_SQP_strlen'] = 'strlen'; - $GLOBALS['PMA_SQP_strpos'] = 'strpos'; - $GLOBALS['PMA_SQP_strrpos'] = 'strrpos'; - $GLOBALS['PMA_SQP_substr'] = 'substr'; - } /** * Include the string library as we use it heavily @@ -181,7 +170,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { return $sql; } - $len = $GLOBALS['PMA_SQP_strlen']($sql); + $len = $GLOBALS['PMA_strlen']($sql); if ($len == 0) { return array(); } @@ -246,18 +235,18 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { $type = 'mysql'; case '-': $type = 'ansi'; - $pos = $GLOBALS['PMA_SQP_strpos']($sql, "\n", $count2); + $pos = $GLOBALS['PMA_strpos']($sql, "\n", $count2); break; case '/': $type = 'c'; - $pos = $GLOBALS['PMA_SQP_strpos']($sql, '*/', $count2); + $pos = $GLOBALS['PMA_strpos']($sql, '*/', $count2); $pos += 2; break; default: break; } // end switch $count2 = ($pos < $count2) ? $len : $pos; - $str = $GLOBALS['PMA_SQP_substr']($sql, $count1, $count2 - $count1); + $str = $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1); PMA_SQP_arrayAdd($sql_array, 'comment_' . $type, $str, $arraysize); continue; } // end if @@ -273,7 +262,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { $oldpos = 0; do { $oldpos = $pos; - $pos = $GLOBALS['PMA_SQP_strpos'](' ' . $sql, $quotetype, $oldpos + 1) - 1; + $pos = $GLOBALS['PMA_strpos'](' ' . $sql, $quotetype, $oldpos + 1) - 1; // ($pos === FALSE) if ($pos < 0) { $debugstr = $GLOBALS['strSQPBugUnclosedQuote'] . ' @ ' . $startquotepos. "\n" @@ -317,7 +306,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { default: break; } // end switch - $data = $GLOBALS['PMA_SQP_substr']($sql, $count1, $count2 - $count1); + $data = $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1); PMA_SQP_arrayAdd($sql_array, $type, $data, $arraysize); continue; } @@ -356,7 +345,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { if ($l == 1) { $punct_data = $c; } else { - $punct_data = $GLOBALS['PMA_SQP_substr']($sql, $count1, $l); + $punct_data = $GLOBALS['PMA_substr']($sql, $count1, $l); } // Special case, sometimes, althought two characters are @@ -393,10 +382,10 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { $punct_data = $first; } else if (($last2 == '/*') || ($last2 == '--')) { $count2 -= 2; - $punct_data = $GLOBALS['PMA_SQP_substr']($sql, $count1, $count2 - $count1); + $punct_data = $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1); } else if (($last == '-') || ($last == '+') || ($last == '!')) { $count2--; - $punct_data = $GLOBALS['PMA_SQP_substr']($sql, $count1, $count2 - $count1); + $punct_data = $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1); } else { $debugstr = $GLOBALS['strSQPBugUnknownPunctuation'] . ' @ ' . ($count1+1) . "\n" . 'STR: ' . $punct_data; @@ -435,7 +424,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { continue; } else { $debugstr = $GLOBALS['strSQPBugInvalidIdentifer'] . ' @ ' . ($count1+1) . "\n" - . 'STR: ' . $GLOBALS['PMA_SQP_substr']($sql, $count1, $count2 - $count1); + . 'STR: ' . $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1); PMA_SQP_throwError($debugstr, $sql); return $sql; } @@ -463,7 +452,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { } // end while $l = $count2 - $count1; - $str = $GLOBALS['PMA_SQP_substr']($sql, $count1, $l); + $str = $GLOBALS['PMA_substr']($sql, $count1, $l); $type = ''; if ($is_digit) { @@ -492,7 +481,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { $count2++; $debugstr = 'C1 C2 LEN: ' . $count1 . ' ' . $count2 . ' ' . $len . "\n" - . 'STR: ' . $GLOBALS['PMA_SQP_substr']($sql, $count1, $count2 - $count1) . "\n"; + . 'STR: ' . $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1) . "\n"; PMA_SQP_bug($debugstr, $sql); return $sql; @@ -657,10 +646,10 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { */ function PMA_SQP_formatHtml_colorize($arr) { - $i = $GLOBALS['PMA_SQP_strpos']($arr['type'], '_'); + $i = $GLOBALS['PMA_strpos']($arr['type'], '_'); $class = ''; if ($i > 0) { - $class = 'syntax_' . $GLOBALS['PMA_SQP_substr']($arr['type'], 0, $i) . ' '; + $class = 'syntax_' . $GLOBALS['PMA_substr']($arr['type'], 0, $i) . ' '; } $class .= 'syntax_' . $arr['type']; diff --git a/libraries/string.lib.php3 b/libraries/string.lib.php3 index df124b83e..e982ca6b7 100644 --- a/libraries/string.lib.php3 +++ b/libraries/string.lib.php3 @@ -18,6 +18,19 @@ if (!defined('PMA_STR_LIB_INCLUDED')) { define('PMA_STR_LIB_INCLUDED', 1); + //this is for handling input better + if(defined('PMA_MULTIBYTE_ENCODING')) { + $GLOBALS['PMA_strlen'] = 'mb_strlen'; + $GLOBALS['PMA_strpos'] = 'mb_strpos'; + $GLOBALS['PMA_strrpos'] = 'mb_strrpos'; + $GLOBALS['PMA_substr'] = 'mb_substr'; + } else { + $GLOBALS['PMA_strlen'] = 'strlen'; + $GLOBALS['PMA_strpos'] = 'strpos'; + $GLOBALS['PMA_strrpos'] = 'strrpos'; + $GLOBALS['PMA_substr'] = 'substr'; + } + /** * This checks if a string actually exists inside another string * We try to do it in a PHP3-portable way. @@ -30,9 +43,9 @@ if (!defined('PMA_STR_LIB_INCLUDED')) { */ function PMA_STR_strInStr($needle, $haystack) { - // strpos($haystack, $needle) !== FALSE - // return (is_integer(strpos($haystack, $needle))); - return strpos(' ' . $haystack, $needle); + // $GLOBALS['PMA_strpos']($haystack, $needle) !== FALSE + // return (is_integer($GLOBALS['PMA_strpos']($haystack, $needle))); + return $GLOBALS['PMA_strpos'](' ' . $haystack, $needle); } // end of the "PMA_STR_strInStr()" function @@ -47,7 +60,7 @@ if (!defined('PMA_STR_LIB_INCLUDED')) { */ function PMA_STR_charIsEscaped($string, $pos, $start = 0) { - $len = strlen($string); + $len = $GLOBALS['PMA_strlen']($string); // Base case: // Check for string length or invalid input or special case of input // (pos == $start)