Dotclear

Changeset 1542:2de80618299a


Ignore:
Timestamp:
08/03/13 18:04:19 (12 years ago)
Author:
Lepeltier kévin
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.
Message:

Fusion avec 2.5

Files:
2 edited

Legend:

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

    r1262 r1542  
    696696     - no_content: Don't retrieve entry content (excerpt and content) 
    697697     - 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_id 
     698     - post_id: (integer or array) Get entry with given post_id 
    699699     - post_url: Get entry with given post_url field 
    700700     - user_id: (integer) Get entries belonging to given user ID 
     
    716716     - limit: Limit parameter 
    717717     - 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 
    718719      
    719720     Please note that on every cat_id or cat_url, you can add ?not to exclude 
     
    809810               } 
    810811               $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']).') '; 
    811821          } 
    812822           
  • inc/core/class.dc.blog.php

    r1541 r1542  
    203203     @param    ids       <b>mixed</b>        Comment(s) ID(s) 
    204204     @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) 
    207208     { 
    208209          $co_ids = dcUtils::cleanIds($ids); 
     210          $a_ids = dcUtils::cleanIds($affected_posts); 
     211          $a_tbs = array(); 
    209212           
    210213          # 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               } 
    223227          } 
    224228           
     
    255259          { 
    256260               $nb_comment = $nb_trackback = 0; 
     261               //$cur->nb_comment = $nb_comment; 
    257262               foreach($b_ids as $b_key => $b_id) 
    258263               { 
     
    505510          $this->core->callBehavior('coreBeforeCategoryCreate',$this,$cur); 
    506511           
    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          } 
    508519           
    509520          # --BEHAVIOR-- coreAfterCategoryCreate 
     
    21912202          $co_ids = dcUtils::cleanIds($ids); 
    21922203           
    2193           if (empty($ids)) { 
     2204          if (empty($co_ids)) { 
    21942205               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; 
    21952219          } 
    21962220           
     
    22222246           
    22232247          $this->con->execute($strReq); 
    2224           $this->triggerComments($co_ids,true); 
     2248          $this->triggerComments($co_ids, true, $affected_posts); 
    22252249          $this->triggerBlog(); 
    22262250     } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map