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.6 2002/04/02 07:22:19 oes Exp $
14 Revision 1.6 2002/04/02 07:22:19 oes
15 Elimnating duplicate images; using relative link for step3
17 Revision 1.4 2002/04/01 19:13:47 oes
18 Extended, fixed bugs, beefed up design, made IE-safe
20 Revision 1.1 2002/03/30 03:20:30 oes
21 Added Feedback mechanism for actions file
24 Written by and Copyright (C) 2002 the SourceForge
25 Privoxy team. http://www.privoxy.org/
27 This program is free software; you can redistribute it
28 and/or modify it under the terms of the GNU General
29 Public License as published by the Free Software
30 Foundation; either version 2 of the License, or (at
31 your option) any later version.
33 This program is distributed in the hope that it will
34 be useful, but WITHOUT ANY WARRANTY; without even the
35 implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public
37 License for more details.
39 The GNU General Public License should be included with
40 this file. If not, you can view it at
41 http://www.gnu.org/copyleft/gpl.html
42 or write to the Free Software Foundation, Inc., 59
43 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
48 <link rel="stylesheet" type="text/css" href="../p_feedback.css">
50 <script language="javascript">
52 // Could be as easy as style="max-wdith: 300px; max-height..." inside the
53 // <img> tag, but IE doesn't do that. Setting the values directly also
54 // screws IE for some weird reason. All praise MS.
57 function prettyscale(image)
62 if (image.width > 300)
67 if (image.height > 50)
77 if (image.height < 20)
84 image.width = newwidth
89 image.height = newheight
101 //error_reporting(E_ALL);
102 error_reporting(E_NONE);
106 * Cannot start with step 2:
108 if (!isset($referrer_url))
110 echo (" <title>Invalid Feedback Submission</title>
111 <link rel="stylesheet" type="text/css" href="../p_feedback.css">
114 <div class=\"title\">Invalid Feedback Submission</div>
115 <div align=\"center\">
116 <div class=\"errorbox\" align=\"left\">When submitting your feedback please start with
117 <a href=\"index.php\">step 1</a>.
127 * Cannot work on unknown problem:
129 if (!isset($problem) || $problem == "INVALID")
131 echo (" <title>Invalid Feedback Submission</title>
132 <link rel="stylesheet" type="text/css" href="../p_feedback.css">
135 <div class=\"title\">Invalid Feedback Submission</div>
136 <div align=\"center\">
137 <div class=\"errorbox\" align=\"left\">You need to select the nature of the problem in
138 <a href=\"javascript:history.back();\">step 1</a>.
148 * Check if URL really exists and buffer its contents:
150 * FIXME: Curl is not installed on SF; Filed as Alexandria
151 * Feature Request #537014.
152 * PHP's fopen() supports URLs, but it seems that
153 * curls options for Timeouts and HTTP error handling
154 * are not supported by fopen().
156 $ch = curl_init ($referrer_url);
158 curl_setopt ($ch, CURLOPT_HEADER, 0);
159 curl_setopt ($ch, CURLOPT_FAILONERROR, 1);
160 curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
161 curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
164 $success = curl_exec ($ch);
165 $page = ob_get_contents();
172 echo (" <title>Invalid Feedback Submission</title>
173 <link rel="stylesheet" type="text/css" href="../p_feedback.css">
176 <div class=\"title\">Invalid Feedback Submission</div>
177 <div align=\"center\">
178 <div class=\"errorbox\" align=\"left\">
179 <p>The URL that you entered (<a href=\"$referrer_url\">$referrer_url</a>)
180 <br>could not be retrieved.
182 <p>Make sure the URL is correct and publicly accessible.</p>
183 <p><a href=\"javascript:history.back();\">Back to step 1</a></p>
193 * Create description from problem code:
197 case "P1": $problem_description="an advertisment was not blocked"; break;
198 case "P2": $problem_description="an innocent image was blocked"; break;
199 case "P3": $problem_description="the whole page was erraneously blocked"; break;
200 case "P4": $problem_description="the page needs popups but they don't work"; break;
201 case "P5": $problem_description="a problem occured"; break;
202 default: $problem_description="AN UNPROCESSABLE PROBLEM OCCURED";
207 <title>Privoxy Action List Feedback - Step 2 of 2</title>
208 <link rel="stylesheet" type="text/css" href="../p_feedback.css">
212 <div class="title"><a href="http://www.privoxy.org" target="_blank">Privoxy</a> Action List Feedback - Step 2 of 2</div>
215 <b>You are about to report that <?php echo ($problem_description) ?> on
216 <a href="<?php echo ($referrer_url) ?>"><?php echo ($referrer_url) ?></a>.</b>
220 <form action="step3.php" method="post">
222 <input type="hidden" name="problem" value="<?php echo ($problem) ?>">
223 <input type="hidden" name="referrer_url" value="<?php echo ($referrer_url) ?>">
231 * Create / suppress for elements depending on type of
234 if ($problem != "P1")
241 * Extract all image links from page, make them
242 * absolute, and present them (scaled to reasonable size)
243 * in a table for the user to select
245 preg_match_all('|<img\s+[^>]*?src=[\'"]?(.*?)[\'" >]|i', $page, $matches);
246 $image_urls = array_values(array_unique($matches[1]));
247 $count = count($image_urls);
252 * Base URL ends in slash: don't touch.
254 if (strpos(strrev($referrer_url), '/') == 0)
256 $referrer_base = $referrer_url;
259 * Else grab URL up to last slash as base.
263 $referrer_base = substr($referrer_url, 0, -strpos(strrev($referrer_url), '/'));
267 * Get the protocol + host info for relative links
268 * that start with slash. FIXME: Cut trailing slash off!
270 $referrer_host = "http://".strrev(strrchr(strrev(substr($referrer_url, 7)), "/"));
273 * Open section in <dl>; Open table:
275 echo (" <dt><b>Choose the images you want blocked from the following list:</b></dt>
278 <input type=\"hidden\" name=\"num_images\" value=\"$count\">
279 <table border=\"0\" cellpadding=\"0\" cellspacing=\"4\">\n");
281 * Print one table row for each image found:
283 for ($i=0; $i< $count; $i++)
285 $image_url = $image_urls[$i];
288 * Make image URLs absolute:
290 if (strncmp("http://", $image_url, 7))
292 if ($image_url{0} == "/")
294 $image_url = $referrer_host.$image_url;
298 $image_url = $referrer_base.$image_url;
307 <input type=\"checkbox\" name=\"block_image[$i]\" value=\"off\">
310 <a href=\"$image_url\">$image_url</a>:
313 <input type=\"hidden\" name=\"image_url[$i]\" value=\"$image_url\">
318 <img onload=\"prettyscale(this);\" src=\"$image_url\" alt=\"banner or not?\">
326 <b>If the banner that you saw is not listed above, enter the URL here</b>\n");
331 <b>URL of the advertisment image:</b>\n");
337 <br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.</i>
341 <input name="manual_image_url" type="text" size="45" maxlength="255">
345 <?php if($problem != "P1") echo ("-->") ?>
347 <?php if($problem != "P2") echo ("<!--") ?>
350 <p><b>URL of the innocent image:</b>
351 <br><i>Hint: right-click the image, select "Copy image location" and paste the URL here.
352 <br>This may not work if the image was blocked by size or if +image-blocker is set to redirect.</i>
357 <input name="image_url" value="unknown" type="text" size="45" maxlength="255">
361 <?php if($problem != "P2") echo ("-->") ?>
363 <dt><b>Severity:</b></dt>
366 <select name="severity">
367 <option value="3">drives me crazy</option>
368 <option selected value="2">normal</option>
369 <option value="1">cosmetic</option>
375 <b>Remarks:</b> <i>(optional)</i>
379 <textarea wrap="hard" style="font-size: 10px" name="remarks" cols="35" rows="3">None.</textarea>
384 <b>Your Name:</b> <i>(optional)</i>
388 <input name="name" size="45">
394 <input type=submit value="Submit">