function parseResponse() { $output = $this->tableHeader(); $thing = $this->htmlPage; // We got a response so display it. // Chop the front end off. $thing = str_replace("Recent Torrents", "Search results", $thing); while (is_integer(strpos($thing, "Search results"))) { $thing = substr($thing, strpos($thing, "Search results")); $thing = substr($thing, strpos($thing, "</thead>")); $thing = substr($thing, strpos($thing, "<tr>")); $tmpList = substr($thing, 0, strpos($thing, "<script")); // ok so now we have the listing. $tmpListArr = split("</tr>", $tmpList); $bg = $this->cfg["bgLight"]; foreach ($tmpListArr as $key => $value) { $buildLine = true; if (strpos($value, "static.thepiratebay.org")) { $ts = new pBay($value); // Determine if we should build this output if (is_int(array_search($ts->CatName, $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"]; } } } } } $output .= "</table>"; // is there paging at the bottom? if (strpos($thing, "&page=") != false) { // Yes, then lets grab it and display it! ;) $thing = substr($thing, strpos($thing, "<tr><td colspan") + strlen("<tr><td colspan")); $thing = substr($thing, strpos($thing, ">") + 1); $pages = substr($thing, 0, strpos($thing, "</td>")); if (strpos($pages, "prev") > 0) { $tmpStr = substr($pages, 0, strpos($pages, "<img")); $pages = substr($pages, strpos($pages, "<img")); $pages = substr($pages, strpos($pages, ">") + 1); $pages = $tmpStr . "Prev" . $pages; if (strpos($pages, "next") > 0) { $pages = substr($pages, 0, strpos($pages, "<img")) . "Next</a>"; } } elseif (strpos($pages, "next") > 0) { $pages = substr($pages, 0, strpos($pages, "<img")) . "Next</a>"; } if (strpos($this->curRequest, "LATEST")) { $pages = str_replace("?", $this->searchURL() . "&LATEST=1&", $pages); $pages = str_replace("/recent.php", "", $pages); } else { $pages = str_replace("?", $this->searchURL() . "&", $pages); $pages = str_replace("/search.php", '', $pages); } $pages = str_replace("page=", "pg=", $pages); $pages = str_replace("d=", "cat=", $pages); $pages = str_replace("c=", "subGenre=", $pages); $pages = str_replace("q=", "searchterm=", $pages); $pages = str_replace("orderby=", "", $pages); $pages = str_replace("&&", "&", $pages); $pages = str_replace("/brwsearch.php", "", $pages); $output .= "<div align=center>" . $pages . "</div>"; } return $output; }
function parseResponse() { $thing = $this->htmlPage; // We got a response so display it. // Chop the front end off. if (is_integer(strpos($thing, "Your search did not match any torrents"))) { $this->msg = "Your search did not match any torrents"; } else { $output = $this->tableHeader(); if (strpos($thing, "searchResult") !== false) { $thing = substr($thing, strpos($thing, "searchResult")); $thing = substr($thing, strpos($thing, "<tr>")); $tmpList = substr($thing, 0, strpos($thing, "</table>")); // keep for paging $thing = substr($thing, strlen($tmpList)); // clean tabs $tmpList = str_replace("\t", "", $tmpList); // ok so now we have the listing. $tmpListArr = explode("</tr>", $tmpList); $bg = $this->cfg["bgLight"]; foreach ($tmpListArr as $key => $value) { $buildLine = true; if (strpos($value, "static.thepiratebay.org")) { $ts = new pBay($value); // Determine if we should build this output if (is_int(array_search($ts->CatName, $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"]; } } } elseif (strpos($value, "torrents.thepiratebay.org")) { $ts = new pBay($value); // Determine if we should build this output if (is_int(array_search($ts->CatName, $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"]; } } } } } $output .= "</table>"; // is there paging at the bottom? if (strpos($thing, ">2<") !== false || strpos($thing, ">1<") !== false) { // Yes, then lets grab it and display it! ;) $thing = substr($thing, strpos($thing, "<div") + 1); $thing = substr($thing, strpos($thing, ">") + 1); $pages = substr($thing, 0, strpos($thing, "</div>")); $thing = ""; $lastSearch = $this->lastSearch; if (strpos($pages, "prev") > 0) { $tmpStr = substr($pages, 0, strpos($pages, "<img")); $pages = substr($pages, strpos($pages, "<img")); $pages = substr($pages, strpos($pages, ">") + 1); $pages = $tmpStr . "Prev" . $pages; if (strpos($pages, "next") > 0) { $pages = substr($pages, 0, strpos($pages, "<img")) . "Next</a>"; } } elseif (strpos($pages, "next") > 0) { $pages = substr($pages, 0, strpos($pages, "<img")) . "Next</a>"; } if (strpos($this->curRequest, "LATEST")) { $pages = str_replace('/recent/' . $lastSearch . '/', $this->searchURL() . '&searchterm=' . $lastSearch . '&pg=', $pages); } else { $pages = str_replace('/search/' . $lastSearch . '/', $this->searchURL() . '&searchterm=' . $lastSearch . '&pg=', $pages); } $pages = preg_replace("#/(\\d+)/#", '&orderby=\\1&cat=', $pages); $pages = str_replace("/", '', $pages); $output .= "<div align=center>" . $pages . "</div>"; } } return $output; }