Browse Source

Update things

master
Skylar Ittner 6 months ago
parent
commit
c5f9b01554
2 changed files with 140 additions and 121 deletions
  1. 1
    1
      LICENSE.md
  2. 139
    120
      index.php

+ 1
- 1
LICENSE.md View File

@@ -1,4 +1,4 @@
1
-Copyright 2018 Netsyms Technologies
1
+Copyright 2018-2019 Netsyms Technologies
2 2
 
3 3
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 4
 

+ 139
- 120
index.php View File

@@ -4,7 +4,7 @@ Nice Dirlist
4 4
 
5 5
 https://source.netsyms.com/Netsyms/NiceDirlist
6 6
 
7
-Copyright 2018 Netsyms Technologies
7
+Copyright 2018-2019 Netsyms Technologies
8 8
 
9 9
 Redistribution and use in source and binary forms, with or without
10 10
 modification, are permitted provided that the following conditions are met:
@@ -58,15 +58,10 @@ $MIRRORBASE = [
58 58
 ];
59 59
 */
60 60
 
61
-// Bootstrap and optional CSS
61
+// Bootstrap, FontAwesome, and optional CSS
62 62
 $STYLESHEETS = [
63
-	"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
64
-];
65
-// FontAwesome 5 locations
66
-$FONTAWESOME = [
67
-	"https://use.fontawesome.com/releases/v5.0.9/js/solid.js",
68
-	"https://use.fontawesome.com/releases/v5.0.9/js/brands.js",
69
-	"https://use.fontawesome.com/releases/v5.0.9/js/fontawesome.js"
63
+	"https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css",
64
+	"https://use.fontawesome.com/releases/v5.6.3/css/all.css"
70 65
 ];
71 66
 // Mimetype to FontAwesome conversion table
72 67
 $MIMEICONS = [
@@ -76,7 +71,7 @@ $MIMEICONS = [
76 71
 	// Text/Code
77 72
 	"text/html" => "fab fa-html5",
78 73
 	"text/css" => "fab fa-css3",
79
-	"text/csv" => "fas fa-table",
74
+	"text/csv" => "fas fa-file-csv",
80 75
 	"application/ecmascript" => "fas fa-code",
81 76
 	"text/calendar" => "fas fa-calendar",
82 77
 	"application/javascript" => "fab fa-js",
@@ -91,7 +86,12 @@ $MIMEICONS = [
91 86
 	"text/checksum" => "fas fa-file-medical-alt",
92 87
 	"text/config" => "fas fa-list",
93 88
 	"text/other" => "fas fa-file-alt",
94
-	// Archives and disk images
89
+	"text/x-java-source" => "fab fa-java",
90
+	"application/x-python-code" => "fab fa-python",
91
+	"text/x-vcard" => "fas fa-address-card",
92
+	"text/x-c" => "fas fa-code",
93
+	"text/x-asm" => "fas fa-microchip",
94
+	// Archives, disk images, and executables
95 95
 	"application/x-iso9660-image" => "fas fa-hdd",
96 96
 	"application/x-gzip" => "fas fa-file-archive",
97 97
 	"application/zip" => "fas fa-file-archive",
@@ -100,11 +100,15 @@ $MIMEICONS = [
100 100
 	"application/x-7z-compressed" => "fas fa-file-archive",
101 101
 	"application/x-msi" => "fab fa-windows",
102 102
 	"application/x-msdownload" => "fab fa-windows",
103
-	"application/java-archive" => "fas fa-coffee",
103
+	"application/java-archive" => "fab fa-java",
104
+	"application/x-java-jnlp-file" => "fab fa-java",
104 105
 	"application/x-rar-compressed" => "fas fa-file-archive",
105 106
 	"application/x-tar" => "fas fa-file-archive",
106 107
 	"application/x-apple-diskimage" => "fab fa-apple",
107 108
 	"application/imgfile" => "fas fa-hdd",
109
+	"application/x-debian-package" => "fab fa-linux",
110
+	"application/x-appimage" => "fab fa-linux",
111
+	"application/x-msdownload" => "fab fa-windows",
108 112
 	// Fonts
109 113
 	"application/vnd.ms-fontobject" => "fas fa-font",
110 114
 	"application/x-font-ttf" => "fas fa-font",
@@ -124,6 +128,7 @@ $MIMEICONS = [
124 128
 	"image/tiff" => "fas fa-image",
125 129
 	"image/webp" => "fas fa-image",
126 130
 	"image/other" => "fas fa-image",
131
+	"application/postscript" => "fas fa-file-image",
127 132
 	// Audio
128 133
 	"audio/acc" => "fas fa-file-audio",
129 134
 	"audio/ogg" => "fas fa-file-audio",
@@ -133,6 +138,8 @@ $MIMEICONS = [
133 138
 	"audio/3gpp" => "fas fa-file-audio",
134 139
 	"audio/3gpp2" => "fas fa-file-audio",
135 140
 	"audio/other" => "fas fa-file-audio",
141
+	"audio/mpeg" => "fas fa-file-audio",
142
+	"application/vnd.apple.mpegurl" => "fas fa-podcast",
136 143
 	// Video
137 144
 	"application/x-shockwave-flash" => "fas fa-video-slash",
138 145
 	"video/mpeg" => "fas fa-file-video",
@@ -141,6 +148,7 @@ $MIMEICONS = [
141 148
 	"video/3gpp" => "fas fa-file-video",
142 149
 	"video/3gpp2" => "fas fa-file-video",
143 150
 	"video/other" => "fas fa-file-video",
151
+	"video/x-matroska" => "fas fa-file-video",
144 152
 	// Office files
145 153
 	"application/x-abiword" => "fas fa-file-word",
146 154
 	"application/msword" => "fas fa-file-word",
@@ -152,12 +160,24 @@ $MIMEICONS = [
152 160
 	"application/vnd.oasis.opendocument.text" => "fas fa-file-word",
153 161
 	"application/pdf" => "fas fa-file-pdf",
154 162
 	"application/rtf" => "fas fa-file",
163
+	"application/x-gnumeric" => "fas fa-file-excel",
155 164
 	// Other
156 165
 	"application/vnd.amazon.ebook" => "fas fa-book",
157 166
 	"application/epub+zip" => "fas fa-book",
167
+	"application/x-mobipocket-ebook" => "fas fa-book",
158 168
 	"application/ogg" => "fas fa-play",
159 169
 	"application/x-sql" => "fas fa-database",
160 170
 	"application/odb" => "fas fa-database",
171
+	"application/gpx+xml" => "fas fa-compass",
172
+	"application/java-serialized-object" => "fab fa-java",
173
+	"application/java-vm" => "fab fa-java",
174
+	"application/x-ms-shortcut" => "fas fa-external-link-alt",
175
+	"application/x-bittorrent" => "fas fa-share-alt",
176
+	"application/x-pkcs12" => "fas fa-certificate",
177
+	"application/pgp-encrypted" => "fas fa-lock",
178
+	"application/pgp-signature" => "fas fa-file-signature",
179
+	"model/mesh" => "fas fa-cube",
180
+	"model/vnd.dwf" => "fas fa-cube",
161 181
 ];
162 182
 // File extension to mimetype conversion
163 183
 $EXT2MIME = [
@@ -180,6 +200,8 @@ $EXT2MIME = [
180 200
 	"img" => "application/imgfile",
181 201
 	"ini" => "text/config",
182 202
 	"yml" => "text/config",
203
+	"py" => "application/x-python-code",
204
+	"appimage" => "application/x-appimage",
183 205
 	// From Apache: http://svn.apache.org/viewvc?view=revision&revision=1810122
184 206
 	"ez" => "application/andrew-inset",
185 207
 	"aw" => "application/applixware",
@@ -1223,116 +1245,113 @@ word-break: break-all;
1223 1245
 	}
1224 1246
 }
1225 1247
 </style>
1226
-<?php
1227
-foreach ($FONTAWESOME as $fa) {
1228
-	echo "<script src=\"$fa\"></script>\n";
1229
-}
1230
-?>
1231 1248
 <div class="container">
1232
-<div class="card">
1233
-<div class="card-body">
1234
-<div class="row">
1235
-<div class="col-12 col-md-4 col-lg-2" style="text-align: center;">
1236
-<img src="<?php echo $SITEICON; ?>" class="site-icon" />
1237
-</div>
1238
-<div class="col-12 col-md-8 col-lg-10">
1239
-<div class="d-flex flex-column justify-content-center" style="height: 100%;">
1240
-<h1 class="display-4"><?php echo $H1; ?></h1>
1241
-<h2 class="display-5"><?php echo $H2; ?></h2>
1242
-</div>
1243
-</div>
1244
-</div>
1245
-</div>
1246
-</div>
1247
-
1248
-<div class="row mt-4">
1249 1249
 
1250
-<div class="col-12">
1251
-<div class="card">
1252
-<div class="card-header d-flex">
1253
-<span class="mr-auto">
1254
-<nav aria-label="breadcrumb">
1255
-<ol class="breadcrumb m-0">
1256
-<?php
1257
-$pathparts = explode("/", $path);
1258
-$pstr = "";
1259
-for ($i = 0; $i < count($pathparts)-1; $i++) {
1260
-	$p = $pathparts[$i];
1261
-	$pstr .= $p . "/";
1262
-	if ($i == 0) {
1263
-		$p = "<span class=\"fas fa-home\"></span>";
1264
-	}
1265
-	if ($i+1 == count($pathparts)-1) {
1266
-		echo "\t<li aria-current=\"page\" class=\"breadcrumb-item active\">$p</li>";
1267
-	} else {
1268
-		echo "\t<li class=\"breadcrumb-item\"><a href=\"$pstr\">$p</a></li>";
1269
-	}
1270
-	echo "\n";
1271
-}
1272
-?>
1273
-</ol>
1274
-</nav>
1275
-</span>
1276
-</div>
1277
-<div class="card-body">
1278
-<ul class="list-group">
1279
-<?php
1280
-$files = scandir($dir);
1281
-foreach ($files as $f) {
1282
-	if (strpos($f, '.') !== 0 && !in_array($f, $IGNORE)) {
1283
-		echo "<li class=\"list-group-item d-flex\">\n";
1284
-		echo "\t<a href=\"$path$f\">";
1285
-		if (is_dir($dir . "/" . $f)) {
1286
-			echo "<span class=\"fas fa-folder fa-fw\"></span> ";
1287
-		} else {
1288
-			$icon = "fas fa-file";
1289
-			$extension = pathinfo("$dir/$f")['extension'];
1290
-			// If we don't have an extension, try using the whole filename
1291
-			if ($extension == "") {
1292
-				$extension = $f;
1293
-			}
1294
-			$mimetype = "application/octet-stream";
1295
-			// Lookup mimetype from extension
1296
-			if (array_key_exists($extension, $EXT2MIME)) {
1297
-				$mimetype = $EXT2MIME[$extension];	
1298
-			}
1299
-			// Lookup icon from mimetype
1300
-			if (array_key_exists($mimetype, $MIMEICONS)) {
1301
-				$icon = $MIMEICONS[$mimetype];
1302
-			} else { // Allow broad generic <format>/other icons
1303
-				$mimefirst = explode("/", $mimetype, 2)[0];
1304
-				if (array_key_exists($mimefirst."/other", $MIMEICONS)) {
1305
-					$icon = $MIMEICONS[$mimetype];
1306
-				}
1307
-			}
1308
-			echo "<span class=\"$icon fa-fw\"></span> ";
1309
-		}
1310
-		echo $f . "</a>\n";
1311
-		if (count($MIRRORBASE) > 0 && !is_dir($dir . "/" . $f)) {
1312
-			echo "<span class=\"d-inline-flex justify-content-end "
1313
-			 . "align-items-center flex-wrap ml-auto\">\n";
1314
-			echo "\t<a href=\"$path$f\" class=\"my-1 btn btn-outline-default btn-sm\">"
1315
-			 . "<span class=\"fas fa-cloud-download-alt\"></span>"
1316
-			 . " Main</a>\n";
1317
-			foreach ($MIRRORBASE as $mirror) {
1318
-				$name = $mirror["name"];
1319
-				$base = $mirror["base"];
1320
-				echo "\t<a href=\"$base$path$f\""
1321
-				 . " class=\"ml-2 my-1 btn btn-outline-default btn-sm\">"
1322
-				 . "<span class=\"fas fa-cloud-download-alt\"></span>"
1323
-				 . " $name</a>\n";
1324
-			}
1325
-			echo "</span>";
1326
-		}
1327
-		echo "</li>\n\n";
1328
-	}
1329
-}
1330
-?>
1331
-</ul>
1332
-</div>
1333
-</div>
1334
-</div>
1250
+    <div class="card">
1251
+        <div class="card-body">
1252
+            <div class="row">
1253
+                <div class="col-12 col-md-4 col-lg-2" style="text-align: center;">
1254
+                    <img src="<?php echo $SITEICON; ?>" class="site-icon" />
1255
+                </div>
1256
+                <div class="col-12 col-md-8 col-lg-10">
1257
+                    <div class="d-flex flex-column justify-content-center" style="height: 100%;">
1258
+                        <h1 class="display-4"><?php echo $H1; ?></h1>
1259
+                        <h2 class="display-5"><?php echo $H2; ?></h2>
1260
+                    </div>
1261
+                </div>
1262
+            </div>
1263
+        </div>
1264
+    </div>
1335 1265
 
1336
-</div>
1266
+    <div class="row mt-4">
1267
+        <div class="col-12">
1268
+            <div class="card">
1269
+            
1270
+                <div class="card-header d-flex">
1271
+                    <span class="mr-auto">
1272
+                        <nav aria-label="breadcrumb">
1273
+                            <ol class="breadcrumb m-0">
1274
+                                <?php
1275
+                                $pathparts = explode("/", $path);
1276
+                                $pstr = "";
1277
+                                for ($i = 0; $i < count($pathparts)-1; $i++) {
1278
+                                    $p = $pathparts[$i];
1279
+                                    $pstr .= $p . "/";
1280
+                                    if ($i == 0) {
1281
+                                        $p = "<span class=\"fas fa-home\"></span>";
1282
+                                    }
1283
+                                    if ($i+1 == count($pathparts)-1) {
1284
+                                        echo "\t<li aria-current=\"page\" class=\"breadcrumb-item active\">$p</li>";
1285
+                                    } else {
1286
+                                        echo "\t<li class=\"breadcrumb-item\"><a href=\"$pstr\">$p</a></li>";
1287
+                                    }
1288
+                                    echo "\n";
1289
+                                }
1290
+                                ?>
1291
+                            </ol>
1292
+                        </nav>
1293
+                    </span>
1294
+                </div>
1295
+                
1296
+                <div class="card-body">
1297
+                    <ul class="list-group">
1298
+                        <?php
1299
+                        $files = scandir($dir);
1300
+                        foreach ($files as $f) {
1301
+                            if (strpos($f, '.') !== 0 && !in_array($f, $IGNORE)) {
1302
+                                echo "<li class=\"list-group-item d-flex\">\n";
1303
+                                echo "\t<a href=\"$path$f\">";
1304
+                                if (is_dir($dir . "/" . $f)) {
1305
+                                    echo "<span class=\"fas fa-folder fa-fw\"></span> ";
1306
+                                } else {
1307
+                                    $icon = "fas fa-file";
1308
+                                    $extension = strtolower(pathinfo("$dir/$f")['extension']);
1309
+                                    // If we don't have an extension, try using the whole filename
1310
+                                    if ($extension == "") {
1311
+                                        $extension = $f;
1312
+                                    }
1313
+                                    $mimetype = "application/octet-stream";
1314
+                                    // Lookup mimetype from extension
1315
+                                    if (array_key_exists($extension, $EXT2MIME)) {
1316
+                                        $mimetype = $EXT2MIME[$extension];	
1317
+                                    }
1318
+                                    // Lookup icon from mimetype
1319
+                                    if (array_key_exists($mimetype, $MIMEICONS)) {
1320
+                                        $icon = $MIMEICONS[$mimetype];
1321
+                                    } else { // Allow broad generic <format>/other icons
1322
+                                        $mimefirst = explode("/", $mimetype, 2)[0];
1323
+                                        if (array_key_exists($mimefirst."/other", $MIMEICONS)) {
1324
+                                            $icon = $MIMEICONS[$mimetype];
1325
+                                        }
1326
+                                    }
1327
+                                    echo "<span class=\"$icon fa-fw\"></span> ";
1328
+                                }
1329
+                                echo $f . "</a>\n";
1330
+                                if (count($MIRRORBASE) > 0 && !is_dir($dir . "/" . $f)) {
1331
+                                    echo "<span class=\"d-inline-flex justify-content-end "
1332
+                                    . "align-items-center flex-wrap ml-auto\">\n";
1333
+                                    echo "\t<a href=\"$path$f\" class=\"my-1 btn btn-outline-default btn-sm\">"
1334
+                                    . "<span class=\"fas fa-cloud-download-alt\"></span>"
1335
+                                    . " Main</a>\n";
1336
+                                    foreach ($MIRRORBASE as $mirror) {
1337
+                                        $name = $mirror["name"];
1338
+                                        $base = $mirror["base"];
1339
+                                        echo "\t<a href=\"$base$path$f\""
1340
+                                        . " class=\"ml-2 my-1 btn btn-outline-default btn-sm\">"
1341
+                                        . "<span class=\"fas fa-cloud-download-alt\"></span>"
1342
+                                        . " $name</a>\n";
1343
+                                    }
1344
+                                    echo "</span>";
1345
+                                }
1346
+                                echo "</li>\n\n";
1347
+                            }
1348
+                        }
1349
+                        ?>
1350
+                    </ul>
1351
+                </div>
1352
+                
1353
+            </div>
1354
+        </div>
1355
+    </div>
1337 1356
 
1338 1357
 </div>

Loading…
Cancel
Save