本文整理汇总了PHP中tfb_getRequestVar函数的典型用法代码示例。如果您正苦于以下问题:PHP tfb_getRequestVar函数的具体用法?PHP tfb_getRequestVar怎么用?PHP tfb_getRequestVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tfb_getRequestVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performSearch
function performSearch($searchTerm)
{
if ($searchTerm == "") {
$request = "/";
} else {
$searchTerm = str_replace(" ", "+", $searchTerm);
$request = "/search.php?terms=" . $searchTerm;
}
$cat = tfb_getRequestVar("cat");
if (empty($cat)) {
$cat = tfb_getRequestVar("mainGenre");
}
if (!empty($cat)) {
if (strpos($request, "?")) {
$request .= "&cat=" . $cat;
} else {
$request .= "?cat=" . $cat;
}
}
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;
}
}
示例2: getLatest
function getLatest()
{
$cat = tfb_getRequestVar('mainGenre');
if (empty($cat)) {
$cat = tfb_getRequestVar('c');
}
if (!empty($cat)) {
$request = "/browse";
if (strpos($request, "?")) {
$request .= "&c=" . $cat;
} else {
$request .= "?c=" . $cat;
}
} else {
$request = "/?do=latest";
}
if (!empty($this->pg)) {
if (strpos($request, "?")) {
$request .= "&p=" . $this->pg;
} else {
$request .= "?p=" . $this->pg;
}
}
$request .= "&o=72";
// Sort Newest to Oldest
//$request .= "&o=52"; // Sort Most Seeded
if ($this->makeRequest($request)) {
return $this->parseResponse();
} else {
return $this->msg;
}
}
示例3: auth_validateRecaptcha
$md5password = "";
if (!empty($user)) {
$isLoginRequest = true;
// test the captcha.
auth_validateRecaptcha($user, $iamhim, $bSetRecaptcha);
} else {
// this is not a login request
$bSetReCaptcha = true;
}
break;
case 0:
/* Form-Based Auth Standard */
/* Form-Based Auth Standard */
default:
$user = strtolower(tfb_getRequestVar('username'));
$iamhim = addslashes(tfb_getRequestVar('iamhim'));
$md5password = "";
if (!empty($user)) {
$isLoginRequest = true;
}
break;
}
// process login if this is a login-request
if ($isLoginRequest) {
// First User check
$next_loc = "index.php?iid=index";
$sql = "SELECT count(*) FROM tf_users";
$user_count = $db->GetOne($sql);
if ($user_count == 0) {
firstLogin($user, $iamhim);
$next_loc = "admin.php?op=serverSettings";
示例4: tmplInitializeInstance
@ob_end_clean();
@header("location: ../../index.php");
exit;
}
/******************************************************************************/
// common functions
require_once 'inc/functions/functions.common.php';
// transfer functions
require_once 'inc/functions/functions.transfer.php';
// init template-instance
tmplInitializeInstance($cfg["theme"], "page.transferControl.tmpl");
// init transfer
transfer_init();
// request-vars
$pageop = tfb_getRequestVar('pageop');
$client = tfb_getRequestVar('client');
// init ch-instance
$ch = $client == "" ? ClientHandler::getInstance(getTransferClient($transfer)) : ClientHandler::getInstance($client);
// customize-vars
transfer_setCustomizeVars();
// load settings, default if settings could not be loaded (fresh transfer)
if ($ch->settingsLoad($transfer) !== true) {
$ch->settingsDefault();
$settings_exist = 0;
} else {
$settings_exist = 1;
}
$tmpl->setvar('settings_exist', $settings_exist);
// set running-field
$ch->running = isTransferRunning($transfer) ? 1 : 0;
$tmpl->setvar('running', $ch->running);
示例5: parseResponse
function parseResponse()
{
$thing = $this->htmlPage;
// We got a response so display it.
// Chop the front end off.
if (strpos($thing, "Nothing here!") !== false) {
$this->msg = "Your search did not match any torrents";
} else {
$output = $this->tableHeader();
if (strpos($thing, "catHead") !== false) {
$thing = substr($thing, strpos($thing, "<table"));
$thing = substr($thing, strpos($thing, "<tr>"));
$tmpList = substr($thing, 0, strpos($thing, "</table>"));
// keep after 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, "download.php")) {
$ts = new fileTorrentDay($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"];
}
}
}
}
//foreach
} else {
$output .= "<tr><td> </td></tr>\n";
}
$output .= "</table>";
// is there paging at the bottom?
if (strpos($thing, "page=") !== false) {
// Yes, then lets grab it and display it! ;)
$pages = substr($thing, strpos($thing, "<p"));
$pages = substr($pages, strpos($pages, ">"));
$pages = substr($pages, 0, strpos($pages, "</p>"));
$thing = "";
$lastSearch = $this->lastSearch;
$pages = str_replace(" ", ' ', $pages);
$tmpPageArr = explode("</a>", $pages);
$pagesOut = '';
foreach ($tmpPageArr as $key => $value) {
$value .= "</a>";
if (!preg_match("#((browse|0day|torrents\\-search|torrents|search)\\.php[^>]+)#", $value, $matches)) {
continue;
}
$url = rtrim($matches[0], '"');
$php = $matches[2];
//search,torrents...
if (!preg_match("#page=([\\d]+)#", $value, $matches)) {
continue;
}
$pgNum = (int) $matches[1];
$pagesOut .= str_replace($url, "XXXURLXXX" . $pgNum, $value);
}
$pagesout = str_replace($php . ".php?page=", "", $pagesOut);
$cat = tfb_getRequestVar('subGenre');
if (empty($cat) && !empty($_REQUEST['cat'])) {
$cat = $_REQUEST['cat'];
}
$cat = (int) $cat;
if (stripos($this->curRequest, "LATEST")) {
if (!empty($cat)) {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&LATEST=1&cat=" . $cat . "&pg=", $pagesOut);
} else {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&LATEST=1&pg=", $pagesOut);
}
} else {
if (!empty($cat)) {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&searchterm=" . $_REQUEST["searchterm"] . "&cat=" . $cat . "&pg=", $pagesOut);
} else {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&searchterm=" . $_REQUEST["searchterm"] . "&pg=", $pagesOut);
}
}
$output .= "<div align=center>" . substr($pages, 1) . "</div>";
}
}
return $output;
}
示例6: AuditAction
$sourceDir = $cfg["path"] . $dir;
// only valid dirs + entries with permission
if (!(tfb_isValidPath($sourceDir) && tfb_isValidPath($sourceDir . $file) && isValidEntry($file) && hasPermission($dir, $cfg["user"], 'w'))) {
AuditAction($cfg["constants"]["error"], "ILLEGAL RENAME: " . $cfg["user"] . " tried to rename " . $file . " in " . $dir);
@error("Illegal rename. Action has been logged.", "", "");
}
// template
$tmpl->setvar('is_start', 1);
$tmpl->setvar('file', $file);
$tmpl->setvar('dir', $dir);
$tmpl->setvar('_REN_FILE', $cfg['_REN_FILE']);
$tmpl->setvar('_REN_STRING', $cfg['_REN_STRING']);
} else {
$file = tfb_getRequestVar('fileFrom');
$fileTo = tfb_getRequestVar('fileTo');
$dir = tfb_getRequestVar('dir');
$sourceDir = $cfg["path"] . $dir;
$targetDir = $cfg["path"] . $dir . $fileTo;
// Add slashes if magic_quotes off:
if (get_magic_quotes_gpc() !== 1) {
$targetDir = addslashes($targetDir);
$sourceDir = addslashes($sourceDir);
}
// only valid dirs + entries with permission
if (!(tfb_isValidPath($sourceDir) && tfb_isValidPath($sourceDir . $file) && tfb_isValidPath($targetDir) && isValidEntry($file) && isValidEntry($fileTo) && hasPermission($dir, $cfg["user"], 'w'))) {
AuditAction($cfg["constants"]["error"], "ILLEGAL RENAME: " . $cfg["user"] . " tried to rename " . $file . " in " . $dir . " to " . $fileTo);
@error("Illegal rename. Action has been logged.", "", "");
}
// Use single quote to escape mv args:
$cmd = "mv '" . $sourceDir . $file . "' '" . $targetDir . "'";
$cmd .= ' 2>&1';
示例7: Initialize
function Initialize($cfg)
{
$rtnValue = false;
$this->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;
}
示例8: tfb_getRequestVar
@header("location: index.php?iid=index");
exit;
}
// message
$message = tfb_getRequestVar('message');
if (!empty($message)) {
$to_all_r = tfb_getRequestVar('to_all');
$force_read_r = tfb_getRequestVar('force_read');
$message = check_html($message, "nohtml");
SaveMessage($to_user, $cfg["user"], htmlentities($message), empty($to_all_r) ? 0 : 1, !empty($force_read_r) && $cfg['isAdmin'] ? 1 : 0);
@header("location: index.php?iid=readmsg");
exit;
}
// rmid
if (isset($_REQUEST['rmid'])) {
$rmid = tfb_getRequestVar('rmid');
if (!empty($rmid)) {
list($from_user, $message, $ip, $time) = GetMessage($rmid);
$message = $cfg['_DATE'] . ": " . date($cfg['_DATETIMEFORMAT'], $time) . "\n" . $from_user . " " . $cfg['_WROTE'] . ":\n\n" . $message;
$message = ">" . str_replace("\n", "\n>", $message);
$message = "\n\n\n" . $message;
}
}
// init template-instance
tmplInitializeInstance($cfg["theme"], "page.message.tmpl");
// set vars
$tmpl->setvar('to_user', $to_user);
$tmpl->setvar('user', $cfg["user"]);
$tmpl->setvar('message', $message);
//
$tmpl->setvar('_TO', $cfg['_TO']);
示例9: setFilePriority
/**
* set file prio
*
* @param $transfer
*/
function setFilePriority($transfer)
{
global $cfg;
$isTransmissionTorrent = false;
if ($cfg["transmission_rpc_enable"] && isHash($transfer)) {
require_once 'inc/functions/functions.rpc.transmission.php';
$theTorrent = getTransmissionTransfer($transfer, array('hashString', 'id', 'name'));
$isTransmissionTorrent = is_array($theTorrent);
}
if ($isTransmissionTorrent) {
foreach ($_REQUEST['files'] as $fileid) {
$selectedFiles[] = (int) $fileid;
}
# Get files that are wanted or not for download, then we can compare.
$responseWantedFiles = getTransmissionTransfer($transfer, array('wanted'));
$wantedFiles = $responseWantedFiles['wanted'];
$thearray = array_fill(0, count($wantedFiles), 0);
foreach ($selectedFiles as $fileid) {
$thearray[$fileid] = 1;
}
$counter = 0;
foreach ($wantedFiles as $fileid => $wanted) {
if ($thearray[$counter] == 1 && $wantedFiles[$counter] == 0) {
// the file is not marked as selected in the gui but it has been saved as "wanted"
$includeFiles[] = (int) $counter;
// deselect this files
}
if ($thearray[$counter] == 0 && $wantedFiles[$counter] == 1) {
// the file is not marked as selected in the gui but it has been saved as "wanted"
$excludeFiles[] = (int) $counter;
// deselect this files
}
$counter++;
}
if (count($includeFiles) > 0) {
$includeFiles = array_values($includeFiles);
setTransmissionTransferProperties($transfer, array("files-wanted" => $includeFiles));
}
if (count($excludeFiles) > 0) {
$excludeFiles = array_values($excludeFiles);
setTransmissionTransferProperties($transfer, array("files-unwanted" => $excludeFiles));
}
} else {
// we will use this to determine if we should create a prio file.
// if the user passes all 1's then they want the whole thing.
// so we don't need to create a prio file.
// if there is a -1 in the array then they are requesting
// to skip a file. so we will need to create the prio file.
$okToCreate = false;
if (!empty($transfer)) {
$fileName = $cfg["transfer_file_path"] . $transfer . ".prio";
$result = array();
$files = array();
if (isset($_REQUEST['files'])) {
$filesTemp = is_array($_REQUEST['files']) ? $_REQUEST['files'] : array($_REQUEST['files']);
$files = array_filter($filesTemp, "getFile");
}
// if there are files to get then process and create a prio file.
if (count($files) > 0) {
for ($i = 0; $i <= tfb_getRequestVar('count'); $i++) {
if (in_array($i, $files)) {
array_push($result, 1);
} else {
$okToCreate = true;
array_push($result, -1);
}
}
if ($okToCreate) {
$fp = fopen($fileName, "w");
fwrite($fp, tfb_getRequestVar('filecount') . ",");
fwrite($fp, implode($result, ','));
fclose($fp);
} else {
// No files to skip so must be wanting them all.
// So we will remove the prio file.
@unlink($fileName);
}
} else {
// No files selected so must be wanting them all.
// So we will remove the prio file.
@unlink($fileName);
}
}
}
}
示例10: AuditAction
require_once 'inc/functions/functions.common.php';
// dir functions
require_once 'inc/functions/functions.dir.php';
// is enabled ?
if ($cfg["enable_sfvcheck"] != 1) {
AuditAction($cfg["constants"]["error"], "ILLEGAL ACCESS: " . $cfg["user"] . " tried to use checkSFV");
@error("checkSFV is disabled", "index.php?iid=index", "");
}
// check the needed bins
// cksfv
if (@file_exists($cfg['bin_cksfv']) !== true) {
@error("Required binary could not be found", "", "", $cfg['isAdmin'] ? array('cksfv is required for sfv-checking', 'Specified cksfv-binary does not exist: ' . $cfg['bin_cksfv'], 'Check Settings on Admin-Server-Settings Page') : array('Please contact an Admin'));
}
// target
$dir = tfb_getRequestVar('dir');
$file = tfb_getRequestVar('file');
// validate dir + file
if (!empty($dir)) {
$dirS = str_replace($cfg["path"], '', $dir);
if (!(tfb_isValidPath($dir) && hasPermission($dirS, $cfg["user"], 'r'))) {
AuditAction($cfg["constants"]["error"], "ILLEGAL SFV-ACCESS: " . $cfg["user"] . " tried to check " . $dirS);
@error("Illegal access. Action has been logged.", "", "");
}
}
if (!empty($file)) {
$fileS = str_replace($cfg["path"], '', $file);
if (!(tfb_isValidPath($file) && isValidEntry(basename($file)) && hasPermission($fileS, $cfg["user"], 'r'))) {
AuditAction($cfg["constants"]["error"], "ILLEGAL SFV-ACCESS: " . $cfg["user"] . " tried to check " . $fileS);
@error("Illegal access. Action has been logged.", "", "");
}
}
示例11: array
// incoming-path
$tmpl->setvar('path_incoming', $cfg["enable_home_dirs"] != 0 ? $cfg["user"] : $cfg["path_incoming"]);
// some configs
$tmpl->setvar('enable_metafile_download', $cfg["enable_metafile_download"]);
$tmpl->setvar('enable_multiops', $cfg["enable_multiops"]);
$tmpl->setvar('twd', $cfg["transfer_window_default"]);
$tmpl->setvar('transfer_delete_data', $cfg["transfer_delete_data"]);
// =============================================================================
// transfer-list
// =============================================================================
$arUserTorrent = array();
$arListTorrent = array();
// settings
$settings = convertIntegerToArray($cfg["index_page_settings"]);
// sortOrder
$sortOrder = tfb_getRequestVar("so");
$tmpl->setvar('sortOrder', empty($sortOrder) ? $cfg["index_page_sortorder"] : $sortOrder);
// t-list
$arList = getTransferArray($sortOrder);
$progress_color = "#22BB22";
$bar_width = "4";
$bUseRPC = false;
// ---------------------------------------------------------------------
if ($cfg["transmission_rpc_enable"]) {
$bUseRPC = true;
require_once 'inc/functions/functions.rpc.transmission.php';
try {
if ($cfg["transmission_rpc_enable"] == 2) {
$aTrTorrents = getUserTransmissionTransfers((int) $cfg['uid']);
} else {
$aTrTorrents = getUserTransmissionTransfers();
示例12: getTransferListArray
/**
* This method gets the list of transfer
*
* @return array
*/
function getTransferListArray()
{
global $cfg, $db, $transfers;
$kill_id = "";
$lastUser = "";
$arUserTransfers = array();
$arListTransfers = array();
// settings
$settings = convertIntegerToArray($cfg["index_page_settings"]);
// sortOrder
$sortOrder = tfb_getRequestVar("so");
if ($sortOrder == "") {
$sortOrder = $cfg["index_page_sortorder"];
}
if ($cfg["transmission_rpc_enable"] == 2) {
require_once 'inc/functions/functions.rpc.transmission.php';
// New method for transmission-daemon transfers
$result = getUserTransmissionTransfers($cfg['uid']);
foreach ($result as $aTorrent) {
if ($aTorrent['status'] == 4 || $aTorrent['status'] == 8) {
if (!isset($cfg["total_upload"])) {
$cfg["total_upload"] = 0;
}
if (!isset($cfg["total_download"])) {
$cfg["total_download"] = 0;
}
$cfg["total_upload"] = $cfg["total_upload"] + GetSpeedValue($aTorrent['rateUpload'] / 1000);
$cfg["total_download"] = $cfg["total_download"] + GetSpeedValue($aTorrent['rateDownload'] / 1000);
}
array_push($arUserTransfers, $aTorrent);
}
}
$arList = getTransferArray($sortOrder);
foreach ($arList as $transfer) {
// init some vars
$displayname = $transfer;
$show_run = true;
$transferowner = getOwner($transfer);
$owner = IsOwner($cfg["user"], $transferowner);
// stat
$sf = new StatFile($transfer, $transferowner);
// settings
if (isset($transfers['settings'][$transfer])) {
$settingsAry = $transfers['settings'][$transfer];
} else {
$settingsAry = array();
if (substr(str_replace('.imported', '', $transfer), -8) == ".torrent") {
// this is a t-client
$settingsAry['type'] = "torrent";
$settingsAry['client'] = $cfg["btclient"];
} else {
if (substr($transfer, -5) == ".wget") {
// this is wget.
$settingsAry['type'] = "wget";
$settingsAry['client'] = "wget";
} else {
if (substr($transfer, -4) == ".nzb") {
// this is nzbperl.
$settingsAry['type'] = "nzb";
$settingsAry['client'] = "nzbperl";
} else {
AuditAction($cfg["constants"]["error"], "INVALID TRANSFER: " . $transfer);
@error("Invalid Transfer", "", "", array($transfer));
}
}
}
$settingsAry['hash'] = "";
$settingsAry["savepath"] = $cfg["enable_home_dirs"] != 0 ? $cfg["path"] . $transferowner . '/' : $cfg["path"] . $cfg["path_incoming"] . '/';
$settingsAry['datapath'] = "";
}
// cache running-flag in local var. we will access that often
$transferRunning = $sf->running;
// cache percent-done in local var. ...
$percentDone = $sf->percent_done;
// ---------------------------------------------------------------------
//XFER: update1: add upload/download stats to the xfer array
if ($cfg['enable_xfer'] == 1 && $cfg['xfer_realtime'] == 1) {
@Xfer::update1($transfer, $transferowner, $settingsAry['client'], $settingsAry['hash'], $sf->uptotal, $sf->downtotal);
}
// ---------------------------------------------------------------------
// injects
if (!file_exists($cfg["transfer_file_path"] . $transfer . ".stat")) {
$transferRunning = 2;
$sf->running = "2";
$sf->size = getTransferSize($transfer);
injectTransfer($transfer);
}
// use default client if client is not set
if (!isset($settingsAry['client'])) {
$settingsAry['client'] = $cfg['btclient'];
}
// totals-preparation
// if downtotal + uptotal + progress > 0
if ($settings[2] + $settings[3] + $settings[5] > 0) {
$ch = ClientHandler::getInstance($settingsAry['client']);
//.........这里部分代码省略.........
示例13: tfb_getRequestVar
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
*******************************************************************************/
// prevent direct invocation
if (!isset($cfg['user']) || isset($_REQUEST['cfg'])) {
@ob_end_clean();
@header("location: ../../../index.php");
exit;
}
/******************************************************************************/
$newUser = tfb_getRequestVar('newUser');
$pass1 = tfb_getRequestVar('pass1');
$pass2 = tfb_getRequestVar('pass2');
$userType = tfb_getRequestVar('userType');
// check username
$usernameCheck = checkUsername($newUser);
// check password
$passwordCheck = checkPassword($pass1, $pass2);
// new user ?
$newUser = strtolower($newUser);
if ($usernameCheck === true && $passwordCheck === true) {
addNewUser($newUser, $pass1, $userType);
AuditAction($cfg["constants"]["admin"], $cfg['_NEWUSER'] . ": " . $newUser);
@header("location: admin.php?op=showUsers");
exit;
}
// init template-instance
tmplInitializeInstance($cfg["theme"], "page.admin.addUser.tmpl");
// set vars
示例14: parseResponse
function parseResponse($latest = true)
{
$output = $this->tableHeader();
$thing = $this->htmlPage;
if (strpos($thing, "Error:") > 0) {
$tmpStr = substr($thing, strpos($thing, "Error:") + strlen("Error:"));
$tmpStr = substr($tmpStr, 0, strpos($tmpStr, "</p>"));
$this->msg = strip_tags($tmpStr);
return $output . "<center>" . $this->msg . "</center><br>";
}
// We got a response so display it.
// Chop the front end off.
$thing = substr($thing, strpos($thing, "CONTENT START"));
$thing = substr($thing, strpos($thing, 'Health</td></tr>') + strlen('Health</td></tr>'));
$table = substr($thing, 0, strpos($thing, "</table><BR>"));
//var_dump(htmlentities($thing)); exit;
// ok so now we have the listing.
$tmpListArr = explode("<tr>", $table);
//print_r($tmpListArr);
$bg = $this->cfg["bgLight"];
foreach ($tmpListArr as $key => $value) {
$buildLine = true;
if (strpos($value, "download.php?id")) {
$ts = new fileItoma($value, $this->altURL);
//print_r($ts);
// Determine if we should build this output
if (is_int(array_search($ts->MainId, $this->catFilter))) {
$buildLine = false;
}
if ($this->hideSeedless == "yes") {
if (intval($ts->Seeds) == 0) {
$buildLine = false;
}
} elseif ($this->hideSeedless == "only") {
if (intval($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,"</table>"));
$output .= "</table>";
// is there paging at the bottom?
if (strpos($thing, "page=") !== false) {
// Yes, then lets grab it and display it! ;)
$pages = substr($thing, strpos($thing, "<p"));
$pages = substr($pages, strpos($pages, ">"));
$pages = substr($pages, 0, strpos($pages, "</p>"));
$pages = str_replace(" ", '', $pages);
$tmpPageArr = explode("</a>", $pages);
array_pop($tmpPageArr);
$pagesout = '';
foreach ($tmpPageArr as $key => $value) {
$value .= "</a> ";
if (!preg_match("#((browse|torrents\\-search|torrents|search)\\.php[^>]+)#", $value, $matches)) {
continue;
}
$url = rtrim($matches[0], '"');
$php = $matches[2];
//browse,search,torrents...
if (!preg_match("#page=([\\d]+)#", $value, $matches)) {
continue;
}
$pgNum = (int) $matches[1];
$pagesout .= str_replace($url, "XXXURLXXX" . $pgNum, $value);
}
$pagesout = str_replace($php . ".php?page=", "", $pagesout);
$cat = tfb_getRequestVar('mainGenre');
if (empty($cat) && !empty($_REQUEST['cat'])) {
$cat = $_REQUEST['cat'];
}
if (stripos($this->curRequest, "LATEST")) {
if (!empty($cat)) {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&LATEST=1&cat=" . $cat . "&pg=", $pagesout);
} else {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&LATEST=1&pg=", $pagesout);
}
} else {
if (!empty($cat)) {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&searchterm=" . $_REQUEST["searchterm"] . "&cat=" . $cat . "&pg=", $pagesout);
} else {
$pages = str_replace("XXXURLXXX", $this->searchURL() . "&searchterm=" . $_REQUEST["searchterm"] . "&pg=", $pagesout);
}
}
$output .= "<div align=center>" . substr($pages, 1) . "</div>";
}
return $output;
}
示例15: tmplInitializeInstance
To read the license please visit http://www.gnu.org/copyleft/gpl.html
*******************************************************************************/
// prevent direct invocation
if (!isset($cfg['user']) || isset($_REQUEST['cfg'])) {
@ob_end_clean();
@header("location: ../../../index.php");
exit;
}
/******************************************************************************/
// search engine base
require_once "inc/searchEngines/SearchEngineBase.php";
// init template-instance
tmplInitializeInstance($cfg["theme"], "page.admin.searchSettings.tmpl");
// set vars
$searchEngine = tfb_getRequestVar('searchEngine');
if (empty($searchEngine)) {
$searchEngine = $cfg["searchEngine"];
}
if (is_file('inc/searchEngines/' . $searchEngine . 'Engine.php')) {
include_once 'inc/searchEngines/' . $searchEngine . 'Engine.php';
$sEngine = new SearchEngine(serialize($cfg));
if ($sEngine->initialized) {
$tmpl->setvar('is_file', 1);
$tmpl->setvar('mainTitle', $sEngine->mainTitle);
$tmpl->setvar('searchEngine', $searchEngine);
$tmpl->setvar('mainURL', $sEngine->mainURL);
$tmpl->setvar('author', $sEngine->author);
$tmpl->setvar('version', $sEngine->version);
if (strlen($sEngine->updateURL) > 0) {
$tmpl->setvar('update_pos', 1);