From: Matteo Nastasi Date: Sun, 13 Sep 2026 10:36:37 +0000 (+0200) Subject: the donation button was not distributed anywhere X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=409f3e0041b7471cbbc6ae0be6d778eb82312c8e;p=brisk.git the donation button was not distributed anywhere index.php reads it from FTOK_PATH/brisk_donate.txt, but that file was not in the repository: whoever installed from scratch had no button, and the daemon wrote a file_get_contents warning on every page load. The html fragment now lives in data/, next to the other data files of the installation, and INSTALL.sh copies it into FTOK_PATH only if it is not there already, so as not to overwrite the one of the installation. The file stays optional: index.php checks that it exists before reading it, so whoever does not want the button does not get a dirty log (the code already handled the case, but only after the warning had been written). Checked in the container with a full installation, no longer just -W: the file lands in FTOK_PATH, the page shows the form, the log stays clean; without the file the page still loads with no form and no warning; and a second installation does not touch the file already there. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_014M1jiEq9cHdE5SE5j6vFuE --- diff --git a/INSTALL.sh b/INSTALL.sh index a424076..4095c73 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -377,6 +377,15 @@ if [ "$web_only" = "FALSE" ]; then done chmod -R 777 ${proxy_path}/bin5 + # The donation button is a fragment of html that index.php reads from + # FTOK_PATH. It is installed only if it is not there already, so as not to + # overwrite the one of the installation: whoever does not want it simply + # does not put it there. + if [ -f data/brisk_donate.txt -a ! -f "${ftokk_path}/brisk_donate.txt" ]; then + install -m 644 data/brisk_donate.txt "${ftokk_path}/brisk_donate.txt" + echo " installed brisk_donate.txt in ${ftok_path}" + fi + mkdir -p "${legal_path}" chmod 777 "${legal_path}" fi @@ -501,7 +510,7 @@ sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" $ 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}" + echo " installed $(basename "$i") in ${document_root}" done fi diff --git a/data/brisk_donate.txt b/data/brisk_donate.txt new file mode 100644 index 0000000..35c554d --- /dev/null +++ b/data/brisk_donate.txt @@ -0,0 +1,7 @@ +
+ + + + +
diff --git a/web/index.php b/web/index.php index 4269821..b87af37 100644 --- a/web/index.php +++ b/web/index.php @@ -631,8 +631,13 @@ function index_main(&$brisk, $transp_type, $header, &$header_out, $remote_addr_f /* NOTE: Brisk donate or donate fake if local */ - if (!$G_is_local) - $brisk_donate = file_get_contents(FTOK_PATH."/brisk_donate.txt"); + if (!$G_is_local) { + /* the file is optional, and an installation with no donation button + must not write a warning in the log on every page */ + $brisk_donate_path = FTOK_PATH."/brisk_donate.txt"; + $brisk_donate = (file_exists($brisk_donate_path) ? + file_get_contents($brisk_donate_path) : FALSE); + } else $brisk_donate = '
BRISK_DONATE
';