patch #2407785 [cleanup] ereg*() deprecated in PHP 5.3

This commit is contained in:
Marc Delisle
2008-12-14 13:58:06 +00:00
parent c6bd88d51a
commit 398feb40fd
14 changed files with 47 additions and 45 deletions

View File

@@ -21,6 +21,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug #1963184 [export] YAML export improvement, - bug #1963184 [export] YAML export improvement,
thanks to Bryce Thornton - brycethornton thanks to Bryce Thornton - brycethornton
+ [lang] Dutch update, thanks to Herman van Rink - helmo + [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) 3.1.1.0 (2008-12-09)
- patch #2242765 [core] Navi panel server links wrong, - patch #2242765 [core] Navi panel server links wrong,

View File

@@ -175,7 +175,6 @@ class PMA_Config
} elseif (preg_match('@OmniWeb/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) { } 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_VER', $log_version[1]);
$this->set('PMA_USR_BROWSER_AGENT', 'OMNIWEB'); $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 2.2.2 says Konqueror/2.2.2
// Konqueror 3.0.3 says Konqueror/3 // Konqueror 3.0.3 says Konqueror/3
} elseif (preg_match('@(Konqueror/)(.*)(;)@', $HTTP_USER_AGENT, $log_version)) { } elseif (preg_match('@(Konqueror/)(.*)(;)@', $HTTP_USER_AGENT, $log_version)) {

View File

@@ -499,10 +499,10 @@ require_once './libraries/List.class.php';
// TODO: db names may contain characters // TODO: db names may contain characters
// that are regexp instructions // that are regexp instructions
$re = '(^|(\\\\\\\\)+|[^\])'; $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 // Fixed db name matching
// 2000-08-28 -- Benjamin Gandon // 2000-08-28 -- Benjamin Gandon
if (ereg('^' . $tmp_regex . '$', $tmp_db)) { if (preg_match('/^' . addcslashes($tmp_regex,'/') . '$/', $tmp_db)) {
$dblist[] = $tmp_db; $dblist[] = $tmp_db;
break; break;
} }

View File

@@ -23,13 +23,13 @@ function Swekey_auth_check()
$_SESSION['SWEKEY']['VALID_SWEKEYS'] = array(); $_SESSION['SWEKEY']['VALID_SWEKEYS'] = array();
$valid_swekeys = split("\n",@file_get_contents($confFile)); $valid_swekeys = split("\n",@file_get_contents($confFile));
foreach ($valid_swekeys as $line) { 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); $items = explode(":", $line);
if (count($items) == 2) if (count($items) == 2)
$_SESSION['SWEKEY']['VALID_SWEKEYS'][$items[0]] = trim($items[1]); $_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); $items = explode("=", $line);
$_SESSION['SWEKEY']['CONF_'.trim($items[0])] = trim($items[1]); $_SESSION['SWEKEY']['CONF_'.trim($items[0])] = trim($items[1]);
} }

View File

