From c77ac55a56fae6784e324433b7083570f8b0f256 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 4 Apr 2018 18:02:44 -0600 Subject: [PATCH] Add support for multiple mirrors --- index.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 4321890..b9ece38 100644 --- a/index.php +++ b/index.php @@ -15,8 +15,18 @@ $IGNORE = [ ]; // Actual path of the wwwroot $ROOTPATH = "/var/www/clients/client1/web68/web"; -// If set to a URL, will be used as the base path for mirror links -$MIRRORBASE = ""; + +// Fill in to add mirror download links to files +$MIRRORBASE = []; +/* +$MIRRORBASE = [ + [ + "name" => "Mirror 1", + "base" => "http://example.com/downloads" + ], +]; +*/ + // Bootstrap and optional CSS $STYLESHEETS = [ "https://static.netsyms.net/bootstrap/4.0.0/bootstrap.materia.min.css" @@ -1240,10 +1250,14 @@ foreach ($files as $f) { echo " "; } echo $f . "\n"; - if (!is_dir($dir . "/" . $f) && $MIRRORBASE != "") { + if (count($MIRRORBASE) > 0 && !is_dir($dir . "/" . $f)) { echo "\n"; - echo "\t Primary\n"; - echo "\t Mirror\n"; + echo "\t Main\n"; + foreach ($MIRRORBASE as $mirror) { + $name = $mirror["name"]; + $base = $mirror["base"]; + echo "\t $name\n"; + } echo ""; } echo "\n\n";