From 187501c286c1c5eaa5fb8357228bbd6ed2cf0b33 Mon Sep 17 00:00:00 2001 From: Clortox Date: Mon, 4 Jan 2021 19:18:26 -0500 Subject: [PATCH] Make config more robust --- index.php | 12 +++++++++++- var/config.php | 31 +++++++++++++++++++++++++++++++ www/header.php | 19 ++++++++++--------- 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 66c7a63..f65683e 100644 --- a/index.php +++ b/index.php @@ -30,7 +30,17 @@

Folders

-

Select a catagory to start browsing

+ THERE ARE NO TRACKED DIRECTORIES, + OR THERE IS AN ERROR IN YOU CONFIGURATION. + PLEASE CHECK 'var/config' + errorblock; + exit(); + } + ?> +

Select a category to start browsing

diff --git a/var/config.php b/var/config.php index cac6aa4..f25ca35 100644 --- a/var/config.php +++ b/var/config.php @@ -14,11 +14,20 @@ * These can start with "#" to direct to a tag on the page, could be an internal * link by using "/listing.php?folder=SomeFolder", or could be an external site * + * $nav_rname and $nav_rlink are for a link on the right side of the nav bar. + * This link is by default an ad for this repo, however you can disable it by + * setting $isrNav to false, or change it to advertise anything you choose! + * + * The navbar can be disabled by changing isNav to false + * * These associate in order ie the Tag $nav_names[3] will direct the user to * the link in $nav_links[3] * */ + $isNav = true; + $isrNav = true; + $nav_names = array( 'Home', 'Github', @@ -29,6 +38,10 @@ 'https://github.com/Clortox', ); + //$nav_rname = 'Git this site!'; + //$nav_rlink = 'https://github.com/Clortox/SimpleFileRepository'; + + /* Directory Variables * * Each variable in $dir_dirs will be a listing @@ -43,6 +56,8 @@ * the title $dir_names[3] */ + $isDir = true; + $dir_names = array( 'Printable Guns', 'GNU Software', @@ -85,4 +100,20 @@ ' is asking for help with their homework from ', ); + //Be safe, check arrays + if(empty($nav_names) or empty($nav_links)){ + $isNav = false; + } else if(count($nav_names) !== count($nav_links)){ + $isNav = false; + } + + if(empty($dir_names) or empty($dir_dirs)){ + $isDir = false; + } else if (count($dir_names) !== count($dir_dirs)){ + $isDir = false; + } + + if(empty($convo)){ + $isConvo = false; + } ?> diff --git a/www/header.php b/www/header.php index 03e715b..a92ad80 100644 --- a/www/header.php +++ b/www/header.php @@ -12,17 +12,18 @@ $saying = $convo[rand(0,count($convo)-1)]; echo '

' . $clientip . $saying . $serverip . '

'; } + + if($isNav){ + echo ''; + } ?> - -