Dotclear


Ignore:
Timestamp:
11/17/13 20:25:53 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Children:
2567:6c11245cbf04, 2568:61c67a7d17fa
Message:

Add some people in CREDITS, remove trailing spaces and tabs.

File:
1 edited

Legend:

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

    r1505 r2566  
    1717     protected $con;          ///< <b>connection</b> Database connection 
    1818     protected $table;        ///< <b>string</b> Post-Media table name 
    19       
     19 
    2020     /** 
    2121     Object constructor. 
    22       
     22 
    2323     @param    core      <b>dcCore</b>       dcCore instance 
    2424     @param    type      <b>string</b>       Media type filter 
     
    3030          $this->table = $this->core->prefix.'post_media'; 
    3131     } 
    32       
     32 
    3333     /** 
    3434     Returns media items attached to a blog post. Result is an array containing 
    3535     fileItems objects. 
    36       
     36 
    3737     @param    post_id   <b>integer</b>      Post ID 
    3838     @param    media_id  <b>integer</b>      Optionnal media ID 
     
    4444          'SELECT M.media_file, M.media_id, M.media_path, M.media_title, M.media_meta, M.media_dt, '. 
    4545          'M.media_creadt, M.media_upddt, M.media_private, M.user_id, PM.post_id '; 
    46            
     46 
    4747          if (!empty($params['columns']) && is_array($params['columns'])) { 
    4848               $strReq .= implode(', ',$params['columns']).', '; 
    4949          } 
    50            
     50 
    5151          $strReq .= 
    5252          'FROM '.$this->core->prefix.'media M '. 
    5353          'INNER JOIN '.$this->table.' PM ON (M.media_id = PM.media_id) '; 
    54            
     54 
    5555          if (!empty($params['from'])) { 
    5656               $strReq .= $params['from'].' '; 
    5757          } 
    58            
     58 
    5959          $where=''; 
    6060          if (isset($params['post_id'])) { 
     
    8080     //echo $strReq; exit; 
    8181          $rs = $this->con->select($strReq); 
    82            
     82 
    8383          return $rs; 
    8484     } 
     
    8686     /** 
    8787     Attaches a media to a post. 
    88       
     88 
    8989     @param    post_id   <b>integer</b>      Post ID 
    9090     @param    media_id  <b>integer</b>      Optionnal media ID 
     
    9494          $post_id = (integer) $post_id; 
    9595          $media_id = (integer) $media_id; 
    96            
     96 
    9797          $f = $this->getPostMedia(array('post_id'=>$post_id,'media_id'=>$media_id,'link_type'=>$link_type)); 
    98            
     98 
    9999          if (!$f->isEmpty()) { 
    100100               return; 
    101101          } 
    102            
     102 
    103103          $cur = $this->con->openCursor($this->table); 
    104104          $cur->post_id = $post_id; 
    105105          $cur->media_id = $media_id; 
    106106          $cur->link_type = $link_type; 
    107            
     107 
    108108          $cur->insert(); 
    109109          $this->core->blog->triggerBlog(); 
    110110     } 
    111       
     111 
    112112     /** 
    113113     Detaches a media from a post. 
    114       
     114 
    115115     @param    post_id   <b>integer</b>      Post ID 
    116116     @param    media_id  <b>integer</b>      Optionnal media ID 
     
    120120          $post_id = (integer) $post_id; 
    121121          $media_id = (integer) $media_id; 
    122            
     122 
    123123          $strReq = 'DELETE FROM '.$this->table.' '. 
    124124                    'WHERE post_id = '.$post_id.' '. 
     
    130130          $this->core->blog->triggerBlog(); 
    131131     } 
    132       
     132 
    133133     /** 
    134134     Returns media items attached to a blog post. Result is an array containing 
    135135     fileItems objects. 
    136       
     136 
    137137     @param    post_id   <b>integer</b>      Post ID 
    138138     @param    media_id  <b>integer</b>      Optionnal media ID 
     
    142142     { 
    143143          $post_id = (integer) $post_id; 
    144            
     144 
    145145          $strReq = 
    146146          'SELECT media_file, M.media_id, media_path, media_title, media_meta, media_dt, '. 
     
    150150          "WHERE media_path = '".$this->path."' ". 
    151151          'AND post_id = '.$post_id.' '; 
    152            
     152 
    153153          if ($media_id) { 
    154154               $strReq .= 'AND M.media_id = '.(integer) $media_id.' '; 
    155155          } 
    156            
     156 
    157157          $rs = $this->con->select($strReq); 
    158            
     158 
    159159          $res = array(); 
    160            
     160 
    161161          while ($rs->fetch()) { 
    162162               $f = $this->fileRecord($rs); 
     
    165165               } 
    166166          } 
    167            
     167 
    168168          return $res; 
    169169     } 
    170       
     170 
    171171} 
    172 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map