Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
36 kaklik 1
<?php
2
 
3
/*************************************************************
4
*  TorrentFlux - PHP Torrent Manager
5
*  www.torrentflux.com
6
**************************************************************/
7
/*
8
    This file is part of TorrentFlux.
9
 
10
    TorrentFlux is free software; you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation; either version 2 of the License, or
13
    (at your option) any later version.
14
 
15
    TorrentFlux is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with TorrentFlux; if not, write to the Free Software
22
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
*/
24
 
25
include_once("config.php");
26
include_once("functions.php");
27
require_once("metaInfo.php");
28
 
29
$torrent = getRequestVar('torrent');
30
$displayName = $torrent;
31
 
32
if(strlen($displayName) >= 55)
33
{
34
    $displayName = substr($displayName, 0, 52)."...";
35
}
36
 
37
?>
38
 
39
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
40
 
41
<html>
42
<head>
43
    <title><?php echo _RUNTORRENT ?> - <?php echo $displayName ?></title>
44
    <LINK REL="StyleSheet" HREF="themes/<?php echo $cfg["theme"] ?>/style.css" TYPE="text/css" />
45
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache; charset=<?php echo _CHARSET ?>">
46
 
47
<script language="JavaScript">
48
function StartTorrent()
49
{
50
 
51
    if (ValidateValues())
52
    {
53
        document.theForm.submit();
54
    }
55
}
56
 
57
function ValidateValues()
58
{
59
 
60
    var rtnValue = true;
61
    var msg = "";
62
    if (isNumber(document.theForm.rate.value) == false)
63
    {
64
        msg = msg + "* Max Upload Rate must be a valid number.\n";
65
        document.theForm.rate.focus();
66
    }
67
    if (isNumber(document.theForm.drate.value) == false)
68
    {
69
        msg = msg + "* Max Download Rate must be a valid number.\n";
70
        document.theForm.drate.focus();
71
    }
72
    if (isNumber(document.theForm.maxuploads.value) == false)
73
    {
74
        msg = msg + "* Max # Uploads must be a valid number.\n";
75
        document.theForm.maxuploads.focus();
76
    }
77
    if ((isNumber(document.theForm.minport.value) == false) || (isNumber(document.theForm.maxport.value) == false))
78
    {
79
        msg = msg + "* Port Range must have valid numbers.\n";
80
        document.theForm.minport.focus();
81
    }
82
    if (isNumber(document.theForm.rerequest.value) == false)
83
    {
84
        msg = msg + "* Rerequest Interval must be a valid number.\n";
85
        document.theForm.rerequest.focus();
86
    }
87
    if (document.theForm.rerequest.value < 10)
88
    {
89
        msg = msg + "* Rerequest Interval must be 10 or greater.\n";
90
        document.theForm.rerequest.focus();
91
    }
92
    if (isNumber(document.theForm.sharekill.value) == false)
93
    {
94
        msg = msg + "* Keep seeding until Sharing % must be a valid number.\n";
95
        document.theForm.sharekill.focus();
96
    }
97
    if ((document.theForm.maxport.value > 65535) || (document.theForm.minport.value > 65535))
98
    {
99
        msg = msg + "* Port can not be higher than 65535.\n";
100
        document.theForm.minport.focus();
101
    }
102
    if ((document.theForm.maxport.value < 0) || (document.theForm.minport.value < 0))
103
    {
104
        msg = msg + "* Can not have a negative number for port value.\n";
105
        document.theForm.minport.focus();
106
    }
107
    if (document.theForm.maxport.value < document.theForm.minport.value)
108
    {
109
        msg = msg + "* Port Range is not valid.\n";
110
        document.theForm.minport.focus();
111
    }
112
 
113
    if (msg != "")
114
    {
115
        rtnValue = false;
116
        alert("Please check the following:\n\n" + msg);
117
    }
118
 
119
    return rtnValue;
120
}
121
 
122
function CheckShareState()
123
{
124
 
125
    var obj = document.getElementById('sharekiller');
126
    if (document.theForm.runtime.value == "True")
127
    {
128
        obj.style.visibility = "hidden";
129
    }
130
    else
131
    {
132
        obj.style.visibility = "visible";
133
    }
134
}
135
 
