aboutsummaryrefslogtreecommitdiffstats
path: root/comments.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-05-20 21:22:44 +0000
committerz0rglub <z0rglub@piwigo.org>2004-05-20 21:22:44 +0000
commit8db124da81b8f90d6622ae8086ff57010a996355 (patch)
tree4b0b5eceb204eea75d017a2fd895bd752915b691 /comments.php
parent396d68275d6fe79ffdf07a378d7e46ebe60bcc7b (diff)
field comments.date becomes a datetime MySQL field type (instead of int)
git-svn-id: http://piwigo.org/svn/trunk@420 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--comments.php45
1 files changed, 25 insertions, 20 deletions
diff --git a/comments.php b/comments.php
index 1ae42749f..f829e44d7 100644
--- a/comments.php
+++ b/comments.php
@@ -91,13 +91,16 @@ $template->assign_vars(array(
);
foreach ( $conf['last_days'] as $option ) {
- $url = $PHP_SELF.'?last_days='.($option - 1);
+ $url = $_SERVER['PHP_SELF'].'?last_days='.($option - 1);
if (defined('IN_ADMIN')) $url.= '&amp;page=comments';
- $template->assign_block_vars('last_day_option', array (
- 'OPTION'=>$option,
- 'T_STYLE'=>(( $option == MAX_DAYS + 1 )?'text-decoration:underline;':''),
- 'U_OPTION'=>add_session_id( $url )
- ));
+ $template->assign_block_vars(
+ 'last_day_option',
+ array(
+ 'OPTION'=>$option,
+ 'T_STYLE'=>(( $option == MAX_DAYS + 1 )?'text-decoration:underline;':''),
+ 'U_OPTION'=>add_session_id( $url )
+ )
+ );
}
// 1. retrieving picture ids which have comments recently added
@@ -109,7 +112,7 @@ $query.= '(ic.category_id) as category_id';
$query.= ' FROM '.COMMENTS_TABLE.' AS c';
$query.= ', '.IMAGE_CATEGORY_TABLE.' AS ic';
$query.= ' WHERE c.image_id = ic.image_id';
-$query.= ' AND date > '.$maxtime;
+$query.= ' AND date > FROM_UNIXTIME('.$maxtime.')';
if ( $user['status'] != 'admin' )
{
$query.= " AND validated = 'true'";
@@ -173,7 +176,7 @@ while ( $row = mysql_fetch_array( $result ) )
// for each picture, retrieving all comments
$query = 'SELECT * FROM '.COMMENTS_TABLE;
$query.= ' WHERE image_id = '.$row['image_id'];
- $query.= ' AND date > '.$maxtime;
+ $query.= ' AND date > FROM_UNIXTIME('.$maxtime.')';
if ( $user['status'] != 'admin' )
{
$query.= " AND validated = 'true'";
@@ -201,18 +204,20 @@ while ( $row = mysql_fetch_array( $result ) )
$pattern = '/\/([^\s]*)\//';
$replacement = '<span style="font-style:italic;">\1</span>';
$content = preg_replace( $pattern, $replacement, $content );
- $template->assign_block_vars('picture.comment',array(
- 'COMMENT_AUTHOR'=>$author,
- 'COMMENT_DATE'=>format_date( $subrow['date'], 'unix', true ),
- 'COMMENT'=>$content,
- ));
- if ( $user['status'] == 'admin' )
- {
- $template->assign_block_vars('picture.comment.validation', array(
- 'ID'=> $subrow['id'],
- 'CHECKED'=>($subrow['validated']=='false')?'checked="checked"': ''
- ));
- }
+ $template->assign_block_vars(
+ 'picture.comment',array(
+ 'COMMENT_AUTHOR'=>$author,
+ 'COMMENT_DATE'=>format_date( $subrow['date'],'mysql_datetime',true ),
+ 'COMMENT'=>$content,
+ ));
+ if ( $user['status'] == 'admin' )
+ {
+ $template->assign_block_vars(
+ 'picture.comment.validation', array(
+ 'ID'=> $subrow['id'],
+ 'CHECKED'=>($subrow['validated']=='false')?'checked="checked"': ''
+ ));
+ }
}
}
//----------------------------------------------------------- html code display