diff --git a/admin.php b/admin.php
index d0dcd63..091a32e 100644
--- a/admin.php
+++ b/admin.php
@@ -4,6 +4,7 @@
* Licensed under the GNU Affero General Public License version 3.0
*/
+include "core.php";
include "config.php";
include "create-table.php";
@@ -16,17 +17,8 @@ $Authorized = 0;
$Database = createTables($sqlDB);
$DatabaseQuery = $Database->query('SELECT * FROM admins');
-$html .= "\n";
-$html .= "\n";
-$html .= "\t
\n";
-$html .= "\t\t\n";
+$html = "";
+$html = printHead($html);
if (isset($_REQUEST['key'])) {
$Key = $_REQUEST['key'];
@@ -88,9 +80,7 @@ if (isset($_REQUEST['key'])) {
}
}
-$html .= "\t\t
\n";
-$html .= "\t\n";
-$html .= "\n";
+$html = printFooter($html);
print "$html";
diff --git a/config.ini b/config.ini
index 44618ce..66a2055 100644
--- a/config.ini
+++ b/config.ini
@@ -1,6 +1,7 @@
[html]
instance_name = curload
css = index.css
+javascript = index.js
favicon = favicon.svg
[upload]
diff --git a/config.php b/config.php
index 61a7825..a9c27a9 100644
--- a/config.php
+++ b/config.php
@@ -6,6 +6,7 @@
$configFile = "config.ini";
$Stylesheet = "index.css";
+$javaScript = "index.js";
$Icon = "favicon.svg";
$uploadDir = "uploads/";
$maxFileSize = "100";
@@ -52,4 +53,5 @@ $enableAdminKeys = $configEntries['enable_admin_keys'];
$enableTemporaryKeys = $configEntries['enable_temporary_keys'];
$enableUploadRemoval = $configEntries['enable_upload_removal'];
$enableKeyUploadRemoval = $configEntries['enable_key_upload_removal'];
+$javaScript = $configEntries['javascript'];
?>
diff --git a/core.php b/core.php
new file mode 100644
index 0000000..e0b8de6
--- /dev/null
+++ b/core.php
@@ -0,0 +1,38 @@
+\n";
+ $html .= "\n";
+ $html .= "\t\n";
+ $html .= "\t\t\n";
+
+ return "$html";
+}
+
+function printFooter($html) {
+ include "config.php";
+
+ $html .= "\t\t
\n";
+ $html .= "\t\n";
+ $html .= "\n";
+
+ return "$html";
+}
+
+?>
diff --git a/index.php b/index.php
index 1312416..376cd70 100644
--- a/index.php
+++ b/index.php
@@ -4,30 +4,23 @@
* Licensed under the GNU Affero General Public License version 3.0
*/
-include "config.php";
+function main() {
+ include "config.php";
+ include "core.php";
-$html = "";
-$html .= "\n";
-$html .= "\n";
-$html .= "\t\n";
-$html .= "\t\t\n";
+ $html = "";
+ $html = printHead($html);
-$html .= "\t\t\t
speedie's super awesome file uploader junk
\n";
-$html .= "\t\t\t
\n";
-$html .= "\t\t\t
Max file size: $maxFileSize MB
\n";
-$html .= "\t\t\t
source code\n";
+ $html .= "\t\t\t
speedie's super awesome file uploader junk
\n";
+ $html .= "\t\t\t
\n";
+ $html .= "\t\t\t
Max file size: $maxFileSize MB
\n";
+ $html .= "\t\t\t
source code\n";
-$html .= "\t\t
\n";
-$html .= "\t\n";
-$html .= "\n";
+ $html = printFooter($html);
-print "$html";
+ print "$html";
+}
+
+main();
?>