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
@@ -80,8 +80,9 @@ class ViewHitAndRun extends ViewRecord
protected function getActions(): array protected function getActions(): array
{ {
return [ $actions = [];
Actions\Action::make('Pardon') if (in_array($this->record->status, HitAndRun::CAN_PARDON_STATUS)) {
$actions[] = Actions\Action::make('Pardon')
->requiresConfirmation() ->requiresConfirmation()
->action(function () { ->action(function () {
$hitAndRunRep = new HitAndRunRepository(); $hitAndRunRep = new HitAndRunRepository();
@@ -93,10 +94,12 @@ class ViewHitAndRun extends ViewRecord
$this->notify('danger', $exception->getMessage()); $this->notify('danger', $exception->getMessage());
} }
}) })
->label(__('admin.resources.hit_and_run.action_pardon')), ->label(__('admin.resources.hit_and_run.action_pardon'))
;
}
$actions[] = Actions\DeleteAction::make();
Actions\DeleteAction::make(), return $actions;
];
} }
} }
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('peers', function (Blueprint $table) {
$table->index('last_action');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('peers', function (Blueprint $table) {
$table->dropIndex('peers_last_action_index');
});
}
};
+3 -2
View File
@@ -97,9 +97,10 @@ function hash_pad($hash) {
} }
function hash_where($name, $hash) { function hash_where($name, $hash) {
$shhash = preg_replace('/ *$/s', "", $hash); // $shhash = preg_replace('/ *$/s', "", $hash);
// return "($name = " . sqlesc($hash) . " OR $name = " . sqlesc($shhash) . ")"; // return "($name = " . sqlesc($hash) . " OR $name = " . sqlesc($shhash) . ")";
return sprintf("$name in (%s, %s)", sqlesc($hash), sqlesc($shhash)); // return sprintf("$name in (%s, %s)", sqlesc($hash), sqlesc($shhash));
return "$name = " . sqlesc($hash);
} }
//no need any more... //no need any more...
+4 -4
View File
@@ -451,13 +451,13 @@ $lang_settings = array
'row_cleanup_interval' => "自动清理间隔", 'row_cleanup_interval' => "自动清理间隔",
'text_cleanup_interval_note_one' => "每XXX秒时间做自动清理工作(用户升级、降级、添加做种魔力值等)。", 'text_cleanup_interval_note_one' => "每XXX秒时间做自动清理工作(用户升级、降级、添加做种魔力值等)。",
'text_priority_one' => "优先级1", 'text_priority_one' => "优先级1",
'text_priority_one_note' => "更新同伴状态;添加做种魔力值。默认'900',即15分钟。", 'text_priority_one_note' => "更新同伴状态;添加做种魔力值。默认'3600',即60分钟。",
'text_priority_two' => "优先级2", 'text_priority_two' => "优先级2",
'text_priority_two_note' => "更新种子可见性。默认'1800',即30分钟。", 'text_priority_two_note' => "更新种子可见性。默认'5400',即90分钟。",
'text_priority_three' => "优先级3", 'text_priority_three' => "优先级3",
'text_priority_three_note' => "更新种子做种数、下载数、评论数;更新论坛帖子/主题数;删除过期的候选;种子促销到期;自动挑选热门种子。默认'3600',即60分钟", 'text_priority_three_note' => "更新种子做种数、下载数、评论数;更新论坛帖子/主题数;删除过期的候选;种子促销到期;自动挑选热门种子。默认'7200',即2小时",
'text_priority_four' => "优先级4", 'text_priority_four' => "优先级4",
'text_priority_four_note' => "删除未通过验证的账号,过期的登录尝试记录,过期的邀请码和图片验证码;清理用户账号(删除不活跃账号,账号升级、降级、禁用);发送上传的图片;更新用户总做种和下载时间。默认'43200',即24小时。", 'text_priority_four_note' => "删除未通过验证的账号,过期的登录尝试记录,过期的邀请码和图片验证码;清理用户账号(删除不活跃账号,账号升级、降级、禁用);发送上传的图片;更新用户总做种和下载时间。默认'86400',即24小时。",
'text_priority_five' => "优先级5", 'text_priority_five' => "优先级5",
'text_priority_five_note' => "删除种子文件不存在的种子;锁定论坛的古老主题;删除古老的举报信息。默认'1296000',即15天。", 'text_priority_five_note' => "删除种子文件不存在的种子;锁定论坛的古老主题;删除古老的举报信息。默认'1296000',即15天。",
'text_cleanup_interval_note_two' => "<b>注意</b><font class=striking><b>不要</b></font>改变时间递增的排序。", 'text_cleanup_interval_note_two' => "<b>注意</b><font class=striking><b>不要</b></font>改变时间递增的排序。",
+4 -4
View File
@@ -452,13 +452,13 @@ $lang_settings = array
'row_cleanup_interval' => "自動清理間隔", 'row_cleanup_interval' => "自動清理間隔",
'text_cleanup_interval_note_one' => "每XXX秒時間做自動清理工作(用戶升級、降級、添加做種魔力值等)。", 'text_cleanup_interval_note_one' => "每XXX秒時間做自動清理工作(用戶升級、降級、添加做種魔力值等)。",
'text_priority_one' => "優先級1", 'text_priority_one' => "優先級1",
'text_priority_one_note' => "更新同伴狀態;添加做種魔力值。預設'900',即15分鐘。", 'text_priority_one_note' => "更新同伴狀態;添加做種魔力值。預設'3600',即60分鐘。",
'text_priority_two' => "優先級2", 'text_priority_two' => "優先級2",
'text_priority_two_note' => "更新種子可見性。預設'1800',即30分鐘。", 'text_priority_two_note' => "更新種子可見性。預設'5400',即90分鐘。",
'text_priority_three' => "優先級3", 'text_priority_three' => "優先級3",
'text_priority_three_note' => "更新種子做種數、下載數、評論數;更新論壇帖子/主題數;移除過期的候選;種子促銷到期;自動挑揀熱門種子。預設'3600',即60分鐘", 'text_priority_three_note' => "更新種子做種數、下載數、評論數;更新論壇帖子/主題數;移除過期的候選;種子促銷到期;自動挑揀熱門種子。預設'7200',即2小時",
'text_priority_four' => "優先級4", 'text_priority_four' => "優先級4",
'text_priority_four_note' => "移除未通過驗證的賬號,過期的登入嘗試記錄,過期的邀請碼和圖片驗證碼;清理用戶賬號(移除不活躍賬號,賬號升級、降級、禁用);傳送上傳的圖片;更新用戶總做種和下載時間。預設'43200',即24小時。", 'text_priority_four_note' => "移除未通過驗證的賬號,過期的登入嘗試記錄,過期的邀請碼和圖片驗證碼;清理用戶賬號(移除不活躍賬號,賬號升級、降級、禁用);傳送上傳的圖片;更新用戶總做種和下載時間。預設'86400',即24小時。",
'text_priority_five' => "優先級5", 'text_priority_five' => "優先級5",
'text_priority_five_note' => "移除種子檔案不存在的種子;鎖定論壇的古老主題;移除古老的舉報資訊。預設'1296000',即15天。", 'text_priority_five_note' => "移除種子檔案不存在的種子;鎖定論壇的古老主題;移除古老的舉報資訊。預設'1296000',即15天。",
'text_cleanup_interval_note_two' => "<b>注意</b><font class=striking><b>不要</b></font>改變時間遞增的排序。", 'text_cleanup_interval_note_two' => "<b>注意</b><font class=striking><b>不要</b></font>改變時間遞增的排序。",
+4 -4
View File
@@ -451,13 +451,13 @@ $lang_settings = array
'row_cleanup_interval' => "Auto Cleanup Interval", 'row_cleanup_interval' => "Auto Cleanup Interval",
'text_cleanup_interval_note_one' => "Do cleanup (user promotion, demotion, adding seeding bonus, etc.) every XXX seconds.", 'text_cleanup_interval_note_one' => "Do cleanup (user promotion, demotion, adding seeding bonus, etc.) every XXX seconds.",
'text_priority_one' => "Priority 1: ", 'text_priority_one' => "Priority 1: ",
'text_priority_one_note' => "Update peer status; Calculate seeding bonus. Default '900', i.e. 15 mins.", 'text_priority_one_note' => "Update peer status; Calculate seeding bonus. Default '3600', i.e. 60 minutes.",
'text_priority_two' => "Priority 2: ", 'text_priority_two' => "Priority 2: ",
'text_priority_two_note' => "Update torrents' visibility. Default '1800', i.e. 30 mins.", 'text_priority_two_note' => "Update torrents' visibility. Default '5400', i.e. 90 minutes.",
'text_priority_three' => "Priority 3: ", 'text_priority_three' => "Priority 3: ",
'text_priority_three_note' => "Update count of seeders, leechers, comments for torrents; Update forum post/topic count; Delete offers that are timeout; Expire torrent promotion; Automatically pick hot torrents. Default '3600', i.e. 60 mins.", 'text_priority_three_note' => "Update count of seeders, leechers, comments for torrents; Update forum post/topic count; Delete offers that are timeout; Expire torrent promotion; Automatically pick hot torrents. Default '7200', i.e. 2 hours.",
'text_priority_four' => "Priority 4: ", 'text_priority_four' => "Priority 4: ",
'text_priority_four_note' => "Delete unconfirmed accounts, old login attempts, invite codes and regimage codes; Clean up user accounts (delete inactive ones, do account promotion and demotion, banning, etc.); Post uploaded image; Update total seeding and leeching time of users. Default '43200', i.e. 24 hours.", 'text_priority_four_note' => "Delete unconfirmed accounts, old login attempts, invite codes and regimage codes; Clean up user accounts (delete inactive ones, do account promotion and demotion, banning, etc.); Post uploaded image; Update total seeding and leeching time of users. Default '86400', i.e. 24 hours.",
'text_priority_five' => "Priority 5: ", 'text_priority_five' => "Priority 5: ",
'text_priority_five_note' => "Delete torrents that doesn't exist any more; Lock very old forum topics; Delete very old report items. Default '1296000', i.e. 15 days.", 'text_priority_five_note' => "Delete torrents that doesn't exist any more; Lock very old forum topics; Delete very old report items. Default '1296000', i.e. 15 days.",
'text_cleanup_interval_note_two' => "<b>NOTE</b>: Do <b>NOT</b> change the ascendant order of the times!", 'text_cleanup_interval_note_two' => "<b>NOTE</b>: Do <b>NOT</b> change the ascendant order of the times!",
+5 -5
View File
@@ -39,11 +39,11 @@ return array (
'PAYPALACCOUNT' => '', 'PAYPALACCOUNT' => '',
'SLOGAN' => 'The Ultimate File Sharing Experience', 'SLOGAN' => 'The Ultimate File Sharing Experience',
'icplicense' => '', 'icplicense' => '',
'autoclean_interval_one' => '900', 'autoclean_interval_one' => '3600',
'autoclean_interval_two' => '1800', 'autoclean_interval_two' => '5400',
'autoclean_interval_three' => '3600', 'autoclean_interval_three' => '7200',
'autoclean_interval_four' => '43200', 'autoclean_interval_four' => '86400',
'autoclean_interval_five' => '648000', 'autoclean_interval_five' => '1296000',
'reportemail' => 'nobody@gmail.com', 'reportemail' => 'nobody@gmail.com',
'invitesystem' => 'no', 'invitesystem' => 'no',
'registration' => 'yes', 'registration' => 'yes',
+1 -2
View File
@@ -154,7 +154,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
$query[] = "search=".rawurlencode($searchstr); $query[] = "search=".rawurlencode($searchstr);
if ($_POST["search_mode"]){ if ($_POST["search_mode"]){
$search_mode = intval($_POST["search_mode"] ?? 0); $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; $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']?> <input type="text" name="search" style="width: 200px;" /> <?php echo $lang_getrss['text_with']?>
<select name="search_mode" style="width: 60px;"> <select name="search_mode" style="width: 60px;">
<option value="0"><?php echo $lang_getrss['select_and'] ?></option> <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> <option value="2"><?php echo $lang_getrss['select_exact'] ?></option>
</select> </select>
<?php echo $lang_getrss['text_mode']?> <?php echo $lang_getrss['text_mode']?>
+9 -9
View File
@@ -7,6 +7,14 @@ dbconn_announce();
// BLOCK ACCESS WITH WEB BROWSERS AND CHEATS! // BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
block_browser(); 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); preg_match_all('/info_hash=([^&]*)/i', $_SERVER["QUERY_STRING"], $info_hash_array);
$fields = "info_hash, times_completed, seeders, leechers"; $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]); $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); $res = sql_query($query);
if (mysql_num_rows($res) < 1){ if (mysql_num_rows($res) < 1){
@@ -42,5 +42,5 @@ while ($row = mysql_fetch_assoc($res)) {
} }
$d = ['files' => $torrent_details]; $d = ['files' => $torrent_details];
\Nexus\Database\NexusDB::cache_put($cacheKey, $d, 900); \Nexus\Database\NexusDB::cache_put($cacheKey, $d, 1200);
benc_resp($d); benc_resp($d);
+1 -1
View File
@@ -42,7 +42,7 @@ if (empty($searchstr))
unset($searchstr); unset($searchstr);
if (isset($searchstr)){ if (isset($searchstr)){
$search_mode = intval($_GET["search_mode"] ?? 0); $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; $search_mode = 0;
} }
+5 -2
View File
@@ -695,7 +695,11 @@ if (isset($searchstr))
$notnewword="notnewword=1&"; $notnewword="notnewword=1&";
} }
$search_mode = intval($_GET["search_mode"] ?? 0); $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; $search_mode = 0;
write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking search_mode field in" . $_SERVER['SCRIPT_NAME'], 'mod'); 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;"> <select name="search_mode" style="width: 60px;">
<option value="0"><?php echo $lang_torrents['select_and'] ?></option> <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> <option value="2"<?php echo isset($_GET["search_mode"]) && $_GET["search_mode"] == 2 ? " selected=\"selected\"" : "" ?>><?php echo $lang_torrents['select_exact'] ?></option>
</select> </select>
+2 -2
View File
@@ -5,10 +5,10 @@ require_once(get_langfile_path());
loggedinorreturn(); loggedinorreturn();
function bark($msg) { function bark($msg) {
//stdhead(); stdhead();
global $lang_usercp; global $lang_usercp;
stdmsg($lang_usercp['std_sorry'], $msg); stdmsg($lang_usercp['std_sorry'], $msg);
//stdfoot(); stdfoot();
exit; exit;
} }
function usercpmenu ($selected = "home") { function usercpmenu ($selected = "home") {
+3
View File
@@ -0,0 +1,3 @@
<?php
use Illuminate\Support\Facades\Route;