From d13c45929b75b1ed1475c4bad820db0750df32bb Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Wed, 25 May 2011 17:13:25 +0000 Subject: link URLs in comments --- index.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index b5e9f1e..14f2883 100644 --- a/index.php +++ b/index.php @@ -15,6 +15,8 @@ * @link http://svnweb.mageia.org/svn/web/hugs/ */ +header('Content-Type: text/html; charset=utf-8'); + $app_root = realpath(dirname(__FILE__)); $images = glob(sprintf('%s/var/hugs/*.jpg', $app_root)); @@ -31,7 +33,9 @@ if (count($images) > 0) { && isset($exif['COMMENT'])) { $out .= sprintf('
%s
', - nl2br($exif['COMMENT'][0])); + nl2br(preg_replace('`((?:https?|ftp)://\S+[[:alnum:]]/?)`si', + '$1', + trim($exif['COMMENT'][0])))); } $out = sprintf('
%s
', $out); @@ -75,7 +79,7 @@ if (count($images) > 0) { #hi.flipped { -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); } #hi p { padding: 2em; } #hicomment { width: 342px; padding: 1em 4px; color: #cccccc; font-size: 70%; font-family: Verdana, Arial; } - #hicomment a { color: #aaaaaa; } + #hicomment a { color: #bbbbbb; } p { font-family: "Trebuchet MS"; font-size: 90%; color: #222; } section { float: left; margin-left: 20px; } aside { float: left; text-align: left; margin-left: 60px; width: 350px; display: block; } -- cgit v1.2.1