mainURL = "torrentportal.com"; $this->altURL = "tp.searching.com"; $this->mainTitle = "TorrentPortal"; $this->engineName = "TorrentPortal"; $this->author = "kboy"; $this->version = "1.03-tfb"; $this->updateURL = "http://www.torrentflux.com/forum/index.php?topic=875.0.html"; $this->Initialize($cfg); } //---------------------------------------------------------------- // Function to Get Main Categories function populateMainCategories() { $this->mainCatalog["0"] = "(all types)"; $this->mainCatalog["1"] = "Games"; $this->mainCatalog["2"] = "Movies"; $this->mainCatalog["3"] = "TV"; $this->mainCatalog["4"] = "Videos"; $this->mainCatalog["5"] = "Apps"; $this->mainCatalog["6"] = "Anime"; $this->mainCatalog["7"] = "Audio"; $this->mainCatalog["8"] = "Comics"; $this->mainCatalog["9"] = "Unsorted"; $this->mainCatalog["10"] = "Porn"; } //---------------------------------------------------------------- // Function to Make the Request (overriding base) function makeRequest($request) { return parent::makeRequest($request, false); } //---------------------------------------------------------------- // Function to get Latest.. function getLatest() { $cat = tfb_getRequestVar('subGenre'); $count = tfb_getRequestVar('count'); if (empty($cat)) $cat = tfb_getRequestVar('cat'); if(empty($cat) && empty($this->pg)) { $request = "/new-torrents.php"; } else { $request = "/torrents.php"; } if(!empty($cat)) { if(strpos($request,"?")) { $request .= "&cat=".$cat; } else { $request .= "?cat=".$cat; } } if(!empty($count)) { if(strpos($request,"?")) { $request .= "&count=".$count; } else { $request .= "?count=".$count; } } if (!empty($this->pg)) { if(strpos($request,"?")) { $request .= "&page=" . $this->pg; } else { $request .= "?page=" . $this->pg; } } if ($this->makeRequest($request)) { return $this->parseResponse(); } else { return $this->msg; } } //---------------------------------------------------------------- // Function to perform Search. function performSearch($searchTerm) { $searchTerm = str_replace(" ", "+", $searchTerm); $request = "/torrents-search.php?search=".$searchTerm; if(!empty($cat)) { $request .= "&cat=".$cat; } $count = tfb_getRequestVar('count'); if(!empty($count)) { $request .= "&count=".$count; } $onlyname = tfb_getRequestVar('onlyname'); if (empty($onlyname)) $onlyname = "no"; $request .= "&onlyname=".$onlyname; $incldead = tfb_getRequestVar('incldead'); if (empty($incldead)) $incldead = "0"; $request .= "&incldead=".$incldead; $request .= "&submit="; if (!empty($this->pg)) { $request .= "&page=" . $this->pg; } if ($this->makeRequest($request,true)) { return $this->parseResponse(); } else { return $this->msg; } } //---------------------------------------------------------------- // Override the base to show custom table header. // Function to setup the table header function tableHeader() { $output = ""; $output .= "
\n"; $output .= "cfg["table_header_bg"]."\">"; $output .= " "; $output .= " "; $output .= " "; $output .= " "; $output .= " "; $output .= " "; $output .= " "; $output .= "\n"; return $output; } //---------------------------------------------------------------- // Function to parse the response. function parseResponse() { $output = $this->tableHeader(); $thing = $this->htmlPage; // We got a response so display it. // Chop the front end off. while (is_integer(strpos($thing,">Health"))) { $thing = substr($thing,strpos($thing,">Health")); $thing = substr($thing,strpos($thing,"")); // ok so now we have the listing. $tmpListArr = explode("",$tmpList); $bg = $this->cfg["bgLight"]; foreach($tmpListArr as $key =>$value) { $buildLine = true; if (strpos($value,"/download/")) { $ts = new tPort($value); // Determine if we should build this output if (is_int(array_search($ts->MainCategory,$this->catFilter))) { $buildLine = false; } if ($this->hideSeedless == "yes") { if($ts->Seeds == "N/A" || $ts->Seeds == "0") { $buildLine = false; } } if (!empty($ts->torrentFile) && $buildLine) { $output .= trim($ts->BuildOutput($bg, $this->searchURL())); // ok switch colors. if ($bg == $this->cfg["bgLight"]) { $bg = $this->cfg["bgDark"]; } else { $bg = $this->cfg["bgLight"]; } } } } // set thing to end of this table. $thing = substr($thing,strpos($thing,"
 Torrent Name  ("; $tmpURI = str_replace(array("?hideSeedless=yes","&hideSeedless=yes","?hideSeedless=no","&hideSeedless=no"),"",$_SERVER["REQUEST_URI"]); // Check to see if Question mark is there. if (strpos($tmpURI,'?')) { $tmpURI .= "&"; } else { $tmpURI .= "?"; } if($this->hideSeedless == "yes") { $output .= "Show Seedless"; } else { $output .= "Hide Seedless"; } $output .= ")Category  SizeSeedsPeersHealth
