]> mop.ddnsfree.com - git repositories - brisk.git/commitdiff
docroot/: the files that belong in the root of the site
authorMatteo Nastasi <nastasi@alternativeoutput.it>
Sun, 13 Sep 2026 10:33:22 +0000 (12:33 +0200)
committerMatteo Nastasi <nastasi@alternativeoutput.it>
Sun, 13 Sep 2026 10:33:22 +0000 (12:33 +0200)
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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014M1jiEq9cHdE5SE5j6vFuE

INSTALL.sh
docroot/README [new file with mode: 0644]
docroot/cookie_law.css [new file with mode: 0644]
docroot/cookie_law.js [new file with mode: 0644]

index d57cef97f3804b73654b429eccc2ccc975a78814..5336b8597cf849cde80fd4a2d66930b85af8dccf 100755 (executable)
@@ -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 (file)
index 0000000..5b344b3
--- /dev/null
@@ -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 (file)
index 0000000..ae8bff5
--- /dev/null
@@ -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 (file)
index 0000000..518c51a
--- /dev/null
@@ -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 = "<b>Informativa</b><br><br>\
+Questo sito o gli strumenti terzi da questo utilizzati si avvalgono di cookie necessari al funzionamento ed utili alle finalità  illustrate nella cookie policy.<br> Se vuoi saperne di più o negare il consenso a tutti o ad alcuni cookie, consulta la<a href='/cookie.php'> cookie policy</a>.<br>\
+Chiudendo questo banner, scorrendo questa pagina, cliccando su un link o proseguendo la navigazione in altra maniera, acconsenti all' uso dei cookie.<br>";
+
+    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.";
+}