Treat binary type as hex
This commit is contained in:
parent
4af4018a06
commit
5a73c01212
|
@ -915,6 +915,7 @@ if (!defined("DRIVER")) {
|
||||||
$edit_functions = array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only
|
$edit_functions = array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only
|
||||||
array(
|
array(
|
||||||
"char" => "md5/sha1/password/encrypt/uuid", //! JavaScript for disabling maxlength
|
"char" => "md5/sha1/password/encrypt/uuid", //! JavaScript for disabling maxlength
|
||||||
|
"binary" => "md5/sha1/hex",
|
||||||
"date|time" => "now",
|
"date|time" => "now",
|
||||||
), array(
|
), array(
|
||||||
"int|float|double|decimal" => "+/-",
|
"int|float|double|decimal" => "+/-",
|
||||||
|
|
|
@ -150,8 +150,8 @@ document.getElementById('username').focus();
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function selectVal($val, $link, $field) {
|
function selectVal($val, $link, $field) {
|
||||||
$return = ($val != "<i>NULL</i>" && $field["type"] == "char" ? "<code>$val</code>" : $val);
|
$return = ($val != "<i>NULL</i>" && ereg("^char|binary", $field["type"]) ? "<code>$val</code>" : $val);
|
||||||
if (ereg('binary|blob|bytea|raw|file', $field["type"]) && !is_utf8($val)) {
|
if (ereg('blob|bytea|raw|file', $field["type"]) && !is_utf8($val)) {
|
||||||
$return = lang('%d byte(s)', strlen(html_entity_decode($val, ENT_QUOTES)));
|
$return = lang('%d byte(s)', strlen(html_entity_decode($val, ENT_QUOTES)));
|
||||||
}
|
}
|
||||||
return ($link ? "<a href='$link'>$return</a>" : $return);
|
return ($link ? "<a href='$link'>$return</a>" : $return);
|
||||||
|
@ -163,7 +163,7 @@ document.getElementById('username').focus();
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function editVal($val, $field) {
|
function editVal($val, $field) {
|
||||||
return $val;
|
return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print columns box in select
|
/** Print columns box in select
|
||||||
|
@ -449,9 +449,12 @@ document.getElementById('username').focus();
|
||||||
$return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
|
$return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
|
||||||
} elseif (ereg('^(addtime|subtime|concat)$', $function)) {
|
} elseif (ereg('^(addtime|subtime|concat)$', $function)) {
|
||||||
$return = "$function(" . idf_escape($name) . ", $return)";
|
$return = "$function(" . idf_escape($name) . ", $return)";
|
||||||
} elseif (ereg('^(md5|sha1|password|encrypt)$', $function)) {
|
} elseif (ereg('^(md5|sha1|password|encrypt|hex)$', $function)) {
|
||||||
$return = "$function($return)";
|
$return = "$function($return)";
|
||||||
}
|
}
|
||||||
|
if (ereg("binary", $field["type"])) {
|
||||||
|
$return = "unhex($return)";
|
||||||
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -573,14 +573,14 @@ function input($field, $value, $function) {
|
||||||
$checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
|
$checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
|
||||||
echo " <label><input type='checkbox' name='fields[$name][$i]' value='" . (1 << $i) . "'" . ($checked ? ' checked' : '') . "$onchange>" . h($val) . '</label>';
|
echo " <label><input type='checkbox' name='fields[$name][$i]' value='" . (1 << $i) . "'" . ($checked ? ' checked' : '') . "$onchange>" . h($val) . '</label>';
|
||||||
}
|
}
|
||||||
} elseif (ereg('binary|blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) {
|
} elseif (ereg('blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) {
|
||||||
echo "<input type='file' name='fields-$name'$onchange>";
|
echo "<input type='file' name='fields-$name'$onchange>";
|
||||||
} elseif (ereg('text|lob', $field["type"])) {
|
} elseif (ereg('text|lob', $field["type"])) {
|
||||||
echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs>" . h($value) . '</textarea>'; // 1.2em - line-height
|
echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs>" . h($value) . '</textarea>'; // 1.2em - line-height
|
||||||
} else {
|
} else {
|
||||||
// int(3) is only a display hint
|
// int(3) is only a display hint
|
||||||
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ($match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
|
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
|
||||||
echo "<input value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char', $field["type"]) && $field["length"] > 20 ? " size='40'" : "") . "$attrs>";
|
echo "<input value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -615,7 +615,7 @@ function process_input($field) {
|
||||||
if ($field["type"] == "set") {
|
if ($field["type"] == "set") {
|
||||||
return array_sum((array) $value);
|
return array_sum((array) $value);
|
||||||
}
|
}
|
||||||
if (ereg('binary|blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) {
|
if (ereg('blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) {
|
||||||
$file = get_file("fields-$idf");
|
$file = get_file("fields-$idf");
|
||||||
if (!is_string($file)) {
|
if (!is_string($file)) {
|
||||||
return false; //! report errors
|
return false; //! report errors
|
||||||
|
|
|
@ -286,7 +286,7 @@ if (!$columns) {
|
||||||
if (!isset($val)) {
|
if (!isset($val)) {
|
||||||
$val = "<i>NULL</i>";
|
$val = "<i>NULL</i>";
|
||||||
} else {
|
} else {
|
||||||
if (ereg('binary|blob|bytea|raw|file', $field["type"]) && $val != "") {
|
if (ereg('blob|bytea|raw|file', $field["type"]) && $val != "") {
|
||||||
$link = h(ME . 'download=' . urlencode($TABLE) . '&field=' . urlencode($key) . $unique_idf);
|
$link = h(ME . 'download=' . urlencode($TABLE) . '&field=' . urlencode($key) . $unique_idf);
|
||||||
}
|
}
|
||||||
if ($val == "") {
|
if ($val == "") {
|
||||||
|
|
|
@ -4,6 +4,7 @@ Allow concurrent logins on the same server
|
||||||
Allow permanent login without customization
|
Allow permanent login without customization
|
||||||
In-place editation in select
|
In-place editation in select
|
||||||
Foreign key options in Table creation
|
Foreign key options in Table creation
|
||||||
|
Treat binary type as hex
|
||||||
Show number of tables in server overview
|
Show number of tables in server overview
|
||||||
Operator LIKE %%
|
Operator LIKE %%
|
||||||
Remember export parameters in cookie
|
Remember export parameters in cookie
|
||||||
|
@ -19,7 +20,7 @@ Ability to jump to any page in select by JavaScript
|
||||||
Display comment in table overview
|
Display comment in table overview
|
||||||
Link last page above data in select
|
Link last page above data in select
|
||||||
Link table names in SQL queries
|
Link table names in SQL queries
|
||||||
Japanese translation
|
Japanese and Tamil translation
|
||||||
Defer table information in database overview to JavaScript (performance)
|
Defer table information in database overview to JavaScript (performance)
|
||||||
Big tables optimizations (performance)
|
Big tables optimizations (performance)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue