Skip to content

Commit

Permalink
feature 1028 : Allow admin to validate comment from picture page
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@3409 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
nikrou committed Jun 10, 2009
1 parent 0ace045 commit 1e8ae9e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
24 changes: 21 additions & 3 deletions include/picture_comment.inc.php
Expand Up @@ -118,11 +118,20 @@

if ($row['nb_comments'] > 0)
{
if ( !is_admin() )
{
$validated_clause = ' AND validated = \'true\'';
}
else
{
$validated_clause = '';
}

$query = '
SELECT id,author,date,image_id,content
SELECT id,author,date,image_id,content,validated
FROM '.COMMENTS_TABLE.'
WHERE image_id = '.$page['image_id'].'
AND validated = \'true\'
WHERE image_id = '.$page['image_id'].
$validated_clause.'
ORDER BY date ASC
LIMIT '.$page['start'].', '.$conf['nb_comment_page'].'
;';
Expand Down Expand Up @@ -152,6 +161,15 @@
'comment_to_delete'=>$row['id']
)
);
if ($row['validated'] != 'true')
{
$tpl_comment['U_VALIDATE'] =
add_url_params($url_self,
array('action' => 'validate_comment',
'comment_to_validate' => $row['id']
)
);
}
}
$template->append('comments', $tpl_comment);
}
Expand Down
17 changes: 17 additions & 0 deletions picture.php
Expand Up @@ -322,6 +322,23 @@ function default_picture_content($content, $element_info)

redirect($url_self);
}
case 'validate_comment' :
{
if (isset($_GET['comment_to_validate'])
and is_numeric($_GET['comment_to_validate'])
and is_admin() and !is_adviser() )
{
$query = '
UPDATE '.COMMENTS_TABLE.'
SET validated = \'true\'
, validation_date = NOW()
WHERE id='.$_GET['comment_to_validate'].'
;';
pwg_query( $query );
}
redirect($url_self);
}

}
}

Expand Down

0 comments on commit 1e8ae9e

Please sign in to comment.