aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-05-25 17:13:25 +0000
committerRomain d'Alverny <rda@mageia.org>2011-05-25 17:13:25 +0000
commitd13c45929b75b1ed1475c4bad820db0750df32bb (patch)
tree886f5bffe08f55f5dbc05ed74bb83324c4859d07 /index.php
parent94825c88a04d5a1822d1d7d845bcb066ab6bedae (diff)
downloadhugs-d13c45929b75b1ed1475c4bad820db0750df32bb.tar
hugs-d13c45929b75b1ed1475c4bad820db0750df32bb.tar.gz
hugs-d13c45929b75b1ed1475c4bad820db0750df32bb.tar.bz2
hugs-d13c45929b75b1ed1475c4bad820db0750df32bb.tar.xz
hugs-d13c45929b75b1ed1475c4bad820db0750df32bb.zip
link URLs in comments
Diffstat (limited to 'index.php')
-rw-r--r--index.php8
1 files 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('<figcaption id="hicomment">%s</figcaption>',
- nl2br($exif['COMMENT'][0]));
+ nl2br(preg_replace('`((?:https?|ftp)://\S+[[:alnum:]]/?)`si',
+ '<a href="$1" rel="nofollow">$1</a>',
+ trim($exif['COMMENT'][0]))));
}
$out = sprintf('<figure>%s</figure>', $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; }