From: Christian Weiske Date: Mon, 4 Jan 2016 16:09:24 +0000 (+0100) Subject: shorten escaping code X-Git-Url: https://git.cweiske.de/noxon-gateway.git/commitdiff_plain/c2f92936e31182abf0034abedf58b343c72eccfe shorten escaping code --- diff --git a/www/index.php b/www/index.php index 1670931..a81f774 100644 --- a/www/index.php +++ b/www/index.php @@ -161,7 +161,7 @@ function getDisplayItem($line) $line = preg_replace('#\s+#', ' ', $line); return '' . 'Display' - . '' . utf8_decode(htmlspecialchars($line)) . '' + . '' . nox_esc($line) . '' . ''; } @@ -170,9 +170,9 @@ function getDirItem($title, $urlPath) global $host1, $host2; return '' . 'Dir' - . '' . utf8_decode(htmlspecialchars($title)) . '' - . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' - . '' . $host2 . utf8_decode(htmlspecialchars($urlPath)) . '' + . '' . nox_esc($title) . '' + . '' . $host1 . nox_esc($urlPath) . '' + . '' . $host2 . nox_esc($urlPath) . '' . ''; } @@ -180,9 +180,9 @@ function getEpisodeItem($title, $fullUrl, $desc, $type) { return '' . 'ShowEpisode' - . '' . utf8_decode(htmlspecialchars($title)) . '' + . '' . nox_esc($title) . '' . '' . htmlspecialchars($fullUrl) . '' - . '' . utf8_decode(htmlspecialchars($desc)) . '' + . '' . nox_esc($desc) . '' . '' . $type . '' . ''; } @@ -192,8 +192,8 @@ function getPodcastItem($title, $urlPath) global $host1; return '' . 'ShowOnDemand' - . '' . utf8_decode(htmlspecialchars($title)) . '' - . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' + . '' . nox_esc($title) . '' + . '' . $host1 . nox_esc($urlPath) . '' . ''; } @@ -201,7 +201,7 @@ function getMessageItem($msg) { return '' . 'Message' - . '' . utf8_decode(htmlspecialchars($msg)) . '' + . '' . nox_esc($msg) . '' . ''; } @@ -210,8 +210,8 @@ function getPreviousItem($urlPath) global $host1, $host2; return '' . 'Previous' - . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' - . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' + . '' . $host1 . nox_esc($urlPath) . '' + . '' . $host1 . nox_esc($urlPath) . '' . ''; } @@ -224,6 +224,11 @@ function addPreviousItem(&$listItems, $urlPath) $listItems[] = getPreviousItem($parentDir); } +function nox_esc($string) +{ + return utf8_decode(htmlspecialchars($string)); +} + function sendMessage($msg) { sendListItems(array(getMessageItem($msg)));