cfg = unserialize($cfg); $this->pg = tfb_getRequestVar('pg'); if (empty($this->altURL)) $this->altURL = $this->mainURL; if (empty($this->cfg)) { $this->msg = "Config not passed"; $this->initialized = false; return; } $this->catFilterName = $this->engineName."GenreFilter"; $this->mainCatalogName = $this->engineName."_catalog"; if (array_key_exists('hideSeedless',$_SESSION)) $this->hideSeedless = $_SESSION['hideSeedless']; $this->catFilter = (array_key_exists($this->catFilterName,$this->cfg)) ? $this->cfg[$this->catFilterName] : array(); if (array_key_exists($this->mainCatalogName,$this->cfg)) $this->mainCatalog = $this->cfg[$this->mainCatalogName]; else $this->populateMainCategories(); if ($this->getConnection()) $rtnValue = true; $this->closeConnection(); // in PHP 5 use //$this->curRequest = http_build_query($_REQUEST); $this->curRequest = $this->http_query_builder($_REQUEST); $this->initialized = $rtnValue; } //------------------------------------------------------------------ // This is for backward compatibility. function http_query_builder( $formdata, $numeric_prefix = null, $key = null ) { $res = array(); foreach ((array)$formdata as $k=>$v) { $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k); if ($key) $tmp_key = $key.'['.$tmp_key.']'; $res[] = (is_array($v) || is_object($v)) ? $this->http_query_builder($v, null, $tmp_key) : $tmp_key."=".urlencode($v); } $separator = ini_get('arg_separator.output'); return implode($separator, $res); } //---------------------------------------------------------------- // Function to populate the mainCatalog function populateMainCategories() { return; } //---------------------------------------------------------------- // Function to Get Sub Categories function getSubCategories($mainGenre) { return array(); } //---------------------------------------------------------------- // Function to test Connection. function getConnection() { // Try to connect if (!$this->fp = @fsockopen ($this->mainURL, 80, $errno, $errstr, 30)) { // Error Connecting $this->msg = "Error connecting to ".$this->mainURL."!"; return false; } return true; } //---------------------------------------------------------------- // Function to Close Connection. function closeConnection() { if($this->fp) fclose($this->fp); } //---------------------------------------------------------------- // Function to return the URL needed by tf function searchURL() { return "index.php?iid=torrentSearch&searchEngine=".$this->engineName; } //---------------------------------------------------------------- // Function to Make the GetRequest function makeRequest($request, $useAlt = false) { $refererURI = (isset($_SESSION['lastOutBoundURI'])) ? $_SESSION['lastOutBoundURI'] : "http://".$this->mainURL; $request = ($useAlt) ? "http://".$this->altURL. $request : "http://".$this->mainURL. $request; // require SimpleHTTP require_once("inc/classes/SimpleHTTP.php"); // get data $this->htmlPage = SimpleHTTP::getData($request, $refererURI); // return return (SimpleHTTP::getState() == SIMPLEHTTP_STATE_OK); } //---------------------------------------------------------------- // Function to Get Main Categories function getMainCategories($filtered = true) { $output = array(); foreach ($this->mainCatalog as $mainId => $mainName) { if ($filtered) { // see if this is filtered out. if (!(@in_array($mainId, $this->catFilter))) $output[$mainId] = $mainName; } else { $output[$mainId] = $mainName; } } return $output; } //---------------------------------------------------------------- // Function to Get Main Category Name function GetMainCatName($mainGenre) { $mainGenreName = ''; foreach ($this->getMainCategories() as $mainId => $mainName) { if ($mainId == $mainGenre) $mainGenreName = $mainName; } return $mainGenreName; } //---------------------------------------------------------------- // Function to setup the table header function tableHeader() { $output = ""; $output .= "
\n"; $output .= "cfg["table_header_bg"]."\">"; $output .= " "; $output .= " "; $output .= " "; $output .= " "; $output .= " "; $output .= " "; $output .= "\n"; return $output; } } ?>
 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. $tmpURI .= (strpos($tmpURI,'?')) ? "&" : "?"; $output .= ($this->hideSeedless == "yes") ? "Show Seedless" : "Hide Seedless"; $output .= ")Category  SizeSeedsPeers