forked from yunasc/tbdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexedit.php
116 lines (101 loc) · 5.43 KB
/
indexedit.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
<?
/*
// +--------------------------------------------------------------------------+
// | Project: TBDevYSE - TBDev Yuna Scatari Edition |
// +--------------------------------------------------------------------------+
// | This file is part of TBDevYSE. TBDevYSE is based on TBDev, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// | |
// | TBDevYSE is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | TBDevYSE is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with TBDevYSE; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------------+
// | Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require_once("include/bittorrent.php");
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr($tracker_lang["error"], $tracker_lang["access_denied"]);
$action = $_GET["action"];
if ($action == 'edit') {
$id = (int) $_GET["id"];
if (!is_valid_id($id))
stderr($tracker_lang["error"], $tracker_lang["invalid_id"]);
$res = sql_query("SELECT * FROM indexreleases WHERE id = ".sqlesc($id)) or sqlerr(__FILE__,__LINE__);
if (mysql_num_rows($res) != 1)
stderr($tracker_lang["error"], $tracker_lang["invalid_id"]);
$release = mysql_fetch_array($res);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$var_list = "name:poster:torrentid:cat:top:center:bottom";
$int_list = "torrentid:cat";
foreach (explode(":", $var_list) as $x)
if (empty($_POST[$x]))
stderr($tracker_lang["error"], "Âû íå çàïîëíèëè âñå ïîëÿ!");
else
$GLOBALS[$x] = $_POST[$x];
foreach (explode(":", $int_list) as $x)
if (!is_valid_id($GLOBALS[$x]))
stderr($tracker_lang["error"], "Âû ââåëè íå ÷èñëî â ñëåäóþùåå ïîëå: $x");
$updateset = array();
$imdb = $_POST["imdb"];
foreach (explode(":", $var_list) as $x)
$updateset[] = "$x = ".sqlesc($GLOBALS[$x]);
if (!empty($imdb))
$updateset[] = "imdb = ".sqlesc($imdb);
sql_query("UPDATE indexreleases SET " . implode(", ", $updateset) . " WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$returnto = htmlentities($_POST['returnto']);
if ($returnto != "")
header("Location: $returnto");
else
stderr("Óñïåøíî", "Ðåëèç îòðåäàêòèðîâàí.");
} else {
$returnto = $_GET['returnto'];
stdhead("Ðåäàêòèðîâàòü ðåëèç");
$cats = genrelist();
$categories = "<select name=\"cat\"><option selected>Âûáåðèòå êàòåãîðèþ</option>";
foreach ($cats as $cat) {
$cat_id = $cat["id"];
$cat_name = $cat["name"];
$categories .= "<option value=\"$cat_id\"".($release["cat"] == $cat_id ? " selected" : "").">$cat_name</option>";
}
$categories .= "</select>";
$id = (int) $_GET["id"];
?>
<form name="index" action="?action=edit&id=<?=$id;?>" method="post">
<table border="0" cellspacing="0" cellpadding="5">
<?
tr("Íàçâàíèå ðåëèçà", "<input type=\"text\" name=\"name\" size=\"80\" value=\"$release[name]\" /><br />Ïðèìåð: Ñìåðòü Ïðåçèäåíòà (2006) DVDRip\n", 1);
tr("Ïîñòåð", "<input type=\"text\" name=\"poster\" size=\"80\" value=\"$release[poster]\" /><br />Çàëèòü êàðòèíêó íà <a href=\"http://www.imageshack.us\">ImageShack</a>", 1);
?>
<tr><td width="" class="heading" valign="top" align="right">Âåðõíèé øàáëîí</td><td valign="top" align="left"><?=textbbcode("index", "top", $release["top"]);?></td></tr>
<tr><td width="" class="heading" valign="top" align="right">Ñðåäíèé øàáëîí</td><td valign="top" align="left"><?=textbbcode("index", "center", $release["center"]);?></td></tr>
<tr><td width="" class="heading" valign="top" align="right">Íèæíèé øàáëîí</td><td valign="top" align="left"><?=textbbcode("index", "bottom", $release["bottom"]);?></td></tr>
<?
tr("Íîìåð òîððåíòà", "<input type=\"text\" name=\"torrentid\" size=\"60\" value=\"$release[torrentid]\" /><br />Ïðèìåð: $DEFAULTBASEURL/details.php?id=<b>6764</b><br />Âûäåëåííîå æèðíûì - è åñòü íîìåð òîððåíòà\n", 1);
tr("URL IMDB", "<input type=\"text\" name=\"imdb\" size=\"60\" value=\"$release[imdb]\" /><br />Ïðèìåð: http://www.imdb.com/title/tt0408306/\n", 1);
tr("Êàòåãîðèÿ", $categories, 1);
?>
<tr><td align="center" colspan="2"><input type="submit" value="Èçìåíèòü" /></td></tr>
</table>
<? if ($_GET["returnto"])
print "<input type=\"hidden\" name=\"returnto\" value=\"".htmlentities($_GET["returnto"])."\" />";
?>
</form>
<?
stdfoot();
}
}
?>