]> git.mxchange.org Git - friendica.git/commitdiff
fix admin log viewer (will only read the last 5M of the log, and puts the text into...
authorFriendika <info@friendika.com>
Fri, 17 Jun 2011 05:20:12 +0000 (22:20 -0700)
committerFriendika <info@friendika.com>
Fri, 17 Jun 2011 05:20:12 +0000 (22:20 -0700)
mod/admin.php
view/admin_logs.tpl

index 6f411bdb1b278a0bca996a831004f58633689671..e657c805332dd732711da2363b78ca125f0ffc44 100644 (file)
@@ -573,11 +573,32 @@ function admin_page_logs(&$a){
        );
        
        $t = get_markup_template("admin_logs.tpl");
+
+       $f = get_config('system','logfile');
+       $size = filesize($f);
+       if($size > 5000000)
+               $size = 5000000;
+
+       $data = '';
+       $fp = fopen($f,'r');
+       if($fp) {
+               $seek = fseek($fp,0-$size,SEEK_END);
+               if($seek === 0) {
+                       fgets($fp); // throw away the first partial line
+                       $data = str_replace(array("\n","\t"),array('<br />','&nbsp;&nbsp;&nbsp;&nbsp;'),escape_tags(fread($fp,$size)));
+                       while(! feof($fp))
+                               $data .= str_replace(array("\n","\t"),array('<br />','&nbsp;&nbsp;&nbsp;&nbsp;'),escape_tags(fread($fp,4096)));
+               }
+               fclose($fp);
+       }
+
+
        return replace_macros($t, array(
                '$title' => t('Administration'),
                '$page' => t('Logs'),
                '$submit' => t('Submit'),
                '$clear' => t('Clear'),
+               '$data' => $data,
                '$baseurl' => $a->get_baseurl(),
                '$logname' =>  get_config('system','logfile'),
                
index f2939a7ac368ee4ac3b562d3c2b5d1a395e0539b..9d133b1553b22ca8440841af5f91a566abd4c1f0 100644 (file)
@@ -12,6 +12,7 @@
        </form>
        
        <h3>$logname</h3>
-       <iframe src='$baseurl/$logname' style="width:100%; height:400px"></iframe>
+       <div style="width:100%; height:400px; overflow: auto; "><pre>$data</pre></div>
+<!--   <iframe src='$baseurl/$logname' style="width:100%; height:400px"></iframe> -->
        <!-- <div class="submit"><input type="submit" name="page_logs_clear_log" value="$clear" /></div> -->
 </div>