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.log.php

    r1179 r2566  
    1616     protected $core; 
    1717     protected $prefix; 
    18       
     18 
    1919     /** 
    2020     Object constructor. 
    21       
     21 
    2222     @param    core      <b>dcCore</b>  dcCore instance 
    2323     */ 
     
    2727          $this->prefix = $core->prefix; 
    2828     } 
    29       
     29 
    3030     /** 
    3131     Retrieves logs. <b>$params</b> is an array taking the following 
    3232     optionnal parameters: 
    33       
     33 
    3434     - blog_id: Get logs belonging to given blog ID 
    3535     - user_id: Get logs belonging to given user ID 
     
    3838     - order: Order of results (default "ORDER BY log_dt DESC") 
    3939     - limit: Limit parameter 
    40       
     40 
    4141     @param    params         <b>array</b>        Parameters 
    4242     @param    count_only     <b>boolean</b>      Only counts results 
     
    5454               'U.user_firstname, U.user_displayname, U.user_url'; 
    5555          } 
    56            
     56 
    5757          $strReq = 'SELECT '.$f.' FROM '.$this->prefix.'log L '; 
    58            
     58 
    5959          if (!$count_only) { 
    6060               $strReq .= 
     
    6262               'ON U.user_id = L.user_id '; 
    6363          } 
    64            
     64 
    6565          if (!empty($params['blog_id'])) { 
    6666               if ($params['blog_id'] === 'all') { 
     
    7474               $strReq .= "WHERE L.blog_id = '".$this->core->blog->id."' "; 
    7575          } 
    76            
     76 
    7777          if (!empty($params['user_id'])) { 
    7878               $strReq .= 'AND L.user_id'.$this->core->con->in($params['user_id']); 
     
    8484               $strReq .= 'AND log_table'.$this->core->con->in($params['log_table']); 
    8585          } 
    86            
     86 
    8787          if (!$count_only) 
    8888          { 
     
    9393               } 
    9494          } 
    95            
     95 
    9696          if (!empty($params['limit'])) { 
    9797               $strReq .= $this->core->con->limit($params['limit']); 
    9898          } 
    99            
     99 
    100100          $rs = $this->core->con->select($strReq); 
    101101          $rs->extend('rsExtLog'); 
    102            
     102 
    103103          return $rs; 
    104104     } 
    105       
     105 
    106106     /** 
    107107     Creates a new log. Takes a cursor as input and returns the new log 
    108108     ID. 
    109       
     109 
    110110     @param    cur       <b>cursor</b>       Log cursor 
    111111     @return   <b>integer</b>      New log ID 
     
    114114     { 
    115115          $this->core->con->writeLock($this->prefix.'log'); 
    116            
     116 
    117117          try 
    118118          { 
     
    120120               $rs = $this->core->con->select( 
    121121                    'SELECT MAX(log_id) '. 
    122                     'FROM '.$this->prefix.'log '  
     122                    'FROM '.$this->prefix.'log ' 
    123123               ); 
    124                 
     124 
    125125               $cur->log_id = (integer) $rs->f(0) + 1; 
    126126               $cur->blog_id = (string) $this->core->blog->id; 
    127127               $cur->log_dt = date('Y-m-d H:i:s'); 
    128                 
     128 
    129129               $this->getLogCursor($cur,$cur->log_id); 
    130                 
     130 
    131131               # --BEHAVIOR-- coreBeforeLogCreate 
    132132               $this->core->callBehavior('coreBeforeLogCreate',$this,$cur); 
    133                 
     133 
    134134               $cur->insert(); 
    135135               $this->core->con->unlock(); 
     
    140140               throw $e; 
    141141          } 
    142            
     142 
    143143          # --BEHAVIOR-- coreAfterLogCreate 
    144144          $this->core->callBehavior('coreAfterLogCreate',$this,$cur); 
    145            
     145 
    146146          return $cur->log_id; 
    147147     } 
    148       
     148 
    149149     /** 
    150150     Deletes a log. 
    151       
     151 
    152152     @param    id        <b>integer</b>      Log ID 
    153153     */ 
     
    157157          'TRUNCATE TABLE '.$this->prefix.'log' : 
    158158          'DELETE FROM '.$this->prefix.'log WHERE log_id'.$this->core->con->in($id); 
    159            
     159 
    160160          $this->core->con->execute($strReq); 
    161161     } 
    162       
     162 
    163163     private function getLogCursor($cur,$log_id = null) 
    164164     { 
     
    166166               throw new Exception(__('No log message')); 
    167167          } 
    168            
     168 
    169169          if ($cur->log_table === null) { 
    170170               $cur->log_table = 'none'; 
    171171          } 
    172            
     172 
    173173          if ($cur->user_id === null) { 
    174174               $cur->user_id = 'unknown'; 
    175175          } 
    176            
     176 
    177177          if ($cur->log_dt === '' || $cur->log_dt === null) { 
    178178               $cur->log_dt = date('Y-m-d H:i:s'); 
    179179          } 
    180            
     180 
    181181          if ($cur->log_ip === null) { 
    182182               $cur->log_ip = http::realIP(); 
    183183          } 
    184            
     184 
    185185          $log_id = is_int($log_id) ? $log_id : $cur->log_id; 
    186186     } 
     
    193193          $user = dcUtils::getUserCN($rs->user_id, $rs->user_name, 
    194194          $rs->user_firstname, $rs->user_displayname); 
    195            
     195 
    196196          if ($user === 'unknown') { 
    197197               $user = __('unknown'); 
    198198          } 
    199            
     199 
    200200          return $user; 
    201201     } 
    202202} 
    203  
    204 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map