From 1ee0d7153c17bb2925707d59f13edd1dbee12ff3 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Sun, 5 Oct 2003 13:43:00 +0000 Subject: Support of special syntax to underline, emphasis or italic words in users comments git-svn-id: http://piwigo.org/svn/trunk@180 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/comments.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'admin/comments.php') diff --git a/admin/comments.php b/admin/comments.php index 9a6a3ba4d..1706897b8 100644 --- a/admin/comments.php +++ b/admin/comments.php @@ -90,7 +90,26 @@ function display_pictures( $mysql_result, $maxtime, $validation_box = false ) $vtp->setVar( $sub, 'comment.author', $author ); $displayed_date = format_date( $subrow['date'], 'unix', true ); $vtp->setVar( $sub, 'comment.date', $displayed_date ); - $vtp->setVar( $sub, 'comment.content', nl2br( $subrow['content'] ) ); + + $content = nl2br( $subrow['content'] ); + + // replace _word_ by an underlined word + $pattern = '/_([^\s]*)_/'; + $replacement = '\1'; + $content = preg_replace( $pattern, $replacement, $content ); + + // replace *word* by a bolded word + $pattern = '/\*([^\s]*)\*/'; + $replacement = '\1'; + $content = preg_replace( $pattern, $replacement, $content ); + + // replace /word/ by an italic word + $pattern = '/\/([^\s]*)\//'; + $replacement = '\1'; + $content = preg_replace( $pattern, $replacement, $content ); + + $vtp->setVar( $sub, 'comment.content', $content ); + $vtp->addSession( $sub, 'delete' ); $url = './admin.php?page=comments'; if ( isset( $_GET['last_days'] ) ) $url.= '&last_days='.MAX_DAYS; -- cgit v1.2.3