[ Index ] |
|
Code source de GeekLog 1.4.1 |
1 <?php 2 3 /** 4 * File: Logview.Admin.class.php 5 * This is the LogViewer for the Geeklog Spam-X plugin 6 * 7 * Copyright (C) 2004-2006 by the following authors: 8 * Author Tom Willett tomw AT pigstye DOT net 9 * 10 * Licensed under GNU General Public License 11 * 12 * $Id: LogView.Admin.class.php,v 1.7 2006/08/20 16:42:32 dhaun Exp $ 13 */ 14 15 if (strpos ($_SERVER['PHP_SELF'], 'LogView.Admin.class.php') !== false) { 16 die ('This file can not be used on its own!'); 17 } 18 19 require_once($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php'); 20 21 class LogView extends BaseAdmin { 22 /** 23 * Constructor 24 */ 25 function display() 26 { 27 global $_CONF, $LANG_SX00; 28 29 $display = ''; 30 31 $max_Log_Size = 100000; 32 $action = ''; 33 if (isset ($_POST['action'])) { 34 $action = COM_applyFilter ($_POST['action']); 35 } 36 $path = $_CONF['site_admin_url'] 37 . '/plugins/spamx/index.php?command=LogView'; 38 $log = 'spamx.log'; 39 $display .= "<form method=\"post\" action=\"{$path}\">"; 40 $display .= "<input type=\"submit\" name=\"action\" value=\"{$LANG_SX00['clearlog']}\">"; 41 $display .= "</form>"; 42 if ($action == $LANG_SX00['clearlog']) { 43 $timestamp = strftime("%c"); 44 $fd = fopen($_CONF['path_log'] . $log, "w"); 45 fputs($fd, "$timestamp {$LANG_SX00['logcleared']} \n"); 46 fclose($fd); 47 } 48 $fsize = filesize($_CONF['path_log'] . $log); 49 if ($fsize > $max_Log_Size) { 50 $fd=fopen($_CONF['path_log'] . $log, "r"); 51 fseek($fd,-$max_Log_Size,SEEK_END); 52 $data = fgets($fd); 53 $data = fread($fd,$max_Log_Size); 54 fclose($fd); 55 $fd = fopen($_CONF['path_log'] . $log, "w"); 56 fputs($fd, "$timestamp {$LANG_SX00['logcleared']} \n"); 57 fwrite($fd,$data); 58 fclose($fd); 59 } 60 $display .= "<hr><pre>"; 61 $display .= implode('', file($_CONF['path_log'] . $log)); 62 $display .= "</pre>"; 63 return $display; 64 } 65 66 function link() 67 { 68 global $LANG_SX00; 69 70 return $LANG_SX00['viewlog']; 71 } 72 } 73 74 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |