Updated to new Bookmarklet
[privoxy.git] / doc / webserver / actions / index.php
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3  <!--
4
5   File :  $Source: /cvsroot/ijbswa/current/doc/webserver/actions/index.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: index.php,v 1.21 2002/04/10 13:44:07 oes Exp $
12
13   $Log: index.php,v $
14   Revision 1.20  2002/04/10 00:07:35  oes
15   Moved window sizing and positioning code to Bookmarklet
16
17   Revision 1.19  2002/04/09 13:06:29  oes
18   Resize and jump to the right on load
19
20   Revision 1.18  2002/04/08 17:03:29  oes
21    - Fixed problem with spaces in URLs
22    - Adapt to unified stylesheet
23
24   Revision 1.17  2002/04/08 10:32:00  oes
25   cosmetics again
26
27   Revision 1.16  2002/04/08 08:11:04  oes
28   Bumped up actions file number
29
30   Revision 1.15  2002/04/07 17:13:08  oes
31   Ooops: fixing submit target url
32
33   Revision 1.14  2002/04/07 15:10:12  oes
34   Restoring CVS history
35
36   Revision 1.13  2002/04/06 15:19:35  oes
37   Clean-up, smarter handling of unreachable URLs
38
39   Revision 1.12  2002/04/06 11:34:44  oes
40   Cosmetics
41
42   Revision 1.11  2002/04/04 19:48:11  oes
43   Reactivating the scripts ,-)
44
45   Revision 1.10  2002/04/03 19:36:04  swa
46   consistent look
47
48   Revision 1.9  2002/04/02 19:32:45  oes
49   Adding temporary fix for missing curl support on SF (step 2 + 3 on oesterhelt.org)
50
51   Revision 1.8  2002/04/02 08:45:22  oes
52   Made script location indepandant
53
54   Revision 1.7  2002/04/02 07:21:34  oes
55   Using relative link for step2
56
57   Revision 1.6  2002/04/02 06:14:22  oes
58   Fixed bookmarklet
59
60   Revision 1.5  2002/04/01 19:13:47  oes (based on 1.2)
61   Extended, fixed bugs, beefed up design, made IE-safe
62
63   Revision 1.4  2002/03/30 20:44:44  swa
64   have consistent look and feel. part 2.
65   use correct urls.
66
67   Revision 1.3  2002/03/30 19:49:34  swa
68   have consistent look and feel
69
70   Revision 1.2  2002/03/30 03:35:48  oes
71   Updated bookmarklet
72
73   Revision 1.1  2002/03/30 03:20:30  oes
74   Added Feedback mechanism for actions file
75
76
77   Copyright (C) 2002 the SourceForge Privoxy team. 
78   http://www.privoxy.org/
79
80   Written by Andreas Oesterhelt
81
82   This program is free software; you can redistribute it
83   and/or modify it under the terms of the GNU General
84   Public License as published by the Free Software
85   Foundation; either version 2 of the License, or (at
86   your option) any later version.
87
88   This program is distributed in the hope that it will
89   be useful, but WITHOUT ANY WARRANTY; without even the
90   implied warranty of MERCHANTABILITY or FITNESS FOR A
91   PARTICULAR PURPOSE.  See the GNU General Public
92   License for more details.
93
94   The GNU General Public License should be included with
95   this file.  If not, you can view it at
96   http://www.gnu.org/copyleft/gpl.html
97   or write to the Free Software Foundation, Inc., 59
98   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
99
100  -->
101
102  <head>
103   <meta http-equiv="Content-Style-Type" content="text/css">
104   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
105   <meta http-equiv="Content-Script-Type" content="text/javascript">
106   <link rel="stylesheet" type="text/css" href="../privoxy.css">
107   <link rel="stylesheet" type="text/css" href="../p_feedback.css">
108
109 <?php
110
111 /*
112  * Config:
113  */
114 $required_actions_file_version = "1.1";
115 $required_privoxy_version = "2.9.14";
116 $actions_file_download = "http://www.privoxy.org/actions/testdrive.action";
117 $submit_target = "http://www.oesterhelt.org/actions/step2.php";
118
119
120 /*
121  * Debug:
122  */
123 //phpinfo();
124 //error_reporting(E_ALL);
125 error_reporting(E_NONE);
126
127 /*
128  * Function: error_abort
129  * Purpose:  Return an error page with $title and $message
130  */
131 function error_abort($title, $message)
132 {
133    if ($title == "invalid") /* shortcut */
134    {
135       $title = "Invalid Feedback Submission";
136    }
137
138    echo ("  <title>Privoxy: $title</title>
139            </head>
140            <body>
141             <div class=\"title\">
142              <h1>
143               <a href=\"http://www.privoxy.org/\">Privoxy</a>: $title
144               </h1>
145              </div>
146             <center>
147              <div class=\"warning\">
148               $message
149              </div>
150             </center>
151             <p>Valid <a href=\"http://validator.w3.org/\">HTML 4.01 Transitional</a></p>
152            </body>
153           </html>\n");
154    exit; 
155 }
156
157
158 /*
159  * Bookmarklet that leads here:
160  */
161 $my_address = "http://" . $HTTP_SERVER_VARS["HTTP_HOST"] . $PHP_SELF;
162 $bookmarklet = "javascript:w=Math.floor(screen.width/2);h=Math.floor(screen.height*0.9);void(window.open('$my_address?url='+escape(location.href)," .
163                "'Feedback','screenx='+w+',width='+w+',height='+h+',scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no," .
164                "copyhistory=no').focus());";
165
166 /* 
167  * Provide default if URL unset
168  */
169 if (!isset($url))
170 {
171    $url = "http://www.example.com/";
172 }
173 else
174 {
175    $url = strtr($url, " ", "+");
176 }
177
178 /* 
179  * Deny feedback which is not based on our latest
180  * distribution:
181  */
182 $headers = getallheaders();
183
184 if (!isset($headers["X-Actions-File-Version"]) || $headers["X-Actions-File-Version"] < $required_actions_file_version)
185 {
186
187    error_abort("invalid", "<p>As much as we welcome your feedback, please note that
188                we can only accept problem reports based on:
189                </p>
190                <ul>
191                 <li><a href=\"http://www.privoxy.org/\" target=\"_blank\">Privoxy</a> version $required_privoxy_version or later</li>
192                 <li><a href=\"$actions_file_download\">Actionsfile</a> version  version $required_actions_file_version or later</li>
193                </ul>
194                <p>We hope you will understand that we feel unable to maintain concurrent versions of the file.</p>
195                <p><i>Hint: To upgrade your actions file, just right-click the above link, then save as default.action in
196                   your Privoxy config directory</i>
197                </p>");
198 }
199
200 ?>
201
202   <title>Privoxy Action List Feedback - Step 1 of 2</title>
203  </head>
204
205  <body>
206   <div class="title">
207     <h1>
208       <a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Step 1 of 2
209     </h1>
210   </div>
211
212   <div class="box">
213    <p>
214     <b>Thank you for reporting a missing or invalid action!</b> 
215    </p>
216
217    <p>
218     The Privoxy team relies on <b>your</b> feedback to maintain an efficient actions file!
219     <br>Please fill the below form and click to proceed to step 2.
220    </p>
221   </div>
222
223   <div class="box">
224    <form action="<?php echo($submit_target); ?>" method="post">
225
226     <table border="0" cellpadding="0" cellspacing="4">
227
228      <tr>
229       <td align="right">URL:</td>
230       <td>
231        <input name="referrer_url" value="<?php echo($url); ?>" type="text" size="45" maxlength="255">
232       </td>
233      </tr>
234
235      <tr>
236       <td align="right">Nature of the problem:</td>
237       <td>
238        <select name="problem" size="1">
239         <option selected value="INVALID">Please select...</option>
240         <option value="P1">An advertisment was NOT blocked</option>
241         <option value="P2">An innocent image WAS blocked</option>
242         <option value="P3">The whole page was erraneously blocked</option>
243         <option value="P4">The page needs popups but they don't work</option>
244         <option value="P5">Other problem</option>
245        </select>
246       </td>
247      </tr>
248
249      <tr>
250       <td>&nbsp;</td>
251       <td>
252        <input type=submit value="Proceed to step 2">
253       </td>
254      </tr>
255
256     </table>
257    </form>
258   </div>
259
260   <center>
261    <div class="info">
262     <h2>Using <a href="http://www.bookmarklets.com" target="_blank">Bookmarklets</a> for Feedback</h2>
263     <p>
264      To make it even easier for you, we provide a bookmarklet which will not only take you here from
265      any troubled page you might be surfing, but also pre-fill the form!
266     </p>
267     <p>
268      Please right-click the following link and choose "Add to Favorites" (IE) or "Add Bookmark for Link" (Netscape): 
269      <a href="<?php echo($bookmarklet); ?>">Privoxy-Submit</a>
270     </p>
271
272     <p>
273      <i>You might get a warning that the bookmark "may not be safe" (IE) - just click OK.
274      For even faster access, you can put it on the "Links" bar (IE) or the "Personal Toolbar" (Netscape),
275      and submit feedback with a single click!</i>
276     </p>
277    </div>
278   </center>
279
280   <p>Valid <a href="http://validator.w3.org/">HTML 4.01 Transitional</a></p>
281
282  </body>
283 </html>