Dotclear

Changeset 1052:de274bbd7b80 for inc/core


Ignore:
Timestamp:
12/03/12 14:14:58 (13 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Cope with junk comments without antispam plugin enabled (addresses #903)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.blog.php

    r1042 r1052  
    22152215          $this->triggerBlog(); 
    22162216     } 
     2217 
     2218     public function delJunkComments() 
     2219     { 
     2220          if (!$this->core->auth->check('delete,contentadmin',$this->id)) { 
     2221               throw new Exception(__('You are not allowed to delete comments')); 
     2222          } 
     2223           
     2224          # mySQL uses "INNER JOIN" synthax 
     2225          if ($this->con->driver() == 'mysql') { 
     2226               $strReq =  
     2227                    'DELETE FROM tc '. 
     2228                    'USING '.$this->prefix.'comment tc '. 
     2229                    'INNER JOIN '.$this->prefix.'post tp '; 
     2230          } 
     2231          # pgSQL uses nothing special 
     2232          else { 
     2233               $strReq =  
     2234                    'DELETE FROM '.$this->prefix.'comment tc '. 
     2235                    'USING '.$this->prefix.'post tp '; 
     2236          } 
     2237           
     2238          $strReq .=  
     2239               'WHERE tc.post_id = tp.post_id '. 
     2240               "AND tp.blog_id = '".$this->con->escape($this->id)."' ". 
     2241               'AND comment_status = -2'; 
     2242           
     2243          #If user can only delete, we need to check the post's owner 
     2244          if (!$this->core->auth->check('contentadmin',$this->id)) 
     2245          { 
     2246               $strReq .=  
     2247                    "AND user_id = '".$this->con->escape($this->core->auth->userID())."' "; 
     2248          } 
     2249           
     2250          $this->con->execute($strReq); 
     2251          $this->triggerBlog(); 
     2252     } 
    22172253      
    22182254     private function getCommentCursor($cur) 
Note: See TracChangeset for help on using the changeset viewer.

Sites map