Changeset 3409


Ignore:
Timestamp:
Jun 10, 2009, 10:11:28 PM (15 years ago)
Author:
nikrou
Message:

feature 1028 : Allow admin to validate comment from picture page

Location:
trunk
Files:
2 edited

Legend:

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

    r3282 r3409  
    119119  if ($row['nb_comments'] > 0)
    120120  {
     121    if ( !is_admin() )
     122    {
     123      $validated_clause = '  AND validated = \'true\'';
     124    }
     125    else
     126    {
     127      $validated_clause = '';
     128    }
     129
    121130    $query = '
    122 SELECT id,author,date,image_id,content
     131SELECT id,author,date,image_id,content,validated
    123132  FROM '.COMMENTS_TABLE.'
    124   WHERE image_id = '.$page['image_id'].'
    125     AND validated = \'true\'
     133  WHERE image_id = '.$page['image_id'].
     134$validated_clause.'
    126135  ORDER BY date ASC
    127136  LIMIT '.$page['start'].', '.$conf['nb_comment_page'].'
     
    153162                  )
    154163              );
     164        if ($row['validated'] != 'true')
     165        {
     166          $tpl_comment['U_VALIDATE'] =
     167            add_url_params($url_self,
     168                           array('action' => 'validate_comment',
     169                                 'comment_to_validate' => $row['id']
     170                                 )
     171                           );
     172        }
    155173      }
    156174      $template->append('comments', $tpl_comment);
  • trunk/picture.php

    r3282 r3409  
    323323      redirect($url_self);
    324324    }
     325    case 'validate_comment' :
     326    {
     327      if (isset($_GET['comment_to_validate'])
     328          and is_numeric($_GET['comment_to_validate'])
     329          and is_admin() and !is_adviser() )
     330      {
     331        $query = '
     332UPDATE '.COMMENTS_TABLE.'
     333  SET validated = \'true\'
     334  , validation_date = NOW()
     335  WHERE id='.$_GET['comment_to_validate'].'
     336;';
     337        pwg_query( $query );
     338      }
     339      redirect($url_self);
     340    }
     341
    325342  }
    326343}
Note: See TracChangeset for help on using the changeset viewer.