Changeset 2628:a46041c31f11 for inc/core/class.dc.blog.php
- Timestamp:
- 01/03/14 08:39:19 (12 years ago)
- 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. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.blog.php
r2567 r2628 2204 2204 2205 2205 $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.' '; 2214 2208 $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)."' "; 2234 2213 if (!$this->core->auth->check('contentadmin',$this->id)) 2235 2214 { … … 2237 2216 "AND user_id = '".$this->con->escape($this->core->auth->userID())."' "; 2238 2217 } 2239 2218 $strReq .= ')'; 2240 2219 $this->con->execute($strReq); 2241 2220 $this->triggerComments($co_ids); … … 2284 2263 } 2285 2264 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)."' "; 2305 2271 #If user can only delete, we need to check the post's owner 2306 2272 if (!$this->core->auth->check('contentadmin',$this->id)) 2307 2273 { 2308 2274 $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 .= ")"; 2312 2278 $this->con->execute($strReq); 2313 2279 $this->triggerComments($co_ids, true, $affected_posts); … … 2321 2287 } 2322 2288 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)."' "; 2342 2295 #If user can only delete, we need to check the post's owner 2343 2296 if (!$this->core->auth->check('contentadmin',$this->id)) 2344 2297 { 2345 2298 $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 .= ")"; 2349 2302 $this->con->execute($strReq); 2350 2303 $this->triggerBlog(); -
inc/core/class.dc.blog.php
r2626 r2628 1894 1894 - post_id: (integer) Get comments belonging to given post_id 1895 1895 - cat_id: (integer or array) Get comments belonging to entries of given category ID 1896 - comment_id: (integer ) Get comment with given ID1896 - comment_id: (integer or array) Get comment with given ID (or IDs) 1897 1897 - comment_site: (string) Get comments with given comment_site 1898 1898 - comment_status: (integer) Get comments with given comment_status … … 1984 1984 1985 1985 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']); 1987 1992 } 1988 1993
Note: See TracChangeset
for help on using the changeset viewer.