-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbbcode.php
80 lines (63 loc) · 1.74 KB
/
bbcode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/*
* BBCode 源代码查看窗口
*
* 版本:1.0
* 作者:樱桃
* 时间:2014-10-01
*
* 修订记录:
* 无
*
*/
require_once("include/bittorrent.php");
require_once(get_langfile_path());
dbconn();
// 是否可以查看当前代码。
$can_view_bbcode = (get_user_class() >= $viewbbcode_class || $CURUSER["id"] == $row["owner"]);
// 如果当前用户没有权限,则显示权限不足并中止执行。
if(!$can_view_bbcode){
permissiondenied();
die();
}
// 种子 ID。
$id = 0 + $_GET['id'];
// 查询种子信息。
$sql = new_mysqli();
$query = $sql->prepare("SELECT `name`, `descr`, `banned` FROM `torrents` WHERE `id` = ?");
$query->bind_param("i", $id);
$query->execute();
$query->bind_result($title, $descrption, $banned);
// 没有找到种子。
if (!$query->fetch()) {
stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']);
die();
}
// Ban 项目的特殊权限检查。
if ($banned == 'yes' && get_user_class() < $seebanned_class){
permissiondenied();
die();
}
// 关闭数据库。
$sql->close();
// 当前用户的语言。
$user_lang = get_user_lang($CURUSER['id']);
?>
<h1><?= MessageFormatter::formatMessage($user_lang, $lang_bbcode['text_title_format'], $title) ?></h1>
<p><?= $lang_bbcode['text_instruction'] ?></p>
<table style="width: 95%; margin: 10px;">
<thead>
<tr>
<th class="colhead" align="center"><?= MessageFormatter::formatMessage($user_lang, $lang_bbcode['text_title_format'], $title) ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<blockquote style="white-space: pre-wrap; overflow:scroll; font-family: 'Segoe UI';">
<?= htmlspecialchars($descrption) ?>
</blockquote>
</td>
</tr>
</tbody>
</table>