From 5abd943c29a95d850acceafc2c2127883366a1d6 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Mon, 13 Jul 2009 16:03:51 +0000 Subject: [PATCH] Change simple preg_match to ereg git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@812 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/edit.inc.php | 2 +- adminer/include/editing.inc.php | 6 +++--- adminer/include/functions.inc.php | 14 +++++++------- adminer/schema.inc.php | 8 ++++---- adminer/select.inc.php | 6 +++--- adminer/user.inc.php | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index c21fc753..40ca0081 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -3,7 +3,7 @@ $where = (isset($_GET["select"]) ? (count($_POST["check"]) == 1 ? where_check($_ $update = ($where && !$_POST["clone"]); $fields = fields($_GET["edit"]); foreach ($fields as $name => $field) { - if (isset($_GET["default"]) ? $field["auto_increment"] || preg_match('~text|blob~', $field["type"]) : !isset($field["privileges"][$update ? "update" : "insert"])) { + if (isset($_GET["default"]) ? $field["auto_increment"] || ereg('text|blob', $field["type"]) : !isset($field["privileges"][$update ? "update" : "insert"])) { unset($fields[$name]); } } diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index dc139569..b8ef821e 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -32,9 +32,9 @@ echo ($unsigned ? " '; - } elseif (preg_match('~binary|blob~', $field["type"])) { + } elseif (ereg('binary|blob', $field["type"])) { echo (ini_get("file_uploads") ? '' : lang('File uploads are disabled.') . ' '); } else { // int(3) is only a display hint @@ -334,7 +334,7 @@ function process_input($name, $field) { return (isset($_GET["default"]) ? $dbh->quote($value) : intval($value)); } elseif ($field["type"] == "set") { return (isset($_GET["default"]) ? "'" . implode(",", array_map('escape_string', (array) $value)) . "'" : array_sum((array) $value)); - } elseif (preg_match('~binary|blob~', $field["type"])) { + } elseif (ereg('binary|blob', $field["type"])) { $file = get_file($idf); if (!is_string($file)) { return false; //! report errors diff --git a/adminer/schema.inc.php b/adminer/schema.inc.php index fed0eacf..6452561a 100644 --- a/adminer/schema.inc.php +++ b/adminer/schema.inc.php @@ -64,13 +64,13 @@ foreach ($schema as $name => $table) { foreach ($table["fields"] as $field) { $val = htmlspecialchars($field["field"]); $title = ' title="' . htmlspecialchars($field["full_type"] . ($field["null"] ? " " . lang('NULL') : '')) . '"'; - if (preg_match('~char|text~', $field["type"])) { + if (ereg('char|text', $field["type"])) { $val = "$val"; - } elseif (preg_match('~date|time|year~', $field["type"])) { + } elseif (ereg('date|time|year', $field["type"])) { $val = "$val"; - } elseif (preg_match('~binary|blob~', $field["type"])) { + } elseif (ereg('binary|blob', $field["type"])) { $val = "$val"; - } elseif (preg_match('~enum|set~', $field["type"])) { + } elseif (ereg('enum|set', $field["type"])) { $val = "$val"; } else { $val = "$val"; diff --git a/adminer/select.inc.php b/adminer/select.inc.php index cd86f32a..8fda8ecb 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -14,7 +14,7 @@ unset($text_length); foreach ($fields as $key => $field) { if (isset($field["privileges"]["select"])) { $columns[$key] = strip_tags(adminer_field_name($fields, $key)); //! numeric $key is problematic in optionlist() - if (preg_match('~text|blob~', $field["type"])) { + if (ereg('text|blob', $field["type"])) { $text_length = (isset($_GET["text_length"]) ? $_GET["text_length"] : "100"); } } @@ -273,12 +273,12 @@ if (!$columns) { } if (!isset($val)) { $val = "NULL"; - } elseif (preg_match('~blob|binary~', $fields[$key]["type"]) && !is_utf8($val)) { //! download link may be printed even with is_utf8 + } elseif (ereg('blob|binary', $fields[$key]["type"]) && !is_utf8($val)) { //! download link may be printed even with is_utf8 $val = '' . lang('%d byte(s)', strlen($val)) . ''; } else { if (!strlen(trim($val, " \t"))) { $val = " "; - } elseif (intval($text_length) > 0 && preg_match('~blob|text~', $fields[$key]["type"])) { + } elseif (intval($text_length) > 0 && ereg('blob|text', $fields[$key]["type"])) { $val = nl2br(shorten_utf8($val, intval($text_length))); // usage of LEFT() would reduce traffic but complicates query } else { $val = nl2br(htmlspecialchars($val)); diff --git a/adminer/user.inc.php b/adminer/user.inc.php index 891aa663..6fee3bf5 100644 --- a/adminer/user.inc.php +++ b/adminer/user.inc.php @@ -40,7 +40,7 @@ if (isset($_GET["host"]) && ($result = $dbh->query("SHOW GRANTS FOR " . $dbh->qu if (preg_match('~GRANT (.*) ON (.*) TO ~', $row[0], $match) && preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~', $match[1], $matches, PREG_SET_ORDER)) { //! escape the part between ON and TO foreach ($matches as $val) { $grants["$match[2]$val[2]"][$val[1]] = true; - if (preg_match('~ WITH GRANT OPTION~', $row[0])) { //! don't check inside strings and identifiers + if (ereg(' WITH GRANT OPTION', $row[0])) { //! don't check inside strings and identifiers $grants["$match[2]$val[2]"]["GRANT OPTION"] = true; } }