5705996921a077ac6c3fba1b0237e4211e248d38
[privoxy.git] / doc / webserver / actions / step3.php
1 <?php
2
3 error_reporting(E_NONE);
4 #error_reporting(E_ALL);
5
6 //  File :  $Source: $
7 //
8 //  Purpose  :  Submit form for actions file feedback (step 1)
9 //              This file belongs in
10 //              ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
11 //
12 //  $Id: $
13 //
14 //  $Log: $
15 //
16 //  Written by and Copyright (C) 2001 the SourceForge
17 //  Privoxy team. http://www.privoxy.org/
18 //
19 //  Based on the Internet Junkbuster originally written
20 //  by and Copyright (C) 1997 Anonymous Coders and
21 //  Junkbusters Corporation.  http://www.junkbusters.com
22 //
23 //  This program is free software; you can redistribute it
24 //  and/or modify it under the terms of the GNU General
25 //  Public License as published by the Free Software
26 //  Foundation; either version 2 of the License, or (at
27 //  your option) any later version.
28 //
29 //  This program is distributed in the hope that it will
30 //  be useful, but WITHOUT ANY WARRANTY; without even the
31 //  implied warranty of MERCHANTABILITY or FITNESS FOR A
32 //  PARTICULAR PURPOSE.  See the GNU General Public
33 //  License for more details.
34 //
35 //  The GNU General Public License should be included with
36 //  this file.  If not, you can view it at
37 //  http://www.gnu.org/copyleft/gpl.html
38 //  or write to the Free Software Foundation, Inc., 59
39 //  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
40 //
41 //
42
43 /* 
44  * Cannot start with step 3:
45  */
46 if (!isset($referrer_url))
47 {
48      echo ("<html><head><title>Invalid Feedback Submission</title></head>
49                 <body><h2>Invalid Feedback Submission</h2>
50                       <p>When submitting your feedback please start with
51                          <a href=\"test.php\">step 1</a>.</p>
52                  </body>
53           </html>");
54    exit; 
55 }
56
57 /* 
58  * Cannot work on unknown problem:
59  */
60 if (!isset($problem))
61 {
62      echo ("<html><head><title>Invalid Feedback Submission</title></head>
63                 <body><h2>Invalid Feedback Submission</h2>
64                       <p>You need to select the nature of the problem in
65                          <a href=\"test.php\">step 1</a>.</p>
66                  </body>
67           </html>");
68    exit; 
69 }
70
71 /*
72  * Handle optional text fields:
73  */
74 if (!isset($name))
75 {
76    $name = "anonymous";
77 }
78
79 /* 
80  * Open the logfile:
81  */
82 $logfile = "feedback-data.txt";
83 $fp = fopen($logfile, "a");
84
85 if(!$fp)
86 {
87    echo ("<html><head><title>Internal Script Error</title></head>
88                 <body><h2>Internal Script Error</h2>
89                       <p>This script was unable to open its logfile.</p>
90                       <p>Please <a href=\"mailto:info@privoxy.org?SUBJECT=Feedback-Script-Broken\">mail its owner</a>!</p>
91                  </body>
92           </html>");
93    exit; 
94 }
95
96 /*
97  * Write Head and remarks field:
98  */
99 fwrite($fp, "#FEEDBACK TYPE $problem SEVERITY $severity FROM $name ON $REMOTE_ADDR\n");
100 if (isset($remarks))
101 {
102    $lines = explode("\n", $remarks);
103    foreach ($lines as $line)
104    {
105       fwrite($fp, "#REMARKS: $line\n");
106    }
107 }
108
109 /*
110  * Depending on the type of problem reported,
111  * we need to write additional data:
112  */
113 switch ($problem)
114 {
115    case "P1":
116       fwrite($fp, "#BLOCK-REFERRER: $referrer_url\n");
117       if (isset($num_images))
118       {
119          for($i=0; $i < $num_images; $i++)
120          {
121              if (isset($block_image[$i]))
122              {
123                 fwrite($fp, "#BLOCK-URL: $image_url[$i]\n");
124              }
125          }
126       }
127       if (isset($manual_image_url) && ($manual_image_url != ""))
128       {
129          fwrite($fp, "#BLOCK-URL: $manual_image_url\n");
130       }
131       break;
132
133    case "P2":
134       fwrite($fp, "#UNBLOCK-REFERRER: $referrer_url\n");
135       if (isset($manual_image_url) && ($manual_image_url != ""))
136       {
137          fwrite($fp, "#UNBLOCK-URL: image_url\n");
138       }
139       break;
140
141
142 }        
143             
144 fclose($fp);
145
146 ?>
147
148 <html>
149   <head>
150     <title>Privoxy Action List Feedback - Result</title>
151     <link rel="stylesheet" type="text/css" href="../p_web.css">
152 </head>
153
154 <h2><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Result</h2>
155
156 <p><b>Thank you very much for taking the time to submit your feedback!</b></p>
157
158 <p>It will be reviewed by the developers and used to improve the
159 distribution actions file.</p>
160
161 <input type="submit" value="Close this window" onClick="window.close()">
162
163 </body>
164 </html>