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