return (preg_match("~^(https?)://($domain?\\.)+$domain(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string, $match) ? strtolower($match[1]) : ""); //! restrict path, query and fragment characters
}
+/** Check if field should be shortened
+* @param array
+* @return bool
+*/
+function is_shortable($field) {
+ return ereg('char|text|lob|geometry|point|linestring|polygon', $field["type"]);
+}
+
/** Run query which can be killed by AJAX call after timing out
* @param string
* @return Min_Result
$name = $adminer->fieldName($field);
if (isset($field["privileges"]["select"]) && $name != "") {
$columns[$key] = html_entity_decode(strip_tags($name));
- if (ereg('text|lob|geometry|point|linestring|polygon', $field["type"])) {
+ if (is_shortable($field)) {
$text_length = $adminer->selectLengthProcess();
}
}
if ($val === "") { // === - may be int
$val = " ";
} elseif (is_utf8($val)) {
- if ($text_length != "" && ereg('text|lob|geometry|point|linestring|polygon', $field["type"])) {
+ if ($text_length != "" && is_shortable($field)) {
$val = shorten_utf8($val, max(0, +$text_length)); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network
} else {
$val = h($val);