Dotclear

Changeset 2628:a46041c31f11


Ignore:
Timestamp:
01/03/14 08:39:19 (10 years ago)
Author:
Dsls
Branch:
default
Parents:
2617:5117532eb684 (diff), 2627:9d1adf085d11 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with 2.6

Files:
2 edited

Legend:

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

    r2567 r2628  
    22042204 
    22052205          $strReq = 
    2206                'UPDATE '.$this->prefix.'comment tc '; 
    2207  
    2208           # mySQL uses "JOIN" synthax 
    2209           if ($this->con->driver() == 'mysql' || $this->con->driver() == 'mysqli') { 
    2210                $strReq .= 
    2211                     'JOIN '.$this->prefix.'post tp ON tc.post_id = tp.post_id '; 
    2212           } 
    2213  
     2206               'UPDATE '.$this->prefix.'comment '. 
     2207               'SET comment_status = '.$status.' '; 
    22142208          $strReq .= 
    2215                'SET comment_status = '.$status.' '; 
    2216  
    2217           # pgSQL uses "FROM" synthax 
    2218           if ($this->con->driver() != 'mysql' && $this->con->driver() != 'mysqli') { 
    2219                $strReq .= 
    2220                     'FROM '.$this->prefix.'post tp '; 
    2221           } 
    2222  
    2223           $strReq .= 
    2224                "WHERE blog_id = '".$this->con->escape($this->id)."' ". 
    2225                'AND comment_id'.$this->con->in($co_ids); 
    2226  
    2227           # add pgSQL "WHERE" clause 
    2228           if ($this->con->driver() != 'mysql' && $this->con->driver() != 'mysqli') { 
    2229                $strReq .= 
    2230                     'AND tc.post_id = tp.post_id '; 
    2231           } 
    2232  
    2233           #If user is only usage, we need to check the post's owner 
     2209               'WHERE comment_id'.$this->con->in($co_ids). 
     2210               'AND post_id in (SELECT tp.post_id '. 
     2211               'FROM '.$this->prefix.'post tp '. 
     2212               "WHERE tp.blog_id = '".$this->con->escape($this->id)."' "; 
    22342213          if (!$this->core->auth->check('contentadmin',$this->id)) 
    22352214          { 
     
    22372216                    "AND user_id = '".$this->con->escape($this->core->auth->userID())."' "; 
    22382217          } 
    2239  
     2218          $strReq .= ')'; 
    22402219          $this->con->execute($strReq); 
    22412220          $this->triggerComments($co_ids); 
     
    22842263          } 
    22852264 
    2286           # mySQL uses "INNER JOIN" synthax 
    2287           if ($this->con->driver() == 'mysql' || $this->con->driver() == 'mysqli') { 
    2288                $strReq = 
    2289                     'DELETE FROM tc '. 
    2290                     'USING '.$this->prefix.'comment tc '. 
    2291                     'INNER JOIN '.$this->prefix.'post tp '; 
    2292           } 
    2293           # pgSQL uses nothing special 
    2294           else { 
    2295                $strReq = 
    2296                     'DELETE FROM '.$this->prefix.'comment tc '. 
    2297                     'USING '.$this->prefix.'post tp '; 
    2298           } 
    2299  
    2300           $strReq .= 
    2301                'WHERE tc.post_id = tp.post_id '. 
    2302                "AND tp.blog_id = '".$this->con->escape($this->id)."' ". 
    2303                'AND comment_id'.$this->con->in($co_ids); 
    2304  
     2265          $strReq = 
     2266               'DELETE FROM '.$this->prefix.'comment '. 
     2267               'WHERE comment_id'.$this->con->in($co_ids).' '. 
     2268               'AND post_id in (SELECT tp.post_id '. 
     2269               'FROM '.$this->prefix.'post tp '. 
     2270               "WHERE tp.blog_id = '".$this->con->escape($this->id)."' "; 
    23052271          #If user can only delete, we need to check the post's owner 
    23062272          if (!$this->core->auth->check('contentadmin',$this->id)) 
    23072273          { 
    23082274               $strReq .= 
    2309                     "AND user_id = '".$this->con->escape($this->core->auth->userID())."' "; 
    2310           } 
    2311  
     2275                    "AND tp.user_id = '".$this->con->escape($this->core->auth->userID())."' "; 
     2276          } 
     2277          $strReq .= ")"; 
    23122278          $this->con->execute($strReq); 
    23132279          $this->triggerComments($co_ids, true, $affected_posts); 
     
    23212287          } 
    23222288 
    2323           # mySQL uses "INNER JOIN" synthax 
    2324           if ($this->con->driver() == 'mysql' || $this->con->driver() == 'mysqli') { 
    2325                $strReq = 
    2326                     'DELETE FROM tc '. 
    2327                     'USING '.$this->prefix.'comment tc '. 
    2328                     'INNER JOIN '.$this->prefix.'post tp '; 
    2329           } 
    2330           # pgSQL uses nothing special 
    2331           else { 
    2332                $strReq = 
    2333                     'DELETE FROM '.$this->prefix.'comment tc '. 
    2334                     'USING '.$this->prefix.'post tp '; 
    2335           } 
    2336  
    2337           $strReq .= 
    2338                'WHERE tc.post_id = tp.post_id '. 
    2339                "AND tp.blog_id = '".$this->con->escape($this->id)."' ". 
    2340                'AND comment_status = -2'; 
    2341  
     2289          $strReq = 
     2290               'DELETE FROM '.$this->prefix.'comment '. 
     2291               'WHERE comment_status = -2 '. 
     2292               'AND post_id in (SELECT tp.post_id '. 
     2293               'FROM '.$this->prefix.'post tp '. 
     2294               "WHERE tp.blog_id = '".$this->con->escape($this->id)."' "; 
    23422295          #If user can only delete, we need to check the post's owner 
    23432296          if (!$this->core->auth->check('contentadmin',$this->id)) 
    23442297          { 
    23452298               $strReq .= 
    2346                     "AND user_id = '".$this->con->escape($this->core->auth->userID())."' "; 
    2347           } 
    2348  
     2299                    "AND tp.user_id = '".$this->con->escape($this->core->auth->userID())."' "; 
     2300          } 
     2301          $strReq .= ")"; 
    23492302          $this->con->execute($strReq); 
    23502303          $this->triggerBlog(); 
  • inc/core/class.dc.blog.php

    r2626 r2628  
    18941894     - post_id: (integer) Get comments belonging to given post_id 
    18951895     - cat_id: (integer or array) Get comments belonging to entries of given category ID 
    1896      - comment_id: (integer) Get comment with given ID 
     1896     - comment_id: (integer or array) Get comment with given ID (or IDs) 
    18971897     - comment_site: (string) Get comments with given comment_site 
    18981898     - comment_status: (integer) Get comments with given comment_status 
     
    19841984 
    19851985          if (isset($params['comment_id']) && $params['comment_id'] !== '') { 
    1986                $strReq .= 'AND comment_id = '.(integer) $params['comment_id'].' '; 
     1986               if (is_array($params['comment_id'])) { 
     1987                    array_walk($params['comment_id'],create_function('&$v,$k','if($v!==null){$v=(integer)$v;}')); 
     1988               } else { 
     1989                    $params['comment_id'] = array((integer) $params['comment_id']); 
     1990               } 
     1991               $strReq .= 'AND comment_id '.$this->con->in($params['comment_id']); 
    19871992          } 
    19881993 
Note: See TracChangeset for help on using the changeset viewer.

Sites map