From d506a4ebfbe6c39f6c593887e7be450203bd3085 Mon Sep 17 00:00:00 2001 From: xiaomlove <353856593@qq.com> Date: Sat, 20 Feb 2021 18:22:19 +0800 Subject: [PATCH] add requests and tags --- include/functions.php | 104 +++++++- lang/chs/lang_functions.php | 9 +- lang/chs/lang_viewrequests.php | 21 ++ lang/cht/lang_functions.php | 7 +- lang/cht/lang_viewrequests.php | 5 + lang/en/lang_functions.php | 7 +- lang/en/lang_viewrequests.php | 5 + public/edit.php | 1 + public/takeedit.php | 2 + public/takeupload.php | 4 +- public/torrents.php | 4 +- public/upload.php | 1 + public/viewrequests.php | 465 +++++++++++++++++++++++++++++++++ 13 files changed, 613 insertions(+), 22 deletions(-) create mode 100644 lang/chs/lang_viewrequests.php create mode 100644 lang/cht/lang_viewrequests.php create mode 100644 lang/en/lang_viewrequests.php create mode 100644 public/viewrequests.php diff --git a/include/functions.php b/include/functions.php index 1ddd7f2a..a2bf49b5 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2108,7 +2108,7 @@ function menu ($selected = "home") { global $enableoffer, $enablespecial, $enableextforum, $extforumurl, $where_tweak; global $USERUPDATESET; //no this option in config.php - $enablerequest = 'no'; + $enablerequest = 'yes'; $script_name = $_SERVER["SCRIPT_FILENAME"]; if (preg_match("/index/i", $script_name)) { $selected = "home"; @@ -2120,6 +2120,8 @@ function menu ($selected = "home") { $selected = "music"; }elseif (preg_match("/offers/i", $script_name) OR preg_match("/offcomment/i", $script_name)) { $selected = "offers"; + }elseif (preg_match("/requests/i", $script_name)) { + $selected = "requests"; }elseif (preg_match("/upload/i", $script_name)) { $selected = "upload"; }elseif (preg_match("/subtitles/i", $script_name)) { @@ -2153,7 +2155,7 @@ function menu ($selected = "home") { print ("".$lang_functions['text_request'].""); print ("".$lang_functions['text_upload'].""); print ("".$lang_functions['text_subtitles'].""); - print ("".$lang_functions['text_user_cp'].""); +// print ("".$lang_functions['text_user_cp'].""); print ("".$lang_functions['text_top_ten'].""); print ("".$lang_functions['text_log'].""); print ("".$lang_functions['text_rules'].""); @@ -2428,12 +2430,24 @@ else { "; + + + //sql_query("UPDATE requests SET message = '".$message."' WHERE id = ".$_POST["id"])or sqlerr(__FILE__, __LINE__); + + //sql_query("INSERT reqcommen (user , added ,text ,reqid) VALUES ( '".$CURUSER["id"]."' , ".sqlesc(date("Y-m-d H:i:s"))." , ".sqlesc($_POST["message"])." , '".$_POST["id"]."' )"); + sql_query("INSERT INTO comments (user, request, added, text, ori_text) VALUES (" . $CURUSER["id"] . ",{$_POST['id']}, '" . date("Y-m-d H:i:s") . "', " . sqlesc($_POST["message"]) . "," . sqlesc($_POST["message"]) . ")"); + + if ($CURUSER["id"] <> $arr['userid']) sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, " . $arr['userid'] . ", '你的求种请求收到新回复', " . sqlesc(" [url=viewrequests.php?action=view&id={$_POST['id']}] " . $arr['request'] . "[/url].") . ", " . sqlesc(date("Y-m-d H:i:s")) . ")") or sqlerr(__FILE__, __LINE__); + + $ruserid = 0 + $_POST["ruserid"]; + if ($ruserid <> $CURUSER["id"] && $ruserid <> $arr['userid']) sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, " . $ruserid . ", '你的求种评论收到新回复', " . sqlesc(" [url=viewrequests.php?action=view&id={$_POST['id']}] " . $arr['request'] . "[/url].") . ", " . sqlesc(date("Y-m-d H:i:s")) . ")") or sqlerr(__FILE__, __LINE__); + + header("Location: viewrequests.php?action=view&id=" . $_POST['id']); + } + } + + +} +die; + + +?> \ No newline at end of file
- - +
, []= UC_MODERATOR) { ?> [] = UC_SYSOP) { ?> [] [] []: []:
- - Torrents seeding Torrents leeching  
+ + , + [] + [] + = UC_MODERATOR) { ?> [] + = UC_SYSOP) { ?> [] + [] + []: + []:
+ + + + Torrents seeding Torrents leeching   + +
+

- = $staffmem_class){ $totalreports = $Cache->get_value('staff_report_count'); @@ -3177,9 +3191,8 @@ while ($row = mysql_fetch_assoc($res)) if ($row['pos_state'] == 'sticky' && $CURUSER['appendsticky'] == 'yes') $stickyicon = "\"Sticky\" "; else $stickyicon = ""; - - print("
".$stickyicon."".htmlspecialchars($dispname).""); - $sp_torrent = get_torrent_promotion_append($row['sp_state'],"",true,$row["added"], $row['promotion_time_type'], $row['promotion_until']); + $sp_torrent = get_torrent_promotion_append($row['sp_state'],"",true,$row["added"], $row['promotion_time_type'], $row['promotion_until']); + print(""); if ($enablePtGen && !empty($row['pt_gen'])) { echo $ptGen->renderTorrentsPageAverageRating(json_decode($row['pt_gen'], true)); @@ -4421,6 +4437,68 @@ function return_category_image($categoryid, $link="") /******************************************** bellow functioons avaliable since v1.6 ***********************************************************/ +function get_requestcount() +{ + global $CURUSER, $Cache; + //return; + $CURUSERID = 0 + $CURUSER['id']; + if (!$count = $Cache->get_value($CURUSERID . '_get_requestcount')) { + $row = @mysql_fetch_array(sql_query(" SELECT count(*) FROM requests LEFT JOIN resreq ON reqid=requests.id WHERE reqid>0 and finish = 'no' and userid= " . $CURUSERID)); + $count = ($row[0] ? " style='background: none red;' " : " style='' "); + $Cache->cache_value($CURUSERID . '_get_requestcount', $count, 120); + } + return $count; +} + +function torrentTags($tags = 0, $type = 'checkbox') +{ + global $lang_functions; + $tagsOptions = [ + [ + 'text' => $lang_functions['text_tag_no_release_to_any_other'], + 'color' => '#D74D4D', + ], + [ + 'text' => $lang_functions['text_tag_first_release'], + 'color' => '#8F77B5', + ], + [ + 'text' => $lang_functions['text_tag_official'], + 'color' => '#2F7DB8', + ], + [ + 'text' => $lang_functions['text_tag_diy'], + 'color' => '#787878', + ], + [ + 'text' => $lang_functions['text_tag_mother_language'], + 'color' => '#FFAA32', + ], + [ + 'text' => $lang_functions['text_tag_mother_language_subtitle'], + 'color' => '#91B493', + ], + ]; + $html = ''; + foreach ($tagsOptions as $key => $value) { + $currentValue = pow(2, $key); + if ($type == 'checkbox') { + $checked = ''; + if ($currentValue & $tags) { + $checked = 'checked'; + } + $html .= sprintf( + '', + $currentValue, $checked, $value['text'] + ); + } + if ($type == 'span' && ($currentValue & $tags)) { + $html .= "{$value['text']} "; + } + } + return $html; +} + function saveSetting($prefix, $nameAndValue) { $prefix = strtolower($prefix); diff --git a/lang/chs/lang_functions.php b/lang/chs/lang_functions.php index 004d1f63..ae15530c 100644 --- a/lang/chs/lang_functions.php +++ b/lang/chs/lang_functions.php @@ -233,9 +233,7 @@ $lang_functions = array 'col_to_make_a' => "得到...", 'text_year' => "年", 'text_month' => "月", - 'text_day' => "天", 'text_hour' => "时", - 'text_min' => "分", 'select_color' => "颜色", 'select_font' => "字体", 'select_size' => "字号", @@ -251,7 +249,6 @@ $lang_functions = array 'text_reply' => "回复", 'submit_submit' => "提交", 'submit_preview' => "预览", - 'text_tags' => "标签", 'row_subject' => "主题", 'row_body' => "正文", 'text_peasant' => "Peasant", @@ -298,6 +295,12 @@ $lang_functions = array 'imdb_cache_dir_is_not_writeable' => 'imdb 缓存目录不可写', 'imdb_photo_dir_can_not_create' => 'imdb 图片目录无法创建', 'imdb_photo_dir_is_not_writeable' => 'imdb 图片目录不可写', + 'text_tag_no_release_to_any_other' => '禁转', + 'text_tag_first_release' => '首发', + 'text_tag_official' => '官方', + 'text_tag_diy' => '自制', + 'text_tag_mother_language' => '国语', + 'text_tag_mother_language_subtitle' => '中字', ); ?> diff --git a/lang/chs/lang_viewrequests.php b/lang/chs/lang_viewrequests.php new file mode 100644 index 00000000..8248c85d --- /dev/null +++ b/lang/chs/lang_viewrequests.php @@ -0,0 +1,21 @@ + '求种区', + 'add_request' => '添加', + 'view_request_all' => '查看所有', + 'view_request_resolved' => '查看已解决', + 'view_request_unresolved' => '查看未解决', + 'view_request_resolving' => '查看解决中', + 'view_request_my' => '查看我发布的', + 'thead_name' => '名称', + 'thead_price_newest' => '最新出价', + 'thead_price_original' => '原始出价', + 'thead_comment_count' => '评论数', + 'thead_on_request_count' => '应求数', + 'thead_request_user' => '求种者', + 'thead_created_at' => '时间', + 'thead_status' => '状态', + 'request_status_resolved' => '求种成功', + 'request_status_resolving' => '求种中', + 'action_search' => '搜索', +]; \ No newline at end of file diff --git a/lang/cht/lang_functions.php b/lang/cht/lang_functions.php index 97ef88d8..9c3204f0 100644 --- a/lang/cht/lang_functions.php +++ b/lang/cht/lang_functions.php @@ -251,7 +251,6 @@ $lang_functions = array 'text_reply' => "回復", 'submit_submit' => "提交", 'submit_preview' => "預覽", - 'text_tags' => "標籤", 'row_subject' => "主題", 'row_body' => "正文", 'text_peasant' => "Peasant", @@ -297,6 +296,12 @@ $lang_functions = array 'imdb_cache_dir_is_not_writeable' => 'imdb 緩存目錄不可寫', 'imdb_photo_dir_can_not_create' => 'imdb 圖片目錄無法創建', 'imdb_photo_dir_is_not_writeable' => 'imdb 圖片目錄不可寫', + 'text_tag_no_release_to_any_other' => '禁轉', + 'text_tag_first_release' => '首發', + 'text_tag_official' => '官方', + 'text_tag_diy' => '自制', + 'text_tag_mother_language' => '國語', + 'text_tag_mother_language_subtitle' => '中字', ); ?> diff --git a/lang/cht/lang_viewrequests.php b/lang/cht/lang_viewrequests.php new file mode 100644 index 00000000..6bd5fdaa --- /dev/null +++ b/lang/cht/lang_viewrequests.php @@ -0,0 +1,5 @@ + 'Requests', + '' +]; \ No newline at end of file diff --git a/lang/en/lang_functions.php b/lang/en/lang_functions.php index 298edd88..a56026b6 100644 --- a/lang/en/lang_functions.php +++ b/lang/en/lang_functions.php @@ -251,7 +251,6 @@ $lang_functions = array 'text_reply' => "Reply", 'submit_submit' => "Submit", 'submit_preview' => "Preview", - 'text_tags' => "Tags", 'row_subject' => "Subject", 'row_body' => "Body", 'text_peasant' => "Peasant", @@ -298,6 +297,12 @@ $lang_functions = array 'imdb_cache_dir_is_not_writeable' => 'imdb cache dir is not writeable', 'imdb_photo_dir_can_not_create' => 'imdb photo dir can not create', 'imdb_photo_dir_is_not_writeable' => 'imdb photo dir is not writeable', + 'text_tag_no_release_to_any_other' => 'No release to any other', + 'text_tag_first_release' => 'First release', + 'text_tag_official' => 'Official', + 'text_tag_diy' => 'DIY', + 'text_tag_mother_language' => 'Mother language', + 'text_tag_mother_language_subtitle' => 'Mother language subtitle', ); ?> diff --git a/lang/en/lang_viewrequests.php b/lang/en/lang_viewrequests.php new file mode 100644 index 00000000..6bd5fdaa --- /dev/null +++ b/lang/en/lang_viewrequests.php @@ -0,0 +1,5 @@ + 'Requests', + '' +]; \ No newline at end of file diff --git a/public/edit.php b/public/edit.php index e4fd8f13..a2b02c0a 100644 --- a/public/edit.php +++ b/public/edit.php @@ -132,6 +132,7 @@ else { tr($lang_edit['row_content'],$team_select,1); } + tr($lang_functions['text_tags'], torrentTags($row['tags'], 'checkbox'), 1); tr($lang_edit['row_check'], " ".$lang_edit['checkbox_visible']."   ".(get_user_class() >= $beanonymous_class || get_user_class() >= $torrentmanage_class ? "".$lang_edit['checkbox_anonymous_note']."   " : "").(get_user_class() >= $torrentmanage_class ? " ".$lang_edit['checkbox_banned'] : ""), 1); if (get_user_class()>= $torrentsticky_class || (get_user_class() >= $torrentmanage_class && $CURUSER["picker"] == 'yes')){ $pickcontent = ""; diff --git a/public/takeedit.php b/public/takeedit.php index e7e9a54a..b28c3f2d 100644 --- a/public/takeedit.php +++ b/public/takeedit.php @@ -55,6 +55,8 @@ if (!empty($_POST['pt_gen'])) { $updateset[] = "pt_gen = ''"; } +$updateset[] = "tags = " . array_sum($_POST['tags']); + if ($enablenfo_main=='yes'){ $nfoaction = $_POST['nfoaction']; if ($nfoaction == "update") diff --git a/public/takeupload.php b/public/takeupload.php index 8151b12b..7208778e 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -342,8 +342,8 @@ if (empty($url) && !empty($ptGenImdbLink)) { $url = str_replace('tt', '', $ptGenImdbInfo['id']); } -$ret = sql_query("INSERT INTO torrents (filename, owner, visible, anonymous, name, size, numfiles, type, url, small_descr, descr, ori_descr, category, source, medium, codec, audiocodec, standard, processing, team, save_as, sp_state, added, last_action, nfo, info_hash, pt_gen) VALUES (".sqlesc($fname).", ".sqlesc($CURUSER["id"]).", 'yes', ".sqlesc($anonymous).", ".sqlesc($torrent).", ".sqlesc($totallen).", ".count($filelist).", ".sqlesc($type).", ".sqlesc($url).", ".sqlesc($small_descr).", ".sqlesc($descr).", ".sqlesc($descr).", ".sqlesc($catid).", ".sqlesc($sourceid).", ".sqlesc($mediumid).", ".sqlesc($codecid).", ".sqlesc($audiocodecid).", ".sqlesc($standardid).", ".sqlesc($processingid).", ".sqlesc($teamid).", ".sqlesc($dname).", ".sqlesc($sp_state) . -", " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc(date("Y-m-d H:i:s")) . ", ".sqlesc($nfo).", " . sqlesc($infohash). ", " . sqlesc(json_encode($postPtGen)) . ")"); +$ret = sql_query("INSERT INTO torrents (filename, owner, visible, anonymous, name, size, numfiles, type, url, small_descr, descr, ori_descr, category, source, medium, codec, audiocodec, standard, processing, team, save_as, sp_state, added, last_action, nfo, info_hash, pt_gen, tags) VALUES (".sqlesc($fname).", ".sqlesc($CURUSER["id"]).", 'yes', ".sqlesc($anonymous).", ".sqlesc($torrent).", ".sqlesc($totallen).", ".count($filelist).", ".sqlesc($type).", ".sqlesc($url).", ".sqlesc($small_descr).", ".sqlesc($descr).", ".sqlesc($descr).", ".sqlesc($catid).", ".sqlesc($sourceid).", ".sqlesc($mediumid).", ".sqlesc($codecid).", ".sqlesc($audiocodecid).", ".sqlesc($standardid).", ".sqlesc($processingid).", ".sqlesc($teamid).", ".sqlesc($dname).", ".sqlesc($sp_state) . +", " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc(date("Y-m-d H:i:s")) . ", ".sqlesc($nfo).", " . sqlesc($infohash). ", " . sqlesc(json_encode($postPtGen)) . ", " . array_sum($_POST['tags']) . ")"); if (!$ret) { if (mysql_errno() == 1062) bark($lang_takeupload['std_torrent_existed']); diff --git a/public/torrents.php b/public/torrents.php index 7c7883b0..ef16692e 100644 --- a/public/torrents.php +++ b/public/torrents.php @@ -859,10 +859,10 @@ if ($count) list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "?" . $addparam); if ($allsec == 1 || $enablespecial != 'yes'){ - $query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $where $orderby $limit"; + $query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,tags FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $where $orderby $limit"; } else{ - $query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit"; + $query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,tags FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit"; } $res = sql_query($query) or die(mysql_error()); diff --git a/public/upload.php b/public/upload.php index 84d8ccdb..72386476 100644 --- a/public/upload.php +++ b/public/upload.php @@ -149,6 +149,7 @@ stdhead($lang_upload['head_upload']); { tr($lang_upload['row_show_uploader'], "".$lang_upload['checkbox_hide_uploader_note'], 1); } + tr($lang_functions['text_tags'], torrentTags(0, 'checkbox'), 1); ?>
".$stickyicon."".htmlspecialchars($dispname)."" . $sp_torrent); $picked_torrent = ""; if ($CURUSER['appendpicked'] != 'no'){ if($row['picktype']=="hot") @@ -3193,7 +3206,8 @@ while ($row = mysql_fetch_assoc($res)) print(" (".$lang_functions['text_new_uppercase'].")"); $banned_torrent = ($row["banned"] == 'yes' ? " (".$lang_functions['text_banned'].")" : ""); - print($banned_torrent.$picked_torrent.$sp_torrent); + print($banned_torrent.$picked_torrent); + $tags = torrentTags($row['tags'], 'span'); if ($displaysmalldescr){ //small descr $dissmall_descr = trim($row["small_descr"]); @@ -3203,8 +3217,10 @@ while ($row = mysql_fetch_assoc($res)) { $dissmall_descr=mb_substr($dissmall_descr, 0, $max_lenght_of_small_descr-2,"UTF-8") . ".."; } - print($dissmall_descr == "" ? "" : "
".htmlspecialchars($dissmall_descr)); - } + print($dissmall_descr == "" ? "" : "
".$tags.htmlspecialchars($dissmall_descr)); + } else { + print("
$tags"); + } print("
diff --git a/public/viewrequests.php b/public/viewrequests.php new file mode 100644 index 00000000..e63fa4d5 --- /dev/null +++ b/public/viewrequests.php @@ -0,0 +1,465 @@ +=1 and finish = 'no'"; + break; + } + default: + { + $limit = "finish = 'no'"; + break; + } + } + //if (!in_array($finished, $allowed_finished)){$limit = "finish = 'no'";(get_user_class() >= 13?$limitorder="Totalreq DESC ,":"");} + //else $limit = ( $finished=="all" ? "1" : ( $finished=="all" ? "1" : "finish ='".$finished."'")); + + + if (!empty($_POST['query'])) $limit = $limit . " and (request like " . sqlesc("%" . $_POST['query'] . "%") . " or descr like " . sqlesc("%" . $_POST['query'] . "%") . ")"; + + + $rows = sql_query("SELECT requests.* FROM requests WHERE " . $limit . " ORDER BY id DESC") or sqlerr(__FILE__, __LINE__); + list($pagertop, $pagerbottom, $limit2) = pager(20, mysql_num_rows($rows), "?$finishedlimit"); + //if (mysql_num_rows($rows) == 0) stderr( "没有求种" , "没有符合条件的求种项目,点击这里增加新求种",0); + //else + { + stdhead($lang_viewrequests['page_title']); + + $rows = sql_query("SELECT requests.* ,(SELECT count(DISTINCT torrentid) FROM resreq where reqid=requests.id ) as Totalreq FROM requests WHERE " . $limit . " ORDER BY $limitorder id DESC $limit2") or sqlerr(__FILE__, __LINE__); + print("

{$lang_viewrequests['page_title']}

"); + print("
{$lang_viewrequests['add_request']} | {$lang_viewrequests['view_request_all']} | {$lang_viewrequests['view_request_resolved']} | {$lang_viewrequests['view_request_unresolved']} | {$lang_viewrequests['view_request_resolving']} | {$lang_viewrequests['view_request_my']}

\n"); + print("\n"); + + if (mysql_num_rows($rows) == 0) { + print("\n"); + } else { + print("\n"); + while ($row = mysql_fetch_array($rows)) { + print(" + + + + + + + \n"); + } + } + print("
Nothing
{$lang_viewrequests['thead_name']}{$lang_viewrequests['thead_price_newest']}{$lang_viewrequests['thead_price_original']}{$lang_viewrequests['thead_comment_count']}{$lang_viewrequests['thead_on_request_count']}{$lang_viewrequests['thead_request_user']}{$lang_viewrequests['thead_created_at']}{$lang_viewrequests['thead_status']}
" . $row["request"] . "" . $row['amount'] . "" . $row['ori_amount'] . "" . ($row['comments']) . "" . ($row['Totalreq']) . "" . get_username($row['userid']) . "" . gettime($row['added'], true, false) . "" . ($row['finish'] == "yes" ? $lang_viewrequests['request_status_resolved'] : ($row['userid'] == $CURUSER['id'] ? $lang_viewrequests['request_status_resolving'] : "{$lang_viewrequests['request_status_resolving']}")) . "
\n"); + print($pagerbottom); + //print("
添加 查看所有 查看已解决 查看未解决\n"); + print("\n"); + print("
\n"); + print("\n"); + print(""); + print(""); + + print("
\n"); + print("

\n"); + + + stdfoot(); + } + die; + break; + } + + case "view": + { + if (is_numeric($_GET["id"])) { + $id = $_GET["id"]; + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_GET["id"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("错误", "ID不存在"); + else $arr = mysql_fetch_assoc($res); + stdhead("求种区"); + print("

求种-" . htmlspecialchars($arr["request"]) . "

\n"); + print("\n"); + $res = sql_query("SELECT * FROM resreq WHERE reqid ='" . $_GET["id"] . "'" . $limit) or sqlerr(__FILE__, __LINE__); + tr("基本信息", get_username($arr['userid']) . "发表于" . gettime($arr["added"], true, false) . "\n", 1); + tr("悬赏", "最新竞价为" . $arr['amount'] . " 原始竞价为" . $arr["ori_amount"] . "\n", 1); + tr("操作", "举报" . + (($arr['userid'] == $CURUSER['id'] || get_user_class() >= 13) && $arr["finish"] == "no" ? " | 编辑" : "") . "\n" . + ($arr['userid'] == $CURUSER['id'] || $arr["finish"] == "yes" ? "" : " | 应求\n") . + ((get_user_class() >= 13 || $arr['userid'] == $CURUSER['id']) && $arr['finish'] == "no" ? " | 删除" : "title='回收返还80%魔力值'>回收") . "" : "") . "\n" + , 1); + if ($arr["finish"] == "no") tr("追加悬赏", " 追加悬赏每次将扣减25个魔力值作为手续费", 1); + tr("介绍", format_comment(unesc($arr["descr"])), 1); + $limit = ($arr['finish'] == "no" ? "" : " AND chosen = 'yes' "); + $ress = ""; + if (mysql_num_rows($res) == 0) $ress = "还没有应求"; + else { + if ($arr['userid'] == $CURUSER['id'] || get_user_class() >= 13) + $ress .= "\n\n"; + while ($row = mysql_fetch_array($res)) { + $each = mysql_fetch_assoc(sql_query("SELECT * FROM torrents WHERE id = '" . $row["torrentid"] . "'")); + if (mysql_num_rows(sql_query("SELECT * FROM torrents WHERE id = '" . $row["torrentid"] . "'")) == 1) + $ress .= (($arr['userid'] == $CURUSER['id'] || get_user_class() >= 13) && $arr['finish'] == "no" ? "" : "") . "" . $each["name"] . " " . ($arr['finish'] == "no" ? "" : "by " . get_username($each[owner])) . "
\n"; + } + $ress .= ""; + + if (($arr['userid'] == $CURUSER['id'] || get_user_class() >= 13) && $arr['finish'] == "no") + $ress .= "\n"; + $ress .= "\n"; + } + tr("应求", $ress, 1); + print("


\n"); + + + $count = get_row_count("comments", "WHERE request=" . sqlesc($_GET["id"])); + if ($count) { + print("

"); + print("

评论

\n"); + list($pagertop, $pagerbottom, $limit) = pager(10, $count, "viewrequests.php?action=view&id=" . $_GET["id"] . "&", array('lastpagedefault' => 1), "page"); + + $subres = sql_query("SELECT * FROM comments WHERE request=" . sqlesc($_GET["id"]) . " ORDER BY id $limit") or sqlerr(__FILE__, __LINE__); + + $allrows = array(); + while ($subrow = mysql_fetch_array($subres)) { + $allrows[] = $subrow; + } + print($pagertop); + commenttable($allrows, 'request', $_GET["id"]); + print($pagerbottom); + } + + + print (" + +
" . $lang_details['text_quick_comment'] . "

+
+
"); + quickreply('comment', 'body', "添加"); + print("
"); + + + print (" + +添加评论
"); + + stdfoot(); + + } else stderr("出错了!!!", "ID不存在"); + die; + break; + } + + case "edit": + { + if (!is_numeric($_GET["id"])) stderr("出错了!!!", "求种ID必须为数字"); + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_GET["id"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该求种已被删除!"); + $arr = mysql_fetch_assoc($res); + if ($arr["finish"] == "yes") stderr("出错了!", "该求种已完成!"); + if ($arr['userid'] == $CURUSER['id'] || get_user_class() >= 13) { + stdhead("编辑求种"); + print( + "
\n + + + "); + print(""); + tr("标题:", "
", 1); + print(""); + print("
编辑求种
介绍:"); + textbbcode("edit", "descr", $arr["descr"]); + print("

\n"); + stdfoot(); + die; + } else stderr("出错了!!!", "你没有该权限!!!点击这里返回", 0); + } + + case "new": + { + if (get_user_class() >= 1) { + stdhead("新增求种"); + print( + "
\n\n"); + print("\n"); + tr("标题:", "
", 1); + tr("悬赏:", "赏金不得低于100魔力值,每次求种将扣去100魔力值作为手续费。
", 1); + print(""); + print("
新增求种
介绍:"); + textbbcode("edit", "descr", $arr["descr"]); + print("

\n"); + + stdfoot(); + die; + } else stderr("出错了!!!", "你没有该权限!!!点击这里返回", 0); + } + + case "newmessage": + { + + { + stdhead("回复"); + + + //
"); +//quickreply('reply', 'message', "我要留言"); +//print("
"); + + $ruserid = 0 + $_GET["userid"]; + + + print( + "
\n\n"); + print("\n"); + + print(""); + print("
"); + if ($ruserid) { + textbbcode("reply", "message", "[b]回复:" . get_plain_username($ruserid) . "[/b]\n"); + print(""); + } else + textbbcode("reply", "message"); + print("

\n"); + + stdfoot(); + die; + } + + } + case "search": + { + + { + stdhead("搜索"); + + + print("\n"); + print("\n"); + print("
搜索
\n"); + print("\n"); + print(""); + print("
\n"); + print("

\n"); + + + stdfoot(); + die; + } + + } + case "takeadded": + { + if (!$_POST["descr"]) stderr("出错了!", "介绍未填!点击这里返回", 0); + if (!$_POST["request"]) stderr("出错了!", "名称未填!点击这里返回", 0); + if (!$_POST["amount"]) stderr("出错了!", "赏金未填!点击这里返回", 0); + if (!is_numeric($_POST["amount"])) stderr("出错了!!!", "赏金必须为数字!点击这里返回", 0); + $amount = $_POST["amount"]; + if ($amount < 100) stderr("出错了!", "发布求种赏金不得小于100个魔力值!点击这里返回", 0); + if ($amount > 10000) stderr("出错了!", "发布求种赏金不得大于10000个魔力值!点击这里返回", 0); + $amount += 100; + if ($amount + 100 > $CURUSER['seedbonus']) stderr("出错了!", "你没有那么多魔力值!!!点击这里返回", 0); + if (get_user_class() >= 1) { + sql_query("UPDATE users SET seedbonus = seedbonus - " . $amount . " WHERE id = " . $CURUSER['id']); + sql_query("INSERT requests ( request , descr, ori_descr ,amount , ori_amount , userid ,added ) VALUES ( " . sqlesc($_POST["request"]) . " , " . sqlesc($_POST["descr"]) . " , " . sqlesc($_POST["descr"]) . " , " . sqlesc($_POST["amount"]) . " , " . sqlesc($_POST["amount"]) . " , " . sqlesc($CURUSER['id']) . " , '" . date("Y-m-d H:i:s") . "' )") or sqlerr(__FILE__, __LINE__); +// shoutbox_into('[rid' . ($id = mysql_insert_id()) . ']'); + $id = mysql_insert_id(); + stderr("成功", "新增求种成功,点击这里返回", 0); + } else stderr("出错了!!!", "你没有该权限!!!点击这里返回", 0); + die; + break; + } + + case "takeedit": + { + if (!is_numeric($_POST["reqid"])) stderr("出错了!!!", "求种ID必须为数字!点击这里返回", 0); + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_POST["reqid"] . "'") or sqlerr(__FILE__, __LINE__); + if (!$_POST["descr"]) stderr("出错了!!!", "介绍未填!点击这里返回", 0); + if (!$_POST["request"]) stderr("出错了!!!", "名称未填!点击这里返回", 0); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该求种已被删除!点击这里返回", 0); + $arr = mysql_fetch_assoc($res); + if ($arr["finish"] == "yes") stderr("出错了!", "该求种已完成!点击这里返回", 0); + if ($arr['userid'] == $CURUSER['id'] || get_user_class() >= 13) { + sql_query("UPDATE requests SET descr = " . sqlesc($_POST["descr"]) . " , request = " . sqlesc($_POST["request"]) . " WHERE id ='" . $_POST["reqid"] . "'") or sqlerr(__FILE__, __LINE__); + stderr("成功", "编辑成功,点击这里返回", 0); + } else stderr("出错了!!!", "你没有该权限!!!点击这里返回", 0); + die; + break; + } + + case "res": + { + stdhead("应求"); + stdmsg("我要应求", " +
+ + + 请输入种子的ID:http://$BASEURL/details.php?id= +
点击这里返回", 0); + stdfoot(); + die; + break; + } + + case "takeres": + { + if (!is_numeric($_POST["reqid"])) stderr("出错了!!!", "不要试图入侵系统!"); + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_POST["reqid"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该求种已被删除!点击这里返回", 0); + $arr = mysql_fetch_assoc($res); + if ($arr["finish"] == "yes") stderr("出错了!", "该求种已完成!点击这里返回", 0); + if (!is_numeric($_POST["torrentid"])) stderr("出错了!!!", "种子ID必须为数字!点击这里返回", 0); + $res = sql_query("SELECT * FROM torrents WHERE id ='" . $_POST["torrentid"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该种子不存在!点击这里返回", 0); + $tor = mysql_fetch_assoc($res); + if ($tor[last_seed] == "0000-00-00 00:00:00") stderr("出错了!!!", "该种子尚未正式发布!点击这里返回", 0); + if (get_row_count('resreq', "where reqid ='" . $_POST["reqid"] . "' and torrentid='" . $_POST["torrentid"] . "'")) + stderr("出错了!!!", "该应求已经存在!点击这里返回", 0); + sql_query("INSERT resreq (reqid , torrentid) VALUES ( '" . $_POST["reqid"] . "' , '" . $_POST["torrentid"] . "')"); + + + $added = sqlesc(date("Y-m-d H:i:s")); + $subject = sqlesc("有人应求你的求种请求,请及时确认该应求"); + $notifs = sqlesc("求种名称:[url=viewrequests.php?id=$arr[id]] " . $arr['request'] . "[/url],请及时确认该应求."); + sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, " . $arr['userid'] . ", $subject, $notifs, $added)") or sqlerr(__FILE__, __LINE__); + + + stderr("成功", "应求成功,点击这里返回", 0); + die; + break; + } + + case "addamount": + { + if (!is_numeric($_POST["reqid"])) stderr("出错了!!!", "不要试图入侵系统"); + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_POST["reqid"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该求种已被删除!"); + $arr = mysql_fetch_assoc($res); + if ($arr["finish"] == "yes") stderr("出错了!", "该求种已完成!"); + if (!is_numeric($_POST["amount"])) stderr("出错了!", "赏金必须为数字!"); + $amount = $_POST["amount"]; + if ($amount < 100) stderr("出错了!", "追加悬赏赏金不得小于100个魔力值!"); + if ($amount > 5000) stderr("出错了!", "追加悬赏赏金不得大于5000个魔力值!"); + $amount += 25; + if ($amount > $CURUSER['seedbonus']) stderr("出错了!", "你没有那么多魔力值!"); + sql_query("UPDATE users SET seedbonus = seedbonus - " . $amount . " WHERE id = " . $CURUSER['id']); + sql_query("UPDATE requests SET amount = amount + " . $_POST["amount"] . " WHERE id = " . $_POST["reqid"]); + stderr("成功", "追加悬赏成功,点击这里返回", 0); + die; + break; + } + + case "delete": + { + if (!is_numeric($_GET["id"])) stderr("出错了!!!", "求种ID必须为数字"); + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_GET["id"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该求种已被删除!"); + $arr = mysql_fetch_assoc($res); + if (get_user_class() >= 13 || $arr['userid'] == $CURUSER["id"] && $arr['finish'] == 'no') { + if (!get_row_count("resreq", "WHERE reqid=" . sqlesc($_GET["id"]))) { + KPS("+", $arr['amount'] * 8 / 10, $arr['userid']); + } + sql_query("DELETE FROM requests WHERE id ='" . $_GET["id"] . "'") or sqlerr(__FILE__, __LINE__); + sql_query("DELETE FROM resreq WHERE reqid ='" . $_GET["id"] . "'") or sqlerr(__FILE__, __LINE__); + sql_query("DELETE FROM comments WHERE request ='" . $_GET["id"] . "'") or sqlerr(__FILE__, __LINE__); + stderr("成功", "删除求种成功,点击这里返回", 0); + } else stderr("出错了!!!", "你没有该权限!!!"); + die; + break; + } + + case "confirm": + { + if (!is_numeric($_POST["id"])) stderr("出错了!!!", "不要试图入侵系统"); + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_POST["id"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该求种已被删除!"); + $arr = mysql_fetch_assoc($res); + if (empty($_POST["torrentid"])) stderr("出错了!", "你没有选择符合条件的应求!"); + else $torrentid = $_POST["torrentid"]; + if ($arr['userid'] == $CURUSER['id'] || get_user_class() >= 13) { + $amount = $arr["amount"] / count($torrentid); + sql_query("UPDATE requests SET finish = 'yes' WHERE id = " . $_POST["id"]); + sql_query("UPDATE resreq SET chosen = 'yes' WHERE reqid = " . $_POST["id"] . " AND ( torrentid = '" . join("' OR torrentid = '", $torrentid) . "' )") or sqlerr(__FILE__, __LINE__); + sql_query("DELETE FROM resreq WHERE reqid ='" . $_POST["id"] . "' AND chosen = 'no'") or sqlerr(__FILE__, __LINE__); + $res = sql_query("SELECT owner FROM torrents WHERE ( id = '" . join("' OR id = '", $torrentid) . "' ) ") or sqlerr(__FILE__, __LINE__); + while ($row = mysql_fetch_array($res)) { + + $owner[] = $row[0]; + $added = sqlesc(date("Y-m-d H:i:s")); + $subject = sqlesc("你的种子被人应求"); + $notifs = sqlesc("求种名称:[url=viewrequests.php?id=$arr[id]] " . $arr['request'] . "[/url].你获得: $amount 魔力值"); + sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES(0, " . $row[0] . ", $subject, $notifs, $added)") or sqlerr(__FILE__, __LINE__); + + } + sql_query("UPDATE users SET seedbonus = seedbonus + $amount WHERE id = '" . join("' OR id = '", $owner) . "'") or sqlerr(__FILE__, __LINE__); + stderr("成功", "确认成功,点击这里返回", 0); + + } + + } + + case "message": + { + if (!is_numeric($_POST["id"])) stderr("出错了!!!", "不要试图入侵系统"); + $res = sql_query("SELECT * FROM requests WHERE id ='" . $_POST["id"] . "'") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) == 0) stderr("出错了!", "该求种已被删除!"); + if (!$_POST["message"]) stderr("出错了!", "留言不能为空!"); + $arr = mysql_fetch_assoc($res); + $message = $arr["message"]; + $message .= "
由" . $CURUSER["username"] . "添加于" . date("Y-m-d H:i:s") . "" . $_POST["message"] . "