@@ -179,7 +179,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
} elseif ($row[$j] == '0' || $row[$j] != '') { } elseif ($row[$j] == '0' || $row[$j] != '') {
// loic1 : always enclose fields // loic1 : always enclose fields
if ($what == 'excel') { if ($what == 'excel') {
$row[$j] = ereg_replace("\015(\012)?", "\012", $row[$j]); $row[$j] = preg_replace("/\015(\012)?/", "\012", $row[$j]);
} }
if ($csv_enclosed == '') { if ($csv_enclosed == '') {
$schema_insert .= $row[$j]; $schema_insert .= $row[$j];

View File

@@ -268,8 +268,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$type = $row['Type']; $type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001 // reformat mysql query output - staybyte - 9. June 2001
// loic1: set or enum types: slashes single quotes inside options // loic1: set or enum types: slashes single quotes inside options
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = ''; $type_nowrap = '';
@@ -278,16 +278,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$zerofill = 0; $zerofill = 0;
} else { } else {
$type_nowrap = ' nowrap="nowrap"'; $type_nowrap = ' nowrap="nowrap"';
$type = eregi_replace('BINARY', '', $type); $type = preg_replace('/BINARY/i', '', $type);
$type = eregi_replace('ZEROFILL', '', $type); $type = preg_replace('/ZEROFILL/i', '', $type);
$type = eregi_replace('UNSIGNED', '', $type); $type = preg_replace('/UNSIGNED/i', '', $type);
if (empty($type)) { if (empty($type)) {
$type = ' '; $type = ' ';
} }
$binary = eregi('BINARY', $row['Type']); $binary = preg_match('/BINARY/i', $row['Type']);
$unsigned = eregi('UNSIGNED', $row['Type']); $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
$zerofill = eregi('ZEROFILL', $row['Type']); $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
} }
$strAttribute = ' '; $strAttribute = ' ';
if ($binary) { if ($binary) {

View File

@@ -395,8 +395,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$type = $row['Type']; $type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001 // reformat mysql query output - staybyte - 9. June 2001
// loic1: set or enum types: slashes single quotes inside options // loic1: set or enum types: slashes single quotes inside options
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = ''; $type_nowrap = '';
@@ -405,16 +405,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$zerofill = 0; $zerofill = 0;
} else { } else {
$type_nowrap = ' nowrap="nowrap"'; $type_nowrap = ' nowrap="nowrap"';
$type = eregi_replace('BINARY', '', $type); $type = preg_replace('/BINARY/i', '', $type);
$type = eregi_replace('ZEROFILL', '', $type); $type = preg_replace('/ZEROFILL/i', '', $type);
$type = eregi_replace('UNSIGNED', '', $type); $type = preg_replace('/UNSIGNED/i', '', $type);
if (empty($type)) { if (empty($type)) {
$type = ' '; $type = ' ';
} }
$binary = eregi('BINARY', $row['Type']); $binary = preg_match('/BINARY/i', $row['Type']);
$unsigned = eregi('UNSIGNED', $row['Type']); $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
$zerofill = eregi('ZEROFILL', $row['Type']); $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
} }
if (!isset($row['Default'])) { if (!isset($row['Default'])) {
if ($row['Null'] != '') { if ($row['Null'] != '') {

View File

@@ -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 // loic1: set or enum types: slashes single quotes inside options
$field_name = $row['Field']; $field_name = $row['Field'];
$type = $row['Type']; $type = $row['Type'];
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = ''; $type_nowrap = '';
@@ -341,16 +341,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$zerofill = 0; $zerofill = 0;
} else { } else {
$type_nowrap = ' nowrap="nowrap"'; $type_nowrap = ' nowrap="nowrap"';
$type = eregi_replace('BINARY', '', $type); $type = preg_replace('/BINARY/i', '', $type);
$type = eregi_replace('ZEROFILL', '', $type); $type = preg_replace('/ZEROFILL/i', '', $type);
$type = eregi_replace('UNSIGNED', '', $type); $type = preg_replace('/UNSIGNED/i', '', $type);
if (empty($type)) { if (empty($type)) {
$type = ' '; $type = ' ';
} }
$binary = eregi('BINARY', $row['Type']); $binary = preg_match('/BINARY/i', $row['Type']);
$unsigned = eregi('UNSIGNED', $row['Type']); $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
$zerofill = eregi('ZEROFILL', $row['Type']); $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
} }
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
. '<text:p>' . htmlspecialchars($type) . '</text:p>' . '<text:p>' . htmlspecialchars($type) . '</text:p>'

View File

@@ -257,8 +257,8 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$type = $row['Type']; $type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001 // reformat mysql query output - staybyte - 9. June 2001
// loic1: set or enum types: slashes single quotes inside options // loic1: set or enum types: slashes single quotes inside options
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = ''; $type_nowrap = '';
@@ -267,16 +267,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$zerofill = 0; $zerofill = 0;
} else { } else {
$type_nowrap = ' nowrap="nowrap"'; $type_nowrap = ' nowrap="nowrap"';
$type = eregi_replace('BINARY', '', $type); $type = preg_replace('/BINARY/i', '', $type);
$type = eregi_replace('ZEROFILL', '', $type); $type = preg_replace('/ZEROFILL/i', '', $type);
$type = eregi_replace('UNSIGNED', '', $type); $type = preg_replace('/UNSIGNED/i', '', $type);
if (empty($type)) { if (empty($type)) {
$type = '&nbsp;'; $type = '&nbsp;';
} }
$binary = eregi('BINARY', $row['Type']); $binary = preg_match('/BINARY/i', $row['Type']);
$unsigned = eregi('UNSIGNED', $row['Type']); $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
$zerofill = eregi('ZEROFILL', $row['Type']); $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
} }
$strAttribute = '&nbsp;'; $strAttribute = '&nbsp;';
if ($binary) { if ($binary) {

View File

@@ -16,7 +16,7 @@
* @uses opendir() * @uses opendir()
* @uses readdir() * @uses readdir()
* @uses is_file() * @uses is_file()
* @uses eregi() * @uses preg_match()
* @param string $plugins_dir directrory with plugins * @param string $plugins_dir directrory with plugins
* @param mixed $plugin_param parameter to plugin by which they can decide whether they can work * @param mixed $plugin_param parameter to plugin by which they can decide whether they can work
* @return array list of plugins * @return array list of plugins

View File

@@ -145,8 +145,8 @@ function PMA_langDetect(&$str, $envType)
if (strpos($expr, '[-_]') === FALSE) { if (strpos($expr, '[-_]') === FALSE) {
$expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr); $expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr);
} }
if (($envType == 1 && eregi('^(' . $expr . ')(;q=[0-9]\\.[0-9])?$', $str)) if (($envType == 1 && preg_match('/^(' . addcslashes($expr,'/') . ')(;q=[0-9]\\.[0-9])?$/i', $str))
|| ($envType == 2 && eregi('(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))', $str))) { || ($envType == 2 && preg_match('/(\(|\[|;[[:space:]])(' . addcslashes($expr,'/') . ')(;|\]|\))/i', $str))) {
if (PMA_langSet($lang)) { if (PMA_langSet($lang)) {
return true; return true;
} }

View File

@@ -2288,8 +2288,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
&& ($typearr[1] != 'punct_level_plus') && ($typearr[1] != 'punct_level_plus')
&& (!PMA_STR_binarySearchInArr($arr[$i]['data'], $keywords_no_newline, $keywords_no_newline_cnt))) { && (!PMA_STR_binarySearchInArr($arr[$i]['data'], $keywords_no_newline, $keywords_no_newline_cnt))) {
// do not put a space before the first token, because // do not put a space before the first token, because
// we use a lot of eregi() checking for the first // we use a lot of pattern matching checking for the
// reserved word at beginning of query // first reserved word at beginning of query
// so do not put a newline before // so do not put a newline before
// //
// also we must not be inside a privilege list // also we must not be inside a privilege list

View File

@@ -5493,7 +5493,8 @@ if(!class_exists('TCPDF', false)) {
if (isset($dash)) { if (isset($dash)) {
$dash_string = ""; $dash_string = "";
if ($dash) { if ($dash) {
if (ereg("^.+,", $dash)) { // phpMyAdmin change
if (preg_match("/^.+,/", $dash)) {
$tab = explode(",", $dash); $tab = explode(",", $dash);
} else { } else {
$tab = array($dash); $tab = array($dash);

View File

@@ -84,7 +84,7 @@ if (!empty($bug_encoded)) {
$bug_encoded = stripslashes($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); $bug_decoded = base64_decode($bug_encoded);
if (substr($bug_encoded, 0, 2) == 'eN') { if (substr($bug_encoded, 0, 2) == 'eN') {
if (function_exists('gzuncompress')) { if (function_exists('gzuncompress')) {