X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=doc%2Fwebserver%2Factions%2Fstep2.php;h=bdc08cd33d830fde9a356b00cbcb58b6094fa729;hb=56e38dc0aae22a1b09359b04dfbf90952ab87569;hp=f0dcd18fb35e3a784fc3e53502c444f6403f243b;hpb=acfe700ddafd7570cd1475629a45d1146e521549;p=privoxy.git diff --git a/doc/webserver/actions/step2.php b/doc/webserver/actions/step2.php index f0dcd18f..bdc08cd3 100644 --- a/doc/webserver/actions/step2.php +++ b/doc/webserver/actions/step2.php @@ -1,108 +1,339 @@ + + + + +
+ + + + + + + + ]*?src=[\'"]?(.*?)[\'" >]|i', $page, $matches); + + foreach (array_unique($matches[1]) as $image_link) + { + $result[] = link_to_absolute($url, $image_link); + } + + return count($result) ? $result : 0; +} + +/* + * Function: get_image_urls + * + * Purpose: If the page is a frameset, rerurn the image URLs from all + * its frame SRCes, else from the page itself. + */ +function get_image_urls($page, $url) +{ + + preg_match_all('|]*?src=[\'"]?(.*?)[\'" >]|i', $page, $matches); + + if (count($matches[1])) + { + foreach(array_unique($matches[1]) as $frame_link) + { + $framebuf = slurp_page(link_to_absolute($url, $frame_link)); + $result = array_merge($result, get_image_urls_sp($framebuf, link_to_absolute($url, $frame_link))); + } + } + else + { + $result = get_image_urls_sp($page, $url); + } + + return array_values(array_unique($result)); +} + + +/* + * Function: error_abort + * Purpose: Return an error page with $title and $message + */ +function error_abort($title, $message) +{ + if ($title == "invalid") /* shortcut */ + { + $title = "Invalid Feedback Submission"; + } + + echo ("Valid HTML 4.01 Transitional
+ + \n"); + exit; +} /* * Cannot start with step 2: */ if (!isset($referrer_url)) { - echo ("When submitting your feedback please start with - step 1.
- - "); - exit; + error_abort("invalid", "When submitting your feedback please start with + step 1."); } + /* * Cannot work on unknown problem: */ if (!isset($problem) || $problem == "INVALID") { - echo ("You need to select the nature of the problem in - step 1.
- - "); - exit; + error_abort("invalid", "You need to select the nature of the problem in + step 1."); } /* - * Check if URL really exists and buffer its contents: + * If the protocol is missing from $referrer_url, prepend "http://" */ +if (!preg_match('|^https?://|i', $referrer_url, $dummy)) +{ + $referrer_url = "http://" . $referrer_url; +} -$ch = curl_init ($referrer_url); -curl_setopt ($ch, CURLOPT_HEADER, 0); -curl_setopt ($ch, CURLOPT_FAILONERROR, 1); - -ob_start(); -$success = curl_exec ($ch); -$page = ob_get_contents(); -ob_end_clean(); - -curl_close ($ch); -if (!$success) +/* + * Check if URL really exists and buffer its contents: + */ +if (($page = slurp_page($referrer_url)) == "FAILED") { - echo ("The URL that you entered ($referrer_url)
-
could not be retrieved.
Make sure the URL is correct and publicly accessible.
- - - - "); - exit; + $url_confirm = " +Confirm the URL:
++ The URL that you entered could not be retrieved. Please make sure that +
++ $referrer_url +
++ is correct and publicly accssible. +
++ Yes, I'm sure. +
+
-You are about to report that
-
on .
-
-