Cosmetics
[privoxy.git] / doc / webserver / actions / step3.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3  <!--
4
5   File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/step3.php,v $
6
7   Purpose  :  Submit form for actions file feedback (step 1)
8               This file belongs in
9               ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
10
11   $Id: step3.php,v 1.4 2002/04/01 19:13:47 oes Exp $
12
13   $Log: step3.php,v $
14   Revision 1.4  2002/04/01 19:13:47  oes
15   Extended, fixed bugs, beefed up design, made IE-safe
16
17   Revision 1.1  2002/03/30 03:20:30  oes
18   Added Feedback mechanism for actions file
19
20
21   Written by and Copyright (C) 2002 the SourceForge
22   Privoxy team. http://www.privoxy.org/
23
24   This program is free software; you can redistribute it
25   and/or modify it under the terms of the GNU General
26   Public License as published by the Free Software
27   Foundation; either version 2 of the License, or (at
28   your option) any later version.
29
30   This program is distributed in the hope that it will
31   be useful, but WITHOUT ANY WARRANTY; without even the
32   implied warranty of MERCHANTABILITY or FITNESS FOR A
33   PARTICULAR PURPOSE.  See the GNU General Public
34   License for more details.
35
36   The GNU General Public License should be included with
37   this file.  If not, you can view it at
38   http://www.gnu.org/copyleft/gpl.html
39   or write to the Free Software Foundation, Inc., 59
40   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
41
42  -->
43
44  <head>
45   <style type="text/css">
46    body, div, p, h1, h2, ul, ol, li, td, th, dl, dt, dd { font-family:helvetica,helv,arial,sans-serif; font-size:10px }
47    body { background-color: #ffffff }
48    div.title    { background-color:#dddddd; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:15px; font-weight:bold }
49    div.box      { background-color:#eeeeee; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:10px }
50    div.infobox  { background-color:#ccccff; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
51    div.errorbox { background-color:#ffdddd; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
52   </style>
53
54 <?php
55
56 /* 
57  * For testing:
58  */
59 //phpinfo();
60 //error_reporting(E_ALL);
61 error_reporting(E_NONE);
62
63
64
65 /* 
66  * Cannot start with step 3:
67  */
68 if (!isset($referrer_url))
69 {
70    echo ("  <title>Invalid Feedback Submission</title>
71            </head>
72            <body>
73             <div class=\"title\">Invalid Feedback Submission</div>
74             <div align=\"center\">
75              <div class=\"errorbox\" align=\"left\">
76               When submitting your feedback please start with <a href=\"index.php\">step 1</a>.
77              </div>
78             </div>
79            </body>
80           </html>");
81    exit; 
82 }
83
84
85 /* 
86  * Cannot work on unknown problem:
87  */
88 if (!isset($problem))
89 {
90    echo ("  <title>Invalid Feedback Submission</title>
91            </head>
92            <body>
93             <div class=\"title\">Invalid Feedback Submission</div>
94             <div align=\"center\">
95              <div class=\"errorbox\" align=\"left\">
96               You need to select the nature of the problem in <a href=\"index.php\">step 1</a>.
97              </div>
98             </div>
99            </body>
100           </html>");
101    exit; 
102 }
103
104
105 /*
106  * Handle optional text fields:
107  */
108 if (!isset($name) || ($name == ""))
109 {
110    $name = "anonymous";
111 }
112
113
114 /* 
115  * Open the logfile or fail:
116  */
117 $logfile = "feedback-data.txt";
118 $fp = fopen($logfile, "a");
119
120 if(!$fp)
121 {
122    echo ("  <title>Internal Script Error</title>
123            </head>
124            <body>
125             <div class=\"title\">Internal Script Error</div>
126             <div align=\"center\">
127              <div class=\"errorbox\" align=\"left\">
128               <p>
129                This script was unable to open its logfile.
130               </p>
131               <p>
132                Please <a href=\"mailto:info@privoxy.org?SUBJECT=Feedback-Script-Broken\">mail its owner</a>!
133               </p>
134              </div>
135             </div>
136            </body>
137           </html>");
138    exit; 
139 }
140
141
142 /*
143  * Write Head (type, severity, user, client-ip)
144  * and remarks field:
145  */
146 fwrite($fp, "\n#FEEDBACK TYPE $problem SEVERITY $severity FROM $name ON $REMOTE_ADDR\n");
147 if (isset($remarks))
148 {
149    $lines = explode("\n", $remarks);
150    foreach ($lines as $line)
151    {
152       fwrite($fp, "#REMARKS: $line\n");
153    }
154 }
155
156
157 /*
158  * Depending on the type of problem reported,
159  * we need to write additional data:
160  */
161 switch ($problem)
162 {
163    /*
164     * Banner not blocked:
165     */
166    case "P1":
167       fwrite($fp, "#BLOCK-REFERRER: $referrer_url\n");
168       if (isset($num_images))
169       {
170          for($i=0; $i < $num_images; $i++)
171          {
172              if (isset($block_image[$i]))
173              {
174                 fwrite($fp, "#BLOCK-URL: $image_url[$i]\n");
175              }
176          }
177       }
178       if (isset($manual_image_url) && ($manual_image_url != ""))
179       {
180          fwrite($fp, "#BLOCK-URL: $manual_image_url\n");
181       }
182       break;
183
184    /*
185     * Innocent image blocked:
186     */
187    case "P2":
188       fwrite($fp, "#UNBLOCK-REFERRER: $referrer_url\n");
189       if (isset($image_url) && ($image_url != ""))
190       {
191          fwrite($fp, "#UNBLOCK-URL: $image_url\n");
192       }
193       break;
194
195    /*
196     * All other problems:
197     */
198    default:
199       fwrite($fp, "#PROBLEM-URL: $referrer_url\n");
200       break;
201 }        
202             
203 fclose($fp);
204
205 ?>
206
207   <title>Privoxy Action List Feedback - Result</title>
208  </head>
209
210  <body>
211   <div class="title">
212    <a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Result
213   </div>
214
215   <div class="box">
216    <p>
217     <b>Thank you very much for taking the time to submit your feedback!</b>
218    </p>
219
220    <p>
221     It will be reviewed by the developers and used to improve the
222     distribution actions file.
223    </p>
224    
225    <p align=center>
226     <input type="submit" value="Close this window" onclick="window.close();">
227    </p>
228
229   </div>
230  </body>
231 </html>