diff --git a/database/migrations/2021_06_08_113437_create_agent_allowed_family_table.php b/database/migrations/2021_06_08_113437_create_agent_allowed_family_table.php index f7c2038f..f47dd8d7 100644 --- a/database/migrations/2021_06_08_113437_create_agent_allowed_family_table.php +++ b/database/migrations/2021_06_08_113437_create_agent_allowed_family_table.php @@ -17,7 +17,7 @@ class CreateAgentAllowedFamilyTable extends Migration return; } Schema::create('agent_allowed_family', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('family', 50)->default(''); $table->string('start_name', 100)->default(''); $table->string('peer_id_pattern', 200)->default(''); diff --git a/database/migrations/2021_06_08_113437_create_audiocodecs_table.php b/database/migrations/2021_06_08_113437_create_audiocodecs_table.php index 5ea3b30d..4dae1b80 100644 --- a/database/migrations/2021_06_08_113437_create_audiocodecs_table.php +++ b/database/migrations/2021_06_08_113437_create_audiocodecs_table.php @@ -17,7 +17,7 @@ class CreateAudiocodecsTable extends Migration return; } Schema::create('audiocodecs', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->string('image')->default(''); $table->unsignedTinyInteger('sort_index')->default(0); diff --git a/database/migrations/2021_06_08_113437_create_caticons_table.php b/database/migrations/2021_06_08_113437_create_caticons_table.php index f3b58888..c512b492 100644 --- a/database/migrations/2021_06_08_113437_create_caticons_table.php +++ b/database/migrations/2021_06_08_113437_create_caticons_table.php @@ -17,7 +17,7 @@ class CreateCaticonsTable extends Migration return; } Schema::create('caticons', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 64)->default(''); $table->string('folder')->default(''); $table->string('cssfile')->default(''); diff --git a/database/migrations/2021_06_08_113437_create_codecs_table.php b/database/migrations/2021_06_08_113437_create_codecs_table.php index 75fb8c75..53db47a4 100644 --- a/database/migrations/2021_06_08_113437_create_codecs_table.php +++ b/database/migrations/2021_06_08_113437_create_codecs_table.php @@ -17,7 +17,7 @@ class CreateCodecsTable extends Migration return; } Schema::create('codecs', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->unsignedTinyInteger('sort_index')->default(0); }); diff --git a/database/migrations/2021_06_08_113437_create_downloadspeed_table.php b/database/migrations/2021_06_08_113437_create_downloadspeed_table.php index fecbb030..1817c1d8 100644 --- a/database/migrations/2021_06_08_113437_create_downloadspeed_table.php +++ b/database/migrations/2021_06_08_113437_create_downloadspeed_table.php @@ -17,7 +17,7 @@ class CreateDownloadspeedTable extends Migration return; } Schema::create('downloadspeed', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 50)->default(''); }); } diff --git a/database/migrations/2021_06_08_113437_create_isp_table.php b/database/migrations/2021_06_08_113437_create_isp_table.php index a4d9fff7..f8c07596 100644 --- a/database/migrations/2021_06_08_113437_create_isp_table.php +++ b/database/migrations/2021_06_08_113437_create_isp_table.php @@ -17,7 +17,7 @@ class CreateIspTable extends Migration return; } Schema::create('isp', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 50)->nullable(); }); } diff --git a/database/migrations/2021_06_08_113437_create_links_table.php b/database/migrations/2021_06_08_113437_create_links_table.php index 78a90a65..be16944e 100644 --- a/database/migrations/2021_06_08_113437_create_links_table.php +++ b/database/migrations/2021_06_08_113437_create_links_table.php @@ -17,7 +17,7 @@ class CreateLinksTable extends Migration return; } Schema::create('links', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->string('url')->default(''); $table->string('title', 50)->default(''); diff --git a/database/migrations/2021_06_08_113437_create_media_table.php b/database/migrations/2021_06_08_113437_create_media_table.php index fa99830e..f7c6af47 100644 --- a/database/migrations/2021_06_08_113437_create_media_table.php +++ b/database/migrations/2021_06_08_113437_create_media_table.php @@ -17,7 +17,7 @@ class CreateMediaTable extends Migration return; } Schema::create('media', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->unsignedTinyInteger('sort_index')->default(0); }); diff --git a/database/migrations/2021_06_08_113437_create_processings_table.php b/database/migrations/2021_06_08_113437_create_processings_table.php index 41d55583..c3165359 100644 --- a/database/migrations/2021_06_08_113437_create_processings_table.php +++ b/database/migrations/2021_06_08_113437_create_processings_table.php @@ -17,7 +17,7 @@ class CreateProcessingsTable extends Migration return; } Schema::create('processings', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->unsignedTinyInteger('sort_index')->default(0); }); diff --git a/database/migrations/2021_06_08_113437_create_snatched_table.php b/database/migrations/2021_06_08_113437_create_snatched_table.php index aaf20897..75bc80b7 100644 --- a/database/migrations/2021_06_08_113437_create_snatched_table.php +++ b/database/migrations/2021_06_08_113437_create_snatched_table.php @@ -31,7 +31,7 @@ class CreateSnatchedTable extends Migration $table->dateTime('startdat')->nullable(); $table->dateTime('completedat')->nullable(); $table->enum('finished', ['yes', 'no'])->default('no'); - $table->index(['torrentid', 'userid'], 'torrentid_userid'); + $table->unique(['torrentid', 'userid'], 'torrentid_userid'); }); } diff --git a/database/migrations/2021_06_08_113437_create_sources_table.php b/database/migrations/2021_06_08_113437_create_sources_table.php index d7badcdf..45abc74f 100644 --- a/database/migrations/2021_06_08_113437_create_sources_table.php +++ b/database/migrations/2021_06_08_113437_create_sources_table.php @@ -17,7 +17,7 @@ class CreateSourcesTable extends Migration return; } Schema::create('sources', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->unsignedTinyInteger('sort_index')->default(0); }); diff --git a/database/migrations/2021_06_08_113437_create_standards_table.php b/database/migrations/2021_06_08_113437_create_standards_table.php index b68816cb..48b29bc6 100644 --- a/database/migrations/2021_06_08_113437_create_standards_table.php +++ b/database/migrations/2021_06_08_113437_create_standards_table.php @@ -17,7 +17,7 @@ class CreateStandardsTable extends Migration return; } Schema::create('standards', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->unsignedTinyInteger('sort_index')->default(0); }); diff --git a/database/migrations/2021_06_08_113437_create_stylesheets_table.php b/database/migrations/2021_06_08_113437_create_stylesheets_table.php index 1c1414ad..8258255c 100644 --- a/database/migrations/2021_06_08_113437_create_stylesheets_table.php +++ b/database/migrations/2021_06_08_113437_create_stylesheets_table.php @@ -17,7 +17,7 @@ class CreateStylesheetsTable extends Migration return; } Schema::create('stylesheets', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('uri')->default(''); $table->string('name', 64)->default(''); $table->text('addicode')->nullable(); diff --git a/database/migrations/2021_06_08_113437_create_teams_table.php b/database/migrations/2021_06_08_113437_create_teams_table.php index 0f975e51..e1a64a0a 100644 --- a/database/migrations/2021_06_08_113437_create_teams_table.php +++ b/database/migrations/2021_06_08_113437_create_teams_table.php @@ -17,7 +17,7 @@ class CreateTeamsTable extends Migration return; } Schema::create('teams', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 30)->default(''); $table->unsignedTinyInteger('sort_index')->default(0); }); diff --git a/database/migrations/2021_06_08_113437_create_uploadspeed_table.php b/database/migrations/2021_06_08_113437_create_uploadspeed_table.php index 4e8ff022..ade55cc9 100644 --- a/database/migrations/2021_06_08_113437_create_uploadspeed_table.php +++ b/database/migrations/2021_06_08_113437_create_uploadspeed_table.php @@ -17,7 +17,7 @@ class CreateUploadspeedTable extends Migration return; } Schema::create('uploadspeed', function (Blueprint $table) { - $table->tinyIncrements('id'); + $table->increments('id'); $table->string('name', 50)->nullable(); }); } diff --git a/include/cleanup.php b/include/cleanup.php index 820a84ac..97968e9b 100644 --- a/include/cleanup.php +++ b/include/cleanup.php @@ -934,23 +934,24 @@ function docleanup($forceAll = 0, $printProgress = false) { } //delete duplicated snatched - $snatchRes = sql_query('select userid, torrentid, group_concat(id) as ids from snatched group by userid, torrentid having(count(*)) > 1'); - while ($snatchRow = mysql_fetch_assoc($snatchRes)) { - $torrentId = $snatchRow['torrentid']; - $userId = $snatchRow['userid']; - $idArr = explode(',', $snatchRes['ids']); - sort($idArr, SORT_NUMERIC); - $remainId = array_pop($idArr); - $delIdStr = implode(',', $idArr); - do_log("[DELETE_DUPLICATED_SNATCH], torrent: $torrentId, user: $userId"); - sql_query("delete from snatched where id in ($delIdStr)"); - sql_query("update claims set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId"); - } - $log = "delete duplicated snatched"; - do_log($log); - if ($printProgress) { - printProgress($log); - } + //is it necessary ? duplicate snatch update by torrent_id + userid, all records key fields are the same +// $snatchRes = sql_query('select userid, torrentid, group_concat(id) as ids from snatched group by userid, torrentid having(count(*)) > 1'); +// while ($snatchRow = mysql_fetch_assoc($snatchRes)) { +// $torrentId = $snatchRow['torrentid']; +// $userId = $snatchRow['userid']; +// $idArr = explode(',', $snatchRow['ids']); +// sort($idArr, SORT_NUMERIC); +// $remainId = array_pop($idArr); +// $delIdStr = implode(',', $idArr); +// do_log("[DELETE_DUPLICATED_SNATCH], torrent: $torrentId, user: $userId, snatchIdStr: $delIdStr"); +// sql_query("delete from snatched where id in ($delIdStr)"); +// sql_query("update claims set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId"); +// } +// $log = "delete duplicated snatched"; +// do_log($log); +// if ($printProgress) { +// printProgress($log); +// } //Priority Class 5: cleanup every 15 days $res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime5'"); diff --git a/include/constants.php b/include/constants.php index 65af13d3..cf2e7d91 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ "准确", 'text_mode' => "", 'text_keyword_note' => "只订阅标题中包含此关键字的项目", - 'row_sort' => '排序', - 'sort_sticky' => '置顶优先(默认)', - 'sort_newest' => '最新优先', + 'row_sticky' => '置顶', ); ?> diff --git a/lang/cht/lang_getrss.php b/lang/cht/lang_getrss.php index e333b963..e90d51a2 100644 --- a/lang/cht/lang_getrss.php +++ b/lang/cht/lang_getrss.php @@ -40,7 +40,8 @@ $lang_getrss = array 'select_or' => "或", 'select_exact' => "准確", 'text_mode' => "", - 'text_keyword_note' => "只訂閱標題中包含此關鍵字的項目" + 'text_keyword_note' => "只訂閱標題中包含此關鍵字的項目", + 'row_sticky' => '置頂', ); ?> diff --git a/lang/en/lang_getrss.php b/lang/en/lang_getrss.php index 32bb128e..b53a6f44 100644 --- a/lang/en/lang_getrss.php +++ b/lang/en/lang_getrss.php @@ -39,7 +39,8 @@ $lang_getrss = array 'select_or' => "OR", 'select_exact' => "Exact", 'text_mode' => "matching mode ", - 'text_keyword_note' => "Ony subscribe to items with these keywords in titles." + 'text_keyword_note' => "Ony subscribe to items with these keywords in titles.", + 'row_sticky' => 'Sticky', ); ?> diff --git a/public/getrss.php b/public/getrss.php index dae5c38a..4b33fc55 100644 --- a/public/getrss.php +++ b/public/getrss.php @@ -39,9 +39,10 @@ if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs", $brsectio } stdhead($lang_getrss['head_rss_feeds']); $query = []; +$allowed_showrows=array('10','50','100','200'); +$stickyTypes = apply_filter('rss_sticky_types', ['first' => nexus_trans('torrent.pos_state_sticky'), 'second' => nexus_trans('torrent.pos_state_r_sticky')]); $query[] = "passkey=" . $CURUSER['passkey']; if ($_SERVER['REQUEST_METHOD'] == "POST") { - $allowed_showrows=array('10','50','100','200'); $link = get_protocol_prefix(). $BASEURL ."/torrentrss.php"; if (isset($_POST['showrows']) && in_array($_POST['showrows'], $allowed_showrows, 1)) $query[] = "rows=".(int)$_POST['showrows']; @@ -156,10 +157,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $query[] = "search_mode=".$search_mode; } } - if (!empty($_POST['sort']) && in_array($_POST['sort'], ['newest', 'sticky'])) { - $query[] = "sort=" . $_POST['sort']; - } else { - $query[] = "sort=sticky"; + if (!empty($_POST['sticky']) && is_array($_POST['sticky'])) { + $query[] = "sticky=" . implode(',', $_POST['sticky']); } $inclbookmarked=intval($_POST['inclbookmarked'] ?? 0); if($inclbookmarked) @@ -323,11 +322,14 @@ if (get_setting('main.spsct') == 'yes') {