forked from zjutjh/NexusPHP
/
upload.php
152 lines (134 loc) · 8.32 KB
/
upload.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
<?php
require_once("include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
if ($CURUSER["uploadpos"] == 'no')
stderr($lang_upload['std_sorry'], $lang_upload['std_unauthorized_to_upload'],false);
if ($enableoffer == 'yes')
$has_allowed_offer = get_row_count("offers","WHERE allowed='allowed' AND userid = ". sqlesc($CURUSER["id"]));
else $has_allowed_offer = 0;
$uploadfreely = user_can_upload("torrents");
$allowtorrents = ($has_allowed_offer || $uploadfreely);
$allowspecial = user_can_upload("music");
if (!$allowtorrents && !$allowspecial)
stderr($lang_upload['std_sorry'],$lang_upload['std_please_offer'],false);
$allowtwosec = ($allowtorrents && $allowspecial);
$brsectiontype = $browsecatmode;
$spsectiontype = $specialcatmode;
$showsource = (($allowtorrents && get_searchbox_value($brsectiontype, 'showsource')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showsource'))); //whether show sources or not
$showmedium = (($allowtorrents && get_searchbox_value($brsectiontype, 'showmedium')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showmedium'))); //whether show media or not
$showcodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showcodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showcodec'))); //whether show codecs or not
$showstandard = (($allowtorrents && get_searchbox_value($brsectiontype, 'showstandard')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showstandard'))); //whether show standards or not
$showprocessing = (($allowtorrents && get_searchbox_value($brsectiontype, 'showprocessing')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showprocessing'))); //whether show processings or not
$showteam = (($allowtorrents && get_searchbox_value($brsectiontype, 'showteam')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showteam'))); //whether show teams or not
$showaudiocodec = (($allowtorrents && get_searchbox_value($brsectiontype, 'showaudiocodec')) || ($allowspecial && get_searchbox_value($spsectiontype, 'showaudiocodec'))); //whether show languages or not
stdhead($lang_upload['head_upload']);
?>
<form id="compose" enctype="multipart/form-data" action="takeupload.php" method="post" name="upload">
<?php
print("<p align=\"center\">".$lang_upload['text_red_star_required']."</p>");
?>
<table border="1" cellspacing="0" cellpadding="5" width="940">
<tr>
<td class='colhead' colspan='2' align='center'>
<?php echo $lang_upload['text_tracker_url'] ?>: <b><?php echo get_protocol_prefix() . $announce_urls[0]?></b>
<?php
if(!is_writable($torrent_dir))
print("<br /><br /><b>ATTENTION</b>: Torrent directory isn't writable. Please contact the administrator about this problem!");
if(!$max_torrent_size)
print("<br /><br /><b>ATTENTION</b>: Max. Torrent Size not set. Please contact the administrator about this problem!");
?>
</td>
</tr>
<?php
tr($lang_upload['row_torrent_file']."<font color=\"red\">*</font>", "<input type=\"file\" class=\"file\" id=\"torrent\" name=\"file\" onchange=\"getname()\" />\n", 1);
if ($altname_main == 'yes'){
tr($lang_upload['row_torrent_name'], "<b>".$lang_upload['text_english_title']."</b> <input type=\"text\" style=\"width: 250px;\" name=\"name\" />
<b>".$lang_upload['text_chinese_title']."</b> <input type=\"text\" style=\"width: 250px\" name=\"cnname\"><br /><font class=\"medium\">".$lang_upload['text_titles_note']."</font>", 1);
}
else
tr($lang_upload['row_torrent_name'], "<input type=\"text\" style=\"width: 650px;\" id=\"name\" name=\"name\" /><br /><font class=\"medium\">".$lang_upload['text_torrent_name_note']."</font>", 1);
if ($smalldescription_main == 'yes')
tr($lang_upload['row_small_description'], "<input type=\"text\" style=\"width: 650px;\" name=\"small_descr\" /><br /><font class=\"medium\">".$lang_upload['text_small_description_note']."</font>", 1);
get_external_tr();
if ($enablenfo_main=='yes')
tr($lang_upload['row_nfo_file'], "<input type=\"file\" class=\"file\" name=\"nfo\" /><br /><font class=\"medium\">".$lang_upload['text_only_viewed_by'].get_user_class_name($viewnfo_class,false,true,true).$lang_upload['text_or_above']."</font>", 1);
print("<tr><td class=\"rowhead\" style='padding: 3px' valign=\"top\">".$lang_upload['row_description']."<font color=\"red\">*</font></td><td class=\"rowfollow\">");
textbbcode("upload","descr","",false);
print("</td></tr>\n");
if ($allowtorrents){
$disablespecial = " onchange=\"disableother('browsecat','specialcat')\"";
$s = "<select name=\"type\" id=\"browsecat\" ".($allowtwosec ? $disablespecial : "").">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
$cats = genrelist($browsecatmode);
foreach ($cats as $row)
$s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
$s .= "</select>\n";
}
else $s = "";
if ($allowspecial){
$disablebrowse = " onchange=\"disableother('specialcat','browsecat')\"";
$s2 = "<select name=\"type\" id=\"specialcat\" ".$disablebrowse.">\n<option value=\"0\">".$lang_upload['select_choose_one']."</option>\n";
$cats2 = genrelist($specialcatmode);
foreach ($cats2 as $row)
$s2 .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";
$s2 .= "</select>\n";
}
else $s2 = "";
tr($lang_upload['row_type']."<font color=\"red\">*</font>", ($allowtwosec ? $lang_upload['text_to_browse_section'] : "").$s.($allowtwosec ? $lang_upload['text_to_special_section'] : "").$s2.($allowtwosec ? $lang_upload['text_type_note'] : ""),1);
if ($showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing){
if ($showsource){
$source_select = torrent_selection($lang_upload['text_source'],"source_sel","sources");
}
else $source_select = "";
if ($showmedium){
$medium_select = torrent_selection($lang_upload['text_medium'],"medium_sel","media");
}
else $medium_select = "";
if ($showcodec){
$codec_select = torrent_selection($lang_upload['text_codec'],"codec_sel","codecs");
}
else $codec_select = "";
if ($showaudiocodec){
$audiocodec_select = torrent_selection($lang_upload['text_audio_codec'],"audiocodec_sel","audiocodecs");
}
else $audiocodec_select = "";
if ($showstandard){
$standard_select = torrent_selection($lang_upload['text_standard'],"standard_sel","standards");
}
else $standard_select = "";
if ($showprocessing){
$processing_select = torrent_selection($lang_upload['text_processing'],"processing_sel","processings");
}
else $processing_select = "";
tr($lang_upload['row_quality'], $source_select . $medium_select. $codec_select . $audiocodec_select. $standard_select . $processing_select, 1 );
}
if ($showteam){
if ($showteam){
$team_select = torrent_selection($lang_upload['text_team'],"team_sel","teams");
}
else $showteam = "";
tr($lang_upload['row_content'],$team_select,1);
}
//==== offer dropdown for offer mod from code by S4NE
$offerres = sql_query("SELECT id, name FROM offers WHERE userid = ".sqlesc($CURUSER[id])." AND allowed = 'allowed' ORDER BY name ASC") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($offerres) > 0)
{
$offer = "<select name=\"offer\"><option value=\"0\">".$lang_upload['select_choose_one']."</option>";
while($offerrow = mysql_fetch_array($offerres))
$offer .= "<option value=\"" . $offerrow["id"] . "\">" . htmlspecialchars($offerrow["name"]) . "</option>";
$offer .= "</select>";
tr($lang_upload['row_your_offer']. (!$uploadfreely && !$allowspecial ? "<font color=red>*</font>" : ""), $offer.$lang_upload['text_please_select_offer'] , 1);
}
//===end
if(get_user_class()>=$beanonymous_class)
{
tr($lang_upload['row_show_uploader'], "<input type=\"checkbox\" name=\"uplver\" value=\"yes\" />".$lang_upload['checkbox_hide_uploader_note'], 1);
}
?>
<tr><td class="toolbox" align="center" colspan="2"><b><?php echo $lang_upload['text_read_rules']?></b> <input id="qr" type="submit" class="btn" value="<?php echo $lang_upload['submit_upload']?>" /></td></tr>
</table>
</form>
<?php
stdfoot();