mirror of
https://github.com/vrana/adminer.git
synced 2026-05-07 08:57:39 +02:00
Replace ereg*() by preg_*()
ereg() triggers deprecated error which is sent to custom error handlers. It is also faster. There are no more deprecated functions except mysql_connect().
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
class AdminerEditCalendar {
|
||||
/** @access protected */
|
||||
var $prepend, $langPath;
|
||||
|
||||
|
||||
/**
|
||||
* @param string text to append before first calendar usage
|
||||
* @param string path to language file, %s stands for language code
|
||||
@@ -20,7 +20,7 @@ class AdminerEditCalendar {
|
||||
$this->prepend = $prepend;
|
||||
$this->langPath = $langPath;
|
||||
}
|
||||
|
||||
|
||||
function head() {
|
||||
echo $this->prepend;
|
||||
if ($this->langPath && function_exists('get_lang')) { // since Adminer 3.2.0
|
||||
@@ -32,17 +32,17 @@ class AdminerEditCalendar {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function editInput($table, $field, $attrs, $value) {
|
||||
if (ereg("date|time", $field["type"])) {
|
||||
if (preg_match("~date|time~", $field["type"])) {
|
||||
$dateFormat = "changeYear: true, dateFormat: 'yy-mm-dd'"; //! yy-mm-dd regional
|
||||
$timeFormat = "showSecond: true, timeFormat: 'hh:mm:ss'";
|
||||
return "<input id='fields-" . h($field["field"]) . "' value='" . h($value) . "'" . (+$field["length"] ? " maxlength='" . (+$field["length"]) . "'" : "") . "$attrs><script type='text/javascript'>jQuery('#fields-" . js_escape($field["field"]) . "')."
|
||||
. ($field["type"] == "time" ? "timepicker({ $timeFormat })"
|
||||
: (ereg("time", $field["type"]) ? "datetimepicker({ $dateFormat, $timeFormat })"
|
||||
: (preg_match("~time~", $field["type"]) ? "datetimepicker({ $dateFormat, $timeFormat })"
|
||||
: "datepicker({ $dateFormat })"
|
||||
)) . ";</script>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user