include "./config.inc.php"; $start_time = microtime(); //get progs start time for calc run time for later.// require "Fetcher.class.inc"; require "SBP.class.inc"; include_once "config.inc"; $fetcher = new Fetcher; //new class for fetching// $fetcher->init(); $sbp = new SBP; //new class for manipulating input// $sbp->init(); //Made obsolete by the onclick handler in javascript...keeping for ppl who don't want to have to use javascript. @$form_url = $_POST['form_url']; if(!empty($form_url)) { $url = $form_url; // get the url that the user had in input when they submitted the form // } else { @$url = $_GET['url']; } if(empty($url)) $url = $default_url; //Check the URL for protocol etc.... if(substr($url, 0, 7) != "http://") //didn't start with 'http://'...we have a problem.// { $url = "http://".$url; } if(substr($url, -6)==".cache") //it's a cached image....don't fetch it...just open it!// { //have to parse out the 'cache/' in the url!! //http://www.sufferingfools.net/dev-sbp/cache/ IS 44 long so parse that out! $url = substr($url, strlen($web_path_to_cache)); $cached_source = @fopen($path_to_cache.$url, "r"); $HTML = @fread($cached_source, filesize($path_to_cache.$url)); $sbp->setHeaders($HTML, FALSE); //pass the file's contents to the setHeader() func and inform it that it's a file// echo $HTML; } else //url wasn't a cache file.... { //Check if there was a form redirected to SBP.// if(!empty($_POST['original_url'])) { $form_submission = true; } else if(!empty($_GET['original_url'])) { //have to strip off any unwanted stuff from original_url $url = explode(" ", $_GET['original_url']); $url = $url[0]; $form_submission = false; $url = urldecode($url)."?".str_replace("original_url=".urlencode($_GET['original_url'])."&", "", $_SERVER['QUERY_STRING']); //$url = urldecode($url)."?".$_SERVER['QUERY_STRING']; // $fetcher->referer = $_GET['original_url']; /* echo "\n"; //$form_submission=true; */ } if(!$form_submission) //OK, no redirected form so go ahead and fetch a page.// { if($fetcher->fetch($url)) { //get the page's source// $HTML = $fetcher->results; $HTML = $sbp->prependTitle($HTML, $title_tag); if($scrambleHTML) { //make the HTML source more difficult to match patterns to.// $HTML = $sbp->scrambleHTML($HTML); } if($scrambleURL) { //make the HTML source more difficult to match patterns to.// $HTML = $sbp->scrambleURL($HTML); } //complete local links so that they are fully qualified URIs// $HTML = $sbp->completeURLs($HTML, $url, $title_tag); if($domain2ip) { //replace all domain names with just their IP// $HTML = $sbp->domain2IP($HTML); } if($cacheFiles) { //fetch the images and cache them locally and replace the URLs to them with a URL to the local cache// $HTML = $sbp->cacheFiles($HTML); } //prepend the URL to this page so that all links go through the proxy// $HTML = $sbp->proxyURLs($HTML, $title_tag); if($isMenu) { // embed my javascript menu // $HTML = $sbp->embedMenu($HTML, $url); } //set any headers that need to be set.// $sbp->setHeaders($url, TRUE); //If set true, uses a javascript func that will hide the source from the user && the user's filters :)// if($isHidden) { require 'Crypt.php'; $c = new HTML_Crypt($HTML); $c->cryptText(); $HTML = $c->getScript(); } //ouput the page..so that frames atleast partially are written. // print_r($HTML); flush(); //make sure that the cache hasn't grown too large// if($check_size_cache) { $sbp->checkCache(); } echo ("\n\n\n"); // Calculate execution time and add comment with that info // $execution_time = $sbp->processTime($start_time, microtime()); $execution_time = sprintf("%0.3f", $execution_time); echo ("\n"); } else { echo "Document failed to load: ".$fetcher->error."\n"; } } if(!empty($sbp->debug) && $isDebug) { //Output any debugging information// echo "\n\n"; } echo "