Minor gui fixes

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2021-05-02 08:19:09 +02:00
parent a8f037c3e9
commit dacb7c85aa
2 changed files with 34 additions and 5 deletions

View File

@ -1,5 +1,10 @@
<?php
unction H($s = '') {
print htmlentities($s);
}
function LOGGER($event = '', $username = '') {
$ipaddr = '';
@ -493,7 +498,31 @@ function fixup_date_condition($field = '', $date1 = 0, $date2 = 0) {
function make_short_string($what, $length) {
return strlen($what) > $length ? substr($what, 0, $length) . "..." : $what;
if($length < 1) { return ''; }
if(strlen($what) <= $length) { return $what; }
$arr = preg_split("/\s/", $what);
$s = '';
$i = 0;
foreach($arr as $a) {
if($i == 0) {
if($length > 0 && strlen($a) > $length) {
return substr($a, 0, $length) . '...';
}
}
if(strlen($s) + strlen($a) <= $length) {
$s .= $a . ' ';
} else {
break;
}
$i++;
}
return $s . '...';
}

View File

@ -135,7 +135,7 @@
&nbsp;
<?php if(Registry::get('auditor_user') == 1 && $session->get("sphx_query")) { ?>
<span style="margin-left: 30px;"><a href="#" onclick="Piler.show_message('messagebox1', '<?php print $session->get("sphx_query"); ?>', 5);">sphinx</a></span>
<span style="margin-left: 30px;"><a href="#" onclick="Piler.show_message('messagebox1', '<?php H($session->get("sphx_query")); ?>', 5);">sphinx</a></span>
<?php } ?>
<?php } else { print $text_none_found; } ?>