From 4069be762db7cddb83c94c5d9f8f1dbf727ce813 Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sun, 13 Sep 2026 12:33:22 +0200 Subject: [PATCH] docroot/: the files that belong in the root of the site cookie_law.css and cookie_law.js are referenced by index.php with a leading slash ("/cookie_law.js", lines 1047, 1048, 1221, 1222), so the browser asks the DocumentRoot for them and not the subdirectory of the application. INSTALL.sh installs everything inside $web_path, that is in /brisk/: putting them under web/ would still land them in the wrong place. They only lived as loose, untracked files in the working copy, and on a new machine they would simply have been missing. nginx reported them as 404 on every page load. The docroot/ directory was created, its name declaring its destination, and INSTALL.sh was taught to copy its content into $document_root: the same value it already writes into $DOCUMENT_ROOT, so no second source of truth is introduced. Checked by deleting the two files from the container and running INSTALL.sh again: it puts them back by itself. NOTE: it depends on the "grep DocumentRoot" over the apache configuration file (line 444), which remains the coupling to apache already pointed out. Dropping apache means replacing it, and at that point it serves both uses. custom.js stays out: it is untracked too, but referenced without a leading slash, so it lives inside /brisk/ and it is enough to add it under web/ for INSTALL.sh to distribute it with no further change. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_014M1jiEq9cHdE5SE5j6vFuE --- INSTALL.sh | 10 ++++++++++ docroot/README | 7 +++++++ docroot/cookie_law.css | 27 +++++++++++++++++++++++++++ docroot/cookie_law.js | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 docroot/README create mode 100644 docroot/cookie_law.css create mode 100644 docroot/cookie_law.js diff --git a/INSTALL.sh b/INSTALL.sh index d57cef9..5336b85 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -444,6 +444,16 @@ sed -i "s@\( \+cookiepath *: *\)\"[^\"]*\" *,@\1 \"$prefix_path\",@g" ${web_path document_root="$(grep DocumentRoot "${apache_conf}" | grep -v '^[ ]*#' | awk '{ print $2 }')" sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" ${web_path}__/spush/*.ph* ${web_path}__/donometer.php +# The files under docroot/ belong in the root of the site, not in the +# subdirectory of the application: index.php references them with a leading +# slash ("/cookie_law.js"), so the browser asks the DocumentRoot for them. +if [ -d docroot ] && [ ! -z "$document_root" ]; then + for i in $(find docroot -maxdepth 1 -type f ! -name 'README'); do + install -m 644 "$i" "${document_root}/$(basename "$i")" + echo " installato $(basename "$i") in ${document_root}" + done +fi + if [ -d ../brisk-img ]; then cd ../brisk-img ./INSTALL.sh -w ${web_path}__ diff --git a/docroot/README b/docroot/README new file mode 100644 index 0000000..5b344b3 --- /dev/null +++ b/docroot/README @@ -0,0 +1,7 @@ +Files that belong in the ROOT of the site, not inside the subdirectory of +the application. + +index.php references them with a leading slash ("/cookie_law.js"), so the +browser asks the DocumentRoot for them and not $prefix_path. INSTALL.sh copies +them from here into "$document_root", the same value it writes into +$DOCUMENT_ROOT. diff --git a/docroot/cookie_law.css b/docroot/cookie_law.css new file mode 100644 index 0000000..ae8bff5 --- /dev/null +++ b/docroot/cookie_law.css @@ -0,0 +1,27 @@ +div.coo_oudiv { + position: fixed; + top: 0px; + width: 100%; +} + +div.coo_indiv { + font-size: 14px; + line-height: 18px; + margin: 8px; + margin-left: 32px; + margin-right: 32px; + padding: 16px; + background: black; + color: #ffffff; + text-align: center; +} + +div.coo_indiv a { + color: white; + font-weight: bold; + text-decoration: underline; +} + +div.coo_indiv button { + margin: 12px; +} diff --git a/docroot/cookie_law.js b/docroot/cookie_law.js new file mode 100644 index 0000000..518c51a --- /dev/null +++ b/docroot/cookie_law.js @@ -0,0 +1,41 @@ +function ckl_createCookie(name,value,hours,path) { + if (hours) { + var date = new Date(); + date.setTime(date.getTime()+(hours*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else var expires = ""; + document.cookie = name+"="+value+expires+"; path="+path; +} + +function ckl_readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return null; +} + +function cookie_law(flag) +{ + if (ckl_readCookie('_cookie_law') != null) + return; + + var coo_oudiv = document.createElement('div'); + coo_oudiv.className = 'coo_oudiv'; + var coo_indiv = document.createElement('div'); + coo_indiv.className = 'coo_indiv'; + coo_indiv.innerHTML = "Informativa

\ +Questo sito o gli strumenti terzi da questo utilizzati si avvalgono di cookie necessari al funzionamento ed utili alle finalità illustrate nella cookie policy.
Se vuoi saperne di più o negare il consenso a tutti o ad alcuni cookie, consulta la cookie policy.
\ +Chiudendo questo banner, scorrendo questa pagina, cliccando su un link o proseguendo la navigazione in altra maniera, acconsenti all' uso dei cookie.
"; + + document.body.appendChild(coo_oudiv); + coo_oudiv.appendChild(coo_indiv); + var coo_button = document.createElement('button'); + coo_indiv.appendChild(coo_button); + coo_button.onclick = function() { ckl_createCookie('_cookie_law','true', 87600, "/"); coo_oudiv.style.display = 'none' }; + coo_button.innerHTML = "Ho capito."; +} -- 2.47.3