-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
248 lines (206 loc) · 9.05 KB
/
index.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
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
<?php
$VERSION="0.954";
$time_enter=microtime(true);
require("file_helpers.php");
require("cleaning_support.php");
require("footer.php");
require("visuals.php");
/***************************************************************************
* Copyright (C) 2010 by Periklis Ntanasis , Ammar Qammaz *
*
* *
* This program 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. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
?>
<!DOCTYPE html>
<html>
<head>
<meta name="author" content="Ammar Qammaz" >
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="personal uploader" />
<meta name="description" content="" />
<title>MyLoader @ <?php echo $HOST_NAME; ?></title>
<link rel="stylesheet" type="text/css" href="myloader.css" />
<script src="myloader.js" type="text/javascript"></script>
<style type="text/css">
</style>
<?php
echo $HEAD_HTML_INJECTION;
if ($HTML5_KEYBOARD == 1 )
{
keyboardjs();
}
?>
</head>
<body>
<img id="invisible" src="images/host_logo.png" alt="MyLoader <?php echo $HOST_NAME; ?>" >
<!-- This , here exists in order for url shortners to be able to output the logo of the MyLoader Service :) -->
<div class="MainTab" >
<br><br>
<?php
// THE FOLLOWING CALL PRODUCES THE NICE WEB-DESIGN THINGY ( :P ) WITH THE BLINKING @ IN THE MIDDLE
write_nice_logo($HOST_NAME,$BANNER_NUMBER,$SCRIPT_WEB_BASE,$BANNER_PREFIX);
echo $AFTERLOGO_HTML_INJECTION;
echo "<!-- Version ".$VERSION." -->";
$cache_size = intval(get_cache_size()); //we get the cache size here because it is needed for the bottom line and for quota checks
if(isset($_POST['submit']))
{
//THIS IS DONE TO ENABLE GREEK ETC CHARACTERS TO BE SAVED WITH NO PROBLEMS
//The text is converted to question marks ( ? ) which can be further improved , but the upload works..!
$incoming_file_name = utf8_decode($_FILES['uploadedfile']['name']);
$incoming_file_name = strip_tags($incoming_file_name,0);
$incoming_file_name = stripslashes($incoming_file_name);
if ($ENABLE_URL_UPLOAD == 1 && (strlen($_POST['website'])>0))
{
echo "Website From URL Requested ".$_POST['website'];
DownloadFile($_POST['website']);
}
else
{
$tmpdir = md5($incoming_file_name.date('l jS \of F Y h:i:s A'));
if ( ($MAXIMUM_CACHE_QUOTA!=0) && ($cache_size>$MAXIMUM_CACHE_QUOTA) )
{
echo "<h2> ".$HOST_NAME." has exceeded its storage quota </h2>";
echo "<h4> We are sorry but you will have to wait until some of the older content is removed , thank you!</h4>";
if ( $ENABLE_MIRROR_LINK == 1 )
{ echo "<h5> You can also <a href=\"mirrors.php\">try another host</a></h5>"; }
}
else
if($_FILES['uploadedfile']['size']>$LOCAL_PHP_FILE_LIMIT)
{
echo "Files > ".($LOCAL_PHP_FILE_LIMIT/(1024*1024))."MB are not permitted";
}
if($_FILES['uploadedfile']['size']==0)
{
echo "<h2>You provided no file to upload!</h2>";
}
else
{
$copypastebutton1="";
$copypastebutton2="";
$base_path = "./".$SCRIPT_CACHE_FOLDERNAME."/";
$new_filename = $tmpdir."-".basename($incoming_file_name);
//New file.php file sender
$direct_target_path = "file.php?i=".urlencode($new_filename);
$new_target_path = "vfile.php?i=".urlencode($new_filename);
$target_path = $base_path.$new_filename;
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path))
{
echo "<br/>The file <b>".basename($incoming_file_name);
$thefilesize=filesize($target_path);
if ( $thefilesize>1024*1024 ) { echo " ".number_format($thefilesize/(1024*1024),2)." MB "; } else
if ( $thefilesize>1024 ) { echo " ".number_format($thefilesize/1024,2)." KB "; } else
{ echo " ".$thefilesize." bytes "; }
echo "</b> has been uploaded<br/>";
add_to_cache_size($_FILES['uploadedfile']['size']);
echo "<br/>";
echo "You can access the file <a href='$new_target_path' target=\"_new\">here</a>";
if($ENABLE_GOOGLEDOCS_LINK == 1)
{
$gdocsExtensions = array("pdf","ppt","pptx","tiff");
if (in_array(end(explode(".",strtolower($incoming_file_name))),$gdocsExtensions))
{
echo " - @<a href=\"http://docs.google.com/viewer?url=".urlencode($SCRIPT_WEB_BASE.$direct_target_path)."\">GoogleDocs</a>";
}
}
$weblink=$SCRIPT_WEB_BASE.$new_target_path;
$directlink=$SCRIPT_WEB_BASE.$direct_target_path;
if ( $HTML5_CLIPBOARD == 1 )
{
//THIS DOES NOT WORK , TODO : drop in replacement for this..!
$copypastebutton1="<button id=\"cpbtn1\" onclick=\"copyPasteLinkHTML5('".$weblink."');\" >Copy</button>";
$copypastebutton2="<button id=\"cpbtn2\" onclick=\"copyPasteLinkHTML5('".$directlink."');\" >Copy</button>";
#echo "\n<script>\n";
#echo "$(\"#cpbtn1\").on('click', function (e) { var clip = new ClipboardEvent('copy'); clip.clipboardData.setData('text/plain', \"".$weblink."\"); clip.preventDefault(); e.target.dispatchEvent(clip); }); ";
#echo "$(\"#cpbtn2\").on('click', function (e) { var clip = new ClipboardEvent('copy'); clip.clipboardData.setData('text/plain', \"".$directlink."\"); clip.preventDefault(); e.target.dispatchEvent(clip); }); ";
#echo "\n</script>\n" ;
}
echo "<br/><br/>
<table id=\"StayCentered\">
<tr>
<td>Link : </td>
<td><input type=\"text\" value=\"".$weblink."\"> $copypastebutton1 </td>
</tr>";
echo "<tr>
<td>Direct Link : </td>
<td><input type=\"text\" value=\"".$directlink."\"> $copypastebutton2</td>
</tr>
</table>
</br></br>";
$WILL_CHECK_IF_UPLOAD_DIR_NEEDS_CLEANING=1;
}
else
{
echo "There was an error uploading the file, please try again! ( the file could not be moved )<br> ";
}
}
}
echo '<a href="index.php">Return to MyLoader!</a>';
}
else
{
echo
"<br>
<table id=\"StayCentered\" >
<tr><td>";
if ( ($MAXIMUM_CACHE_QUOTA!=0) && ($cache_size>$MAXIMUM_CACHE_QUOTA) )
{
/* Server over cache quotta no use uploading anything*/
echo "<b>This Server has exceeded its cache quotta!</b>";
} else
{
echo "
<form enctype=\"multipart/form-data\" action=\"index.php\" method=\"POST\">
<input type=\"hidden\" name=\"rawresponse\" value=\"NO\" />
File to upload: <input name=\"uploadedfile\" type=\"file\" />
<input type=\"submit\" value=\"Upload File\" name=\"submit\" />";
}
if ($ENABLE_RANDOM_FILE==1)
{
echo " <input type=\"button\" value=\"".$RANDOM_FILE_BUTTON_LABEL."\" name=\"submit\" onclick=\"window.location.href='random.php';return false\" />";
}
if ($ENABLE_URL_UPLOAD ==1 )
{
// MORE OPTIONS ARE INCLUDED HERE
echo "<br><span id=\"buttonmoreoptions\" class=\"is_on\" onclick=\"make_moreoptions_visible();\"><span id=\"Footnote\"><a href=\"#\" >More Upload Options</a></span></span>";
echo "<span id=\"moreoptions\" class=\"is_off\"><br>
URL : <input name=\"website\" type=\"text\" />
<br><br><span id=\"Footnote\"><a href=\"#\" onclick=\"make_moreoptions_invisible()\" >Less Upload Options</a></span>
</span>";
// MORE OPTIONS ARE INCLUDED HERE
}
echo
"
</form>
</td></tr>
</table>
";
}
?>
<br/><br/>
<?php echo $BEFOREFOOTER_HTML_INJECTION;
write_footer($time_enter,$HOST_NAME,$LOCAL_PHP_FILE_LIMIT,$cache_size,$ENABLE_FILE_INDEXING,$ENABLE_MIRROR_LINK,$ENABLE_SHOW_STATS);
echo $AFTERFOOTER_HTML_INJECTION; ?>
</div>
</body>
</html>
<?php
if ( $WILL_CHECK_IF_UPLOAD_DIR_NEEDS_CLEANING==1 )
{
check_and_clean_uploads();
}
?>