[Mimedefang] More GraphDefang patches

Brent J. Nordquist b-nordquist at bethel.edu
Fri Jan 31 22:46:02 EST 2003


GraphDefang 0.6's index.php non-daily views don't work on modern versions
of PHP (or those at security-conscious sites) -- i.e., where register 
globals are turned off.  I've attached a patch to fix this, and then 
(because I could hardly help myself) another to make its output XHTML 
compliant.  :-)

http://kepler.acns.bethel.edu/~bjn/graphdefang/noregglo.patch
http://kepler.acns.bethel.edu/~bjn/graphdefang/xhtml.patch

-- 
Brent J. Nordquist <b-nordquist at bethel.edu> N0BJN
Other contact information: http://kepler.acns.bethel.edu/~bjn/contact.html
-------------- next part --------------
--- index.php	31 Jan 2003 15:49:55 -0000	1.2
+++ index.php	1 Feb 2003 03:30:22 -0000	1.3
@@ -50,9 +50,10 @@
 }
 closedir($handle); 
 
-foreach($filename_array as $value) {
-
+$view = $_GET['view'];
 if (!$view) $view="hourly";
+
+foreach($filename_array as $value) {
 
 	if (ereg($view,$value)) {
 		$subvalue=explode($view,$value);
-------------- next part --------------
--- index.php	1 Feb 2003 03:30:22 -0000	1.3
+++ index.php	1 Feb 2003 03:32:59 -0000	1.4
@@ -1,8 +1,9 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
 <!-- 
 $Id: index.php,v 1.1 2003/01/22 14:36:23 dfs Exp $ 
 #
-# GraphDefang -- a set of tools to create graphs of your mimedefang
-#                spam and virus logs.
+# GraphDefang - a set of tools to create graphs of your mimedefang
+#               spam and virus logs.
 #
 # Written by:    John Kirkland
 #                jpk at bl.org
@@ -26,21 +27,26 @@
 -->
 
 <html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <title>GraphDefang</title>
+</head>
+<body>
 <center>
-<table border=0 width=50%>
-<tr align=center>
+<table border="0" width="50%">
+<tr align="center">
   <td>
-    <a href=index.php?view=hourly>Hourly</a>
+    <a href="index.php?view=hourly">Hourly</a>
   </td>
   <td>
-    <a href=index.php?view=daily>Daily</a>
+    <a href="index.php?view=daily">Daily</a>
   </td>
   <td>
-    <a href=index.php?view=monthly>Monthly</a>
+    <a href="index.php?view=monthly">Monthly</a>
   </td>
 </tr>
 </table>
-<p>
+<p />
 <?php
 $handle=opendir('/home/jpk/public_html/spam'); 
 while ($filename = readdir($handle)) { 
@@ -54,15 +60,19 @@
 if (!$view) $view="hourly";
 
 foreach($filename_array as $value) {
-
 	if (ereg($view,$value)) {
 		$subvalue=explode($view,$value);
 		#print "$subvalue[1]";
-		print "<a href=index.php?view=$subvalue[1]>";
-		print "<img src=./$value border=0>";
+		print "<a href=\"index.php?view=$subvalue[1]\">";
+		print "<img src=\"./$value\" border=\"0\" alt=\"$value\" />";
 		print "</a>";
-		print "<p>";
+		print "<p />";
 	}
 }
 ?>
+</center>
+<p align="left">
+  <a href="http://validator.w3.org/check/referer"><img src="/graphics/vxhtml10.gif" alt="Valid XHTML 1.0!" height="31" width="88" border="0" hspace="5" /></a>
+</p>
+</body>
 </html>


More information about the MIMEDefang mailing list