Mercurial > hg > mgallery
changeset 200:39f50d08ec50
Fix quoting of image element alt texts.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 19 Mar 2018 15:42:15 +0200 |
parents | d03fad24f4bc |
children | 7b08e19f5a0e |
files | mgallery.php |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mgallery.php Mon Mar 19 15:29:54 2018 +0200 +++ b/mgallery.php Mon Mar 19 15:42:15 2018 +0200 @@ -103,6 +103,12 @@ } +function dhentities($str) +{ + return htmlentities($str, ENT_COMPAT, "UTF-8"); +} + + function mgMangleURI($filename) { global $pageDebug; @@ -276,7 +282,7 @@ " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data). "\"><a href=\"".mgGetURL($galPath, $filename)."\"><img src=\"". mgGetImageURL($galTNPath, $filename). - "\" alt=\"".chentities($filename)."\"></a></div>\n". + "\" alt=\"".dhentities($filename)."\"></a></div>\n". mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities"); /* if ($mode == "") @@ -319,7 +325,7 @@ echo " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">". "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"". - mgGetTrans($data["caption"], TRUE). + dhentities(mgGetTrans($data["caption"], TRUE)). "\" />\n". " <div class=\"albumTitle\">".mgGetTrans($data["caption"], TRUE)."</div></a>\n"; }