1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-18 20:31:19 +02:00

Shorten binary strings

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1011 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-08-25 14:17:58 +00:00
parent e4f5d17eec
commit 95764b0125
2 changed files with 4 additions and 2 deletions

View File

@@ -158,5 +158,5 @@ function dump_headers($identifier, $multi_table = false) {
} }
$dump_output = "<select name='output'>" . optionlist(array('text' => lang('open'), 'file' => lang('save'))) . "</select>"; $dump_output = "<select name='output'>" . optionlist(array('text' => lang('open'), 'file' => lang('save'))) . "</select>";
$dump_output = "<select name='output'>" . optionlist(array('sql' => lang('SQL'), 'csv' => lang('CSV'))) . "</select>"; $dump_format = "<select name='format'>" . optionlist(array('sql' => lang('SQL'), 'csv' => lang('CSV'))) . "</select>";
$max_packet = 1048576; // default, minimum is 1024 $max_packet = 1048576; // default, minimum is 1024

View File

@@ -254,7 +254,9 @@ function is_utf8($val) {
} }
function shorten_utf8($string, $length = 80, $suffix = "") { function shorten_utf8($string, $length = 80, $suffix = "") {
preg_match("~^((?:.|\n){0,$length})(.|\n)?~u", $string, $match); // ~s causes trash in $match[2] under some PHP versions if (!preg_match("~^((?:.|\n){0,$length})(.|\n)?~u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions
preg_match("(^([\t\r\n -~]{0,$length})(.?))s", $string, $match);
}
return h($match[1]) . $suffix . ($match[2] ? "<em>...</em>" : ""); return h($match[1]) . $suffix . ($match[2] ? "<em>...</em>" : "");
} }