prework: list of what needs to
[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.10 2002/04/06 15:19:35 oes Exp $
12
13   $Log: step3.php,v $
14   Revision 1.10  2002/04/06 15:19:35  oes
15   Clean-up, smarter handling of unreachable URLs
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   <meta http-equiv="Content-Style-Type" content="text/css">
52   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
53   <link rel="stylesheet" type="text/css" href="../p_feedback.css">
54
55
56 <?php
57
58 /* 
59  * Config:
60  */
61 $logfile = "results/actions-feedback.txt";
62
63
64 /* 
65  * Debug:
66  */
67 //phpinfo();
68 //error_reporting(E_ALL);
69 error_reporting(E_NONE);
70
71 /*
72  * Function: error_abort
73  * Purpose:  Return an error page with $title and $message
74  */
75 function error_abort($title, $message)
76 {
77    if ($title == "invalid") /* shortcut */
78    {
79       $title = "Invalid Feedback Submission";
80    }
81
82    echo ("  <title>Privoxy: $title</title>
83            </head>
84            <body>
85             <div class=\"title\">
86              <h1>
87               <a href=\"http://www.privoxy.org/\">Privoxy</a>: $title
88               </h1>
89              </div>
90             <center>
91              <div class=\"errorbox\">
92               $message
93              </div>
94             </center>
95             <p>Valid <a href=\"http://validator.w3.org/\">HTML 4.01 Transitional</a></p>
96            </body>
97           </html>\n");
98    exit; 
99 }
100
101
102 /* 
103  * Cannot start with step 3:
104  */
105 if (!isset($referrer_url))
106 {
107    error_abort("invalid", "When submitting your feedback please start with <a href=\"index.php\">step 1</a>.");
108 }
109
110
111 /* 
112  * Cannot work on unknown problem:
113  */
114 if (!isset($problem))
115 {
116    error_abort("invalid", "You need to select the nature of the problem in <a href=\"index.php\">step 1</a>.");
117 }
118
119
120 /* 
121  * Don't accept unconfirmed URLs
122  */
123 if (!isset($url_confirmed))
124 {
125    error_abort("invalid", "When submitting URLs that this script can't retrieve, you need to check \"Yes, I'm sure\"
126                 <a href=\"javascript:history.back();\">step 2</a>.");
127 }
128
129
130 /*
131  * Handle optional text fields:
132  */
133 if (!isset($name) || ($name == ""))
134 {
135    $name = "anonymous";
136 }
137
138
139 /* 
140  * Open the logfile or fail:
141  */
142 $fp = fopen($logfile, "a");
143
144 if(!$fp)
145 {
146    echo ("  <title>Internal Script Error</title>
147            </head>
148            <body>
149             <div class=\"title\">
150               <h1><a href=\"http://www.privoxy.org/\">Privoxy</a>: Internal Script Error</h1>
151             </div>
152             <center>
153              <div class=\"errorbox\">
154               <p>
155                This script was unable to open its logfile.
156               </p>
157               <p>
158                Please <a href=\"mailto:info@privoxy.org?SUBJECT=Feedback-Script-Broken\">mail its owner</a>!
159               </p>
160              </div>
161             </center>
162            </body>
163           </html>");
164    exit; 
165 }
166
167
168 /*
169  * Write Head (type, severity, user, client-ip)
170  * and remarks field:
171  */
172 fwrite($fp, "\n#FEEDBACK TYPE $problem SEVERITY $severity FROM $name ON $REMOTE_ADDR VERIFIED $url_verified TIME " . date("r") ."\n");
173 if (isset($remarks))
174 {
175    $lines = explode("\n", $remarks);
176    foreach ($lines as $line)
177    {
178       fwrite($fp, "#REMARKS: $line\n");
179    }
180 }
181
182
183 /*
184  * Depending on the type of problem reported,
185  * we need to write additional data:
186  */
187 switch ($problem)
188 {
189    /*
190     * Banner not blocked:
191     */
192    case "P1":
193       fwrite($fp, "#BLOCK-REFERRER: $referrer_url\n");
194       if (isset($num_images))
195       {
196          for($i=0; $i < $num_images; $i++)
197          {
198              if (isset($block_image[$i]))
199              {
200                 fwrite($fp, "#BLOCK-URL: $image_url[$i]\n");
201              }
202          }
203       }
204       if (isset($manual_image_url) && ($manual_image_url != ""))
205       {
206          fwrite($fp, "#BLOCK-URL: $manual_image_url\n");
207       }
208       break;
209
210    /*
211     * Innocent image blocked:
212     */
213    case "P2":
214       fwrite($fp, "#UNBLOCK-REFERRER: $referrer_url\n");
215       if (isset($image_url) && ($image_url != ""))
216       {
217          fwrite($fp, "#UNBLOCK-URL: $image_url\n");
218       }
219       break;
220
221    /*
222     * All other problems:
223     */
224    default:
225       fwrite($fp, "#PROBLEM-URL: $referrer_url\n");
226       break;
227 }        
228             
229 fclose($fp);
230
231 // now fill the tracker on sf with all the necessary values:
232 //
233 // <FORM ACTION="/tracker/index.php?group_id=11118&atid=460288" METHOD="POST" enctype="multipart/form-data">
234 // <INPUT TYPE="HIDDEN" NAME="func" VALUE="postadd">
235 //
236 // <SELECT NAME="category_id">
237 // <OPTION VALUE="100">None</OPTION>
238 // <OPTION VALUE="412811">filter: ad-incorrectly-blocked</OPTION>
239 // <OPTION VALUE="412810">filter: ad-not-blocked</OPTION>
240 // <OPTION VALUE="412814">filter: other problem</OPTION>
241 // <OPTION VALUE="412812">filter: page-incorrectly-block</OPTION>
242 // <OPTION VALUE="412813">filter: popups-incorrectly blo</OPTION>
243 //
244 //  <SELECT NAME="artifact_group_id">
245 //  <OPTION VALUE="100">None</OPTION>
246 //  <OPTION VALUE="195870">action file version 1.0</OPTION>
247 //  <OPTION VALUE="195871">action file version 1.1</OPTION>
248 //  <OPTION VALUE="195872">action file version 1.2</OPTION>
249 //  <OPTION VALUE="195873">action file version 1.3</OPTION>
250 //  <OPTION VALUE="195874">action file version 1.4</OPTION>
251 //  <OPTION VALUE="195875">action file version 1.5</OPTION>
252 //  <OPTION VALUE="195876">action file version 1.6</OPTION>
253 //  <OPTION VALUE="195877">action file version 1.7</OPTION>
254 //  <OPTION VALUE="195878">action file version 1.8</OPTION>
255 //  <OPTION VALUE="195879">action file version 1.9</OPTION>
256 //  <OPTION VALUE="195880">action file version 2.0</OPTION> 
257 //
258 // <SELECT NAME="assigned_to">
259 // <OPTION VALUE="100">None</OPTION>
260 // <OPTION VALUE="128588">bart1803</OPTION>
261 // <OPTION VALUE="249980">david__schmidt</OPTION>
262 // <OPTION VALUE="79346">gliptak</OPTION>
263 // <OPTION VALUE="322640">hal9</OPTION>
264 // <OPTION VALUE="108873">joergs</OPTION>
265 // <OPTION VALUE="199289">jongfoster</OPTION>
266 // <OPTION VALUE="10857">morcego</OPTION>
267 // <OPTION VALUE="78811">oes</OPTION>
268 // <OPTION VALUE="43129">roro</OPTION>
269 // <OPTION VALUE="249832">steudten</OPTION>
270 // <OPTION VALUE="74317">swa</OPTION>
271 //
272 // <SELECT NAME="priority">
273 // <OPTION VALUE="1">1 - Lowest</OPTION>
274 // <OPTION VALUE="2">2</OPTION>
275 // <OPTION VALUE="3">3</OPTION>
276 // <OPTION VALUE="4">4</OPTION>
277 // <OPTION VALUE="5" SELECTED>5 - Medium</OPTION>
278 // <OPTION VALUE="6">6</OPTION>
279 // <OPTION VALUE="7">7</OPTION>
280 // <OPTION VALUE="8">8</OPTION>
281 // <OPTION VALUE="9">9 - Highest</OPTION>
282 //
283 // 
284 // we can either put everything in here (nicely formatted) ..
285 // <TEXTAREA NAME="details" ROWS="30" COLS="55" WRAP="HARD"></TEXTAREA>
286 //
287 // ... or attach a file (with the html header so it gets displayed
288 // as if it is a html file
289 // <input type="checkbox" name="add_file" VALUE="1">
290 // <input type="file" name="input_file" size="30">
291 // <input type="text" name="file_description" size="40" maxlength="255">
292 //
293 // <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="SUBMIT">
294
295 ?>
296
297   <title>Privoxy Action List Feedback - Result</title>
298  </head>
299
300  <body>
301   <div class="title">
302    <h1>
303     <a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Result
304    </h1>
305   </div>
306
307   <div class="box">
308    <p>
309     <b>Thank you very much for taking the time to submit your feedback!</b>
310    </p>
311
312    <p>
313     It will be reviewed by the developers and used to improve the
314     distribution actions file.
315    </p>
316    
317    <p align=center>
318     <input type="submit" value="Close this window" onclick="window.close();">
319    </p>
320
321   </div>
322
323   <p>Valid <a href="http://validator.w3.org/">HTML 4.01 Transitional</a></p>
324
325  </body>
326 </html>