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
  • plugins/blogroll/class.dc.blogroll.php

    r1179 r2566  
    1717     private $con; 
    1818     private $table; 
    19       
     19 
    2020     public function __construct($blog) 
    2121     { 
     
    2424          $this->table = $this->blog->prefix.'link'; 
    2525     } 
    26       
     26 
    2727     public function getLinks($params=array()) 
    2828     { 
     
    3131                    'FROM '.$this->table.' '. 
    3232                    "WHERE blog_id = '".$this->con->escape($this->blog->id)."' "; 
    33            
     33 
    3434          if (isset($params['link_id'])) { 
    3535               $strReq .= 'AND link_id = '.(integer) $params['link_id'].' '; 
    3636          } 
    37            
     37 
    3838          $strReq .= 'ORDER BY link_position '; 
    39            
     39 
    4040          $rs = $this->con->select($strReq); 
    4141          $rs = $rs->toStatic(); 
    42            
     42 
    4343          $this->setLinksData($rs); 
    44            
     44 
    4545          return $rs; 
    4646     } 
    47       
     47 
    4848     public function getLink($id) 
    4949     { 
    5050          $params['link_id'] = $id; 
    51            
     51 
    5252          $rs = $this->getLinks($params); 
    53            
     53 
    5454          return $rs; 
    5555     } 
    56       
     56 
    5757     public function addLink($title,$href,$desc='',$lang='', $xfn='') 
    5858     { 
    5959          $cur = $this->con->openCursor($this->table); 
    60            
     60 
    6161          $cur->blog_id = (string) $this->blog->id; 
    6262          $cur->link_title = (string) $title; 
     
    6565          $cur->link_lang = (string) $lang; 
    6666          $cur->link_xfn = (string) $xfn; 
    67            
     67 
    6868          if ($cur->link_title == '') { 
    6969               throw new Exception(__('You must provide a link title')); 
    7070          } 
    71            
     71 
    7272          if ($cur->link_href == '') { 
    7373               throw new Exception(__('You must provide a link URL')); 
    7474          } 
    75            
     75 
    7676          $strReq = 'SELECT MAX(link_id) FROM '.$this->table; 
    7777          $rs = $this->con->select($strReq); 
    7878          $cur->link_id = (integer) $rs->f(0) + 1; 
    79            
     79 
    8080          $cur->insert(); 
    8181          $this->blog->triggerBlog(); 
    8282     } 
    83       
     83 
    8484     public function updateLink($id,$title,$href,$desc='',$lang='', $xfn='') 
    8585     { 
    8686          $cur = $this->con->openCursor($this->table); 
    87            
     87 
    8888          $cur->link_title = (string) $title; 
    8989          $cur->link_href = (string) $href; 
     
    9191          $cur->link_lang = (string) $lang; 
    9292          $cur->link_xfn = (string) $xfn; 
    93            
     93 
    9494          if ($cur->link_title == '') { 
    9595               throw new Exception(__('You must provide a link title')); 
    9696          } 
    97            
     97 
    9898          if ($cur->link_href == '') { 
    9999               throw new Exception(__('You must provide a link URL')); 
    100100          } 
    101            
     101 
    102102          $cur->update('WHERE link_id = '.(integer) $id. 
    103103               " AND blog_id = '".$this->con->escape($this->blog->id)."'"); 
    104104          $this->blog->triggerBlog(); 
    105105     } 
    106       
     106 
    107107     public function updateCategory($id,$desc) 
    108108     { 
    109109          $cur = $this->con->openCursor($this->table); 
    110            
     110 
    111111          $cur->link_desc = (string) $desc; 
    112            
     112 
    113113          if ($cur->link_desc == '') { 
    114114               throw new Exception(__('You must provide a category title')); 
    115115          } 
    116            
     116 
    117117          $cur->update('WHERE link_id = '.(integer) $id. 
    118118          " AND blog_id = '".$this->con->escape($this->blog->id)."'"); 
    119119          $this->blog->triggerBlog(); 
    120120     } 
    121       
     121 
    122122     public function addCategory($title) 
    123123     { 
    124124          $cur = $this->con->openCursor($this->table); 
    125            
     125 
    126126          $cur->blog_id = (string) $this->blog->id; 
    127127          $cur->link_desc = (string) $title; 
    128128          $cur->link_href = ''; 
    129129          $cur->link_title = ''; 
    130            
     130 
    131131          if ($cur->link_desc == '') { 
    132132               throw new Exception(__('You must provide a category title')); 
    133133          } 
    134            
     134 
    135135          $strReq = 'SELECT MAX(link_id) FROM '.$this->table; 
    136136          $rs = $this->con->select($strReq); 
    137137          $cur->link_id = (integer) $rs->f(0) + 1; 
    138            
     138 
    139139          $cur->insert(); 
    140140          $this->blog->triggerBlog(); 
    141            
     141 
    142142          return $cur->link_id; 
    143143     } 
    144       
     144 
    145145     public function delItem($id) 
    146146     { 
    147147          $id = (integer) $id; 
    148            
     148 
    149149          $strReq = 'DELETE FROM '.$this->table.' '. 
    150150                    "WHERE blog_id = '".$this->con->escape($this->blog->id)."' ". 
    151151                    'AND link_id = '.$id.' '; 
    152            
     152 
    153153          $this->con->execute($strReq); 
    154154          $this->blog->triggerBlog(); 
    155155     } 
    156       
     156 
    157157     public function updateOrder($id,$position) 
    158158     { 
    159159          $cur = $this->con->openCursor($this->table); 
    160160          $cur->link_position = (integer) $position; 
    161            
     161 
    162162          $cur->update('WHERE link_id = '.(integer) $id. 
    163163               " AND blog_id = '".$this->con->escape($this->blog->id)."'"); 
    164164          $this->blog->triggerBlog(); 
    165165     } 
    166       
    167       
     166 
     167 
    168168     private function setLinksData($rs) 
    169169     { 
     
    171171          while ($rs->fetch()) { 
    172172               $rs->set('is_cat',!$rs->link_title && !$rs->link_href); 
    173                 
     173 
    174174               if ($rs->is_cat) { 
    175175                    $cat_title = $rs->link_desc; 
     
    181181          $rs->moveStart(); 
    182182     } 
    183       
     183 
    184184     public function getLinksHierarchy($rs) 
    185185     { 
    186186          $res = array(); 
    187            
     187 
    188188          foreach ($rs->rows() as $k => $v) 
    189189          { 
     
    192192               } 
    193193          } 
    194            
     194 
    195195          return $res; 
    196196     } 
    197197} 
    198 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map