Changeset 10122 for trunk/include


Ignore:
Timestamp:
Apr 6, 2011, 9:24:30 PM (13 years ago)
Author:
mistic100
Message:

bug:2152 no special parameter for updated comment validation

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_comment.inc.php

    r10097 r10122  
    266266   
    267267    // should the updated comment must be validated
    268     if (!$conf['comments_update_validation'] or is_admin())
     268    if (!$conf['comments_validation'] or is_admin())
    269269    {
    270270      $comment_action='validate'; //one of validate, moderate, reject
  • trunk/include/picture_comment.inc.php

    r10097 r10122  
    3939}
    4040
    41 if (!isset($comment_action))
    42 {
    43   if ( $page['show_comments'] and isset( $_POST['content'] ) )
    44   {
    45     if ( is_a_guest() and !$conf['comments_forall'] )
    46     {
    47       die ('Session expired');
    48     }
    49 
    50     $comm = array(
    51       'author' => trim( @$_POST['author'] ),
    52       'content' => trim( $_POST['content'] ),
    53       'image_id' => $page['image_id'],
    54      );
    55 
    56     include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    57 
    58     $comment_action = insert_user_comment($comm, @$_POST['key'], $infos );
    59 
    60     switch ($comment_action)
    61     {
    62       case 'moderate':
    63         array_push( $infos, l10n('An administrator must authorize your comment before it is visible.') );
    64       case 'validate':
    65         array_push( $infos, l10n('Your comment has been registered'));
    66         break;
    67       case 'reject':
    68         set_status_header(403);
    69         array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules') );
    70         break;
    71       default:
    72         trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
    73     }
    74 
    75     $template->assign(
    76         ($comment_action=='reject') ? 'errors' : 'infos',
    77         $infos
    78       );
    79 
    80     // allow plugins to notify what's going on
    81     trigger_action( 'user_comment_insertion',
    82         array_merge($comm, array('action'=>$comment_action) )
    83       );
    84   }
    85   elseif ( isset($_POST['content']) )
    86   {
    87     set_status_header(403);
    88     die('ugly spammer');
    89   }
     41if ( $page['show_comments'] and isset( $_POST['content'] ) )
     42{
     43  if ( is_a_guest() and !$conf['comments_forall'] )
     44  {
     45    die ('Session expired');
     46  }
     47
     48  $comm = array(
     49    'author' => trim( @$_POST['author'] ),
     50    'content' => trim( $_POST['content'] ),
     51    'image_id' => $page['image_id'],
     52   );
     53
     54  include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
     55
     56  $comment_action = insert_user_comment($comm, @$_POST['key'], $infos );
     57
     58  switch ($comment_action)
     59  {
     60    case 'moderate':
     61      array_push( $infos, l10n('An administrator must authorize your comment before it is visible.') );
     62    case 'validate':
     63      array_push( $infos, l10n('Your comment has been registered'));
     64      break;
     65    case 'reject':
     66      set_status_header(403);
     67      array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules') );
     68      break;
     69    default:
     70      trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
     71  }
     72
     73  $template->assign(
     74      ($comment_action=='reject') ? 'errors' : 'infos',
     75      $infos
     76    );
     77
     78  // allow plugins to notify what's going on
     79  trigger_action( 'user_comment_insertion',
     80      array_merge($comm, array('action'=>$comment_action) )
     81    );
     82}
     83elseif ( isset($_POST['content']) )
     84{
     85  set_status_header(403);
     86  die('ugly spammer');
    9087}
    9188
Note: See TracChangeset for help on using the changeset viewer.