From cf4479ebea111c216110ed4cb747a1e18a31063f Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Fri, 4 Jun 2021 02:18:34 +0800 Subject: [PATCH] reset authkey + rss download link use downhash --- include/constants.php | 2 +- lang/chs/lang_settings.php | 2 +- lang/chs/lang_usercp.php | 9 ++++++--- lang/cht/lang_settings.php | 2 +- lang/cht/lang_usercp.php | 11 ++++++----- lang/en/lang_usercp.php | 7 +++++-- public/download.php | 3 +-- public/getrss.php | 3 +-- public/takeupload.php | 6 +++--- public/torrentrss.php | 6 +++--- public/usercp.php | 13 +++++++++++-- 11 files changed, 39 insertions(+), 25 deletions(-) diff --git a/include/constants.php b/include/constants.php index 01ce9382..487b21b0 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,5 +1,5 @@ "填写类似这样的地址:http://www.cc98.org", 'row_torrents_category_mode' => "种子区分类模式", 'text_torrents_category_mode_note' => "改变种子区的分类模式。", - 'row_special_category_mode' => "特殊区分类模式", + 'row_special_category_mode' => "特别区分类模式", 'text_special_category_mode_note' => "改变特殊区的分类模式。", 'row_default_site_language' => "默认站点语言", 'text_default_site_language_note' => "改变登录页面的默认语言。", diff --git a/lang/chs/lang_usercp.php b/lang/chs/lang_usercp.php index a7ab7458..8fa27dff 100644 --- a/lang/chs/lang_usercp.php +++ b/lang/chs/lang_usercp.php @@ -77,9 +77,12 @@ $lang_usercp = array 'std_passkey_reset' => " (密钥已成功更新!)", 'std_password_changed' => " (你的密码已成功修改!)", 'std_privacy_level_updated' => " (你的隐私级别已成功更新!)", - 'row_reset_passkey' => "重置密钥", - 'checkbox_reset_my_passkey' => "我想重置密钥。", - 'text_reset_passkey_note' => "注意:当密钥被重置后,你必须重新下载相关的种子文件才能继续下载或做种。", + 'row_reset_passkey' => "重置 passkey", + 'checkbox_reset_my_passkey' => "我想重置 passkey。", + 'text_reset_passkey_note' => "注意:当 passkey 被重置后,种子下载链接(如 rss 列表中的种子链接)必须重新获取。", + 'row_reset_authkey' => "重置 authkey", + 'checkbox_reset_my_authkey' => "我想重置 authkey。", + 'text_reset_authkey_note' => "注意:当 authkey 被重置后,你必须重新下载相关的种子文件才能继续下载或做种。", 'row_email_address' => "邮箱地址", 'text_email_address_note' => "注意:改变邮箱地址后,你将在新地址收到验证邮件。你必须重新验证。", 'row_change_password' => "修改密码", diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php index 7b61f46e..2f1ca9ff 100644 --- a/lang/cht/lang_settings.php +++ b/lang/cht/lang_settings.php @@ -430,7 +430,7 @@ $lang_settings = array 'text_external_forum_url_note' => "填寫類似這樣的位址:http://www.cc98.org", 'row_torrents_category_mode' => "種子區分類型態", 'text_torrents_category_mode_note' => "改變種子區的分類型態。", - 'row_special_category_mode' => "特殊區分類型態", + 'row_special_category_mode' => "特別區分類型態", 'text_special_category_mode_note' => "改變特殊區的分類型態。", 'row_default_site_language' => "預設網站語言", 'text_default_site_language_note' => "改變登入頁面的預設語言。", diff --git a/lang/cht/lang_usercp.php b/lang/cht/lang_usercp.php index 28f30b6a..4b7c14ec 100644 --- a/lang/cht/lang_usercp.php +++ b/lang/cht/lang_usercp.php @@ -77,11 +77,12 @@ $lang_usercp = array 'std_passkey_reset' => " (密鑰已成功更新!)", 'std_password_changed' => " (你的密碼已成功修改!)", 'std_privacy_level_updated' => " (你的隱私級別已成功更新!)", - 'row_reset_passkey' => "重置密匙", - 'checkbox_reset_my_passkey' => "我想重置密鑰。", - 'text_reset_passkey_note' => "注意:當密匙被重置後,你必須重新下載相關的種子檔才能繼續下載或做種。", - 'row_email_address' => "郵箱地址", - 'text_email_address_note' => "注意:改變郵箱位址後,你將在新位址收到驗證郵件。你必須重新驗證。", + 'row_reset_passkey' => "重置 passkey", + 'checkbox_reset_my_passkey' => "我想重置 passkey。", + 'text_reset_passkey_note' => "註意:當 passkey 被重置後,種子下載鏈接(如 rss 列表中的種子鏈接)必須重新獲取。", + 'row_reset_authkey' => "重置 authkey", + 'checkbox_reset_my_authkey' => "我想重置 authkey。", + 'text_reset_authkey_note' => "註意:當 authkey 被重置後,你必須重新下載相關的種子文件才能繼續下載或做種。", 'row_change_password' => "修改密碼", 'row_type_password_again' => "確認新密碼", 'row_privacy_level' => "隱私等級", diff --git a/lang/en/lang_usercp.php b/lang/en/lang_usercp.php index 67a1b4af..e69d75d5 100644 --- a/lang/en/lang_usercp.php +++ b/lang/en/lang_usercp.php @@ -79,8 +79,11 @@ $lang_usercp = array 'std_privacy_level_updated' => " (Your privacy level has been updated!)", 'row_reset_passkey' => "Reset passkey", 'checkbox_reset_my_passkey' => "I want to reset my passkey.", - 'text_reset_passkey_note' => "Note: In order to reset your current passkey, any active torrents must be downloaded again to continue leeching/seeding.", - 'row_email_address' => "Email address", + 'text_reset_passkey_note' => "Note: In order to reset your current passkey, any torrent download link(such as rss list) must be retrieved again to download torrent file.", + 'row_reset_authkey' => "Reset authkey", + 'checkbox_reset_my_authkey' => "I want to reset my authkey.", + 'text_reset_authkey_note' => "Note: In order to reset your current authkey, any active torrents must be downloaded again to continue leeching/seeding.", + 'row_email_address' => "Email address", 'text_email_address_note' => "Note: In order to change your email address, you will receive another confirmation email to your new address.", 'row_change_password' => "Change password", 'row_type_password_again' => "Type password again", diff --git a/public/download.php b/public/download.php index 63a34507..6856d111 100644 --- a/public/download.php +++ b/public/download.php @@ -1,7 +1,7 @@ decryptDownHash($hash, $user); if (empty($decrypted)) { do_log("downhash invalid: " . nexus_json_encode($_REQUEST)); diff --git a/public/getrss.php b/public/getrss.php index 7667f489..87d72c06 100644 --- a/public/getrss.php +++ b/public/getrss.php @@ -38,7 +38,6 @@ if ($showteam) $teams = searchbox_item_list("teams"); if ($showaudiocodec) $audiocodecs = searchbox_item_list("audiocodecs"); } stdhead($lang_getrss['head_rss_feeds']); - $query = []; $query[] = "passkey=" . $CURUSER['passkey']; if ($_SERVER['REQUEST_METHOD'] == "POST") { @@ -173,7 +172,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { $queries = implode("&", $query); if ($queries) $link .= "?".$queries; - $msg = $lang_getrss['std_use_following_url'] ."\n".$link."\n\n".$lang_getrss['std_utorrent_feed_url']."\n".$link."&linktype=dl&passkey=".$CURUSER['passkey'].$addinclbm; + $msg = $lang_getrss['std_use_following_url'] ."\n".$link."\n\n".$lang_getrss['std_utorrent_feed_url']."\n".$link."&linktype=dl".$addinclbm; stdmsg($lang_getrss['std_done'],format_comment($msg)); stdfoot(); die(); diff --git a/public/takeupload.php b/public/takeupload.php index cea0f952..17deed73 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -61,7 +61,7 @@ if ($nfofile['name'] != '') { } -$small_descr = unesc($_POST["small_descr"]); +$small_descr = unesc($_POST["small_descr"] ?? ''); $descr = unesc($_POST["descr"]); if (!$descr) @@ -397,10 +397,10 @@ if ($is_offer) { $res = sql_query("SELECT `userid` FROM `offervotes` WHERE `userid` != " . $CURUSER["id"] . " AND `offerid` = ". sqlesc($offerid)." AND `vote` = 'yeah'") or sqlerr(__FILE__, __LINE__); - while($row = mysql_fetch_assoc($res)) + while($row = mysql_fetch_assoc($res)) { $pn_msg = $lang_takeupload_target[get_user_lang($row["userid"])]['msg_offer_you_voted'].$torrent.$lang_takeupload_target[get_user_lang($row["userid"])]['msg_was_uploaded_by']. $CURUSER["username"] .$lang_takeupload_target[get_user_lang($row["userid"])]['msg_you_can_download'] ."[url=" . get_protocol_prefix() . "$BASEURL/details.php?id=$id&hit=1]".$lang_takeupload_target[get_user_lang($row["userid"])]['msg_here']."[/url]"; - + //=== use this if you DO have subject in your PMs $subject = $lang_takeupload_target[get_user_lang($row["userid"])]['msg_offer'].$torrent.$lang_takeupload_target[get_user_lang($row["userid"])]['msg_was_just_uploaded']; //=== use this if you DO NOT have subject in your PMs diff --git a/public/torrentrss.php b/public/torrentrss.php index 918b4909..1971cac5 100644 --- a/public/torrentrss.php +++ b/public/torrentrss.php @@ -11,7 +11,7 @@ if (!$passkey) { } $where = ""; if ($passkey){ - $res = sql_query("SELECT id, enabled, parked FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1"); + $res = sql_query("SELECT id, enabled, parked, passkey FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1"); $user = mysql_fetch_array($res); if (!$user) die("invalid passkey"); @@ -107,7 +107,7 @@ if ($where) $query = "SELECT torrents.id, torrents.category, torrents.name, torrents.small_descr, torrents.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, users.username AS username, categories.id AS cat_id, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where ORDER BY torrents.added DESC LIMIT $limit"; $res = sql_query($query) or die(mysql_error()); - +$torrentRep = new \App\Repositories\TorrentRepository(); $url = get_protocol_prefix().$BASEURL; $year = substr($datefounded, 0, 4); $yearfounded = ($year ? $year : 2007); @@ -152,7 +152,7 @@ while ($row = mysql_fetch_array($res)) else $author = $row['username']; $itemurl = $url."/details.php?id=".$row['id']; if ($dllink) - $itemdlurl = $url."/download.php?id=".$row['id']."&passkey=".rawurlencode($passkey); + $itemdlurl = $url."/download.php?id=".$row['id']."&downhash=".rawurlencode($torrentRep->encryptDownHash($row['id'], $user)); else $itemdlurl = $url."/download.php?id=".$row['id']; if (!empty($_GET['icat'])) $title .= "[".$row['cat_name']."]"; $title .= $row['name']; diff --git a/public/usercp.php b/public/usercp.php index b004edaf..7c67a575 100644 --- a/public/usercp.php +++ b/public/usercp.php @@ -781,7 +781,12 @@ EOD; $result = sql_query($query); if (!$result) sqlerr(__FILE__,__LINE__); - else + + if (!empty($_REQUEST['resetauthkey']) && $_REQUEST['resetauthkey'] == 1) { + //reset authkey + $torrentRep = new \App\Repositories\TorrentRepository(); + $torrentRep->resetTrackerReportAuthKeySecret($user); + } $to = "usercp.php?action=security&type=saved"; if ($changedemail == 1) $to .= "&mail=1"; @@ -799,17 +804,20 @@ EOD; if ($type == 'save') { print("
"); $resetpasskey = $_POST["resetpasskey"]; + $resetauthkey = $_POST["resetauthkey"]; $email = mysql_real_escape_string( htmlspecialchars( trim($_POST["email"]) )); $chpassword = $_POST["chpassword"]; $passagain = $_POST["passagain"]; $privacy = $_POST["privacy"]; if ($resetpasskey == 1) print(""); + if ($resetauthkey == 1) + print(""); print(""); print(""); print(""); print(""); - Print("".$lang_usercp['row_security_check']."
".$lang_usercp['text_security_check_note']."\n"); + Print("".$lang_usercp['row_security_check']."
".$lang_usercp['text_security_check_note']."\n"); submit(); print(""); stdfoot(); @@ -819,6 +827,7 @@ EOD; print("".$lang_usercp['text_saved'].($_GET["mail"] == "1" ? $lang_usercp['std_confirmation_email_sent'] : "")." ".($_GET["passkey"] == "1" ? $lang_usercp['std_passkey_reset'] : "")." ".($_GET["password"] == "1" ? $lang_usercp['std_password_changed'] : "")." ".($_GET["privacy"] == "1" ? $lang_usercp['std_privacy_level_updated'] : "")."\n"); form ("security"); tr_small($lang_usercp['row_reset_passkey'],"".$lang_usercp['checkbox_reset_my_passkey']."
".$lang_usercp['text_reset_passkey_note']."", 1); + tr_small($lang_usercp['row_reset_authkey'],"".$lang_usercp['checkbox_reset_my_authkey']."
".$lang_usercp['text_reset_authkey_note']."", 1); if ($disableemailchange != 'no' && $smtptype != 'none') //system-wide setting tr_small($lang_usercp['row_email_address'], "
".$lang_usercp['text_email_address_note']."", 1); tr_small($lang_usercp['row_change_password'], "", 1);