mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-10-30 21:52:00 +01:00
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
This commit is contained in:
1 parent
ff1dc9edad
commit
1ee0d7153c
3 files changed
+57
-3
No files matched your search
+20
-1
@@ -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 = '<span style="text-decoration:underline;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
// replace *word* by a bolded word
|
||||
$pattern = '/\*([^\s]*)\*/';
|
||||
$replacement = '<span style="font-weight:bold;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
// replace /word/ by an italic word
|
||||
$pattern = '/\/([^\s]*)\//';
|
||||
$replacement = '<span style="font-style:italic;">\1</span>';
|
||||
$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;
|
||||
|
||||
+19
-1
@@ -108,7 +108,25 @@ function display_pictures( $mysql_result, $maxtime, $forbidden_cat_ids )
|
||||
$vtp->setVar( $handle, 'comment.author', $author );
|
||||
$displayed_date = format_date( $subrow['date'], 'unix', true );
|
||||
$vtp->setVar( $handle, 'comment.date', $displayed_date );
|
||||
$vtp->setVar( $handle, 'comment.content', nl2br( $subrow['content'] ) );
|
||||
|
||||
$content = nl2br( $subrow['content'] );
|
||||
|
||||
// replace _word_ by an underlined word
|
||||
$pattern = '/_([^\s]*)_/';
|
||||
$replacement = '<span style="text-decoration:underline;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
// replace *word* by a bolded word
|
||||
$pattern = '/\*([^\s]*)\*/';
|
||||
$replacement = '<span style="font-weight:bold;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
// replace /word/ by an italic word
|
||||
$pattern = '/\/([^\s]*)\//';
|
||||
$replacement = '<span style="font-style:italic;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
$vtp->setVar( $handle, 'comment.content', $content );
|
||||
$vtp->closeSession( $handle, 'comment' );
|
||||
}
|
||||
$vtp->closeSession( $handle, 'picture' );
|
||||
|
||||
+18
-1
@@ -683,7 +683,24 @@ if ( $conf['show_comments'] )
|
||||
$vtp->setVar( $handle, 'comment.author', $author );
|
||||
$vtp->setVar( $handle, 'comment.date',
|
||||
format_date( $row['date'], 'unix', true ) );
|
||||
$vtp->setVar( $handle, 'comment.content', nl2br( $row['content'] ) );
|
||||
$content = nl2br( $row['content'] );
|
||||
|
||||
// replace _word_ by an underlined word
|
||||
$pattern = '/_([^\s]*)_/';
|
||||
$replacement = '<span style="text-decoration:underline;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
// replace *word* by a bolded word
|
||||
$pattern = '/\*([^\s]*)\*/';
|
||||
$replacement = '<span style="font-weight:bold;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
// replace /word/ by an italic word
|
||||
$pattern = '/\/([^\s]*)\//';
|
||||
$replacement = '<span style="font-style:italic;">\1</span>';
|
||||
$content = preg_replace( $pattern, $replacement, $content );
|
||||
|
||||
$vtp->setVar( $handle, 'comment.content', $content );
|
||||
if ( $user['status'] == 'admin' )
|
||||
{
|
||||
$vtp->addSession( $handle, 'delete' );
|
||||
|
||||
Reference in new issue
Block a user