From: jakubvrana Date: Thu, 30 Jul 2009 09:25:37 +0000 (+0000) Subject: Regexp (?P<>) is not supported with preg_replace_callback in older PHP versions X-Git-Tag: v3.0.0~580 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=175daa360cfaca8d4af60476eaa59ddfa6d8f548;p=adminer.git Regexp (?P<>) is not supported with preg_replace_callback in older PHP versions git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@947 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 9d6fa753..0527549d 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -314,7 +314,10 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5 function processInput($field, $value, $function = "") { global $dbh; - $return = $dbh->quote(ereg('date|timestamp', $field["type"]) ? preg_replace_callback('(' . preg_replace('~(\\\\\\$([0-9]))~', '(?P[0-9]+)', preg_quote(lang('$1-$3-$5'))) . ')', 'conversion_date', $value) : $value); + $return = $dbh->quote(ereg('date|timestamp', $field["type"]) && preg_match('(^' . preg_replace('~(\\\\\\$([0-9]))~', '(?P[0-9]+)', preg_quote(lang('$1-$3-$5'))) . ')', $value, $match) + ? ($match["p1"] ? $match["p1"] : ($match["p2"] < 70 ? 20 : 19) . $match["p2"]) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" + : $value + ); if (!ereg('varchar|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && !strlen($value)) { $return = "NULL"; } elseif (ereg('date|time', $field["type"]) && $value == "CURRENT_TIMESTAMP") { diff --git a/editor/include/editing.inc.php b/editor/include/editing.inc.php index 3c905a4d..a4abe2da 100644 --- a/editor/include/editing.inc.php +++ b/editor/include/editing.inc.php @@ -1,4 +1,2 @@