$edit_functions = array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only
array(
"char" => "md5/sha1/password/encrypt/uuid", //! JavaScript for disabling maxlength
+ "binary" => "md5/sha1/hex",
"date|time" => "now",
), array(
"int|float|double|decimal" => "+/-",
* @return string
*/
function selectVal($val, $link, $field) {
- $return = ($val != "<i>NULL</i>" && $field["type"] == "char" ? "<code>$val</code>" : $val);
- if (ereg('binary|blob|bytea|raw|file', $field["type"]) && !is_utf8($val)) {
+ $return = ($val != "<i>NULL</i>" && ereg("^char|binary", $field["type"]) ? "<code>$val</code>" : $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 ($link ? "<a href='$link'>$return</a>" : $return);
* @return string
*/
function editVal($val, $field) {
- return $val;
+ return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val);
}
/** Print columns box in select
$return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
} elseif (ereg('^(addtime|subtime|concat)$', $function)) {
$return = "$function(" . idf_escape($name) . ", $return)";
- } elseif (ereg('^(md5|sha1|password|encrypt)$', $function)) {
+ } elseif (ereg('^(md5|sha1|password|encrypt|hex)$', $function)) {
$return = "$function($return)";
}
+ if (ereg("binary", $field["type"])) {
+ $return = "unhex($return)";
+ }
return $return;
}
$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>';
}
- } 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>";
} 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
} else {
// 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));
- echo "<input value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char', $field["type"]) && $field["length"] > 20 ? " size='40'" : "") . "$attrs>";
+ $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|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>";
}
}
}
if ($field["type"] == "set") {
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");
if (!is_string($file)) {
return false; //! report errors
if (!isset($val)) {
$val = "<i>NULL</i>";
} 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);
}
if ($val == "") {
Allow permanent login without customization
In-place editation in select
Foreign key options in Table creation
+Treat binary type as hex
Show number of tables in server overview
Operator LIKE %%
Remember export parameters in cookie
Display comment in table overview
Link last page above data in select
Link table names in SQL queries
-Japanese translation
+Japanese and Tamil translation
Defer table information in database overview to JavaScript (performance)
Big tables optimizations (performance)