torrent keyword search remove or

This commit is contained in:
xiaomlove
2023-03-04 13:26:20 +08:00
parent 8d49bb3024
commit 37920145b0
13 changed files with 81 additions and 40 deletions
+1 -2
View File
@@ -154,7 +154,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
$query[] = "search=".rawurlencode($searchstr);
if ($_POST["search_mode"]){
$search_mode = intval($_POST["search_mode"] ?? 0);
if (!in_array($search_mode,array(0,1,2)))
if (!in_array($search_mode,array(0,2)))
{
$search_mode = 0;
}
@@ -367,7 +367,6 @@ if (get_setting('main.spsct') == 'yes') {
<input type="text" name="search" style="width: 200px;" /> <?php echo $lang_getrss['text_with']?>
<select name="search_mode" style="width: 60px;">
<option value="0"><?php echo $lang_getrss['select_and'] ?></option>
<option value="1" selected="selected"><?php echo $lang_getrss['select_or'] ?></option>
<option value="2"><?php echo $lang_getrss['select_exact'] ?></option>
</select>
<?php echo $lang_getrss['text_mode']?>
+9 -9
View File
@@ -7,6 +7,14 @@ dbconn_announce();
// BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
block_browser();
$cacheKey = md5($_SERVER["QUERY_STRING"]);
$cacheData = \Nexus\Database\NexusDB::cache_get($cacheKey);
if ($cacheData) {
do_log("[SCRAPE_FROM_CACHE]: " . $_SERVER["QUERY_STRING"]);
benc_resp($cacheData);
exit(0);
}
preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_array);
$fields = "info_hash, times_completed, seeders, leechers";
@@ -18,14 +26,6 @@ else {
$query = "SELECT $fields FROM torrents WHERE " . hash_where_arr('info_hash', $info_hash_array[1]);
}
$cacheKey = md5($query);
$cacheData = \Nexus\Database\NexusDB::cache_get($cacheKey);
if ($cacheData) {
do_log("[SCRAPE_FROM_CACHE]: " . json_encode($info_hash_array[1]));
benc_resp($cacheData);
exit(0);
}
$res = sql_query($query);
if (mysql_num_rows($res) < 1){
@@ -42,5 +42,5 @@ while ($row = mysql_fetch_assoc($res)) {
}
$d = ['files' => $torrent_details];
\Nexus\Database\NexusDB::cache_put($cacheKey, $d, 900);
\Nexus\Database\NexusDB::cache_put($cacheKey, $d, 1200);
benc_resp($d);
+1 -1
View File
@@ -42,7 +42,7 @@ if (empty($searchstr))
unset($searchstr);
if (isset($searchstr)){
$search_mode = intval($_GET["search_mode"] ?? 0);
if (!in_array($search_mode,array(0,1,2)))
if (!in_array($search_mode,array(0,2)))
{
$search_mode = 0;
}
+5 -2
View File
@@ -695,7 +695,11 @@ if (isset($searchstr))
$notnewword="notnewword=1&";
}
$search_mode = intval($_GET["search_mode"] ?? 0);
if (!in_array($search_mode,array(0,1,2)))
/**
* Deprecated search mode: 1(OR)
* @since 1.8
*/
if (!in_array($search_mode,array(0,2)))
{
$search_mode = 0;
write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking search_mode field in" . $_SERVER['SCRIPT_NAME'], 'mod');
@@ -1189,7 +1193,6 @@ if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showin
<select name="search_mode" style="width: 60px;">
<option value="0"><?php echo $lang_torrents['select_and'] ?></option>
<option value="1"<?php echo isset($_GET["search_mode"]) && $_GET["search_mode"] == 1 ? " selected=\"selected\"" : "" ?>><?php echo $lang_torrents['select_or'] ?></option>
<option value="2"<?php echo isset($_GET["search_mode"]) && $_GET["search_mode"] == 2 ? " selected=\"selected\"" : "" ?>><?php echo $lang_torrents['select_exact'] ?></option>
</select>
+2 -2
View File
@@ -5,10 +5,10 @@ require_once(get_langfile_path());
loggedinorreturn();
function bark($msg) {
//stdhead();
stdhead();
global $lang_usercp;
stdmsg($lang_usercp['std_sorry'], $msg);
//stdfoot();
stdfoot();
exit;
}
function usercpmenu ($selected = "home") {