php TorrentFlux PHP Torrent Manager www torrentflux com This file is p

  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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?php
/*************************************************************
* TorrentFlux - PHP Torrent Manager
* www.torrentflux.com
**************************************************************/
/*
This file is part of TorrentFlux.
TorrentFlux 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.
TorrentFlux 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 TorrentFlux; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include_once("config.php");
include_once("functions.php");
require_once("metaInfo.php");
$torrent = SecurityClean(getRequestVar('torrent'));
$displayName = $torrent;
if (!file_exists($cfg["torrent_file_path"].$torrent))
{
echo $torrent." could not be found or does not exist.";
die();
}
if(strlen($displayName) >= 55)
{
$displayName = substr($displayName, 0, 52)."...";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?php echo _RUNTORRENT ?> - <?php echo $displayName ?></title>
<LINK REL="StyleSheet" HREF="themes/<?php echo $cfg["theme"] ?>/style.css" TYPE="text/css" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" charset="<?php echo _CHARSET ?>">
<script language="JavaScript">
function StartTorrent()
{
if (ValidateValues())
{
document.theForm.submit();
}
}
function ValidateValues()
{
var rtnValue = true;
var msg = "";
if (isNumber(document.theForm.rate.value) == false)
{
msg = msg + "* Max Upload Rate must be a valid number.\n";
document.theForm.rate.focus();
}
if (isNumber(document.theForm.drate.value) == false)
{
msg = msg + "* Max Download Rate must be a valid number.\n";
document.theForm.drate.focus();
}
if (isNumber(document.theForm.maxuploads.value) == false)
{
msg = msg + "* Max # Uploads must be a valid number.\n";
document.theForm.maxuploads.focus();
}
if ((isNumber(document.theForm.minport.value) == false) || (isNumber(document.theForm.maxport.value) == false))
{
msg = msg + "* Port Range must have valid numbers.\n";
document.theForm.minport.focus();
}
if (isNumber(document.theForm.rerequest.value) == false)
{
msg = msg + "* Rerequest Interval must be a valid number.\n";
document.theForm.rerequest.focus();
}
if (document.theForm.rerequest.value < 10)
{
msg = msg + "* Rerequest Interval must be 10 or greater.\n";
document.theForm.rerequest.focus();
}
if (isNumber(document.theForm.sharekill.value) == false)
{
msg = msg + "* Keep seeding until Sharing % must be a valid number.\n";
document.theForm.sharekill.focus();
}
if ((document.theForm.maxport.value > 65535) || (document.theForm.minport.value > 65535))
{
msg = msg + "* Port can not be higher than 65535.\n";
document.theForm.minport.focus();
}
if ((document.theForm.maxport.value < 0) || (document.theForm.minport.value < 0))
{
msg = msg + "* Can not have a negative number for port value.\n";
document.theForm.minport.focus();
}
if (document.theForm.maxport.value < document.theForm.minport.value)
{
msg = msg + "* Port Range is not valid.\n";
document.theForm.minport.focus();
}
if (msg != "")
{
rtnValue = false;
alert("Please check the following:\n\n" + msg);
}
return rtnValue;
}
function CheckShareState()
{
var obj = document.getElementById('sharekiller');
if (document.theForm.runtime.value == "True")
{
obj.style.visibility = "hidden";
}
else
{
obj.style.visibility = "visible";
}
}
function isNumber(sText)
{
var ValidChars = "0123456789";
var IsNumber = true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}
</script>
</head>
<body bgcolor="<?php echo $cfg["body_data_bg"]; ?>">
<div align="center">
<strong><?php echo $displayName ?></strong><br>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr><form name="theForm" target="_parent" action="index.php" method="POST">
<input type="hidden" name="closeme" value="true">
<input type="hidden" name="torrent" value="<?php echo $torrent; ?>">
<td>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="right">Max Upload Rate:</td>
<td><input type="Text" name="rate" maxlength="4" size="4" value="<?php echo $cfg["max_upload_rate"]; ?>"> kB/s</td>
<td align="right">Max # Uploads:</td>
<td><input type="Text" name="maxuploads" maxlength="2" size="2" value="<?php echo $cfg["max_uploads"]; ?>"></td>
</tr>
<tr>
<td align="right" valign="top">Max Download Rate:</td>
<td valign="top"><input type="Text" name="drate" maxlength="4" size="4" value="<?php echo $cfg["max_download_rate"]; ?>"> kB/s<font class="tiny"> (0 = max)</font></td>
<td align="Left" colspan="2" valign="top"><input type="Checkbox" name="superseeder" value="1">Super Seeder<font class="tiny"> (dedicated seed only)</font></td>
</tr>
<tr>
<td align="right" valign="top">Rerequest Interval:</td>
<td valign="top"><input type="Text" name="rerequest" maxlength="5" size="5" value="<?php echo $cfg["rerequest_interval"]; ?>"></td>
<td align="Left" colspan="2" valign="top">
<?php
if($cfg["AllowQueing"] == true)
{
if ( IsAdmin() )
{
echo "<input type='Checkbox' name='queue' checked>Add to Queue";
}
else
{
// Force Queuing if not an admin.
echo "<input type='hidden' name='queue' value=1>";
}
}
else
{
echo "&nbsp;";
}
echo "</td>";
?>
</tr>
<tr>
<td align="right">Completion:</td>
<td>
<?php
$selected = "";
if ($cfg["torrent_dies_when_done"] == "False")
{
$selected = "selected";
}
?>
<select name="runtime" onchange="CheckShareState()">
<option value="True">Die When Done</option>
<option value="False" <?php echo $selected ?>>Keep Seeding</option>
</select>
</td>
<td align="right">Port Range:</td>
<td>
<input type="Text" name="minport" maxlength="5" size="5" value="<?php echo $cfg["minport"]; ?>">
-
<input type="Text" name="maxport" maxlength="5" size="5" value="<?php echo $cfg["maxport"]; ?>">
</td>
</tr>
<tr>
<td colspan="4" align="center"><div ID="sharekiller" align="center" style="visibility:hidden;">Keep seeding until Sharing is: <input type="Text" name="sharekill" maxlength="4" size="4" value="<?php echo $cfg["sharekill"]; ?>">%<font class="tiny"> (0% will keep seeding)</font>&nbsp;</div></td>
</tr>
</table>
<br>
&nbsp;&nbsp;&nbsp;Torrent Meta Data / Priority Selection:
</td>
</tr>
</table>
<div align="left" id="BodyLayer" name="BodyLayer" style="border: thin solid <?php echo $cfg["main_bgcolor"] ?>; background-color: <?php echo $cfg["bgLight"] ?>; position:relative; width:650; height:290; padding-left: 5px; padding-right: 5px; z-index:1; overflow: scroll; visibility: visible">
<?php
showMetaInfo($torrent,false);
?>
</div>
<br>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="button" id="startbtn" name="startbtn" value="<?php echo _RUNTORRENT ?>" onclick="StartTorrent();">&nbsp;&nbsp;
<input type="button" value="Cancel" onclick="window.close()">
</td>
</tr>
</table>
</form>
</div>
<script language="JavaScript">
CheckShareState();
document.getElementById('startbtn').focus();
</script>
</body>
</html>