Changeset 1542:2de80618299a
- Timestamp:
- 08/03/13 18:04:19 (12 years ago)
- Branch:
- Ticket #1430
- Parents:
- 1541:4a3f328d2a74 (diff), 1262:ec1e7bef6c1f (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
r1262 r1542 696 696 - no_content: Don't retrieve entry content (excerpt and content) 697 697 - post_type: Get only entries with given type (default "post", array for many types and '' for no type) 698 - post_id: (integer ) Get entry with given post_id698 - post_id: (integer or array) Get entry with given post_id 699 699 - post_url: Get entry with given post_url field 700 700 - user_id: (integer) Get entries belonging to given user ID … … 716 716 - limit: Limit parameter 717 717 - sql_only : return the sql request instead of results. Only ids are selected 718 - exclude_post_id : (integer or array) Exclude entries with given post_id 718 719 719 720 Please note that on every cat_id or cat_url, you can add ?not to exclude … … 809 810 } 810 811 $strReq .= 'AND P.post_id '.$this->con->in($params['post_id']); 812 } 813 814 if (isset($params['exclude_post_id']) && $params['exclude_post_id'] !== '') { 815 if (is_array($params['exclude_post_id'])) { 816 array_walk($params['exclude_post_id'],create_function('&$v,$k','if($v!==null){$v=(integer)$v;}')); 817 } else { 818 $params['exclude_post_id'] = array((integer) $params['exclude_post_id']); 819 } 820 $strReq .= 'AND P.post_id not in ('.$this->con->in($params['exclude_post_id']).') '; 811 821 } 812 822 -
inc/core/class.dc.blog.php
r1541 r1542 203 203 @param ids <b>mixed</b> Comment(s) ID(s) 204 204 @param del <b>boolean</b> If comment is delete, set this to true 205 */ 206 public function triggerComments($ids,$del=false) 205 @param affected_posts <b>mixed</b> Posts(s) ID(s) 206 */ 207 public function triggerComments($ids, $del=false, $affected_posts=null) 207 208 { 208 209 $co_ids = dcUtils::cleanIds($ids); 210 $a_ids = dcUtils::cleanIds($affected_posts); 211 $a_tbs = array(); 209 212 210 213 # a) Retrieve posts affected by comments edition 211 $strReq = 212 'SELECT post_id, comment_trackback '. 213 'FROM '.$this->prefix.'comment '. 214 'WHERE comment_id'.$this->con->in($co_ids). 215 'GROUP BY post_id,comment_trackback'; 216 217 $rs = $this->con->select($strReq); 218 219 $a_ids = $a_tbs = array(); 220 while ($rs->fetch()) { 221 $a_ids[] = (integer) $rs->post_id; 222 $a_tbs[] = (integer) $rs->comment_trackback; 214 if (empty($a_ids)) { 215 $strReq = 216 'SELECT post_id, comment_trackback '. 217 'FROM '.$this->prefix.'comment '. 218 'WHERE comment_id'.$this->con->in($co_ids). 219 'GROUP BY post_id,comment_trackback'; 220 221 $rs = $this->con->select($strReq); 222 223 while ($rs->fetch()) { 224 $a_ids[] = (integer) $rs->post_id; 225 $a_tbs[] = (integer) $rs->comment_trackback; 226 } 223 227 } 224 228 … … 255 259 { 256 260 $nb_comment = $nb_trackback = 0; 261 //$cur->nb_comment = $nb_comment; 257 262 foreach($b_ids as $b_key => $b_id) 258 263 { … … 505 510 $this->core->callBehavior('coreBeforeCategoryCreate',$this,$cur); 506 511 507 $this->categories()->addNode($cur,$parent); 512 $id = $this->categories()->addNode($cur,$parent); 513 # Update category's cursor 514 $rs = $this->getCategory($id); 515 if (!$rs->isEmpty()) { 516 $cur->cat_lft = $rs->cat_lft; 517 $cur->cat_rgt = $rs->cat_rgt; 518 } 508 519 509 520 # --BEHAVIOR-- coreAfterCategoryCreate … … 2191 2202 $co_ids = dcUtils::cleanIds($ids); 2192 2203 2193 if (empty($ ids)) {2204 if (empty($co_ids)) { 2194 2205 throw new Exception(__('No such comment ID')); 2206 } 2207 2208 # Retrieve posts affected by comments edition 2209 $affected_posts = array(); 2210 $strReq = 2211 'SELECT distinct(post_id) '. 2212 'FROM '.$this->prefix.'comment '. 2213 'WHERE comment_id'.$this->con->in($co_ids); 2214 2215 $rs = $this->con->select($strReq); 2216 2217 while ($rs->fetch()) { 2218 $affected_posts[] = (integer) $rs->post_id; 2195 2219 } 2196 2220 … … 2222 2246 2223 2247 $this->con->execute($strReq); 2224 $this->triggerComments($co_ids, true);2248 $this->triggerComments($co_ids, true, $affected_posts); 2225 2249 $this->triggerBlog(); 2226 2250 }
Note: See TracChangeset
for help on using the changeset viewer.