Changeset 2626:8082d2ad2e34
- Timestamp:
- 12/31/13 09:44:35 (10 years ago)
- Branch:
- 2.6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.blog.php
r2566 r2626 2199 2199 2200 2200 $strReq = 2201 'UPDATE '.$this->prefix.'comment tc '; 2202 2203 # mySQL uses "JOIN" synthax 2204 if ($this->con->driver() == 'mysql' || $this->con->driver() == 'mysqli') { 2205 $strReq .= 2206 'JOIN '.$this->prefix.'post tp ON tc.post_id = tp.post_id '; 2207 } 2208 2201 'UPDATE '.$this->prefix.'comment '. 2202 'SET comment_status = '.$status.' '; 2209 2203 $strReq .= 2210 'SET comment_status = '.$status.' '; 2211 2212 # pgSQL uses "FROM" synthax 2213 if ($this->con->driver() != 'mysql' && $this->con->driver() != 'mysqli') { 2214 $strReq .= 2215 'FROM '.$this->prefix.'post tp '; 2216 } 2217 2218 $strReq .= 2219 "WHERE blog_id = '".$this->con->escape($this->id)."' ". 2220 'AND comment_id'.$this->con->in($co_ids); 2221 2222 # add pgSQL "WHERE" clause 2223 if ($this->con->driver() != 'mysql' && $this->con->driver() != 'mysqli') { 2224 $strReq .= 2225 'AND tc.post_id = tp.post_id '; 2226 } 2227 2228 #If user is only usage, we need to check the post's owner 2204 'WHERE comment_id'.$this->con->in($co_ids). 2205 'AND post_id in (SELECT tp.post_id '. 2206 'FROM '.$this->prefix.'post tp '. 2207 "WHERE tp.blog_id = '".$this->con->escape($this->id)."' "; 2229 2208 if (!$this->core->auth->check('contentadmin',$this->id)) 2230 2209 { … … 2232 2211 "AND user_id = '".$this->con->escape($this->core->auth->userID())."' "; 2233 2212 } 2234 2213 $strReq .= ')'; 2235 2214 $this->con->execute($strReq); 2236 2215 $this->triggerComments($co_ids); … … 2279 2258 } 2280 2259 2281 # mySQL uses "INNER JOIN" synthax 2282 if ($this->con->driver() == 'mysql' || $this->con->driver() == 'mysqli') { 2283 $strReq = 2284 'DELETE FROM tc '. 2285 'USING '.$this->prefix.'comment tc '. 2286 'INNER JOIN '.$this->prefix.'post tp '; 2287 } 2288 # pgSQL uses nothing special 2289 else { 2290 $strReq = 2291 'DELETE FROM '.$this->prefix.'comment tc '. 2292 'USING '.$this->prefix.'post tp '; 2293 } 2294 2295 $strReq .= 2296 'WHERE tc.post_id = tp.post_id '. 2297 "AND tp.blog_id = '".$this->con->escape($this->id)."' ". 2298 'AND comment_id'.$this->con->in($co_ids); 2299 2260 $strReq = 2261 'DELETE FROM '.$this->prefix.'comment '. 2262 'WHERE comment_id'.$this->con->in($co_ids).' '. 2263 'AND post_id in (SELECT tp.post_id '. 2264 'FROM '.$this->prefix.'post tp '. 2265 "WHERE tp.blog_id = '".$this->con->escape($this->id)."' "; 2300 2266 #If user can only delete, we need to check the post's owner 2301 2267 if (!$this->core->auth->check('contentadmin',$this->id)) 2302 2268 { 2303 2269 $strReq .= 2304 "AND user_id = '".$this->con->escape($this->core->auth->userID())."' ";2305 } 2306 2270 "AND tp.user_id = '".$this->con->escape($this->core->auth->userID())."' "; 2271 } 2272 $strReq .= ")"; 2307 2273 $this->con->execute($strReq); 2308 2274 $this->triggerComments($co_ids, true, $affected_posts); … … 2316 2282 } 2317 2283 2318 # mySQL uses "INNER JOIN" synthax 2319 if ($this->con->driver() == 'mysql' || $this->con->driver() == 'mysqli') { 2320 $strReq = 2321 'DELETE FROM tc '. 2322 'USING '.$this->prefix.'comment tc '. 2323 'INNER JOIN '.$this->prefix.'post tp '; 2324 } 2325 # pgSQL uses nothing special 2326 else { 2327 $strReq = 2328 'DELETE FROM '.$this->prefix.'comment tc '. 2329 'USING '.$this->prefix.'post tp '; 2330 } 2331 2332 $strReq .= 2333 'WHERE tc.post_id = tp.post_id '. 2334 "AND tp.blog_id = '".$this->con->escape($this->id)."' ". 2335 'AND comment_status = -2'; 2336 2284 $strReq = 2285 'DELETE FROM '.$this->prefix.'comment '. 2286 'WHERE comment_status = -2 '. 2287 'AND post_id in (SELECT tp.post_id '. 2288 'FROM '.$this->prefix.'post tp '. 2289 "WHERE tp.blog_id = '".$this->con->escape($this->id)."' "; 2337 2290 #If user can only delete, we need to check the post's owner 2338 2291 if (!$this->core->auth->check('contentadmin',$this->id)) 2339 2292 { 2340 2293 $strReq .= 2341 "AND user_id = '".$this->con->escape($this->core->auth->userID())."' ";2342 } 2343 2294 "AND tp.user_id = '".$this->con->escape($this->core->auth->userID())."' "; 2295 } 2296 $strReq .= ")"; 2344 2297 $this->con->execute($strReq); 2345 2298 $this->triggerBlog();
Note: See TracChangeset
for help on using the changeset viewer.