Ignore:
Timestamp:
11/11/11 14:57:12 (8 years ago)
Author:
mistic100
Message:

some more modifications for Subscribe_to_comments

Location:
extensions/Comments_on_Albums/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/Comments_on_Albums/include/coa_admin_comments.php

    r11874 r12601  
    4646    else 
    4747    { 
     48      include_once(COA_PATH.'include/functions_comment.inc.php'); 
    4849      check_input_parameter('comments', $_POST, true, PATTERN_ID); 
    4950 
    5051      if (isset($_POST['validate_albums']))  
    5152      { 
    52         $query = ' 
    53 UPDATE '.COA_TABLE.'  
    54   SET validated = \'true\', 
    55       validation_date = NOW() 
    56   WHERE id IN ('.implode(',', $_POST['comments']).') 
    57 ;'; 
    58         pwg_query($query); 
     53        validate_user_comment_albums($_POST['comments']); 
    5954 
    6055        array_push( 
     
    6964      if (isset($_POST['reject_albums']))  
    7065      { 
    71         $query = ' 
    72 DELETE  
    73   FROM '.COA_TABLE.' 
    74   WHERE id IN ('.implode(',', $_POST['comments']).') 
    75 ;'; 
    76         pwg_query($query); 
     66        delete_user_comment_albums($_POST['comments']); 
    7767 
    7868        array_push( 
  • extensions/Comments_on_Albums/include/coa_albums.php

    r12562 r12601  
    361361  { 
    362362    $replacement = ' 
    363 {if isset($errors)} 
     363{if !empty($errors)} 
    364364<div class="errors"> 
    365365  <ul> 
     
    370370</div> 
    371371{/if} 
    372 {if isset($infos)} 
     372{if !empty($infos)} 
    373373<div class="infos"> 
    374374  <ul> 
     
    380380{/if}'; 
    381381 
    382     return $replacement.$content; 
     382    return str_replace('{$MENUBAR}', $replacement.'{$MENUBAR}', $content); 
    383383  } 
    384384} 
  • extensions/Comments_on_Albums/include/functions_comment.inc.php

    r12562 r12601  
    195195    $user_where_clause = '   AND author_id = \''.$GLOBALS['user']['id'].'\''; 
    196196  } 
     197   
     198  if (is_array($comment_id)) 
     199    $where_clause = 'id IN('.implode(',', $comment_id).')'; 
     200  else 
     201    $where_clause = 'id = '.$comment_id; 
     202   
    197203  $query = ' 
    198204DELETE FROM '.COA_TABLE.' 
    199   WHERE id = '.$comment_id. 
     205  WHERE '.$where_clause. 
    200206$user_where_clause.' 
    201207;'; 
    202208  $result = pwg_query($query); 
    203   if ($result) { 
     209   
     210  if ($result)  
     211  { 
    204212    email_admin('delete',  
    205213                array('author' => $GLOBALS['user']['username'], 
     
    366374} 
    367375 
     376/** 
     377 * Tries to validate a user comment in the database 
     378 * @param int or array of int comment_id 
     379 */ 
    368380function validate_user_comment_albums($comment_id) 
    369381{ 
     382  if (is_array($comment_id)) 
     383    $where_clause = 'id IN('.implode(',', $comment_id).')'; 
     384  else 
     385    $where_clause = 'id = '.$comment_id; 
     386     
    370387  $query = ' 
    371388UPDATE '.COA_TABLE.' 
    372389  SET validated = \'true\' 
    373390    , validation_date = NOW() 
    374   WHERE id = '.$comment_id.' 
     391  WHERE '.$where_clause.' 
    375392;'; 
    376393  pwg_query($query); 
Note: See TracChangeset for help on using the changeset viewer.