diff --git a/ChangeLog b/ChangeLog index 5471025c8..b528a6978 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #1963184 [export] YAML export improvement, thanks to Bryce Thornton - brycethornton + [lang] Dutch update, thanks to Herman van Rink - helmo +- patch #2407785 [cleanup] ereg*() deprecated in PHP 5.3, + thanks to Alex Frase - atfrase 3.1.1.0 (2008-12-09) - patch #2242765 [core] Navi panel server links wrong, diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 2c443eb32..db772ee0c 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -175,7 +175,6 @@ class PMA_Config } elseif (preg_match('@OmniWeb/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) { $this->set('PMA_USR_BROWSER_VER', $log_version[1]); $this->set('PMA_USR_BROWSER_AGENT', 'OMNIWEB'); - //} elseif (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) { // Konqueror 2.2.2 says Konqueror/2.2.2 // Konqueror 3.0.3 says Konqueror/3 } elseif (preg_match('@(Konqueror/)(.*)(;)@', $HTTP_USER_AGENT, $log_version)) { diff --git a/libraries/List_Database.class.php b/libraries/List_Database.class.php index 6528f006f..882caaf38 100644 --- a/libraries/List_Database.class.php +++ b/libraries/List_Database.class.php @@ -499,10 +499,10 @@ require_once './libraries/List.class.php'; // TODO: db names may contain characters // that are regexp instructions $re = '(^|(\\\\\\\\)+|[^\])'; - $tmp_regex = ereg_replace($re . '%', '\\1.*', ereg_replace($re . '_', '\\1.{1}', $tmp_matchpattern)); + $tmp_regex = preg_replace('/' . addcslashes($re,'/') . '%/', '\\1.*', preg_replace('/' . addcslashes($re,'/') . '_/', '\\1.{1}', $tmp_matchpattern)); // Fixed db name matching // 2000-08-28 -- Benjamin Gandon - if (ereg('^' . $tmp_regex . '$', $tmp_db)) { + if (preg_match('/^' . addcslashes($tmp_regex,'/') . '$/', $tmp_db)) { $dblist[] = $tmp_db; break; } diff --git a/libraries/auth/swekey/swekey.auth.lib.php b/libraries/auth/swekey/swekey.auth.lib.php index f53dd81c2..f1e7c583d 100644 --- a/libraries/auth/swekey/swekey.auth.lib.php +++ b/libraries/auth/swekey/swekey.auth.lib.php @@ -23,13 +23,13 @@ function Swekey_auth_check() $_SESSION['SWEKEY']['VALID_SWEKEYS'] = array(); $valid_swekeys = split("\n",@file_get_contents($confFile)); foreach ($valid_swekeys as $line) { - if (ereg("^[0-9A-F]{32}:.+$", $line) != false) + if (preg_match("/^[0-9A-F]{32}:.+$/", $line) != false) { $items = explode(":", $line); if (count($items) == 2) $_SESSION['SWEKEY']['VALID_SWEKEYS'][$items[0]] = trim($items[1]); } - else if (ereg("^[A-Z_]+=.*$", $line) != false) { + else if (preg_match("/^[A-Z_]+=.*$/", $line) != false) { $items = explode("=", $line); $_SESSION['SWEKEY']['CONF_'.trim($items[0])] = trim($items[1]); } diff --git a/libraries/export/csv.php b/libraries/export/csv.php index 5a0b08406..11c02edb9 100644 --- a/libraries/export/csv.php +++ b/libraries/export/csv.php @@ -179,7 +179,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { } elseif ($row[$j] == '0' || $row[$j] != '') { // loic1 : always enclose fields if ($what == 'excel') { - $row[$j] = ereg_replace("\015(\012)?", "\012", $row[$j]); + $row[$j] = preg_replace("/\015(\012)?/", "\012", $row[$j]); } if ($csv_enclosed == '') { $schema_insert .= $row[$j]; diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php index d0392493a..1740f3a1c 100644 --- a/libraries/export/htmlword.php +++ b/libraries/export/htmlword.php @@ -268,8 +268,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 // loic1: set or enum types: slashes single quotes inside options - if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { - $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); + if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) { + $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1); $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type_nowrap = ''; @@ -278,16 +278,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $zerofill = 0; } else { $type_nowrap = ' nowrap="nowrap"'; - $type = eregi_replace('BINARY', '', $type); - $type = eregi_replace('ZEROFILL', '', $type); - $type = eregi_replace('UNSIGNED', '', $type); + $type = preg_replace('/BINARY/i', '', $type); + $type = preg_replace('/ZEROFILL/i', '', $type); + $type = preg_replace('/UNSIGNED/i', '', $type); if (empty($type)) { $type = ' '; } - $binary = eregi('BINARY', $row['Type']); - $unsigned = eregi('UNSIGNED', $row['Type']); - $zerofill = eregi('ZEROFILL', $row['Type']); + $binary = preg_match('/BINARY/i', $row['Type']); + $unsigned = preg_match('/UNSIGNED/i', $row['Type']); + $zerofill = preg_match('/ZEROFILL/i', $row['Type']); } $strAttribute = ' '; if ($binary) { diff --git a/libraries/export/latex.php b/libraries/export/latex.php index d2bfbc26a..fe6d9f27a 100644 --- a/libraries/export/latex.php +++ b/libraries/export/latex.php @@ -395,8 +395,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 // loic1: set or enum types: slashes single quotes inside options - if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { - $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); + if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) { + $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1); $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type_nowrap = ''; @@ -405,16 +405,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $zerofill = 0; } else { $type_nowrap = ' nowrap="nowrap"'; - $type = eregi_replace('BINARY', '', $type); - $type = eregi_replace('ZEROFILL', '', $type); - $type = eregi_replace('UNSIGNED', '', $type); + $type = preg_replace('/BINARY/i', '', $type); + $type = preg_replace('/ZEROFILL/i', '', $type); + $type = preg_replace('/UNSIGNED/i', '', $type); if (empty($type)) { $type = ' '; } - $binary = eregi('BINARY', $row['Type']); - $unsigned = eregi('UNSIGNED', $row['Type']); - $zerofill = eregi('ZEROFILL', $row['Type']); + $binary = preg_match('/BINARY/i', $row['Type']); + $unsigned = preg_match('/UNSIGNED/i', $row['Type']); + $zerofill = preg_match('/ZEROFILL/i', $row['Type']); } if (!isset($row['Default'])) { if ($row['Null'] != '') { diff --git a/libraries/export/odt.php b/libraries/export/odt.php index 338abd03c..136c639b6 100644 --- a/libraries/export/odt.php +++ b/libraries/export/odt.php @@ -331,8 +331,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals // loic1: set or enum types: slashes single quotes inside options $field_name = $row['Field']; $type = $row['Type']; - if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { - $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); + if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) { + $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1); $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type_nowrap = ''; @@ -341,16 +341,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $zerofill = 0; } else { $type_nowrap = ' nowrap="nowrap"'; - $type = eregi_replace('BINARY', '', $type); - $type = eregi_replace('ZEROFILL', '', $type); - $type = eregi_replace('UNSIGNED', '', $type); + $type = preg_replace('/BINARY/i', '', $type); + $type = preg_replace('/ZEROFILL/i', '', $type); + $type = preg_replace('/UNSIGNED/i', '', $type); if (empty($type)) { $type = ' '; } - $binary = eregi('BINARY', $row['Type']); - $unsigned = eregi('UNSIGNED', $row['Type']); - $zerofill = eregi('ZEROFILL', $row['Type']); + $binary = preg_match('/BINARY/i', $row['Type']); + $unsigned = preg_match('/UNSIGNED/i', $row['Type']); + $zerofill = preg_match('/ZEROFILL/i', $row['Type']); } $GLOBALS['odt_buffer'] .= '' . '' . htmlspecialchars($type) . '' diff --git a/libraries/export/texytext.php b/libraries/export/texytext.php index b0642c4f9..544d67407 100644 --- a/libraries/export/texytext.php +++ b/libraries/export/texytext.php @@ -257,8 +257,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 // loic1: set or enum types: slashes single quotes inside options - if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { - $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); + if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) { + $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1); $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type_nowrap = ''; @@ -267,16 +267,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $zerofill = 0; } else { $type_nowrap = ' nowrap="nowrap"'; - $type = eregi_replace('BINARY', '', $type); - $type = eregi_replace('ZEROFILL', '', $type); - $type = eregi_replace('UNSIGNED', '', $type); + $type = preg_replace('/BINARY/i', '', $type); + $type = preg_replace('/ZEROFILL/i', '', $type); + $type = preg_replace('/UNSIGNED/i', '', $type); if (empty($type)) { $type = ' '; } - $binary = eregi('BINARY', $row['Type']); - $unsigned = eregi('UNSIGNED', $row['Type']); - $zerofill = eregi('ZEROFILL', $row['Type']); + $binary = preg_match('/BINARY/i', $row['Type']); + $unsigned = preg_match('/UNSIGNED/i', $row['Type']); + $zerofill = preg_match('/ZEROFILL/i', $row['Type']); } $strAttribute = ' '; if ($binary) { diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index 61226823e..a2750a1d4 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -16,7 +16,7 @@ * @uses opendir() * @uses readdir() * @uses is_file() - * @uses eregi() + * @uses preg_match() * @param string $plugins_dir directrory with plugins * @param mixed $plugin_param parameter to plugin by which they can decide whether they can work * @return array list of plugins diff --git a/libraries/select_lang.lib.php b/libraries/select_lang.lib.php index c923226d1..041b0ea4f 100644 --- a/libraries/select_lang.lib.php +++ b/libraries/select_lang.lib.php @@ -145,8 +145,8 @@ function PMA_langDetect(&$str, $envType) if (strpos($expr, '[-_]') === FALSE) { $expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr); } - if (($envType == 1 && eregi('^(' . $expr . ')(;q=[0-9]\\.[0-9])?$', $str)) - || ($envType == 2 && eregi('(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))', $str))) { + if (($envType == 1 && preg_match('/^(' . addcslashes($expr,'/') . ')(;q=[0-9]\\.[0-9])?$/i', $str)) + || ($envType == 2 && preg_match('/(\(|\[|;[[:space:]])(' . addcslashes($expr,'/') . ')(;|\]|\))/i', $str))) { if (PMA_langSet($lang)) { return true; } diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 8d8babd7f..ba9c955d7 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -2288,8 +2288,8 @@ if (! defined('PMA_MINIMUM_COMMON')) { && ($typearr[1] != 'punct_level_plus') && (!PMA_STR_binarySearchInArr($arr[$i]['data'], $keywords_no_newline, $keywords_no_newline_cnt))) { // do not put a space before the first token, because - // we use a lot of eregi() checking for the first - // reserved word at beginning of query + // we use a lot of pattern matching checking for the + // first reserved word at beginning of query // so do not put a newline before // // also we must not be inside a privilege list diff --git a/libraries/tcpdf/tcpdf.php b/libraries/tcpdf/tcpdf.php index deec37438..26f2dc1ba 100644 --- a/libraries/tcpdf/tcpdf.php +++ b/libraries/tcpdf/tcpdf.php @@ -5493,7 +5493,8 @@ if(!class_exists('TCPDF', false)) { if (isset($dash)) { $dash_string = ""; if ($dash) { - if (ereg("^.+,", $dash)) { + // phpMyAdmin change + if (preg_match("/^.+,/", $dash)) { $tab = explode(",", $dash); } else { $tab = array($dash); diff --git a/scripts/decode_bug.php b/scripts/decode_bug.php index 7dea1e249..48ea0ca4b 100644 --- a/scripts/decode_bug.php +++ b/scripts/decode_bug.php @@ -84,7 +84,7 @@ if (!empty($bug_encoded)) { $bug_encoded = stripslashes($bug_encoded); } - $bug_encoded = ereg_replace('[[:space:]]', '', $bug_encoded); + $bug_encoded = preg_replace('/[[:space:]]/', '', $bug_encoded); $bug_decoded = base64_decode($bug_encoded); if (substr($bug_encoded, 0, 2) == 'eN') { if (function_exists('gzuncompress')) {