1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 File : $Source: /cvsroot/ijbswa/current/doc/webserver/actions/step2.php,v $
7 Purpose : Submit form for actions file feedback (step 2)
9 ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
11 $Id: step2.php,v 1.4 2002/04/01 19:13:47 oes Exp $
14 Revision 1.4 2002/04/01 19:13:47 oes
15 Extended, fixed bugs, beefed up design, made IE-safe
17 Revision 1.1 2002/03/30 03:20:30 oes
18 Added Feedback mechanism for actions file
21 Written by and Copyright (C) 2002 the SourceForge
22 Privoxy team. http://www.privoxy.org/
24 This program is free software; you can redistribute it
25 and/or modify it under the terms of the GNU General
26 Public License as published by the Free Software
27 Foundation; either version 2 of the License, or (at
28 your option) any later version.
30 This program is distributed in the hope that it will
31 be useful, but WITHOUT ANY WARRANTY; without even the
32 implied warranty of MERCHANTABILITY or FITNESS FOR A
33 PARTICULAR PURPOSE. See the GNU General Public
34 License for more details.
36 The GNU General Public License should be included with
37 this file. If not, you can view it at
38 http://www.gnu.org/copyleft/gpl.html
39 or write to the Free Software Foundation, Inc., 59
40 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
45 <style type="text/css">
46 body, div, p, h1, h2, ul, ol, li, td, th, dl, dt, dd { font-family:helvetica,helv,arial,sans-serif; font-size:10px }
47 body { background-color: #ffffff }
48 div.title { background-color:#dddddd; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:15px; font-weight:bold }
49 div.box { background-color:#eeeeee; border:solid black 1px; margin:20px; min-width: 80%; padding:20px; font-size:10px }
50 div.infobox { background-color:#ccccff; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
51 div.errorbox { background-color:#ffdddd; border:solid black 1px; margin:20px; min-width: 60%; max-width: 60%; padding:20px; font-size:10px; }
54 <script language="javascript">
56 // Could be as easy as style="max-wdith: 300px; max-height..." inside the
57 // <img> tag, but IE doesn't do that. Setting the values directly also
58 // screws IE for some weird reason. All praise MS.
61 function prettyscale(image)
66 if (image.width > 300)
71 if (image.height > 50)
81 if (image.height < 20)
88 image.width = newwidth
93 image.height = newheight
104 $base_url = "http://www.oesterhelt.org/actions";
105 //$base_url = "http://privoxy.org/actions";
106 //$base_url = "http://localhost/actions";
108 //error_reporting(E_NONE);
109 error_reporting(E_ALL);
113 * Cannot start with step 2:
115 if (!isset($referrer_url))
117 echo (" <title>Invalid Feedback Submission</title>
120 <div class=\"title\">Invalid Feedback Submission</div>
121 <div align=\"center\">
122 <div class=\"errorbox\" align=\"left\">When submitting your feedback please start with
123 <a href=\"index.php\">step 1</a>.
133 * Cannot work on unknown problem:
135 if (!isset($problem) || $problem == "INVALID")
137 echo (" <title>Invalid Feedback Submission</title>
140 <div class=\"title\">Invalid Feedback Submission</div>
141 <div align=\"center\">
142 <div class=\"errorbox\" align=\"left\">You need to select the nature of the problem in
143 <a href=\"javascript:history.back();\">step 1</a>.
153 * Check if URL really exists and buffer its contents:
155 * FIXME: Curl is not installed on SF; Filed as Alexandria
156 * Feature Request #537014.
157 * PHP's fopen() supports URLs, but it seems that
158 * curls options for Timeouts and HTTP error handling
159 * are not supported by fopen().
161 $ch = curl_init ($referrer_url);
163 curl_setopt ($ch, CURLOPT_HEADER, 0);
164 curl_setopt ($ch, CURLOPT_FAILONERROR, 1);
165 curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
166 curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
169 $success = curl_exec ($ch);
170 $page = ob_get_contents();
177 echo (" <title>Invalid Feedback Submission</title>
180 <div class=\"title\">Invalid Feedback Submission</div>
181 <div align=\"center\">
182 <div class=\"errorbox\" align=\"left\">
183 <p>The URL that you entered (<a href=\"$referrer_url\">$referrer_url</a>)
184 <br>could not be retrieved.
186 <p>Make sure the URL is correct and publicly accessible.</p>
187 <p><a href=\"javascript:history.back();\">Back to step 1</a></p>
197 * Create description from problem code:
201 case "P1": $problem_description="an advertisment was not blocked"; break;
202 case "P2": $problem_description="an innocent image was blocked"; break;
203 case "P3": $problem_description="the whole page was erraneously blocked"; break;
204 case "P4": $problem_description="the page needs popups but they don't work"; break;
205 case "P5": $problem_description="a problem occured"; break;
206 default: $problem_description="AN UNPROCESSABLE PROBLEM OCCURED";
211 <title>Privoxy Action List Feedback - Step 2 of 2</title>
215 <div class="title"><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Step 2 of 2</div>
218 <b>You are about to report that <?php echo ($problem_description) ?> on
219 <a href="<?php echo ($referrer_url) ?>"><?php echo ($referrer_url) ?></a>.</b>
223 <form action="<?php echo($base_url); ?>/step3.php" method="post">
225 <input type="hidden" name="problem" value="<?php echo ($problem) ?>">
226 <input type="hidden" name="referrer_url" value="<?php echo ($referrer_url) ?>">
234 * Create / suppress for elements depending on type of
237 if ($problem != "P1")
244 * Extract all image links from page, make them
245 * absolute, and present them (scaled to reasonable size)
246 * in a table for the user to select
248 preg_match_all('|<img\s+[^>]*?src=[\'"]?(.*?)[\'" >]|i', $page, $matches);
249 $count = count($matches[0]);
253 * Base URL ends in slash: don't touch.
255 if (strpos(strrev($referrer_url), '/') == 0)
257 $referrer_base = $referrer_url;
260 * Else grab URL up to last slash as base.
264 $referrer_base = substr($referrer_url, 0, -strpos(strrev($referrer_url), '/'));
268 * Get the protocol + host info for relative links
269 * that start with slash. FIXME: Cut trailing slash off!
271 $referrer_host = "http://".strrev(strrchr(strrev(substr($referrer_url, 7)), "/"));
274 * Open section in <dl>; Open table:
276 echo (" <dt><b>Choose the images you want blocked from the following list:</b></dt>
279 <input type=\"hidden\" name=\"num_images\" value=\"$count\">
280 <table border=\"0\" cellpadding=\"0\" cellspacing=\"4\">\n");
282 * Print one table row for each image found:
284 for ($i=0; $i< $count; $i++)
286 $image_url = $matches[1][$i];
289 * Make image URLs absolute:
291 if (strncmp("http://", $image_url, 7))
293 if ($image_url{0} == "/")
295 $image_url = $referrer_host.$image_url;
299 $image_url = $referrer_base.$image_url;
308 <input type=\"checkbox\" name=\"block_image[$i]\" value=\"off\">
311 <a href=\"$image_url\">$image_url</a>:
314 <input type=\"hidden\" name=\"image_url[$i]\" value=\"$image_url\">
319 <img onload=\"prettyscale(this);\" src=\"$image_url\" alt=\"banner or not?\">
327 <b>If the banner that you saw is not listed above, enter the URL here</b>\n");
332 <b>URL of the advertisment image:</b>\n");
338 <br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.</i>
342 <input name="manual_image_url" type="text" size="45" maxlength="255">
346 <?php if($problem != "P1") echo ("-->") ?>
348 <?php if($problem != "P2") echo ("<!--") ?>
351 <p><b>URL of the innocent image:</b>
352 <br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.
353 <br>This may not work if the image was blocked by size or if +image-blocker is set to redirect.</i>
358 <input name="image_url" value="unknown" type="text" size="45" maxlength="255">
362 <?php if($problem != "P2") echo ("-->") ?>
364 <dt><b>Severity:</b></dt>
367 <select name="severity">
368 <option value="3">drives me crazy</option>
369 <option selected value="2">normal</option>
370 <option value="1">cosmetic</option>
376 <b>Remarks:</b> <i>(optional)</i>
380 <textarea wrap="hard" style="font-size: 10px" name="remarks" cols="35" rows="3">None.</textarea>
385 <b>Your Name:</b> <i>(optional)</i>
389 <input name="name" size="45">
395 <input type=submit value="Submit">