-
Notifications
You must be signed in to change notification settings - Fork 4
/
edit.php
201 lines (176 loc) · 9.63 KB
/
edit.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?php
/**
* http://btdev.net:1337/svn/test/Installer09_Beta
* Licence Info: GPL
* Copyright (C) 2010 BTDev Installer v.1
* A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
* Project Leaders: Mindless,putyn.
**/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'bittorrent.php');
require_once(INCL_DIR.'user_functions.php');
require_once INCL_DIR.'html_functions.php';
require_once INCL_DIR.'bbcode_functions.php';
require_once INCL_DIR.'page_verify.php';
global $CURUSER;
if (!mkglobal("id"))
die();
$id = 0 + $id;
if (!$id)
die();
/** who is modding by pdq **/
if ((isset($_GET['unedit']) && $_GET['unedit'] == 1) && $CURUSER['class'] >= UC_MODERATOR)
{
$modfile = 'cache/details/'.$id.'_moddin.txt';
if (file_exists($modfile))
unlink($modfile);
$returl = "details.php?id=$id";
if (isset($_POST["returnto"]))
$returl .= "&returnto=" . urlencode($_POST["returnto"]);
header("Refresh: 0; url=$returl");
exit();
}
dbconn();
loggedinorreturn();
$lang = array_merge( load_language('global'), load_language('edit') );
$newpage = new page_verify();
$newpage->create('teit');
$res = sql_query("SELECT * FROM torrents WHERE id = $id");
$row = mysql_fetch_assoc($res);
if (!$row)
stderr($lang['edit_user_error'], $lang['edit_no_torrent']);
if (!isset($CURUSER) || ($CURUSER["id"] != $row["owner"] && $CURUSER["class"] < UC_STAFF))
{
stderr($lang['edit_user_error'], sprintf($lang['edit_no_permission'], urlencode($_SERVER['REQUEST_URI'])));
}
$HTMLOUT = '';
if ($CURUSER['class'] >= UC_MODERATOR)
{
$expire = 300; // 5 minutes
$modfile = 'cache/details/'.$id.'_moddin.txt';
if (file_exists($modfile) && filemtime($modfile) > (time() - $expire)) {
$modcache = fopen($modfile, "r");
$ismoddin = fread($modcache, filesize($modfile));
fclose($modcache);
$HTMLOUT .= '<h1><font size="+1"><font color="#FF0000">'.$ismoddin.'</font> is currently editing this torrent!</font></h1>';
}
else
{
$modder = $CURUSER['username'];
$fp = fopen($modfile, "w") or die('Couldn\'t open file for writing!');
fwrite($fp, $modder) or die('Couldn\'t write values to file!');
fclose($fp);
}
}
$ismodd = '<tr><td align=\'center\' class=\'colhead\' colspan=\'2\'><b>Edit Torrent</b> '.(($CURUSER['class'] > UC_UPLOADER)?'<small><a href="edit.php?id='.$id.'&unedit=1">Click here</a> to add temp edit notification while you edit this torrent</small>':'').'</td></tr>';
$HTMLOUT .= "<form name='compose' method='post' action='takeedit.php' enctype='multipart/form-data'>
<input type='hidden' name='id' value='$id' />";
if (isset($_GET["returnto"]))
$HTMLOUT .= "<input type='hidden' name='returnto' value='" . htmlspecialchars($_GET["returnto"]) . "' />\n";
$HTMLOUT .= "<table border='1' cellspacing='0' cellpadding='10'>\n";
$HTMLOUT .= $ismodd;
$HTMLOUT .= tr("{$lang['edit_imdb_url']}", "<input type='text' name='url' size='80' value='".$row["url"]."' />", 1);
$HTMLOUT .= tr($lang['edit_poster'], "<input type='text' name='poster' size='80' value='" . htmlspecialchars($row["poster"]) . "' /><br />{$lang['edit_poster1']}\n", 1);
$HTMLOUT .= tr($lang['edit_torrent_name'], "<input type='text' name='name' value='" . htmlspecialchars($row["name"]) . "' size='80' />", 1);
$HTMLOUT .= tr($lang['edit_nfo'], "<input type='radio' name='nfoaction' value='keep' checked='checked' />{$lang['edit_keep_current']}<br />".
"<input type='radio' name='nfoaction' value='update' />{$lang['edit_update']}<br /><input type='file' name='nfo' size='80' />", 1);
if ((strpos($row["ori_descr"], "<") === false) || (strpos($row["ori_descr"], "<") !== false))
{
$c = "";
}
else
{
$c = " checked";
}
$HTMLOUT .= tr($lang['edit_description'], "". textbbcode("compose","descr","".htmlspecialchars($row['ori_descr'])."")."<br />({$lang['edit_tags']})", 1);
$s = "<select name='type'>\n";
$cats = genrelist();
foreach ($cats as $subrow)
{
$s .= "<option value='" . $subrow["id"] . "'";
if ($subrow["id"] == $row["category"])
$s .= " selected='selected'";
$s .= ">" . htmlspecialchars($subrow["name"]) . "</option>\n";
}
$s .= "</select>\n";
$HTMLOUT .= tr($lang['edit_type'], $s, 1);
$rg = "<select name='release_group'>\n<option value='scene'".($row["release_group"] == "scene" ? " selected='selected'" : "").">Scene</option>\n<option value='p2p'".($row["release_group"] == "p2p" ? " selected='selected'" : "").">p2p</option>\n<option value='none'".($row["release_group"] == "none" ? " selected='selected'" : "").">None</option> \n</select>\n";
$HTMLOUT .= tr("Release Group", $rg, 1);
$HTMLOUT .= tr($lang['edit_visible'], "<input type='checkbox' name='visible'" . (($row["visible"] == "yes") ? " checked='checked'" : "" ) . " value='1' /> {$lang['edit_visible_mainpage']}<br /><table border='0' cellspacing='0' cellpadding='0' width='420'><tr><td class='embedded'>{$lang['edit_visible_info']}</td></tr></table>", 1);
if ($CURUSER['class'] >= UC_STAFF)
{
$HTMLOUT .= tr($lang['edit_banned'], "<input type='checkbox' name='banned'" . (($row["banned"] == "yes") ? " checked='checked'" : "" ) . " value='1' /> {$lang['edit_banned']}", 1);
}
if ($CURUSER['class'] >= UC_VIP)
$HTMLOUT .= tr("Nuked", "<input type='radio' name='nuked'" . ($row["nuked"] == "yes" ? " checked='checked'" : "") . " value='yes' />Yes <input type='radio' name='nuked'" . ($row["nuked"] == "no" ? " checked='checked'" : "") . " value='no' />No",1);
$HTMLOUT .= tr("Nuke Reason", "<input type='text' name='nukereason' value='" . htmlspecialchars($row["nukereason"]) . "' size='80' />", 1);
if ($CURUSER['class'] >= UC_STAFF)
{
$HTMLOUT .= tr("Free Leech", ($row['free'] != 0 ?
"<input type='checkbox' name='fl' value='1' /> Remove Freeleech" : "
<select name='free_length'>
<option value='0'>------</option>
<option value='42'>Free for 1 day</option>
<option value='1'>Free for 1 week</option>
<option value='2'>Free for 2 weeks</option>
<option value='4'>Free for 4 weeks</option>
<option value='8'>Free for 8 weeks</option>
<option value='255'>Unlimited</option>
</select>"), 1);
}
if ($row['free'] != 0) {
$HTMLOUT .= tr("Free Leech Duration",
($row['free'] != 1 ? "Until ".get_date($row['free'],'DATE')."
(".mkprettytime($row['free'] - time())." to go)" : 'Unlimited'), 1);
}
// ===09 Allow Comments
if ($CURUSER['class'] >= UC_MODERATOR && $CURUSER['class'] <= UC_SYSOP) {
if ($row["allow_comments"] == "yes")
$messc = " Comments are allowed for everyone on this torrent!";
else
$messc = " Only staff members are able to comment on this torrent!";
$HTMLOUT.="<tr>
<td align='right'><font color='red'> * </font><b> {$lang['edit_comment']}</b></td>
<td>
<select name='allow_comments'>
<option value='".htmlspecialchars($row["allow_comments"])."'>".htmlspecialchars($row["allow_comments"])."</option>
<option value='yes'>Yes</option><option value='no'>No</option></select>{$messc}</td></tr>\n";
}
// ===end
if($CURUSER['class'] >= UC_STAFF)
$HTMLOUT .= tr("Sticky", "<input type='checkbox' name='sticky'" . (($row["sticky"] == "yes") ? " checked='checked'" : "" ) . " value='yes' />Sticky this torrent !", 1);
$HTMLOUT .= tr($lang['edit_anonymous'], "<input type='checkbox' name='anonymous'" . (($row["anonymous"] == "yes") ? " checked='checked'" : "" ) . " value='1' />{$lang['edit_anonymous1']}", 1);
$HTMLOUT .= "<tr><td colspan='2' align='center'><input type='submit' value='{$lang['edit_submit']}' class='btn' /> <input type='reset' value='{$lang['edit_revert']}' class='btn' /></td></tr>
</table>
</form>
<br />
<form method='post' action='delete.php'>
<table border='1' cellspacing='0' cellpadding='5'>
<tr>
<td class='embedded' style='background-color: #F5F4EA;padding-bottom: 5px' colspan='2'><b>{$lang['edit_delete_torrent']}.</b> {$lang['edit_reason']}</td>
</tr>
<tr>
<td><input name='reasontype' type='radio' value='1' /> {$lang['edit_dead']} </td><td> {$lang['edit_peers']}</td>
</tr>
<tr>
<td><input name='reasontype' type='radio' value='2' /> {$lang['edit_dupe']}</td><td><input type='text' size='40' name='reason[]' /></td>
</tr>
<tr>
<td><input name='reasontype' type='radio' value='3' /> {$lang['edit_nuked']}</td><td><input type='text' size='40' name='reason[]' /></td>
</tr>
<tr>
<td><input name='reasontype' type='radio' value='4' /> {$lang['edit_rules']}</td><td><input type='text' size='40' name='reason[]' />({$lang['edit_req']})</td>
</tr>
<tr>
<td><input name='reasontype' type='radio' value='5' checked='checked' /> {$lang['edit_other']}</td><td><input type='text' size='40' name='reason[]' />({$lang['edit_req']})<input type='hidden' name='id' value='$id' /></td>
</tr>";
if (isset($_GET["returnto"]))
{
$HTMLOUT .= "<input type='hidden' name='returnto' value='" . htmlspecialchars($_GET["returnto"]) . "' />\n";
}
$HTMLOUT .= "<tr><td colspan='2' align='center'><input type='submit' value='{$lang['edit_delete']}' class='btn' /></td>
</tr>
</table>
</form>";
//////////////////////////// HTML OUTPIT ////////////////////////////////
print stdhead("{$lang['edit_stdhead']} '{$row["name"]}'") . $HTMLOUT . stdfoot();
?>