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