consistent look
[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     <link rel="stylesheet" type="text/css" href="../p_feedback.css">
49
50 <?php
51
52 /* 
53  * For testing:
54  */
55 //phpinfo();
56 //error_reporting(E_ALL);
57 error_reporting(E_NONE);
58
59
60
61 /* 
62  * Cannot start with step 3:
63  */
64 if (!isset($referrer_url))
65 {
66    echo ("  <title>Invalid Feedback Submission</title>
67             <link rel="stylesheet" type="text/css" href="../p_feedback.css">
68            </head>
69            <body>
70             <div class=\"title\">Invalid Feedback Submission</div>
71             <div align=\"center\">
72              <div class=\"errorbox\" align=\"left\">
73               When submitting your feedback please start with <a href=\"index.php\">step 1</a>.
74              </div>
75             </div>
76            </body>
77           </html>");
78    exit; 
79 }
80
81
82 /* 
83  * Cannot work on unknown problem:
84  */
85 if (!isset($problem))
86 {
87    echo ("  <title>Invalid Feedback Submission</title>
88             <link rel="stylesheet" type="text/css" href="../p_feedback.css">
89            </head>
90            <body>
91             <div class=\"title\">Invalid Feedback Submission</div>
92             <div align=\"center\">
93              <div class=\"errorbox\" align=\"left\">
94               You need to select the nature of the problem in <a href=\"index.php\">step 1</a>.
95              </div>
96             </div>
97            </body>
98           </html>");
99    exit; 
100 }
101
102
103 /*
104  * Handle optional text fields:
105  */
106 if (!isset($name) || ($name == ""))
107 {
108    $name = "anonymous";
109 }
110
111
112 /* 
113  * Open the logfile or fail:
114  */
115 $logfile = "feedback-data.txt";
116 $fp = fopen($logfile, "a");
117
118 if(!$fp)
119 {
120    echo ("  <title>Internal Script Error</title>
121             <link rel="stylesheet" type="text/css" href="../p_feedback.css">
122            </head>
123            <body>
124             <div class=\"title\">Internal Script Error</div>
125             <div align=\"center\">
126              <div class=\"errorbox\" align=\"left\">
127               <p>
128                This script was unable to open its logfile.
129               </p>
130               <p>
131                Please <a href=\"mailto:info@privoxy.org?SUBJECT=Feedback-Script-Broken\">mail its owner</a>!
132               </p>
133              </div>
134             </div>
135            </body>
136           </html>");
137    exit; 
138 }
139
140
141 /*
142  * Write Head (type, severity, user, client-ip)
143  * and remarks field:
144  */
145 fwrite($fp, "\n#FEEDBACK TYPE $problem SEVERITY $severity FROM $name ON $REMOTE_ADDR\n");
146 if (isset($remarks))
147 {
148    $lines = explode("\n", $remarks);
149    foreach ($lines as $line)
150    {
151       fwrite($fp, "#REMARKS: $line\n");
152    }
153 }
154
155
156 /*
157  * Depending on the type of problem reported,
158  * we need to write additional data:
159  */
160 switch ($problem)
161 {
162    /*
163     * Banner not blocked:
164     */
165    case "P1":
166       fwrite($fp, "#BLOCK-REFERRER: $referrer_url\n");
167       if (isset($num_images))
168       {
169          for($i=0; $i < $num_images; $i++)
170          {
171              if (isset($block_image[$i]))
172              {
173                 fwrite($fp, "#BLOCK-URL: $image_url[$i]\n");
174              }
175          }
176       }
177       if (isset($manual_image_url) && ($manual_image_url != ""))
178       {
179          fwrite($fp, "#BLOCK-URL: $manual_image_url\n");
180       }
181       break;
182
183    /*
184     * Innocent image blocked:
185     */
186    case "P2":
187       fwrite($fp, "#UNBLOCK-REFERRER: $referrer_url\n");
188       if (isset($image_url) && ($image_url != ""))
189       {
190          fwrite($fp, "#UNBLOCK-URL: $image_url\n");
191       }
192       break;
193
194    /*
195     * All other problems:
196     */
197    default:
198       fwrite($fp, "#PROBLEM-URL: $referrer_url\n");
199       break;
200 }        
201             
202 fclose($fp);
203
204 ?>
205
206   <title>Privoxy Action List Feedback - Result</title>
207   <link rel="stylesheet" type="text/css" href="../p_feedback.css">
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     The developers will review and use your submission 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>