[geeklog-hg] geeklog: Modified the Log Viewer

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Jun 9 11:42:32 EDT 2013


changeset 9090:16c2702b0f74
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/16c2702b0f74
user: dengen
date: Mon Jun 10 00:41:49 2013 +0900
description:
Modified the Log Viewer

diffstat:

 public_html/admin/logviewer.php |  49 +++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 21 deletions(-)

diffs (82 lines):

diff -r 4615a58c6df9 -r 16c2702b0f74 public_html/admin/logviewer.php
--- a/public_html/admin/logviewer.php	Sat Jun 08 21:31:50 2013 +0900
+++ b/public_html/admin/logviewer.php	Mon Jun 10 00:41:49 2013 +0900
@@ -32,18 +32,23 @@
 // |                                                                          |
 // +--------------------------------------------------------------------------+
 
+/**
+* Geeklog common function library
+*/
 require_once '../lib-common.php';
+
+/**
+* Security check to ensure user even belongs on this page
+*/
+require_once 'auth.inc.php';
+
 require_once $_CONF['path_system'] . 'lib-admin.php';
 
 if (!SEC_inGroup('Root')) {
-    $display = COM_siteHeader ('menu');
-    $display .= COM_startBlock ($LANG27[12], '',
-                                COM_getBlockTemplate ('_msg_block', 'header'));
-    $display .= $LANG27[12];
-    $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
-    $display .= COM_siteFooter ();
-    COM_accessLog ("User {$_USER['username']} tried to illegally access the log viewer utility.");
-    echo $display;
+    $display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
+    $display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
+    COM_accessLog("User {$_USER['username']} tried to illegally access the topic administration screen.");
+    COM_output($display);
     exit;
 }
 
@@ -77,7 +82,7 @@
 $display .= $LANG_LOGVIEW['logs'].':   ';
 $files = array();
 if ($dir = @opendir($_CONF['path_log'])) {
-    while(($file = readdir($dir)) !== false) {
+    while (($file = readdir($dir)) !== false) {
         if (is_file($_CONF['path_log'] . $file) && preg_match('/\.log$/i', $file)) {
             array_push($files,$file);
         }
@@ -100,23 +105,25 @@
 $display .= '<input type="submit" name="clearlog" value="'.$LANG_LOGVIEW['clear'].'"'.XHTML.'>';
 $display .= '</div></form>';
 
-if ( isset($_POST['clearlog']) ) {
-    @unlink($_CONF['path_log'] . $log);
-    $timestamp = strftime( "%c" );
-    $fd = fopen( $_CONF['path_log'] . $log, 'a' );
-    fputs( $fd, "$timestamp - Log File Cleared \n" );
-    fclose($fd);
-    $_POST['viewlog'] = 1;
+if (isset($_POST['clearlog'])) {
+    if (@unlink($_CONF['path_log'] . $log)) {
+        if ($fd = @fopen($_CONF['path_log'] . $log, 'a')) {
+            $timestamp = strftime("%c");
+            fputs($fd, "$timestamp - Log File Cleared \n");
+            fclose($fd);
+            $_POST['viewlog'] = 1;
+        }
+    }
 }
-if ( isset($_POST['viewlog']) ) {
+if (isset($_POST['viewlog'])) {
     $display .= '<p><strong>'.$LANG_LOGVIEW['log_file'].': ' . $log . '</strong></p>';
     $display .= '<div style="margin:10px 0 5px;border-bottom:1px solid #cccccc;"></div>';
-    $display .= '<div style="overflow:scroll; height:500px;"><pre>';
-    $display .= htmlentities(implode('', file($_CONF['path_log'] . $log)),ENT_NOQUOTES,COM_getEncodingt());
-    $display .= '</pre></div>';
+    $display .= '<pre style="overflow:scroll; height:500px;">';
+    $display .= htmlentities(implode('', file($_CONF['path_log'] . $log)), ENT_NOQUOTES, COM_getEncodingt());
+    $display .= '</pre>';
 }
 
-$display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
+$display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
 
 $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_LOGVIEW['log_viewer']));
 



More information about the geeklog-cvs mailing list