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