8f7ba7e3b40b09b7221f89d8403ba4fc3a64bff0
[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.7 2002/04/04 10:29:58 oes Exp $
12
13   $Log: step3.php,v $
14   Revision 1.7  2002/04/04 10:29:58  oes
15   Keeping feedback confidential
16
17   Revision 1.6  2002/04/03 19:36:04  swa
18   consistent look
19
20   Revision 1.5  2002/04/02 07:22:43  oes
21   Cosmetics
22
23   Revision 1.4  2002/04/01 19:13:47  oes
24   Extended, fixed bugs, beefed up design, made IE-safe
25
26   Revision 1.1  2002/03/30 03:20:30  oes
27   Added Feedback mechanism for actions file
28
29
30   Written by and Copyright (C) 2002 the SourceForge
31   Privoxy team. http://www.privoxy.org/
32
33   This program is free software; you can redistribute it
34   and/or modify it under the terms of the GNU General
35   Public License as published by the Free Software
36   Foundation; either version 2 of the License, or (at
37   your option) any later version.
38
39   This program is distributed in the hope that it will
40   be useful, but WITHOUT ANY WARRANTY; without even the
41   implied warranty of MERCHANTABILITY or FITNESS FOR A
42   PARTICULAR PURPOSE.  See the GNU General Public
43   License for more details.
44
45   The GNU General Public License should be included with
46   this file.  If not, you can view it at
47   http://www.gnu.org/copyleft/gpl.html
48   or write to the Free Software Foundation, Inc., 59
49   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
50
51  -->
52
53  <head>
54   <link rel="stylesheet" type="text/css" href="../p_feedback.css">
55
56 <?php
57
58 /* 
59  * Config:
60  */
61 $logfile = "results/actions-feedback.txt";
62
63 /* 
64  * For testing:
65  */
66 //phpinfo();
67 //error_reporting(E_ALL);
68 error_reporting(E_NONE);
69
70
71 /* 
72  * Cannot start with step 3:
73  */
74 if (!isset($referrer_url))
75 {
76    echo ("  <title>Invalid Feedback Submission</title>
77            </head>
78            <body>
79             <div class=\"title\">Invalid Feedback Submission</div>
80             <div align=\"center\">
81              <div class=\"errorbox\" align=\"left\">
82               When submitting your feedback please start with <a href=\"index.php\">step 1</a>.
83              </div>
84             </div>
85            </body>
86           </html>");
87    exit; 
88 }
89
90
91 /* 
92  * Cannot work on unknown problem:
93  */
94 if (!isset($problem))
95 {
96    echo ("  <title>Invalid Feedback Submission</title>
97            </head>
98            <body>
99             <div class=\"title\">Invalid Feedback Submission</div>
100             <div align=\"center\">
101              <div class=\"errorbox\" align=\"left\">
102               You need to select the nature of the problem in <a href=\"index.php\">step 1</a>.
103              </div>
104             </div>
105            </body>
106           </html>");
107    exit; 
108 }
109
110
111 /*
112  * Handle optional text fields:
113  */
114 if (!isset($name) || ($name == ""))
115 {
116    $name = "anonymous";
117 }
118
119
120 /* 
121  * Open the logfile or fail:
122  */
123 $fp = fopen($logfile, "a");
124
125 if(!$fp)
126 {
127    echo ("  <title>Internal Script Error</title>
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  </head>
214
215  <body>
216   <div class="title">
217    <a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Result
218   </div>
219
220   <div class="box">
221    <p>
222     <b>Thank you very much for taking the time to submit your feedback!</b>
223    </p>
224
225    <p>
226     The developers will review and use your submission to improve the
227     distribution actions file.
228    </p>
229    
230    <p align=center>
231     <input type="submit" value="Close this window" onclick="window.close();">
232    </p>
233
234   </div>
235  </body>
236 </html>