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