")); } $output .= ""; // is there paging at the bottom? /*

1 - 25 | 26 - 50 | 51 - 75 | 76 - 87
<< Prev      Next >>

*/ if (strpos($thing, "page=") != false) { // Yes, then lets grab it and display it! ;) $thing = substr($thing,strpos($thing,"

")+strlen("

")); $pages = substr($thing,0,strpos($thing,"

")); //$output .= $pages; if(strpos($this->curRequest,"LATEST")) { if(strpos($pages,"cat=")) { $pages = str_replace("page=","pg=",str_replace("?",$this->searchURL()."&LATEST=1&",$pages)); } else { $pages = str_replace("?page=",$this->searchURL()."&LATEST=1&pg=",$pages); } } else { if(strpos($pages,"\"?")) { $pages = str_replace("?",$this->searchURL()."&",$pages); } if(strpos($pages,"?search=")) { $pages = str_replace("?search=",$this->searchURL()."&searchterm=",$pages); } if(strpos($pages,"search=")) { $pages = str_replace("search=","searchterm=",$pages); } } if(strpos($pages,"torrents.php?")) { $pages = str_replace("torrents.php?",$this->searchURL()."&",$pages); } if(strpos($pages,"torrents-search.php?")) { $pages = str_replace("torrents-search.php?",$this->searchURL()."&",$pages); } $pages = str_replace("page=","pg=",$pages); $output .= "
".$pages."
"; } return $output; } } // This is a worker class that takes in a row in a table and parses it. class tPort { var $torrentName = ""; var $torrentDisplayName = ""; var $torrentFile = ""; var $torrentSize = ""; var $torrentStatus = ""; var $MainId = ""; var $MainCategory = ""; var $fileCount = ""; var $Seeds = ""; var $Peers = ""; var $Data = ""; var $torrentRating = ""; function tPort( $htmlLine ) { if (strlen($htmlLine) > 0) { $this->Data = $htmlLine; // Cleanup any bugs in the HTML $htmlLine = preg_replace("/\n/i",'',$htmlLine); // Chunck up the row into columns. $tmpListArr = explode(" 8) { $tmpStr = substr($tmpListArr["1"],strpos($tmpListArr["1"],"href=\"")+strlen("href=\"")); // Download Link $this->torrentFile = "http://www.torrentportal.com".substr($tmpStr,0,strpos($tmpStr,"\"")); $this->MainCategory = $this->cleanLine(""); // MainCategory $tmpStr = substr($tmpListArr["2"],strpos($tmpListArr["2"],"cat=")+strlen("cat=")); // Main Id $this->MainId = substr($tmpStr,0,strpos($tmpStr,"\"")); $this->torrentName = $this->cleanLine(""); // TorrentName $this->torrentRating = $this->cleanLine(""); // Rating $this->torrentSize = $this->cleanLine(""); // Size of File $this->Seeds = $this->cleanLine(""); // Seeds $this->Peers = $this->cleanLine(""); // Leech $tmpStr = substr($tmpListArr["9"],strpos($tmpListArr["9"],"Health ")+strlen("Health ")); // Health $tmpStr = substr($tmpStr,0,strpos($tmpStr,"\"")); $tmpArr = explode("/",$tmpStr); if (count($tmpArr) > 1 && $tmpArr["1"] > 0 ) { $this->torrentStatus = ($tmpArr["0"] / $tmpArr["1"]) * 100 . "%"; } else { $this->torrentStatus = "0%"; } if ($this->Peers == '') { $this->Peers = "N/A"; if (empty($this->Seeds)) $this->Seeds = "N/A"; } if ($this->Seeds == '') $this->Seeds = "N/A"; $this->torrentDisplayName = $this->torrentName; if(strlen($this->torrentDisplayName) > 50) { $this->torrentDisplayName = substr($this->torrentDisplayName,0,50)."..."; } } } } function cleanLine($stringIn,$tags='') { if(empty($tags)) return trim(str_replace(array(" "," ")," ",strip_tags($stringIn))); else return trim(str_replace(array(" "," ")," ",strip_tags($stringIn,$tags))); } //---------------------------------------------------------------- // Function to build output for the table. function BuildOutput($bg, $searchURL = '') { $output = "\n"; $output .= " torrentFile."\">torrentName."\" border=0>\n"; $output .= " torrentFile."\" title=\"".$this->torrentName."\">".$this->torrentDisplayName."\n"; if (strlen($this->MainCategory) > 1){ $genre = "MainId."\">".$this->MainCategory.""; }else{ $genre = ""; } $output .= " ". $genre ."\n"; $output .= " ".$this->torrentSize."\n"; $output .= " ".$this->Seeds."\n"; $output .= " ".$this->Peers."\n"; $output .= " ".$this->torrentStatus."\n"; $output .= "\n"; return $output; } } ?>