The images you can get them from here: wget www.chakra-project.org/temp/manutortosa/smilies.tar.gz or use your own, those are licemsed under gpl2 and are exactly the same you've in your forums.
Best Regards.
From 0765c7f430b982c2fe994c9fc1953669eb3de071 Mon Sep 17 00:00:00 2001 From: Manuel Tortosa <[email protected]> Date: Sun, 3 Oct 2010 12:27:28 +0200 Subject: [PATCH 2/2] Add smilies to comments --- web/lib/pkgfuncs.inc | 14 ++++++++++++++ web/template/pkg_comments.php | 2 +- 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 5605daa..1289b79 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -240,6 +240,20 @@ function package_comments($pkgid = 0) { return $comments; } +# Substitute text by Smilies +function comments_smilies($comments) +{ + // Smilies + $smiley_text = array(':)', '=)', ':|', '=|', ':(', '=(', ':D', '=D', ':o', ':O', ';)', ':/', ':P'); + $smiley_img = array('smile.png', 'smile.png', 'neutral.png', 'neutral.png', 'sad.png', 'sad.png', 'big_smile.png', 'big_smile.png', 'yikes.png', 'yikes.png', 'wink.png', 'hmm.png', 'tongue.png'); + + $comments = ' '.$comments.' '; + $num_smilies = count($smiley_text); + for ($i = 0; $i < $num_smilies; ++$i) + $text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="images/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $comments); + return substr($comments, 1, -1); +} + # grab package sources # function package_sources($pkgid=0) { diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index 02171a0..27ae43a 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -20,7 +20,7 @@ while (list($indx, $carr) = each($comments)) { ?> ?></div> <blockquote class="comment-body"> <div> -<?php echo nl2br(htmlspecialchars($carr['Comments'])) ?> +<?php echo nl2br(htmlspecialchars(comments_smilies($carr['Comments']))) ?> </div> </blockquote> <?php -- 1.7.1
