From f8331ce8dd92edf1eeefb290e937ce83d1673874 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Sat, 30 May 2015 16:37:47 +0200 Subject: [PATCH] Fixed issue when truncating UTF-8 strings, fallback to old way if extension is not loaded. --- html/includes/table/devices.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/html/includes/table/devices.inc.php b/html/includes/table/devices.inc.php index 02c2b925e..e89e0b6db 100644 --- a/html/includes/table/devices.inc.php +++ b/html/includes/table/devices.inc.php @@ -155,7 +155,12 @@ foreach (dbFetchRows($sql, $param) as $device) { $hostname = generate_device_link($device); $platform = $device['hardware'] . '
' . $device['features']; $os = $device['os_text'] . '
' . $device['version']; - $uptime = formatUptime($device['uptime'], 'short') . '
' . truncate($device['location'],32, ''); + if (extension_loaded('mbstring')) { + $location = mb_substr($device['location'], 0, 32, 'utf8'); + } else { + $location = truncate($device['location'], 32, ''); + } + $uptime = formatUptime($device['uptime'], 'short') . '
' . $location; if ($subformat == "detail") { $hostname .= '
' . $device['sysName']; if ($port_count) {