diff options
author | mistic100 <mistic@piwigo.org> | 2011-04-06 08:55:40 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2011-04-06 08:55:40 +0000 |
commit | a8b750b8551697dd6f6927dfc2ae9f297d7ed216 (patch) | |
tree | e650685e3c8881cc22612446564ec807bbcf9fc0 /picture.php | |
parent | 5f7328ed5cf6a628e26f62d460980c5d99b83101 (diff) |
bug:2152 Comments revalidation when modified
git-svn-id: http://piwigo.org/svn/trunk@10097 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'picture.php')
-rw-r--r-- | picture.php | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/picture.php b/picture.php index 5e58bba9a..ba3e144df 100644 --- a/picture.php +++ b/picture.php @@ -189,6 +189,8 @@ function default_picture_content($content, $element_info) // | initialization | // +-----------------------------------------------------------------------+ +$infos = array(); + // caching first_rank, last_rank, current_rank in the displayed // section. This should also help in readability. $page['first_rank'] = 0; @@ -331,7 +333,7 @@ UPDATE '.USER_CACHE_CATEGORIES_TABLE.' { if (!empty($_POST['content'])) { - update_user_comment( + $comment_action = update_user_comment( array( 'comment_id' => $_GET['comment_to_edit'], 'image_id' => $page['image_id'], @@ -340,7 +342,27 @@ UPDATE '.USER_CACHE_CATEGORIES_TABLE.' $_POST['key'] ); - redirect($url_self); + switch ($comment_action) + { + case 'moderate': + array_push($infos, l10n('An administrator must authorize your comment before it is visible.')); + case 'validate': + array_push($infos, l10n('Your comment has been registered')); + break; + case 'reject': + set_status_header(403); + array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules')); + break; + default: + trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING); + } + + $template->assign( + ($comment_action=='reject') ? 'errors' : 'infos', + $infos + ); + + break; } else { @@ -834,8 +856,6 @@ if (isset($picture['current']['comment']) ); } -$infos = array(); - // author if (!empty($picture['current']['author'])) { |