Extended, fixed bugs, beefed up design, made IE-safe
authoroes <oes@users.sourceforge.net>
Mon, 1 Apr 2002 19:13:47 +0000 (19:13 +0000)
committeroes <oes@users.sourceforge.net>
Mon, 1 Apr 2002 19:13:47 +0000 (19:13 +0000)
doc/webserver/actions/index.php
doc/webserver/actions/step2.php
doc/webserver/actions/step3.php

index 04f0c22..e01935f 100755 (executable)
-<?php
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <!--
 
-error_reporting(E_NONE);
-#error_reporting(E_ALL);
-
-//  File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/index.php,v $
-//
-//  Purpose  :  Submit form for actions file feedback (step 1)
-//              This file belongs in
-//              ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
-//
-//  $Id: index.php,v 1.3 2002/03/30 19:49:34 swa Exp $
-//
-//  $Log: index.php,v $
-//  Revision 1.3  2002/03/30 19:49:34  swa
-//  have consistent look and feel
-//
-//  Revision 1.2  2002/03/30 03:35:48  oes
-//  Updated bookmarklet
-//
-//  Revision 1.1  2002/03/30 03:20:30  oes
-//  Added Feedback mechanism for actions file
-//
-//
-//  Written by and Copyright (C) 2001 the SourceForge
-//  Privoxy team. http://www.privoxy.org/
-//
-//  Based on the Internet Junkbuster originally written
-//  by and Copyright (C) 1997 Anonymous Coders and
-//  Junkbusters Corporation.  http://www.junkbusters.com
-//
-//  This program is free software; you can redistribute it
-//  and/or modify it under the terms of the GNU General
-//  Public License as published by the Free Software
-//  Foundation; either version 2 of the License, or (at
-//  your option) any later version.
-//
-//  This program is distributed in the hope that it will
-//  be useful, but WITHOUT ANY WARRANTY; without even the
-//  implied warranty of MERCHANTABILITY or FITNESS FOR A
-//  PARTICULAR PURPOSE.  See the GNU General Public
-//  License for more details.
-//
-//  The GNU General Public License should be included with
-//  this file.  If not, you can view it at
-//  http://www.gnu.org/copyleft/gpl.html
-//  or write to the Free Software Foundation, Inc., 59
-//  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//
-//
+  File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/index.php,v $
+
+  Purpose  :  Submit form for actions file feedback (step 1)
+              This file belongs in
+              ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
+
+  $Id: index.php,v 1.2 2002/03/30 03:35:48 oes Exp $
+
+  $Log: index.php,v $
+  Revision 1.2  2002/03/30 03:35:48  oes
+  Updated bookmarklet
+
+  Revision 1.1  2002/03/30 03:20:30  oes
+  Added Feedback mechanism for actions file
+
+
+  Written by and Copyright (C) 2002 the SourceForge
+  Privoxy team. http://www.privoxy.org/
+
+  This program is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General
+  Public License as published by the Free Software
+  Foundation; either version 2 of the License, or (at
+  your option) any later version.
+
+  This program is distributed in the hope that it will
+  be useful, but WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A
+  PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  The GNU General Public License should be included with
+  this file.  If not, you can view it at
+  http://www.gnu.org/copyleft/gpl.html
+  or write to the Free Software Foundation, Inc., 59
+  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+ -->
+
+ <head>
+  <style type="text/css">
+   body, div, p, h1, h2, ul, ol, li, td, th, dl, dt, dd { font-family:helvetica,helv,arial,sans-serif; font-size:10px }
+   body { background-color: #ffffff }
+   div.title    { background-color:#dddddd; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:15px; font-weight:bold }
+   div.box      { background-color:#eeeeee; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:10px }
+   div.infobox  { background-color:#ccccff; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
+   div.errorbox { background-color:#ffdddd; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
+  </style>
+
+<?php
 
 /*
  * MUST be updated in sync with actions file:
  */
-$current_actions_file_version = "1.0";
+$required_actions_file_version = "1.0";
+$required_privoxy_version = "2.9.13";
+$actions_file_download = "http://www.privoxy.org/actions/testdrive.action";
+
 
 /*
  * For testing: 
  */
-#$base_url = "http://www.oesterhelt.org/actions";
-$base_url = "http://www.privoxy.org/actions";
-#$base_url = "http://localhost/actions";
+$base_url = "http://www.oesterhelt.org/actions";
+//$base_url = "http://www.privoxy.org/actions";
+//$base_url = "http://localhost/actions";
+error_reporting(E_NONE);
+//error_reporting(E_ALL);
+//phpinfo();
 
 
 /* 
- * Provide default if unset
+ * Provide default if URL unset
  */
 if (!isset($url))
 {
    $url = "http://www.example.com/";
 }
 
+
 /* 
  * Deny feedback which is not based on our latest
  * distribution:
  */
 $headers = getallheaders();
 
-if (!isset($headers["X-Actions-File-Version"]) || $headers["X-Actions-File-Version"] < $current_actions_file_version)
+if (!isset($headers["X-Actions-File-Version"]) || $headers["X-Actions-File-Version"] < $required_actions_file_version)
 {
-   echo ("<html><head><title>Invalid Privoxy Action List Feedback</title>
-           <link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\">
-               </head><body><h2>Invalid Feedback Submission</h2>
-                      <p>You are either not using Privoxy at all, or using an
-                         actions file which is not based on the recent
-                         distribution actions file (version $current_actions_file_version).</p>
-                      <p>As much as we welcome your feedback, we are unable to process
-                         input for the actions file if not based on our distribution. Sorry.</p>
-                      <p>You can <a href=\"http://www.privoxy.org/\">download the latest version of
-                         Privoxy here.</a></p>
-                 </body>
-          </html>");
+   echo ("<title>Invalid Privoxy Action List Feedback</title></head>
+          <body><div class=\"title\">Invalid Feedback Submission</div>
+           <div align=\"center\">
+            <div class=\"errorbox\" align=\"left\"><p>As much as we welcome your feedback, please note that
+             we can only accept problem reports based on:
+             <ul>
+              <li><a href=\"http://www.privoxy.org/\">Privoxy</a> version $required_privoxy_version or later</li>
+              <li><a href=\"$actions_file_download\">Actionsfile</a> version  version $required_actions_file_version or later</li>
+             </ul>
+             <p>We hope you will understand that we feel unable to maintain concurrent versions of the file.</p>
+            </div>
+           </div>
+          </body>
+         </html>");
    exit;
 }
 
 ?>
 
-<html>
-  <head>
-    <title>Privoxy Action List Feedback - Step 1 of 2</title>
-    <link rel="stylesheet" type="text/css" href="../p_web.css">
-</head>
-
-<h2><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Step 1 of 2</h2>
-
-<p>
-<b>Thank you for reporting a missing or invalid action!</b>
-</p>
-<p>
-Please fill the below form and click to
-proceed to Step 2.
-</p>
-
-<form action="<?php echo($base_url); ?>/step2.php" method="post">
-
-<table border="0" cellpadding="0" cellspacing="4">
-
-<tr>
-<td align="right">URL:</td>
-<td>
-<input name="referrer_url" value="<?php echo ($url); ?>" type="text" size="45" maxlength="255">
-</td>
-</tr>
-
-<tr>
-<td align="right">Nature of the problem:</td>
-<td>
-<select name="problem" size="1">
-<option selected value="INVALID">Please select...</option>
-<option value="P1">An advertisment was NOT blocked</option>
-<option value="P2">An innocent image WAS blocked</option>
-<option value="P3">The whole page was erraneously blocked</option>
-<option value="P4">The page needs popups but they don't work</option>
-<option value="P5">Other problem</option>
-</select>
-</td>
-</tr>
-
-<tr>
-<td align="right"></td>
-<td>
-<input type=submit value="Proceed to step 2">
-</td>
-<td></td>
-</tr>
-
-</table>
-</form>
-</p>
-
-<p> 
-This special page helps the Privoxy team to improve the filters. Once
-you have bookmarked the page, surf to a troubled page and click on the
-bookmark, which will take you here and pre-fill the URL field.</p>
-
-<p>Use the following link as a bookmark:
-<a href="javascript:void(window.open('http://privoxy.org/actions/?url='+escape(location.href),'Feedback','width=600,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());">Privoxy-Submit</a>.
-
-Right-click the link and choose "Add to Favorites" (IE) or "Add Bookmark" (Netscape). You will get a warning that the bookmark "may not be safe" - just click OK.  For even faster access, you can put them on the "Links" bar (IE) or the "Personal Toolbar" (Netscape), and submit feedback with a single click.
-</p>
-
-</body>
+  <title>Privoxy Action List Feedback - Step 1 of 2</title>
+ </head>
+
+ <body>
+  <div class="title"><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Step 1 of 2</div>
+
+  <div class="box">
+   <p>
+    <b>Thank you for reporting a missing or invalid action!</b> 
+    <br>The Privoxy team relies on <b>your</b> feedback to maintain an efficient actions file!
+   </p>
+
+   <p>
+    Please fill the below form and click to proceed to step 2.
+   </p>
+  </div>
+
+  <div class="box">
+   <form action="<?php echo($base_url); ?>/step2.php" method="post">
+
+    <table border="0" cellpadding="0" cellspacing="4">
+
+     <tr>
+      <td align="right">URL:</td>
+      <td>
+       <input name="referrer_url" value="<?php echo ($url); ?>" type="text" size="45" maxlength="255">
+      </td>
+     </tr>
+
+     <tr>
+      <td align="right">Nature of the problem:</td>
+      <td>
+       <select name="problem" size="1">
+        <option selected value="INVALID">Please select...</option>
+        <option value="P1">An advertisment was NOT blocked</option>
+        <option value="P2">An innocent image WAS blocked</option>
+        <option value="P3">The whole page was erraneously blocked</option>
+        <option value="P4">The page needs popups but they don't work</option>
+        <option value="P5">Other problem</option>
+       </select>
+      </td>
+     </tr>
+
+     <tr>
+      <td>&nbsp;</td>
+      <td>
+       <input type=submit value="Proceed to step 2">
+      </td>
+     </tr>
+
+    </table>
+   </form>
+  </div>
+
+  <div align=center>
+   <div class="infobox" width="60%" align=\"left\">
+    <p>
+     <big>
+      <b>Using <a href="http://www.bookmarklets.com" target="_blank">Bookmarklets</a> for Feedback</b>
+     </big>
+    </p>
+    <p>
+     To make it even easier for you, we provide a bookmarklet which will not only take you here from
+     any troubled page you might be surfing, but also pre-fill the form!
+    </p>
+    <p>
+     Please right-click the following link and choose "Add to Favorites" (IE) or "Add Bookmark for Link" (Netscape): 
+     <a href="javascript:void(window.open('<?php echo($base_url); ?>/index.php?url='+escape(location.href), 'Feedback',
+      'width=600,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());">Privoxy-Submit</a>
+    </p>
+
+    <p>
+     <i>You might get a warning that the bookmark "may not be safe" (IE) - just click OK.
+     For even faster access, you can put it on the "Links" bar (IE) or the "Personal Toolbar" (Netscape),
+     and submit feedback with a single click!</i>
+    </p>
+   </div>
+  </div>
+
+ </body>
 </html>
index 3caa044..635f1d1 100644 (file)
-<?php
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <!--
+
+  File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/step2.php,v $
+
+  Purpose  :  Submit form for actions file feedback (step 2)
+              This file belongs in
+              ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
+
+  $Id: step2.php,v 1.1 2002/03/30 03:20:30 oes Exp $
+
+  $Log: step2.php,v $
+  Revision 1.1  2002/03/30 03:20:30  oes
+  Added Feedback mechanism for actions file
+
+
+  Written by and Copyright (C) 2002 the SourceForge
+  Privoxy team. http://www.privoxy.org/
+
+  This program is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General
+  Public License as published by the Free Software
+  Foundation; either version 2 of the License, or (at
+  your option) any later version.
+
+  This program is distributed in the hope that it will
+  be useful, but WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A
+  PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  The GNU General Public License should be included with
+  this file.  If not, you can view it at
+  http://www.gnu.org/copyleft/gpl.html
+  or write to the Free Software Foundation, Inc., 59
+  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+ -->
+
+ <head>
+  <style type="text/css">
+   body, div, p, h1, h2, ul, ol, li, td, th, dl, dt, dd { font-family:helvetica,helv,arial,sans-serif; font-size:10px }
+   body { background-color: #ffffff }
+   div.title    { background-color:#dddddd; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:15px; font-weight:bold }
+   div.box      { background-color:#eeeeee; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:10px }
+   div.infobox  { background-color:#ccccff; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
+   div.errorbox { background-color:#ffdddd; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
+  </style>
+
+  <script language="javascript">
+   //
+   // Could be as easy as style="max-wdith: 300px; max-height..." inside the
+   // <img> tag, but IE doesn't do that. Setting the values directly also
+   // screws IE for some weird reason. All praise MS.
+   //
+
+   function prettyscale(image)
+   {
+      newwidth = 0
+      newheight = 0
+
+      if (image.width > 300)
+      {
+         newwidth = 300
+      }
+
+      if (image.height > 50)
+      {
+         newheight = 50
+      }
+
+      if (image.width < 20)
+      {
+         newwidth = 20
+      }
 
-error_reporting(E_NONE);
-#error_reporting(E_ALL);
-
-
-//  File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/step2.php,v $
-//
-//  Purpose  :  Submit form for actions file feedback (step 2)
-//              This file belongs in
-//              ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
-//
-//  $Id: step2.php,v 1.2 2002/03/30 19:49:34 swa Exp $
-//
-//  $Log: step2.php,v $
-//  Revision 1.2  2002/03/30 19:49:34  swa
-//  have consistent look and feel
-//
-//  Revision 1.1  2002/03/30 03:20:30  oes
-//  Added Feedback mechanism for actions file
-//
-//
-//  Written by and Copyright (C) 2001 the SourceForge
-//  Privoxy team. http://www.privoxy.org/
-//
-//  Based on the Internet Junkbuster originally written
-//  by and Copyright (C) 1997 Anonymous Coders and
-//  Junkbusters Corporation.  http://www.junkbusters.com
-//
-//  This program is free software; you can redistribute it
-//  and/or modify it under the terms of the GNU General
-//  Public License as published by the Free Software
-//  Foundation; either version 2 of the License, or (at
-//  your option) any later version.
-//
-//  This program is distributed in the hope that it will
-//  be useful, but WITHOUT ANY WARRANTY; without even the
-//  implied warranty of MERCHANTABILITY or FITNESS FOR A
-//  PARTICULAR PURPOSE.  See the GNU General Public
-//  License for more details.
-//
-//  The GNU General Public License should be included with
-//  this file.  If not, you can view it at
-//  http://www.gnu.org/copyleft/gpl.html
-//  or write to the Free Software Foundation, Inc., 59
-//  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//
-//
+      if (image.height < 20)
+      {
+         newheight = 20
+      }
+
+      if (newwidth != 0)
+      {
+         image.width = newwidth
+      }
+
+      if (newheight != 0)
+      {
+         image.height = newheight
+      }
+   }
+  </script>
+
+
+<?php
 
 /*
  * For testing: 
  */
-#$base_url = "http://www.oesterhelt.org/actions";
-$base_url = "http://www.privoxy.org/actions";
-#$base_url = "http://localhost/actions";
+$base_url = "http://www.oesterhelt.org/actions";
+//$base_url = "http://privoxy.org/actions";
+//$base_url = "http://localhost/actions";
+//phpinfo();
+//error_reporting(E_NONE);
+error_reporting(E_ALL);
+
 
 /* 
  * Cannot start with step 2:
  */
 if (!isset($referrer_url))
 {
-     echo ("<html><head><title>Invalid Feedback Submission</title>
-           <link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\">
-               </head>
-                <body><h2>Invalid Feedback Submission</h2>
-                      <p>When submitting your feedback please start with
-                         <a href=\"index.php\">step 1</a>.</p>
-                 </body>
-          </html>");
+   echo ("  <title>Invalid Feedback Submission</title>
+           </head>
+           <body>
+            <div class=\"title\">Invalid Feedback Submission</div>
+            <div align=\"center\">
+             <div class=\"errorbox\" align=\"left\">When submitting your feedback please start with
+              <a href=\"index.php\">step 1</a>.
+             </div>
+            </div>
+           </body>
+          </html>\n");
    exit; 
 }
 
+
 /* 
  * Cannot work on unknown problem:
  */
 if (!isset($problem) || $problem == "INVALID")
 {
-     echo ("<html><head><title>Invalid Feedback Submission</title>
-           <link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\">
-               </head>
-                <body><h2>Invalid Feedback Submission</h2>
-                      <p>You need to select the nature of the problem in
-                         <a href=\"javascript:back()\">step 1</a>.</p>
-                 </body>
-          </html>");
+   echo ("  <title>Invalid Feedback Submission</title>
+           </head>
+           <body>
+            <div class=\"title\">Invalid Feedback Submission</div>
+            <div align=\"center\">
+             <div class=\"errorbox\" align=\"left\">You need to select the nature of the problem in
+              <a href=\"javascript:history.back();\">step 1</a>.
+             </div>
+            </div>
+           </body>
+          </html>\n");
    exit; 
 }
 
 
 /*
  * Check if URL really exists and buffer its contents:
+ *
+ * FIXME: Curl is not installed on SF; Filed as Alexandria
+ *        Feature Request #537014. 
+ *        PHP's fopen() supports URLs, but it seems that
+ *        curls options for Timeouts and HTTP error handling
+ *        are not supported by fopen().
  */
-
 $ch = curl_init ($referrer_url);
+
 curl_setopt ($ch, CURLOPT_HEADER, 0);
 curl_setopt ($ch, CURLOPT_FAILONERROR, 1);
+curl_setopt ($ch, CURLOPT_TIMEOUT, 15);
 
 ob_start();
 $success = curl_exec ($ch);
@@ -104,20 +170,25 @@ curl_close ($ch);
 
 if (!$success)
 {
-   echo ("<html><head><title>Invalid Feedback Submission</title>
-           <link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\">
-               </head>
-                <body><h2>Invalid Feedback Submission</h2>
-                      <p>The URL that you entered (<a href=\"$referrer_url\">$referrer_url</a>)
-                         <br>could not be retrieved.</p>
-                         <p>Make sure the URL is correct and publicly accessible.</p>
-                         <p><a href=\"javascript:back()\">Back to step 1</a></p>
-                         
-                 </body>
-          </html>");
+   echo ("  <title>Invalid Feedback Submission</title>
+           </head>
+           <body>
+            <div class=\"title\">Invalid Feedback Submission</div>
+            <div align=\"center\">
+             <div class=\"errorbox\" align=\"left\">
+              <p>The URL that you entered (<a href=\"$referrer_url\">$referrer_url</a>)
+               <br>could not be retrieved.
+              </p>
+              <p>Make sure the URL is correct and publicly accessible.</p>
+              <p><a href=\"javascript:history.back();\">Back to step 1</a></p>
+             </div>
+            </div>
+           </body>
+          </html>\n");
    exit; 
 }
 
+
 /* 
  * Create description from problem code:
  */
@@ -133,47 +204,86 @@ switch($problem)
 
 ?>
 
-<html>
-  <head>
-    <title>Privoxy Action List Feedback - Step 2 of 2</title>
-    <link rel="stylesheet" type="text/css" href="../p_web.css">
-</head>
-
-<h2><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Step 2 of 2</h2>
-<p>
-You are about to report that <?php echo ($problem_description) ?>
-<br>on <a href="<?php echo ($referrer_url) ?>"><?php echo ($referrer_url) ?></a>.
-</p>
+  <title>Privoxy Action List Feedback - Step 2 of 2</title>
+ </head>
+ <body>
 
+  <div class="title"><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Step 2 of 2</div>
 
-<p>
-<form action="<?php echo($base_url); ?>/step3.php" method="post">
+  <div class="box">
+   <b>You are about to report that <?php echo ($problem_description) ?> on
+   <a href="<?php echo ($referrer_url) ?>"><?php echo ($referrer_url) ?></a>.</b>
+  </div>
 
-<input type="hidden" name="problem" value="<?php echo ($problem) ?>">
-<input type="hidden" name="referrer_url" value="<?php echo ($referrer_url) ?>">
+  <div class="box">
+   <form action="<?php echo($base_url); ?>/step3.php" method="post">
+    <p>
+     <input type="hidden" name="problem" value="<?php echo ($problem) ?>">
+     <input type="hidden" name="referrer_url" value="<?php echo ($referrer_url) ?>">
+    </p>
 
-<dl>
+    <dl>
 
 <?php
 
+/*
+ * Create / suppress for elements depending on type of
+ * problem
+ */
 if ($problem != "P1")
 {
    echo ("<!--");
 }
 else
 {
+   /*
+    * Extract all image links from page, make them
+    * absolute, and present them (scaled to reasonable size)
+    * in a table for the user to select
+    */
    preg_match_all('|<img\s+[^>]*?src=[\'"]?(.*?)[\'" >]|i', $page, $matches);
    $count = count($matches[0]);
    if ($count > 0)
    {
-      $referrer_base = substr($referrer_url, 0, -strpos(strrev($referrer_url), '/'));
+      /* 
+       * Base URL ends in slash: don't touch.
+       */
+      if (strpos(strrev($referrer_url), '/') == 0)
+      {
+         $referrer_base = $referrer_url;
+      }
+      /* 
+       * Else grab URL up to last slash as base.
+       */
+      else
+      {
+         $referrer_base = substr($referrer_url, 0, -strpos(strrev($referrer_url), '/'));
+      }
+
+      /* 
+       * Get the protocol + host info for relative links
+       * that start with slash. FIXME: Cut trailing slash off!
+       */
       $referrer_host = "http://".strrev(strrchr(strrev(substr($referrer_url, 7)), "/"));
 
-      echo ("<dt><b>Choose the images to be blocked from the following list:</b></dt><dd><p>\n");
-      echo ("<input type=\"hidden\" name=\"num_images\" value=\"$count\">\n");
-      echo ("<table border=\"0\" cellpadding=\"0\" cellspacing=\"4\">\n");
-      for ($i=0; $i< $count; $i++) {
+      /*
+       * Open section in <dl>; Open table:
+       */
+      echo ("     <dt><b>Choose the images you want blocked from the following list:</b></dt>
+                  <dd>
+                   <p>
+                    <input type=\"hidden\" name=\"num_images\" value=\"$count\">
+                    <table border=\"0\" cellpadding=\"0\" cellspacing=\"4\">\n");
+      /*
+       * Print one table row for each image found:
+       */
+      for ($i=0; $i< $count; $i++)
+      {
          $image_url = $matches[1][$i];
+         /*
+          * Make image URLs absolute:
+          */
          if (strncmp("http://", $image_url, 7))
          {
             if ($image_url{0} == "/")
@@ -185,66 +295,105 @@ else
                $image_url = $referrer_base.$image_url;
             }
          }
-         echo ("<tr><td rowspan=2><input type=\"checkbox\" name=\"block_image[$i]\" value=\"off\"></td>\n");
-         echo ("<td><a href=\"$image_url\">$image_url</a>:</td>\n");
-         echo ("<td><input type=\"hidden\" name=\"image_url[$i]\" value=\"$image_url\"></td></tr>\n");
-         echo ("<tr><td><img style=\"max-width: 300; max-height: 50; min-width: 20; min-height: 20\" src=\"$image_url\"></td></tr>\n");
+
+         /*
+          * Print the row(s):
+          */
+         echo ("       <tr>
+                        <td rowspan=2>
+                         <input type=\"checkbox\" name=\"block_image[$i]\" value=\"off\">
+                        </td>
+                        <td>
+                         <a href=\"$image_url\">$image_url</a>:
+                        </td>
+                        <td>
+                         <input type=\"hidden\" name=\"image_url[$i]\" value=\"$image_url\">
+                        </td>
+                       </tr>
+                       <tr>
+                        <td>
+                         <img onload=\"prettyscale(this);\" src=\"$image_url\" alt=\"banner or not?\">
+                        </td>
+                       </tr>\n");
       }
-      echo ("</table></p></dd><dt><b>If the banner that you saw is not listed above, enter the URL here</b>\n");
+      echo ("      </table>
+                  </dd>
+
+                  <dt>
+                   <b>If the banner that you saw is not listed above, enter the URL here</b>\n");
    }
    else
    {
-      echo ("<dt><b>URL of the advertisment image:</b>\n");
+      echo ("     <dt>
+                   <b>URL of the advertisment image:</b>\n");
    }
 }
 
 ?>
 
-<br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.</i></dt>
-<dd>
-<p><input name="manual_image_url" type="text" size="45" maxlength="255"></p>
-</dd>
+      <br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.</i>
+     </dt>
+     <dd>
+      <p>
+       <input name="manual_image_url" type="text" size="45" maxlength="255">
+      </p>
+     </dd>
+
 <?php if($problem != "P1") echo ("-->") ?>
 
 <?php if($problem != "P2") echo ("<!--") ?>
-<dt><b>URL of the innocent image:</b>
-<br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.
-<br>This may not work if the image was blocked by size or if +image-blocker is set to redirect.</i></dt>
-<dd>
-<p><input name="image_url" value="unknown" type="text" size="45" maxlength="255"></p>
-</dd>
-<?php if($problem != "P2") echo ("-->") ?>
 
+     <dt>
+      <p><b>URL of the innocent image:</b>
+       <br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.
+       <br>This may not work if the image was blocked by size or if +image-blocker is set to redirect.</i>
+      </p>
+     </dt>
+     <dd>
+      <p>
+       <input name="image_url" value="unknown" type="text" size="45" maxlength="255">
+      </p>
+     </dd>
+
+<?php if($problem != "P2") echo ("-->") ?>
 
-<dt><b>Severity:</b></dt>
-<dd>
-<p>
-<select name="severity">
-<option value="3">drives me crazy</option>
-<option selected value="2">vanilla banner</option>
-<option value="1">cosmetic</option>
-</select>
-</p>
-</dd>
-
-<dt><b>Remarks:</b> <i>(optional)</i></dt>
-<dd>
-<p><textarea name="remarks" cols="35" rows="3">None.</textarea></p>
-</dd>
-
-<dt><b>Your Name:</b> <i>(optional)</i></dt>
-<dd>
-<p><input name="name" size="45"></p>
-</dd>
-
-<dt>&nbsp;</dt>
-<dd>
-<input type=submit value="Submit">
-</dd>
-
-</dl>
-</form>
-</p>
-
-</body>
+     <dt><b>Severity:</b></dt>
+     <dd>
+      <p>
+       <select name="severity">
+        <option value="3">drives me crazy</option>
+        <option selected value="2">normal</option>
+        <option value="1">cosmetic</option>
+       </select>
+      </p>
+     </dd>
+
+     <dt>
+      <b>Remarks:</b> <i>(optional)</i>
+     </dt>
+     <dd>
+      <p>
+       <textarea wrap="hard" style="font-size: 10px" name="remarks" cols="35" rows="3">None.</textarea>
+      </p>
+     </dd>
+
+     <dt>
+      <b>Your Name:</b> <i>(optional)</i>
+     </dt>
+     <dd>
+      <p>
+       <input name="name" size="45">
+      </p>
+     </dd>
+
+     <dt>&nbsp;</dt>
+     <dd>
+      <input type=submit value="Submit">
+     </dd>
+
+    </dl>
+   </form>
+  </div>
+
+ </body>
 </html>
index 0a1003d..906845b 100644 (file)
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <!--
+
+  File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/step3.php,v $
+
+  Purpose  :  Submit form for actions file feedback (step 1)
+              This file belongs in
+              ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
+
+  $Id: step3.php,v 1.1 2002/03/30 03:20:30 oes Exp $
+
+  $Log: step3.php,v $
+  Revision 1.1  2002/03/30 03:20:30  oes
+  Added Feedback mechanism for actions file
+
+
+  Written by and Copyright (C) 2002 the SourceForge
+  Privoxy team. http://www.privoxy.org/
+
+  This program is free software; you can redistribute it
+  and/or modify it under the terms of the GNU General
+  Public License as published by the Free Software
+  Foundation; either version 2 of the License, or (at
+  your option) any later version.
+
+  This program is distributed in the hope that it will
+  be useful, but WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A
+  PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  The GNU General Public License should be included with
+  this file.  If not, you can view it at
+  http://www.gnu.org/copyleft/gpl.html
+  or write to the Free Software Foundation, Inc., 59
+  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+ -->
+
+ <head>
+  <style type="text/css">
+   body, div, p, h1, h2, ul, ol, li, td, th, dl, dt, dd { font-family:helvetica,helv,arial,sans-serif; font-size:10px }
+   body { background-color: #ffffff }
+   div.title    { background-color:#dddddd; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:15px; font-weight:bold }
+   div.box      { background-color:#eeeeee; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:10px }
+   div.infobox  { background-color:#ccccff; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
+   div.errorbox { background-color:#ffdddd; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
+  </style>
+
 <?php
 
+/* 
+ * For testing:
+ */
 error_reporting(E_NONE);
-#error_reporting(E_ALL);
-
-//  File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/step3.php,v $
-//
-//  Purpose  :  Submit form for actions file feedback (step 1)
-//              This file belongs in
-//              ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
-//
-//  $Id: step3.php,v 1.2 2002/03/30 19:49:34 swa Exp $
-//
-//  $Log: step3.php,v $
-//  Revision 1.2  2002/03/30 19:49:34  swa
-//  have consistent look and feel
-//
-//  Revision 1.1  2002/03/30 03:20:30  oes
-//  Added Feedback mechanism for actions file
-//
-//
-//  Written by and Copyright (C) 2001 the SourceForge
-//  Privoxy team. http://www.privoxy.org/
-//
-//  Based on the Internet Junkbuster originally written
-//  by and Copyright (C) 1997 Anonymous Coders and
-//  Junkbusters Corporation.  http://www.junkbusters.com
-//
-//  This program is free software; you can redistribute it
-//  and/or modify it under the terms of the GNU General
-//  Public License as published by the Free Software
-//  Foundation; either version 2 of the License, or (at
-//  your option) any later version.
-//
-//  This program is distributed in the hope that it will
-//  be useful, but WITHOUT ANY WARRANTY; without even the
-//  implied warranty of MERCHANTABILITY or FITNESS FOR A
-//  PARTICULAR PURPOSE.  See the GNU General Public
-//  License for more details.
-//
-//  The GNU General Public License should be included with
-//  this file.  If not, you can view it at
-//  http://www.gnu.org/copyleft/gpl.html
-//  or write to the Free Software Foundation, Inc., 59
-//  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-//
-//
+//error_reporting(E_ALL);
+//phpinfo();
+
 
 /* 
  * Cannot start with step 3:
  */
 if (!isset($referrer_url))
 {
-     echo ("<html><head><title>Invalid Feedback Submission</title>
-           <link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\">
-               </head>
-                <body><h2>Invalid Feedback Submission</h2>
-                      <p>When submitting your feedback, please start with
-                         <a href=\"index.php\">step 1</a>.</p>
-                 </body>
+   echo ("  <title>Invalid Feedback Submission</title>
+           </head>
+           <body>
+            <div class=\"title\">Invalid Feedback Submission</div>
+            <div align=\"center\">
+             <div class=\"errorbox\" align=\"left\">
+              When submitting your feedback please start with <a href=\"index.php\">step 1</a>.
+             </div>
+            </div>
+           </body>
           </html>");
    exit; 
 }
 
+
 /* 
  * Cannot work on unknown problem:
  */
 if (!isset($problem))
 {
-     echo ("<html><head><title>Invalid Feedback Submission</title>
-           <link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\">
-               </head>
-                <body><h2>Invalid Feedback Submission</h2>
-                      <p>You need to select the nature of the problem in
-                         <a href=\"index.php\">step 1</a>.</p>
-                 </body>
+   echo ("  <title>Invalid Feedback Submission</title>
+           </head>
+           <body>
+            <div class=\"title\">Invalid Feedback Submission</div>
+            <div align=\"center\">
+             <div class=\"errorbox\" align=\"left\">
+              You need to select the nature of the problem in <a href=\"index.php\">step 1</a>.
+             </div>
+            </div>
+           </body>
           </html>");
    exit; 
 }
 
+
 /*
  * Handle optional text fields:
  */
-if (!isset($name))
+if (!isset($name) || ($name == ""))
 {
    $name = "anonymous";
 }
 
+
 /* 
- * Open the logfile:
+ * Open the logfile or fail:
  */
 $logfile = "feedback-data.txt";
 $fp = fopen($logfile, "a");
 
 if(!$fp)
 {
-   echo ("<html><head><title>Internal Script Error</title>
-           <link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\">
-               </head>
-                <body><h2>Internal Script Error</h2>
-                      <p>This script was unable to open its logfile.</p>
-                      <p>Please <a href=\"mailto:info@privoxy.org?SUBJECT=Feedback-Script-Broken\">mail its owner</a>!</p>
-                 </body>
+   echo ("  <title>Internal Script Error</title>
+           </head>
+           <body>
+            <div class=\"title\">Internal Script Error</div>
+            <div align=\"center\">
+             <div class=\"errorbox\" align=\"left\">
+              <p>
+               This script was unable to open its logfile.
+              </p>
+              <p>
+               Please <a href=\"mailto:info@privoxy.org?SUBJECT=Feedback-Script-Broken\">mail its owner</a>!
+              </p>
+             </div>
+            </div>
+           </body>
           </html>");
    exit; 
 }
 
+
 /*
- * Write Head and remarks field:
+ * Write Head (type, severity, user, client-ip)
+ * and remarks field:
  */
-fwrite($fp, "#FEEDBACK TYPE $problem SEVERITY $severity FROM $name ON $REMOTE_ADDR\n");
+fwrite($fp, "\n#FEEDBACK TYPE $problem SEVERITY $severity FROM $name ON $REMOTE_ADDR\n");
 if (isset($remarks))
 {
    $lines = explode("\n", $remarks);
@@ -118,12 +149,16 @@ if (isset($remarks))
    }
 }
 
+
 /*
  * Depending on the type of problem reported,
  * we need to write additional data:
  */
 switch ($problem)
 {
+   /*
+    * Banner not blocked:
+    */
    case "P1":
       fwrite($fp, "#BLOCK-REFERRER: $referrer_url\n");
       if (isset($num_images))
@@ -142,35 +177,51 @@ switch ($problem)
       }
       break;
 
+   /*
+    * Innocent image blocked:
+    */
    case "P2":
       fwrite($fp, "#UNBLOCK-REFERRER: $referrer_url\n");
-      if (isset($manual_image_url) && ($manual_image_url != ""))
+      if (isset($image_url) && ($image_url != ""))
       {
-         fwrite($fp, "#UNBLOCK-URL: image_url\n");
+         fwrite($fp, "#UNBLOCK-URL: $image_url\n");
       }
       break;
 
-
+   /*
+    * All other problems:
+    */
+   default:
+      fwrite($fp, "#PROBLEM-URL: $referrer_url\n");
+      break;
 }        
             
 fclose($fp);
 
 ?>
 
-<html>
-  <head>
-    <title>Privoxy Action List Feedback - Result</title>
-    <link rel="stylesheet" type="text/css" href="../p_web.css">
-</head>
-
-<h2><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Result</h2>
-
-<p><b>Thank you very much for taking the time to submit your feedback!</b></p>
-
-<p>It will be reviewed by the developers and used to improve the
-distribution actions file.</p>
-
-<input type="submit" value="Close this window" onClick="window.close()">
-
-</body>
+  <title>Privoxy Action List Feedback - Result</title>
+ </head>
+
+ <body>
+  <div class="title">
+   <a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Result
+  </div>
+
+  <div class="box">
+   <p>
+    <b>Thank you very much for taking the time to submit your feedback!</b>
+   </p>
+
+   <p>
+    It will be reviewed by the developers and used to improve the
+    distribution actions file.
+   </p>
+   
+   <p align=center>
+    <input type="submit" value="Close this window" onclick="window.close();">
+   </p>
+
+  </div>
+ </body>
 </html>