1 Star 3 Fork 2

mojie126/HDCN-PT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
delete.php 4.21 KB
一键复制 编辑 原始数据 按行查看 历史
mojie126 提交于 2016-01-04 21:12 . 修改一些文字提示
<?php
require_once("include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
require_once(get_langfile_path("", true));
loggedinorreturn();
function bark($msg) {
global $lang_delete;
stdhead();
stdmsg($lang_delete['std_delete_failed'], $msg);
stdfoot();
exit;
}
/*
if (!mkglobal("id"))
bark($lang_delete['std_missing_form_date']);
*/
$torrentids = is_array($_REQUEST["id"]) ? $_REQUEST["id"] : array($_REQUEST["id"]);
$recycleMode = $_REQUEST["recycle_mode"];
switch ($recycleMode) {
case 'release':
foreach ($torrentids as $id) {
$res = sql_query("SELECT name, status, owner FROM torrents WHERE id = $id");
$row = mysql_fetch_array($res);
sql_query("UPDATE torrents SET banned = 'no', status = 'normal', added = " . sqlesc(date("Y-m-d H:i:s")) . " WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$beforeStatus = getTorrentStatus($row['status']);
write_log("种子:管理员 $CURUSER[username] 发布了 $beforeStatus 种子 $id ($row[name]) ");
sendMessage(0, $row['owner'], "你的 $beforeStatus 种子被管理员发布了", "管理员 [url=userdetails.php?id=$CURUSER[id]]$CURUSER[username][/url] 发布了 $beforeStatus 种子 [url=details.php?id=$id]($row[name])[/url]");
}
break;
case 'delete':
case 'recycle':
$rt = 0 + $_POST["reasontype"];
if (!is_int($rt) || $rt < 1 || $rt > 5)
bark($lang_delete['std_invalid_reason'] . "$rt.");
$r = $_POST["r"];
$reason = $_POST["reason"];
if ($rt == 1)
$reasonstr = "断种";
elseif ($rt == 2)
$reasonstr = "重复" . ($reason[0] ? (": " . trim($reason[0])) : "!");
elseif ($rt == 3)
$reasonstr = "劣质" . ($reason[1] ? (": " . trim($reason[1])) : "!");
elseif ($rt == 4) {
if (!$reason[2])
bark($lang_delete['std_describe_violated_rule']);
$reasonstr = $SITENAME . " rules broken: " . trim($reason[2]);
}
else {
if (!$reason[3])
bark($lang_delete['std_enter_reason']);
$reasonstr = trim($reason[3]);
}
if ($recycleMode == "delete") {
$delMsg = "删除了";
} else {
$delMsg = "移入回收站";
$reasonstr .= "\n请按照管理员要求在30天内修改各项信息并通知管理员移出回收站,否则将被系统自动清理。";
}
foreach ($torrentids as $id) {
$id = 0 + $id;
if (!$id)
die();
$res = sql_query("SELECT name, owner, seeders, anonymous, status, url, dburl FROM torrents WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
if (!$row)
die();
if ($CURUSER["id"] != $row["owner"] && get_user_class() < $torrentmanage_class)
bark($lang_delete['std_not_owner']);
// added by SamuraiMe,2013.05.17
sendDelMsg($id, $reasonstr, $recycleMode);
// added by SamuraiMe,2013.05.17
$timestamp = sqlesc(date("Y-m-d H:i:s"));
if ($recycleMode == "delete") {
deletetorrent($id, $row['url'], $row['dburl']);
} else if ($recycleMode == "recycle") {
sql_query("UPDATE torrents SET banned = 'yes', visible = '0' ,status = 'recycle', last_status = $timestamp, added =$timestamp WHERE id = $id") or sqlerr(__FILE__, __LINE__);
}
$beforeStatus = getTorrentStatus($row['status']);
if ($CURUSER["id"] == $row["owner"]) {
if ($row['anonymous'] == 'yes') {
write_log("种子:发布者 匿名 $delMsg $beforeStatus 种子 $id ($row[name]) 。原因是 :($reasonstr)", 'normal');
} else {
write_log("种子:发布者 $CURUSER[username] $delMsg $beforeStatus 种子 $id ($row[name])。原因是: ($reasonstr)", 'normal');
}
} else
write_log("种子:管理员 $CURUSER[username] $delMsg $beforeStatus 种子 $id ($row[name])。原因是: ($reasonstr)", 'normal');
//===remove karma
KPS("-", $uploadtorrent_bonus, $row["owner"]);
}
break;
default:
# code...
break;
}
if ($recycleMode == "delete") {
$title = "删除种子成功";
} else if ($recycleMode == "recycle") {
$title = "成功移入回收站";
} else if ($recycleMode == "release") {
$title = "种子发布成功";
}
stdhead($title);
if (isset($_POST["returnto"]))
$ret = "<a href=\"" . htmlspecialchars($_POST["returnto"]) . "\">" . $lang_delete['text_go_back'] . "</a>";
else
$ret = "<a href=\"index.php\">" . $lang_delete['text_back_to_index'] . "</a>";
?>
<h1><?= $title ?></h1>
<p><?= $ret ?></p>
<?php
stdfoot();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/mojie126/HDCN-PT.git
git@gitee.com:mojie126/HDCN-PT.git
mojie126
HDCN-PT
HDCN-PT
master

搜索帮助