diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..672b191 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pfostendynamics.com.iml b/.idea/pfostendynamics.com.iml new file mode 100644 index 0000000..9bc92b6 --- /dev/null +++ b/.idea/pfostendynamics.com.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index d843f34..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,4 +1,6 @@ - + + + \ No newline at end of file diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index 80a7a71..12486b2 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -54,7 +54,7 @@ server { server_tokens off; root /app/public; - index index.php; + index index.html index.htm index.php; # make .well-known directory accessible location ~ /.well-known { @@ -66,21 +66,18 @@ server { } location / { - try_files $uri $uri.php $uri/ /index.php$is_args$args; + if (!-e $request_filename){ + rewrite ^(.*)$ /$1.php; + } + try_files $uri $uri/ =404; } location ~ \.php$ { - include fastcgi_params; + try_files $uri =404; fastcgi_pass php:9000; + fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - } - - location ~ \.html$ { - try_files $uri $uri.html $uri/ /index.php$is_args$args; - } - - location ~ \.php$ { - try_files $uri $uri.php $uri/ /index.php$is_args$args; + include fastcgi_params; } error_page 404 /404; diff --git a/public/includes/footer.php b/public/includes/footer.php index 219a18b..7b6d789 100644 --- a/public/includes/footer.php +++ b/public/includes/footer.php @@ -9,8 +9,7 @@ --> - - + diff --git a/public/includes/header.php b/public/includes/header.php index df9e04f..6d55919 100644 --- a/public/includes/header.php +++ b/public/includes/header.php @@ -9,12 +9,12 @@ - - + + <?php echo htmlentities(PAGE_TITLE); ?> | Pfosten Dynamics - + diff --git a/public/includes/navbar.php b/public/includes/navbar.php index 630e51e..820d5d2 100644 --- a/public/includes/navbar.php +++ b/public/includes/navbar.php @@ -5,11 +5,11 @@ echo "bg-light navbar-light"; } ?>" id="navbar">
- + " style="max-height: 60px" class="d-inline-block align-top" alt="" loading="lazy" id="pfostendynamics" />
diff --git a/public/js/local.js b/public/js/local.js deleted file mode 100644 index 6070ee2..0000000 --- a/public/js/local.js +++ /dev/null @@ -1,13 +0,0 @@ -function givePHP() { - var elements = document.getElementsByClassName("givePHP"); - len = elements !== null ? elements.length : 0; - i = 0; - for (i; i < len; i++) { - if(elements[i].id != "nophp") - elements[i].href += ".php"; - } -} - -function load() { - givePHP(); -} \ No newline at end of file diff --git a/public/js/main.js b/public/js/main.js index bd1f1c2..bf0c79d 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -3,24 +3,24 @@ var state = false; var debug = "false"; if (getCookie("darkmode") == null) { applyDarkmode = false; - if (debug == "true") console.log('Cookie "darkmode" empty'); + if (debug === "true") console.log('Cookie "darkmode" empty'); } else { applyDarkmode = getCookie("darkmode"); - if (debug == "true") console.log("Cookie darkmode:" + applyDarkmode); + if (debug === "true") console.log("Cookie darkmode:" + applyDarkmode); } var isDark = false; function setdarkMode(state) { - if (debug == "true") + if (debug === "true") console.log( 'function "setdarkMode" was initiated with value "state" as ' + state ); var elements = document.getElementsByClassName("couldDark"); len = elements !== null ? elements.length : 0; i = 0; - if (state == true) { + if (state === true) { for (i; i < len; i++) { - if (elements[i].classList.contains("darkMode") == false) { + if (elements[i].classList.contains("darkMode") === false) { elements[i].classList.add("darkMode"); } } @@ -28,9 +28,9 @@ function setdarkMode(state) { "https://pfostendynamics.com/img/darkmode.png"; document.getElementById("pfostendynamics").src = "https://pfostendynamics.com/img/PfostenDynamicsDark.png"; - } else if (state == false) { + } else if (state === false) { for (i; i < len; i++) { - if (elements[i].classList.contains("darkMode") == true) { + if (elements[i].classList.contains("darkMode") === true) { elements[i].classList.remove("darkMode"); } } @@ -45,7 +45,7 @@ function setdarkMode(state) { } function setNavbar(state) { - if (debug == "true") + if (debug === "true") console.log( 'function "setNavbar" was initiated with value "state" as ' + state ); @@ -65,21 +65,20 @@ function setNavbar(state) { function darkMode() { applyDarkmode = !applyDarkmode; - if (debug == "true") console.log("applyDarkmode:" + applyDarkmode); + if (debug === "true") console.log("applyDarkmode:" + applyDarkmode); setdarkMode(applyDarkmode); setNavbar(applyDarkmode); - return; } function checkDarkmode() { - var tmp = getCookie("darkmode"); - if (tmp == "false") { + const tmp = getCookie("darkmode"); + if (tmp === "false") { isDark = false; document.getElementById("darkModeImg").src = "https://pfostendynamics.com/img/lightmode.png"; document.getElementById("pfostendynamics").src = "https://pfostendynamics.com/img/PfostenDynamics.png"; - } else if (tmp == "true") { + } else if (tmp === "true") { document.getElementById("darkModeImg").src = "https://pfostendynamics.com/img/darkmode.png"; document.getElementById("pfostendynamics").src = @@ -92,17 +91,17 @@ function checkDarkmode() { var elements = document.getElementsByClassName("couldDark"); len = elements !== null ? elements.length : 0; i = 0; - if (state == true) { + if (state === true) { for (i; i < len; i++) { - if (elements[i].classList.contains("darkMode") == false) { + if (elements[i].classList.contains("darkMode") === false) { elements[i].className += " darkMode"; } } document.getElementById("darkModeImg").src = "https://pfostendynamics.com/img/darkmode.png"; - } else if (state == false) { + } else if (state === false) { for (i; i < len; i++) { - if (elements[i].classList.contains("darkMode") == true) { + if (elements[i].classList.contains("darkMode") === true) { elements[i].classList.remove("darkMode"); } } @@ -115,11 +114,11 @@ function checkDarkmode() { function load() { debug = getCookie("debug"); - if (getCookie("darkmode") == "") { + if (getCookie("darkmode") === "") { setCookie("darkmode", false, 999); } checkDarkmode(); - if (location.hostname == "localhost") givePHP(); + if (location.hostname === "localhost") givePHP(); } /*Cookie scripts*/ diff --git a/public/js/navbar.js b/public/js/navbar.js index b1795dd..071ecf9 100644 --- a/public/js/navbar.js +++ b/public/js/navbar.js @@ -1,14 +1,22 @@ function setactivePage() { - var path = window.location.pathname; - var tmp = path.split("/").pop(); - var page = tmp.replace(".html", ""); - if (page == "") page = "home"; - if(debug == "true") console.log("page:" + page); - var site = document.getElementsByClassName("canactive"); - len = site !== null ? site.length : 0; - i = 0; - for (i; i < len; i++) { - var siteClass = document.getElementsByClassName(page); + const path = window.location.pathname; + const tmp = path.split("/").pop(); + let page = tmp.replace(".html", ""); + if (page === "") { + page = "home"; + } + + if (debug === "true") { + console.log("page:" + page); + } + + const site = document.getElementsByClassName("canactive"); + + let len = site !== null ? site.length : 0; + let len2; + let j; + for (let i = 0; i < len; i++) { + const siteClass = document.getElementsByClassName(page); len2 = siteClass !== null ? siteClass.length : 0; j = 0; for (j; j < len2; j++) {