Ignore:
Timestamp:
08/15/10 18:45:12 (22 months ago)
Author:
vain
Message:
  • several changes to copyright, router, bootstrap, frontcontroller and various other files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/logger/file.logger.php

    r4501 r4578  
    2424    * 
    2525    * @license    GNU/GPL v2 or (at your option) any later version, see "/doc/LICENSE". 
    26     * 
    2726    * @author     Jens-André Koch <vain@clansuite.com> 
    2827    * @copyright  Jens-André Koch (2005 - onwards) 
    29     * 
    3028    * @link       http://www.clansuite.com 
    31     * @link       http://gna.org/projects/clansuite 
    32     * 
     29   * 
    3330    * @version    SVN: $Id$ 
    3431    */ 
     
    181178        if($logfilename == null) 
    182179        { 
    183             $logfilename = 'logs/clansuite_errorlog.txt.php'; 
     180            $logfilename = ROOT . 'logs/clansuite_errorlog.txt.php'; 
    184181        } 
    185182 
    186183        # get logfile as array 
    187184        $logfile_array = file($logfilename); 
    188         # count array elements = total number of logfile entries 
    189         $i = count($logfile_array) - 1; 
    190         # subtract from total number of logfile entries the number to fetch 
    191         $max_entries = max(0, $i - $entriesToFetch); 
    192  
    193         # reverse for loop over the logfile_array 
    194         $logEntries = ''; 
    195         $logEntries .= '; <?php die(\'Access forbidden.\'); /* DO NOT MODIFY THIS LINE! ?>' . "/n"; 
    196         $logEntries .= ';'. "/n"; 
    197         for($i; $i > $max_entries; $i--) 
    198         { 
    199             # remove linebreaks 
    200             $entry = str_replace(array('\r', '\n'), '', $logfile_array[$i]); 
    201  
    202             $logEntries .= '<b>Entry ' . $i . '</b>'; 
    203             $logEntries .= '<br />' . htmlentities($entry) . '<br />'; 
    204         } 
    205  
    206         # cleanup 
    207         unset($logfilename, $logfile_array, $i, $max_entries, $entry); 
     185        $logfile_cnt = count($logfile_array); 
     186 
     187        if($logfile_cnt > 0) 
     188        { 
     189            # count array elements = total number of logfile entries 
     190            $i = $logfile_cnt - 1; 
     191 
     192            # subtract from total number of logfile entries the number to fetch 
     193            $max_entries = max(0, $i - $entriesToFetch); 
     194 
     195            # reverse for loop over the logfile_array 
     196            $logEntries = ''; 
     197            for($i; $i > $max_entries; $i--) 
     198            { 
     199                # remove linebreaks 
     200                $entry = str_replace(array('\r', '\n'), '', $logfile_array[$i]); 
     201 
     202                $logEntries .= '<b>Entry ' . $i . '</b>'; 
     203                $logEntries .= '<br />' . htmlentities($entry) . '<br />'; 
     204            } 
     205 
     206            # cleanup 
     207            unset($logfilename, $logfile_array, $i, $max_entries, $entry); 
     208        } 
     209        else 
     210        { 
     211            $logEntries .= '<b>No Entries</b>'; 
     212        } 
    208213 
    209214        return $logEntries; 
Note: See TracChangeset for help on using the changeset viewer.