136
function isNumber(sText)
137
{
138
    var ValidChars = "0123456789";
139
    var IsNumber = true;
140
    var Char;
141
 
142
    for (i = 0; i < sText.length && IsNumber == true; i++)
143
    {
144
        Char = sText.charAt(i);
145
        if (ValidChars.indexOf(Char) == -1)
146
        {
147
            IsNumber = false;
148
        }
149
    }
150
 
151
    return IsNumber;
152
}
153
</script>
154
 
155
</head>
156
 
157
<body bgcolor="<?php echo $cfg["body_data_bg"]; ?>">
158
 
159
<div align="center">
160
<strong><?php echo $displayName ?></strong><br>
161
<table width="98%" border="0" cellpadding="0" cellspacing="0">
162
<tr><form name="theForm" target="_parent" action="index.php" method="POST">
163
    <input type="hidden" name="closeme" value="true">
164
    <input type="hidden" name="torrent" value="<?php echo $torrent; ?>">
165
    <td>
166
 
167
        <table width="100%" cellpadding="2" cellspacing="0" border="0">
168
        <tr>
169
            <td align="right">Max Upload Rate:</td>
170
            <td><input type="Text" name="rate" maxlength="4" size="4" value="<?php echo $cfg["max_upload_rate"]; ?>"> kB/s</td>
171
            <td align="right">Max # Uploads:</td>
172
            <td><input type="Text" name="maxuploads" maxlength="2" size="2" value="<?php echo $cfg["max_uploads"]; ?>"></td>
173
        </tr>
174
        <tr>
175
            <td align="right" valign="top">Max Download Rate:</td>
176
            <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>
177
            <td align="Left" colspan="2" valign="top"><input type="Checkbox" name="superseeder" value="1">Super Seeder<font class="tiny"> (dedicated seed only)</font></td>
178
        </tr>
179
        <tr>
180
            <td align="right" valign="top">Rerequest Interval:</td>
181
            <td valign="top"><input type="Text" name="rerequest" maxlength="5" size="5" value="<?php echo $cfg["rerequest_interval"]; ?>"></td>
182
            <td align="Left" colspan="2" valign="top">
183
<?php
184
    if($cfg["AllowQueing"] == true)
185
    {
186
        if ( IsAdmin() )
187
        {
188
            echo "<input type='Checkbox' name='queue' checked>Add to Queue";
189
        }
190
        else
191
        {
192
            // Force Queuing if not an admin.
193
            echo "<input type='hidden' name='queue' value=1>";
194
        }
195
    }
196
    else
197
    {
198
        echo "&nbsp;";
199
    }
200
    echo "</td>";
201
?>
202
 
203
        </tr>
204
        <tr>
205
            <td align="right">Completion:</td>
206
            <td>
207
                <?php
208
                    $selected = "";
209
                    if ($cfg["torrent_dies_when_done"] == "False")
210
                    {
211
                        $selected = "selected";
212
                    }
213
                ?>
214
 
215
                <select name="runtime" onchange="CheckShareState()">
216
                        <option value="True">Die When Done</option>
217
                        <option value="False" <?php echo $selected ?>>Keep Seeding</option>
218
                </select>
219
            </td>
220
            <td align="right">Port Range:</td>
221
            <td>
222
            <input type="Text" name="minport" maxlength="5" size="5" value="<?php echo $cfg["minport"]; ?>">
223
            -
224
            <input type="Text" name="maxport" maxlength="5" size="5" value="<?php echo $cfg["maxport"]; ?>">
225
            </td>
226
        </tr>
227
        <tr>
228
            <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>
229
        </tr>
230
        </table>
231
        <br>
232
        &nbsp;&nbsp;&nbsp;Torrent Meta Data / Priority Selection:
233
    </td>
234
</tr>
235
</table>
236
<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">
237
<?php
238
    showMetaInfo($torrent,false);
239
?>
240
</div>
241
<br>
242
<table border="0" cellpadding="0" cellspacing="0">
243
<tr>
244
    <td>
245
    <input type="button" id="startbtn" name="startbtn" value="<?php echo _RUNTORRENT ?>" onclick="StartTorrent();">&nbsp;&nbsp;
246
    <input type="button" value="Cancel" onclick="window.close()">
247
    </td>
248
</tr>
249
</table>
250
</form>
251
</div>
252
<script language="JavaScript">
253
    CheckShareState();
254
    document.getElementById('startbtn').focus();
255
</script>
256
</body>
257
</html>