Add the ability to include javascript
This commit is contained in:
parent
4a4978cb27
commit
8af14ad90d
18
admin.php
18
admin.php
|
@ -4,6 +4,7 @@
|
||||||
* Licensed under the GNU Affero General Public License version 3.0
|
* Licensed under the GNU Affero General Public License version 3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
include "core.php";
|
||||||
include "config.php";
|
include "config.php";
|
||||||
include "create-table.php";
|
include "create-table.php";
|
||||||
|
|
||||||
|
@ -16,17 +17,8 @@ $Authorized = 0;
|
||||||
$Database = createTables($sqlDB);
|
$Database = createTables($sqlDB);
|
||||||
$DatabaseQuery = $Database->query('SELECT * FROM admins');
|
$DatabaseQuery = $Database->query('SELECT * FROM admins');
|
||||||
|
|
||||||
$html .= "<!DOCTYPE html>\n";
|
$html = "";
|
||||||
$html .= "<html>\n";
|
$html = printHead($html);
|
||||||
$html .= "\t<head>\n";
|
|
||||||
$html .= "\t\t<meta name=\"description\" content=\"Site administration\">\n";
|
|
||||||
$html .= "\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n";
|
|
||||||
$html .= "\t\t<link rel=\"icon\" href=\"$Icon\" />\n";
|
|
||||||
$html .= "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"$Stylesheet\"/>\n";
|
|
||||||
$html .= "\t\t<title>Administration - $instanceName</title>\n";
|
|
||||||
$html .= "\t</head>\n";
|
|
||||||
$html .= "\t<body>\n";
|
|
||||||
$html .= "\t\t<div class=\"content\">\n";
|
|
||||||
|
|
||||||
if (isset($_REQUEST['key'])) {
|
if (isset($_REQUEST['key'])) {
|
||||||
$Key = $_REQUEST['key'];
|
$Key = $_REQUEST['key'];
|
||||||
|
@ -88,9 +80,7 @@ if (isset($_REQUEST['key'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= "\t\t</div>\n";
|
$html = printFooter($html);
|
||||||
$html .= "\t</body>\n";
|
|
||||||
$html .= "</html>\n";
|
|
||||||
|
|
||||||
print "$html";
|
print "$html";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[html]
|
[html]
|
||||||
instance_name = curload
|
instance_name = curload
|
||||||
css = index.css
|
css = index.css
|
||||||
|
javascript = index.js
|
||||||
favicon = favicon.svg
|
favicon = favicon.svg
|
||||||
|
|
||||||
[upload]
|
[upload]
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
$configFile = "config.ini";
|
$configFile = "config.ini";
|
||||||
$Stylesheet = "index.css";
|
$Stylesheet = "index.css";
|
||||||
|
$javaScript = "index.js";
|
||||||
$Icon = "favicon.svg";
|
$Icon = "favicon.svg";
|
||||||
$uploadDir = "uploads/";
|
$uploadDir = "uploads/";
|
||||||
$maxFileSize = "100";
|
$maxFileSize = "100";
|
||||||
|
@ -52,4 +53,5 @@ $enableAdminKeys = $configEntries['enable_admin_keys'];
|
||||||
$enableTemporaryKeys = $configEntries['enable_temporary_keys'];
|
$enableTemporaryKeys = $configEntries['enable_temporary_keys'];
|
||||||
$enableUploadRemoval = $configEntries['enable_upload_removal'];
|
$enableUploadRemoval = $configEntries['enable_upload_removal'];
|
||||||
$enableKeyUploadRemoval = $configEntries['enable_key_upload_removal'];
|
$enableKeyUploadRemoval = $configEntries['enable_key_upload_removal'];
|
||||||
|
$javaScript = $configEntries['javascript'];
|
||||||
?>
|
?>
|
||||||
|
|
38
core.php
Normal file
38
core.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
/* curload
|
||||||
|
* Simple file uploading using POST requests and temporary keys
|
||||||
|
* Licensed under the GNU Affero General Public License version 3.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
function printHead($html) {
|
||||||
|
include "config.php";
|
||||||
|
|
||||||
|
$html .= "<!DOCTYPE html>\n";
|
||||||
|
$html .= "<html>\n";
|
||||||
|
$html .= "\t<head>\n";
|
||||||
|
$html .= "\t\t<meta name=\"description\" content=\"$instanceName is a simple file uploading site allowing users to upload files by authenticating using a key.\">\n";
|
||||||
|
$html .= "\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n";
|
||||||
|
|
||||||
|
if (file_exists($Icon)) $html .= "\t\t<link rel=\"icon\" href=\"$Icon\" />\n";
|
||||||
|
if (file_exists($Stylesheet)) $html .= "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"$Stylesheet\"/>\n";
|
||||||
|
if (file_exists($javaScript)) $html .= "\t\t<script src=\"$javaScript\"></script>\n";
|
||||||
|
|
||||||
|
$html .= "\t\t<title>$instanceName</title>\n";
|
||||||
|
$html .= "\t</head>\n";
|
||||||
|
$html .= "\t<body>\n";
|
||||||
|
$html .= "\t\t<div class=\"content\">\n";
|
||||||
|
|
||||||
|
return "$html";
|
||||||
|
}
|
||||||
|
|
||||||
|
function printFooter($html) {
|
||||||
|
include "config.php";
|
||||||
|
|
||||||
|
$html .= "\t\t</div>\n";
|
||||||
|
$html .= "\t</body>\n";
|
||||||
|
$html .= "</html>\n";
|
||||||
|
|
||||||
|
return "$html";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
35
index.php
35
index.php
|
@ -4,30 +4,23 @@
|
||||||
* Licensed under the GNU Affero General Public License version 3.0
|
* Licensed under the GNU Affero General Public License version 3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include "config.php";
|
function main() {
|
||||||
|
include "config.php";
|
||||||
|
include "core.php";
|
||||||
|
|
||||||
$html = "";
|
$html = "";
|
||||||
$html .= "<!DOCTYPE html>\n";
|
$html = printHead($html);
|
||||||
$html .= "<html>\n";
|
|
||||||
$html .= "\t<head>\n";
|
|
||||||
$html .= "\t\t<meta name=\"description\" content=\"$instanceName is a simple file uploading site allowing users to upload files by authenticating using a key.\">\n";
|
|
||||||
$html .= "\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n";
|
|
||||||
$html .= "\t\t<link rel=\"icon\" href=\"$Icon\" />\n";
|
|
||||||
$html .= "\t\t<link type=\"text/css\" rel=\"stylesheet\" href=\"$Stylesheet\"/>\n";
|
|
||||||
$html .= "\t\t<title>$instanceName</title>\n";
|
|
||||||
$html .= "\t</head>\n";
|
|
||||||
$html .= "\t<body>\n";
|
|
||||||
$html .= "\t\t<div class=\"content\">\n";
|
|
||||||
|
|
||||||
$html .= "\t\t\t<h1>speedie's super awesome file uploader junk</h1>\n";
|
$html .= "\t\t\t<h1>speedie's super awesome file uploader junk</h1>\n";
|
||||||
$html .= "\t\t\t<form action=\"upload.php\" method=\"post\" enctype=\"multipart/form-data\">Select file to upload<br><input type=\"file\" name=\"file\" id=\"file\"><br><input type=\"text\" name=\"key\" placeholder=\"Upload key here\"><br><input type=\"submit\" value=\"Upload selected file\" name=\"web\"></form>\n";
|
$html .= "\t\t\t<form action=\"upload.php\" method=\"post\" enctype=\"multipart/form-data\">Select file to upload<br><input type=\"file\" name=\"file\" id=\"file\"><br><input type=\"text\" name=\"key\" placeholder=\"Upload key here\"><br><input type=\"submit\" value=\"Upload selected file\" name=\"web\"></form>\n";
|
||||||
$html .= "\t\t\t<p>Max file size: $maxFileSize MB</p>\n";
|
$html .= "\t\t\t<p>Max file size: $maxFileSize MB</p>\n";
|
||||||
$html .= "\t\t\t<a href=\"https://git.speedie.site/speedie/curload\">source code</a>\n";
|
$html .= "\t\t\t<a href=\"https://git.speedie.site/speedie/curload\">source code</a>\n";
|
||||||
|
|
||||||
$html .= "\t\t</div>\n";
|
$html = printFooter($html);
|
||||||
$html .= "\t</body>\n";
|
|
||||||
$html .= "</html>\n";
|
|
||||||
|
|
||||||
print "$html";
|
print "$html";
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue