From 3a54de8be789c1b722deceb358fea812edd5a5a8 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Sat, 29 May 2021 18:26:04 +0800 Subject: [PATCH] add special section --- app/Repositories/SearchBoxRepository.php | 20 ++++++-- include/functions.php | 58 ++++++++++++++++++++---- include/globalfunctions.php | 1 + lang/chs/lang_details.php | 13 +++++- lang/chs/lang_edit.php | 2 +- lang/chs/lang_functions.php | 1 + lang/chs/lang_settings.php | 2 + lang/chs/lang_upload.php | 2 +- lang/chs/lang_usercp.php | 2 +- lang/cht/lang_details.php | 13 +++++- lang/cht/lang_edit.php | 2 +- lang/cht/lang_functions.php | 1 + lang/cht/lang_settings.php | 2 + lang/cht/lang_upload.php | 2 +- lang/cht/lang_usercp.php | 2 +- lang/en/lang_details.php | 12 +++++ lang/en/lang_edit.php | 2 +- lang/en/lang_functions.php | 1 + lang/en/lang_settings.php | 2 + lang/en/lang_upload.php | 2 +- lang/en/lang_usercp.php | 2 +- public/details.php | 26 ++++++++--- public/download.php | 18 +++++--- public/settings.php | 5 +- public/special.php | 3 ++ public/torrents.php | 19 +++++++- public/usercp.php | 3 +- 27 files changed, 175 insertions(+), 43 deletions(-) create mode 100644 public/special.php diff --git a/app/Repositories/SearchBoxRepository.php b/app/Repositories/SearchBoxRepository.php index 921e5c16..6dd91280 100644 --- a/app/Repositories/SearchBoxRepository.php +++ b/app/Repositories/SearchBoxRepository.php @@ -6,6 +6,7 @@ use App\Models\Icon; use App\Models\NexusModel; use App\Models\SearchBox; use App\Models\SearchBoxField; +use Illuminate\Support\Arr; class SearchBoxRepository extends BaseRepository { @@ -81,11 +82,22 @@ class SearchBoxRepository extends BaseRepository } } - public function listIcon($id) + public function listIcon(array $idArr) { - $searchBox = SearchBox::query()->findOrFail($id); - $iconIdArr = $searchBox->categories->pluck('icon_id')->unique(); - return Icon::query()->find($iconIdArr); + $searchBoxList = SearchBox::query()->with('categories')->find($idArr); + if ($searchBoxList->isEmpty()) { + return $searchBoxList; + } + $iconIdArr = []; + foreach ($searchBoxList as $value) { + foreach ($value->categories as $category) { + $iconId = $category->icon_id; + if (!isset($iconIdArr[$iconId])) { + $iconIdArr[$iconId] = $iconId; + } + } + } + return Icon::query()->find(array_keys($iconIdArr)); } diff --git a/include/functions.php b/include/functions.php index cf1f40cc..64cedb2c 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2117,8 +2117,8 @@ function menu ($selected = "home") { $selected = "forums"; }elseif (preg_match("/torrents/i", $script_name)) { $selected = "torrents"; - }elseif (preg_match("/music/i", $script_name)) { - $selected = "music"; + }elseif (preg_match("/special/i", $script_name)) { + $selected = "special"; }elseif (preg_match("/offers/i", $script_name) OR preg_match("/offcomment/i", $script_name)) { $selected = "offers"; }elseif (preg_match("/requests/i", $script_name)) { @@ -2149,7 +2149,7 @@ function menu ($selected = "home") { print ("".$lang_functions['text_forums'].""); print ("".$lang_functions['text_torrents'].""); if ($enablespecial == 'yes') - print ("".$lang_functions['text_music'].""); + print ("".$lang_functions['text_special'].""); if ($enableoffer == 'yes') print ("".$lang_functions['text_offers'].""); if ($enablerequest == 'yes') @@ -2225,9 +2225,14 @@ function get_cat_folder($cat = 101) * use setting, not user's caticon, that filed make no sense! */ $caticonrow = get_category_icon_row($catrow['icon_id'] ?: 1); - $catPath[$cat] = "category/".$catmode."/".$caticonrow['folder'] . ($caticonrow['multilang'] == 'yes' ? $CURLANGDIR."/" : ""); + $path = sprintf('category/%s/%s', trim($catmode, '/'), trim($caticonrow['folder'], '/')); + if ($caticonrow['multilang'] == 'yes') { + $path .= '/' . trim($CURLANGDIR, '/'); + } + do_log("cat: $cat, path: $path"); + $catPath[$cat] = $path; } - return trim($catPath[$cat] ?? '', '/'); + return $catPath[$cat] ?? ''; } function get_style_highlight() @@ -2254,7 +2259,6 @@ function stdhead($title = "", $msgalert = true, $script = "", $place = "") global $tstart; global $Cache; global $Advertisement; - global $browsecatmode; $Cache->setLanguage($CURLANGDIR); @@ -2325,13 +2329,15 @@ $cssupdatedate=($cssupdatedate ? "?".htmlspecialchars($cssupdatedate) : ""); if ($CURUSER){ // $caticonrow = get_category_icon_row($CURUSER['caticon']); // if($caticonrow['cssfile']){ + $requireSearchBoxIdAr = list_require_search_box_id(); + if (!empty($requireSearchBoxIdAr)) { + $icons = (new \App\Repositories\SearchBoxRepository())->listIcon($requireSearchBoxIdAr); + foreach ($icons as $icon) { - $icons = (new \App\Repositories\SearchBoxRepository())->listIcon($browsecatmode); - foreach ($icons as $icon) { ?> @@ -4953,4 +4959,38 @@ function get_share_ratio($uploaded, $downloaded) return $ratio; } +function list_require_search_box_id() +{ + $setting = get_setting('main'); + $maps = [ + 'torrents' => [$setting['browsecat']], + 'special' => [$setting['specialcat']], + 'usercp' => [$setting['browsecat'], $setting['specialcat']], + 'getrss' => [$setting['browsecat'], $setting['specialcat']], + ]; + return $maps[CURRENT_SCRIPT] ?? []; +} + +function can_access_torrent($torrent) +{ + global $specialcatmode; + if (get_setting('main.spsct') != 'yes') { + return true; + } + if (is_array($torrent) && isset($torrent['search_box_id'])) { + $searchBoxId = $torrent['search_box_id']; + } elseif (is_numeric($torrent)) { + $searchBoxId = \App\Models\Torrent::query()->findOrFail(intval($torrent), ['id', 'category'])->basic_category->mode; + } else { + throw new \InvalidArgumentException("Unsupported argument: " . json_encode($torrent)); + } + if ($searchBoxId != $specialcatmode) { + return true; + } + if (get_user_class() >= get_setting('authority.view_special_torrent')) { + return true; + } + return false; +} + ?> diff --git a/include/globalfunctions.php b/include/globalfunctions.php index f07cd5ef..e5cd3d42 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -64,6 +64,7 @@ function getip() { function sql_query($query) { + $query = preg_replace("/[\n\r\t]+/", " ", $query); $begin = microtime(true); global $query_name; $result = mysql_query($query); diff --git a/lang/chs/lang_details.php b/lang/chs/lang_details.php index 8a0b7274..99e27ae4 100644 --- a/lang/chs/lang_details.php +++ b/lang/chs/lang_details.php @@ -39,7 +39,7 @@ $lang_details = array 'text_title' => " 片名: ", 'text_title_chinese' => "中文片名: ", 'text_also_known_as' => " 别名: ", - 'text_year' => " 年代: ", + 'text_year' => " 年代: ", 'text_runtime' => " 片长: ", 'text_mins' => "分钟", 'text_votes' => " 票数: ", @@ -219,6 +219,17 @@ $lang_details = array 'row_uploader_bandwidth' => "发布者带宽", 'text_and_more' => "……(这里只显示最新记录。共", 'text_users_in_total' => "个用户表示了感谢)", + 'torrent_dl_url' => "种子链接", + 'torrent_dl_url_notice' => "可在BT客户端使用,请保护好Passkey,谨防泄露。", + 'span_description_have_given' =>'你已经赠送魔力值', + 'text_no_magic_added' => "暂无魔力值奖励", + 'magic_value_number' => "已赠送Number点魔力值", + 'magic_value_award' => "魔力值奖励", + 'magic_newest_record' =>'这里只显示最新记录。 ', + 'magic_sum_user_give_number' => '共Number个会员奖励了魔力值', + 'magic_show_all_description' => '查看详单', + 'magic_haveGotBonus' => '目前发布人已获得Number个魔力值奖励。', + 'magic_have_no_enough_bonus_value' => '需要更多魔力值。', ); ?> diff --git a/lang/chs/lang_edit.php b/lang/chs/lang_edit.php index f1592481..e11a4e8f 100644 --- a/lang/chs/lang_edit.php +++ b/lang/chs/lang_edit.php @@ -60,7 +60,7 @@ $lang_edit = array 'radio_other' => "其他", 'submit_delete_it' => "删除", 'text_move_to_browse' => "类型变为种子区的 ", - 'text_move_to_special' => "类型变为音乐区的 ", + 'text_move_to_special' => "类型变为特别区的 ", 'text_medium' => "媒介:", 'row_pick' => "挑选", 'row_check' => "勾选", diff --git a/lang/chs/lang_functions.php b/lang/chs/lang_functions.php index 9a8559c6..e00cd513 100644 --- a/lang/chs/lang_functions.php +++ b/lang/chs/lang_functions.php @@ -213,6 +213,7 @@ $lang_functions = array 'text_ip_range' => "IP范围", 'text_min' => "分钟", 'text_music' => " 音  乐 ", + 'text_special' => " 特  别 ", 'title_reply_with_quote' => "引用", 'title_add_reply' => "回复", 'title_delete' => "删除", diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php index 653bcd17..3afab069 100644 --- a/lang/chs/lang_settings.php +++ b/lang/chs/lang_settings.php @@ -141,6 +141,8 @@ $lang_settings = array 'text_upload_torrent_note' => "。发布种子到种子区。", 'row_upload_special_torrent' => "发布种子至特别区", 'text_upload_special_torrent_note' => "。发布种子到特别区。", + 'row_view_special_torrent' => '查看特别区种子', + 'text_view_special_torrent_note' => '查看特别区种子。', 'row_move_torrent' => "移动种子", 'text_move_torrent_note' => "。将种子在各区间移动。", 'row_chronicle_management' => "管理史册", diff --git a/lang/chs/lang_upload.php b/lang/chs/lang_upload.php index b47883b1..0532d65a 100644 --- a/lang/chs/lang_upload.php +++ b/lang/chs/lang_upload.php @@ -31,7 +31,7 @@ $lang_upload = array 'text_read_rules' => "我已经阅读过规则", 'submit_upload' => "发布", 'text_to_browse_section' => "发布至种子区 ", - 'text_to_special_section' => "或音乐区 ", + 'text_to_special_section' => "或特别区 ", 'text_type_note' => "   只选两者之一", 'text_medium' => "媒介:", 'text_team' => "制作组:", diff --git a/lang/chs/lang_usercp.php b/lang/chs/lang_usercp.php index c04651d1..a7ab7458 100644 --- a/lang/chs/lang_usercp.php +++ b/lang/chs/lang_usercp.php @@ -204,7 +204,7 @@ $lang_usercp = array 'text_games_and_appz' => "游戏 & 程序:", 'text_others' => "其它:", 'text_at_browse_page' => "种子区", - 'text_at_special_page' => "音乐区", + 'text_at_special_page' => "特别区", 'text_additional_selection' => "补充设定", 'text_stylesheet_note' => "更多界面风格?想自己设计?", 'text_stylesheet_link' => "点击这里", diff --git a/lang/cht/lang_details.php b/lang/cht/lang_details.php index bee50289..ba2d203b 100644 --- a/lang/cht/lang_details.php +++ b/lang/cht/lang_details.php @@ -39,7 +39,7 @@ $lang_details = array 'text_title' => " 片名: ", 'text_title_chinese' => "中文片名: ", 'text_also_known_as' => " 代號: ", - 'text_year' => " 年代: ", + 'text_year' => " 年代: ", 'text_runtime' => " 片長: ", 'text_mins' => "分鐘", 'text_votes' => " 票數: ", @@ -218,6 +218,17 @@ $lang_details = array 'row_uploader_bandwidth' => "發布者頻寬", 'text_and_more' => "……(這裏只顯示最新記錄。共", 'text_users_in_total' => "個用戶表示了感謝)", + 'torrent_dl_url' => "種子連結", + 'torrent_dl_url_notice' => "可在BT用戶端使用,請保護好Passkey,謹防洩露。", + 'span_description_have_given' =>'你已經贈送魔力值', + 'text_no_magic_added' => "暫無魔力值獎勵", + 'magic_value_number' => "已贈送Number點魔力值", + 'magic_value_award' => "魔力值獎勵", + 'magic_newest_record' =>'這裏只顯示最新記錄。 ', + 'magic_sum_user_give_number' => '共Number個會員獎勵了魔力值', + 'magic_show_all_description' => '查看詳單', + 'magic_haveGotBonus' => '目前發佈人已獲得Number個魔力值獎勵。', + 'magic_have_no_enough_bonus_value' => '需要更多魔力值。', ); ?> diff --git a/lang/cht/lang_edit.php b/lang/cht/lang_edit.php index 5075aa04..7b794f24 100644 --- a/lang/cht/lang_edit.php +++ b/lang/cht/lang_edit.php @@ -60,7 +60,7 @@ $lang_edit = array 'radio_other' => "其他", 'submit_delete_it' => "刪除", 'text_move_to_browse' => "類型變為種子區的 ", - 'text_move_to_special' => "類型變為音樂區的 ", + 'text_move_to_special' => "類型變為特別區的 ", 'text_medium' => "媒介:", 'row_pick' => "挑選", 'row_check' => "勾選", diff --git a/lang/cht/lang_functions.php b/lang/cht/lang_functions.php index 5b0e77d9..24376e04 100644 --- a/lang/cht/lang_functions.php +++ b/lang/cht/lang_functions.php @@ -212,6 +212,7 @@ $lang_functions = array 'text_ip_range' => "IP範圍", 'text_min' => "分鐘", 'text_music' => " 音  樂 ", + 'text_special' => " 特  别 ", 'title_reply_with_quote' => "引用", 'title_add_reply' => "回復", 'title_delete' => "刪除", diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php index d6b5e527..7b61f46e 100644 --- a/lang/cht/lang_settings.php +++ b/lang/cht/lang_settings.php @@ -141,6 +141,8 @@ $lang_settings = array 'text_upload_torrent_note' => "。發布種子到種子區。", 'row_upload_special_torrent' => "發布種子至特別區", 'text_upload_special_torrent_note' => "。發布種子到特別區。", + 'row_view_special_torrent' => '查看特別區種子', + 'text_view_special_torrent_note' => '查看特別區種子。', 'row_move_torrent' => "移動種子", 'text_move_torrent_note' => "。將種子在各區間移動。", 'row_chronicle_management' => "管理史冊", diff --git a/lang/cht/lang_upload.php b/lang/cht/lang_upload.php index 691a522b..40efdabd 100644 --- a/lang/cht/lang_upload.php +++ b/lang/cht/lang_upload.php @@ -31,7 +31,7 @@ $lang_upload = array 'text_read_rules' => "我已經閱讀過規則", 'submit_upload' => "發布", 'text_to_browse_section' => "發布至種子區 ", - 'text_to_special_section' => "或音樂區 ", + 'text_to_special_section' => "或特別區 ", 'text_type_note' => "   只選兩者之一", 'text_medium' => "媒介:", 'text_team' => "製作組:", diff --git a/lang/cht/lang_usercp.php b/lang/cht/lang_usercp.php index 125c02a7..28f30b6a 100644 --- a/lang/cht/lang_usercp.php +++ b/lang/cht/lang_usercp.php @@ -204,7 +204,7 @@ $lang_usercp = array 'text_games_and_appz' => "游戲 & 程序:", 'text_others' => "其它:", 'text_at_browse_page' => "種子區", - 'text_at_special_page' => "音樂區", + 'text_at_special_page' => "特别區", 'text_additional_selection' => "補充設定", 'text_stylesheet_note' => "更多界面風格?想自己設計?", 'text_stylesheet_link' => "點擊這裏", diff --git a/lang/en/lang_details.php b/lang/en/lang_details.php index 51611c25..5c6fcdf6 100644 --- a/lang/en/lang_details.php +++ b/lang/en/lang_details.php @@ -218,6 +218,18 @@ $lang_details = array 'row_uploader_bandwidth' => "Uploader
Bandwidth", 'text_and_more' => " and more (thanks from ", 'text_users_in_total' => " users in total)", + 'torrent_dl_url' => "Torrent URL", + 'torrent_dl_url_notice' => "You can copy it to your BT Client. Take care since it contains your passkey.", + 'span_description_have_given' =>'You have given the magic of the value', + 'text_no_magic_added' => "No magic value of the award", + 'magic_value_number' => "Number Magic point value has been presented", + 'magic_value_award' => "Magic value of awards", + 'magic_newest_record' =>'Here only the latest record. ', + 'magic_sum_user_give_number' => 'Number Member gave the magic award totally', + 'magic_show_all_description' => 'View details of a single', + 'magic_haveGotBonus' => 'Publisher now has been got Number Bonus of award.', + 'magic_have_no_enough_bonus_value' => 'more points needed', + ); ?> diff --git a/lang/en/lang_edit.php b/lang/en/lang_edit.php index 980be843..44a14267 100644 --- a/lang/en/lang_edit.php +++ b/lang/en/lang_edit.php @@ -60,7 +60,7 @@ $lang_edit = array 'radio_other' => "Other", 'submit_delete_it' => "Delete it!", 'text_move_to_browse' => "Move to Torrents section as ", - 'text_move_to_special' => "Move to Music section as ", + 'text_move_to_special' => "Move to Special section as ", 'text_medium' => "Medium:", 'row_pick' => "Pick", 'row_check' => "Check", diff --git a/lang/en/lang_functions.php b/lang/en/lang_functions.php index 1a60a47a..1e46f342 100644 --- a/lang/en/lang_functions.php +++ b/lang/en/lang_functions.php @@ -212,6 +212,7 @@ $lang_functions = array 'text_ip_range' => "IP Range", 'text_min' => " min", 'text_music' => "Music", + 'text_special' => "Special", 'title_reply_with_quote' => "Quote", 'title_add_reply' => "Add Reply", 'title_delete' => "Delete", diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php index 0b42b7fb..f444b5cc 100644 --- a/lang/en/lang_settings.php +++ b/lang/en/lang_settings.php @@ -141,6 +141,8 @@ $lang_settings = array 'text_upload_torrent_note' => ". Upload torrents to Torrents section", 'row_upload_special_torrent' => "Upload Special Torrent", 'text_upload_special_torrent_note' => ". Upload torrents to Special section", + 'row_view_special_torrent' => 'View Special Torrent', + 'text_view_special_torrent_note' => 'View torrents in Special section', 'row_move_torrent' => "Move Torrent", 'text_move_torrent_note' => ". Move torrents between sections", 'row_chronicle_management' => "Chronicle Management", diff --git a/lang/en/lang_upload.php b/lang/en/lang_upload.php index 15a2915e..d0dc1bef 100644 --- a/lang/en/lang_upload.php +++ b/lang/en/lang_upload.php @@ -31,7 +31,7 @@ $lang_upload = array 'text_read_rules' => "I read the rules before this uploading.", 'submit_upload' => "Upload", 'text_to_browse_section' => "Upload to Torrents section ", - 'text_to_special_section' => "or Music section ", + 'text_to_special_section' => "or Special section ", 'text_type_note' => "   Choose only either of the two", 'text_medium' => "Medium:", 'text_team' => "Group:", diff --git a/lang/en/lang_usercp.php b/lang/en/lang_usercp.php index f3f7fb7b..67a1b4af 100644 --- a/lang/en/lang_usercp.php +++ b/lang/en/lang_usercp.php @@ -204,7 +204,7 @@ $lang_usercp = array 'text_games_and_appz' => "Games & Appz:", 'text_others' => "Others:", 'text_at_browse_page' => "Torrents section", - 'text_at_special_page' => "Music section", + 'text_at_special_page' => "Special section", 'text_additional_selection' => "Additional selections", 'text_stylesheet_note' => "More stylesheets? Wanna design your own? ", 'text_stylesheet_link' => "CLICK HERE", diff --git a/public/details.php b/public/details.php index 672f4962..075001b6 100644 --- a/public/details.php +++ b/public/details.php @@ -11,7 +11,17 @@ int_check($id); if (!isset($id) || !$id) die(); -$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info, categories.name AS cat_name, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN sources ON torrents.source = sources.id LEFT JOIN media ON torrents.medium = media.id LEFT JOIN codecs ON torrents.codec = codecs.id LEFT JOIN standards ON torrents.standard = standards.id LEFT JOIN processings ON torrents.processing = processings.id LEFT JOIN teams ON torrents.team = teams.id LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id WHERE torrents.id = $id LIMIT 1") +$res = sql_query("SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info, + categories.name AS cat_name, categories.mode as search_box_id, sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name +FROM torrents LEFT JOIN categories ON torrents.category = categories.id + LEFT JOIN sources ON torrents.source = sources.id + LEFT JOIN media ON torrents.medium = media.id + LEFT JOIN codecs ON torrents.codec = codecs.id + LEFT JOIN standards ON torrents.standard = standards.id + LEFT JOIN processings ON torrents.processing = processings.id + LEFT JOIN teams ON torrents.team = teams.id + LEFT JOIN audiocodecs ON torrents.audiocodec = audiocodecs.id +WHERE torrents.id = $id LIMIT 1") or sqlerr(); $row = mysql_fetch_array($res); if (get_user_class() >= $torrentmanage_class || $CURUSER["id"] == $row["owner"]) @@ -20,11 +30,14 @@ else $owned = 0; $settingMain = get_setting('main'); -if (!$row) - stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']); -elseif ($row['banned'] == 'yes' && get_user_class() < $seebanned_class) - permissiondenied(); -else { +if (!$row) { + stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']); +} elseif ( + ($row['banned'] == 'yes' && get_user_class() < $seebanned_class) + || !can_access_torrent($row) +) { + permissiondenied(); +} else { $torrentUpdate = []; if (!empty($_GET["hit"])) { $torrentUpdate[] = 'views = views + 1'; @@ -114,6 +127,7 @@ else { else $download = ""; tr($lang_details['row_action'], $download. ($owned == 1 ? "<$editlink>\"edit\" ".$lang_details['text_edit_torrent'] . " | " : ""). (get_user_class() >= $askreseed_class && $row['seeders'] == 0 ? "\"reseed\" ".$lang_details['text_ask_for_reseed'] ." | " : "") . "\"report\" ".$lang_details['text_report_torrent']."", 1); + tr($lang_details['torrent_dl_url'],sprintf('%s/download.php?id=%u&passkey=%s',$lang_details['torrent_dl_url_notice'], getSchemeAndHttpHost(),$id,$CURUSER['passkey']), 1); // ---------------- start subtitle block -------------------// $r = sql_query("SELECT subs.*, language.flagpic, language.lang_name FROM subs LEFT JOIN language ON subs.lang_id=language.id WHERE torrent_id = " . sqlesc($row["id"]). " ORDER BY subs.lang_id ASC") or sqlerr(__FILE__, __LINE__); diff --git a/public/download.php b/public/download.php index f6deb35d..396ac5f6 100644 --- a/public/download.php +++ b/public/download.php @@ -70,15 +70,19 @@ else{ -$res = sql_query("SELECT name, filename, save_as, size, owner,banned FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__); +$res = sql_query("SELECT torrents.name, torrents.filename, torrents.save_as, torrents.size, torrents.owner, torrents.banned, categories.mode as search_box_id FROM torrents left join categories on torrents.category = categories.id WHERE torrents.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__); $row = mysql_fetch_assoc($res); $fn = ROOT_PATH . "$torrent_dir/$id.torrent"; -if ($CURUSER['downloadpos']=="no") - permissiondenied(); -if (!$row || !is_file($fn) || !is_readable($fn)) - httperr(); -if ($row['banned'] == 'yes' && get_user_class() < $seebanned_class) - permissiondenied(); +if ($CURUSER['downloadpos']=="no") { + permissiondenied(); +} +if (!$row || !is_file($fn) || !is_readable($fn)) { + httperr(); +} +if (($row['banned'] == 'yes' && get_user_class() < $seebanned_class) || !can_access_torrent($row)) { + permissiondenied(); +} + sql_query("UPDATE torrents SET hits = hits + 1 WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__); require_once "include/benc.php"; diff --git a/public/settings.php b/public/settings.php index c8c13e26..6acfb13f 100644 --- a/public/settings.php +++ b/public/settings.php @@ -187,7 +187,7 @@ elseif ($action == 'savesettings_security') // save security elseif ($action == 'savesettings_authority') // save user authority { stdhead($lang_settings['head_save_authority_settings']); - $validConfig = array('defaultclass','staffmem','newsmanage','newfunitem','funmanage','sbmanage','pollmanage','applylink', 'linkmanage', 'postmanage','commanage','forummanage','viewuserlist','torrentmanage','torrentsticky', 'torrentonpromotion', 'askreseed', 'viewnfo', 'torrentstructure','sendinvite','viewhistory','topten','log','confilog','userprofile', 'torrenthistory','prfmanage', 'cruprfmanage','uploadsub','delownsub','submanage','updateextinfo', 'viewanonymous','beanonymous','addoffer','offermanage', 'upload','uploadspecial','movetorrent','chrmanage','viewinvite', 'buyinvite','seebanned','againstoffer','userbar'); + $validConfig = array('defaultclass','staffmem','newsmanage','newfunitem','funmanage','sbmanage','pollmanage','applylink', 'linkmanage', 'postmanage','commanage','forummanage','viewuserlist','torrentmanage','torrentsticky', 'torrentonpromotion', 'askreseed', 'viewnfo', 'torrentstructure','sendinvite','viewhistory','topten','log','confilog','userprofile', 'torrenthistory','prfmanage', 'cruprfmanage','uploadsub','delownsub','submanage','updateextinfo', 'viewanonymous','beanonymous','addoffer','offermanage', 'upload','uploadspecial','view_special_torrent','movetorrent','chrmanage','viewinvite', 'buyinvite','seebanned','againstoffer','userbar'); GetVar($validConfig); $AUTHORITY = []; foreach($validConfig as $config) { @@ -404,9 +404,8 @@ elseif ($action == 'authoritysettings') //Authority settings tr($lang_settings['row_add_offer'], $lang_settings['text_minimum_class'].classlist('addoffer',$maxclass,$AUTHORITY['addoffer']).$lang_settings['text_default'].get_user_class_name(UC_PEASANT,false,true,true).$lang_settings['text_add_offer_note'], 1); tr($lang_settings['row_offer_management'], $lang_settings['text_minimum_class'].classlist('offermanage',$maxclass,$AUTHORITY['offermanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_offer_management_note'],1); tr($lang_settings['row_upload_torrent'], $lang_settings['text_minimum_class'].classlist('upload',$maxclass,$AUTHORITY['upload']).$lang_settings['text_default'].get_user_class_name(UC_POWER_USER,false,true,true).$lang_settings['text_upload_torrent_note'], 1); -// if (THISTRACKER == "HDStar") tr($lang_settings['row_upload_special_torrent'], $lang_settings['text_minimum_class'].classlist('uploadspecial',$maxclass,$AUTHORITY['uploadspecial']).$lang_settings['text_default'].get_user_class_name(UC_UPLOADER,false,true,true).$lang_settings['text_upload_special_torrent_note'],1); -// if (THISTRACKER == "HDStar") + tr($lang_settings['row_view_special_torrent'], $lang_settings['text_minimum_class'].classlist('view_special_torrent',$maxclass,$AUTHORITY['view_special_torrent']).$lang_settings['text_default'].get_user_class_name(UC_CRAZY_USER,false,true,true).$lang_settings['text_view_special_torrent_note'],1); tr($lang_settings['row_move_torrent'], $lang_settings['text_minimum_class'].classlist('movetorrent',$maxclass,$AUTHORITY['movetorrent']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_move_torrent_note'],1); tr($lang_settings['row_chronicle_management'], $lang_settings['text_minimum_class'].classlist('chrmanage',$maxclass,$AUTHORITY['chrmanage']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_chronicle_management_note'],1); tr($lang_settings['row_view_invite'], $lang_settings['text_minimum_class'].classlist('viewinvite',$maxclass,$AUTHORITY['viewinvite']).$lang_settings['text_default'].get_user_class_name(UC_MODERATOR,false,true,true).$lang_settings['text_view_invite_note'],1); diff --git a/public/special.php b/public/special.php new file mode 100644 index 00000000..a52b3fa2 --- /dev/null +++ b/public/special.php @@ -0,0 +1,3 @@ +".($spenablecatrow ? "".$spcatrow[$rownum]."" : "").""; } - $categories .= "\""\n"; +// $categories .= "\""\n"; + $categories .= "" . return_category_image($cat['id'], "special.php?allsec=1&") . "\n"; $i++; } $categories .= "";