]> git.agnieray.net Git - galette.git/commitdiff
Keep config directory as user config, move system config elsewhere
authorJohan Cwiklinski <johan@x-tnd.be>
Tue, 30 Apr 2024 07:08:15 +0000 (09:08 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Tue, 30 Apr 2024 19:25:01 +0000 (21:25 +0200)
closes #1822

18 files changed:
.composer-require-checker.config.json
bin/release
galette/config/exports.yaml [deleted file]
galette/config/galette_tcpdf_config.php [deleted file]
galette/config/paths.inc.php [deleted file]
galette/config/versions.inc.php [deleted file]
galette/includes/galette.inc.php
galette/includes/sys_config/exports.yaml [new file with mode: 0644]
galette/includes/sys_config/galette_tcpdf_config.php [new file with mode: 0644]
galette/includes/sys_config/paths.inc.php [new file with mode: 0644]
galette/includes/sys_config/versions.inc.php [new file with mode: 0644]
galette/lib/Galette/Common/XHProf.php
galette/lib/Galette/IO/CsvOut.php
galette/lib/Galette/IO/Pdf.php
galette/webroot/compat_test.php
galette/webroot/index.php
galette/webroot/installer.php
phpstan.neon

index c22b04f7b1249a3f20a135fa5d853eb642f6834b..df1bc4a20093abf70da3a99fa4aed48d61725b14 100644 (file)
@@ -30,6 +30,7 @@
     "GALETTE_CARD_ROWS",
     "GALETTE_CARD_WIDTH",
     "GALETTE_COMPAT_VERSION",
+    "GALETTE_SYSCONFIG_PATH",
     "GALETTE_CONFIG_PATH",
     "GALETTE_DATA_PATH",
     "GALETTE_DB_VERSION",
index bcc2e8e7de2b47938e57d51fd0c44101e861d0b3..ebc3421a7352e4c95845fdbc1d5885c34c5f81d7 100755 (executable)
@@ -142,7 +142,7 @@ def is_version_bumped(ver):
     global repo, tag_commit
 
     versions_file = repo.git.execute(
-        ["git", "show", f"{tag_commit}:{os.path.join('galette', 'config', 'versions.inc.php')}"])
+        ["git", "show", f"{tag_commit}:{os.path.join('galette', 'includes', 'sys_config', 'versions.inc.php')}"])
     file_version = re.search("^define\\('GALETTE_VERSION', 'v(?P<version>.+)'\\)", versions_file, re.MULTILINE)
     if file_version.group('version') != ver:
         print_err('Trying to release %s, but bumped version is %s!' % (ver, file_version.group('version')))
@@ -387,7 +387,7 @@ def add_libs(rel_name, galette_archive):
     galette.close()
 
     # set galette nightly version
-    config_dir = os.path.join(src_dir, rel_name, 'galette', 'config')
+    config_dir = os.path.join(src_dir, rel_name, 'galette', 'includes', 'sys_config')
     if nightly_version != None:
         sed_cmd = 'sed -e "s/GALETTE_NIGHTLY\', false/GALETTE_NIGHTLY\', \'%s\'/" -i versions.inc.php' % nightly_version
         print(sed_cmd)
diff --git a/galette/config/exports.yaml b/galette/config/exports.yaml
deleted file mode 100644 (file)
index bc1bef3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-- cotisations:
-  # Model: List all cotisations amounts, begin and end dates with adherent name and town
-  name: Cotisations
-  description: Export de l'état des cotisations pour l'ensemble des adhérents
-  filename: galette_cotisations.csv
-  query: |-
-    SELECT nom_adh, prenom_adh, ville_adh, montant_cotis, date_debut_cotis, date_fin_cotis 
-      FROM galette_cotisations 
-      INNER JOIN galette_adherents 
-        ON (galette_cotisations.id_adh=galette_adherents.id_adh)
-  headers:
-    - Name
-    - Surname
-    - Town
-    - Amount
-    - Begin date
-    - End date
-  separator: ;
-  quote: \"
diff --git a/galette/config/galette_tcpdf_config.php b/galette/config/galette_tcpdf_config.php
deleted file mode 100644 (file)
index 01a80b9..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/**
- * Copyright © 2003-2024 The Galette Team
- *
- * This file is part of Galette (https://galette.eu).
- *
- * Galette is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Galette is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Galette. If not, see <http://www.gnu.org/licenses/>.
- */
-
-//============================================================+
-// File name   : tcpdf_config.php
-// Begin       : 2004-06-11
-// Last Update : 2013-05-16
-//
-// Description : Configuration file for TCPDF.
-// Author      : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
-// License     : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
-// -------------------------------------------------------------------
-// Copyright (C) 2004-2013  Nicola Asuni - Tecnick.com LTD
-//
-// This file is part of TCPDF software library.
-//
-// TCPDF is free software: you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// TCPDF is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
-//
-// See LICENSE.TXT file for more information.
-//============================================================+
-
-/**
- * Alternative configuration file for TCPDF.
- * @author Nicola Asuni
- * @package com.tecnick.tcpdf
- * @version 4.9.005
- * @since 2004-10-27
- */
-
-/**
- * Define the following constant to ignore the default configuration file.
- */
-define('K_TCPDF_EXTERNAL_CONFIG', true);
-
-/**
- * Installation path (/var/www/tcpdf/).
- * By default it is automatically calculated but you can also set it as a fixed string to improve performances.
- */
-define('K_PATH_MAIN', GALETTE_TCPDF_PATH);
-
-/**
- * URL path to tcpdf installation folder (http://localhost/tcpdf/).
- * By default it is automatically set but you can also set it as a fixed string to improve performances.
- */
-//define ('K_PATH_URL', '');
-
-/**
- * Path for PDF fonts.
- * By default it is automatically set but you can also set it as a fixed string to improve performances.
- */
-define('K_PATH_FONTS', GALETTE_TCPDF_PATH . '/fonts/');
-
-/**
- * Default images directory.
- * By default it is automatically set but you can also set it as a fixed string to improve performances.
- */
-define('K_PATH_IMAGES', GALETTE_PHOTOS_PATH);
-
-/**
- * Deafult image logo used be the default Header() method.
- * Please set here your own logo or an empty string to disable it.
- */
-//define ('PDF_HEADER_LOGO', '');
-
-/**
- * Header logo image width in user units.
- */
-//define ('PDF_HEADER_LOGO_WIDTH', 0);
-
-/**
- * Cache directory for temporary files (full path).
- */
-define('K_PATH_CACHE', GALETTE_CACHE_DIR);
-
-/**
- * Generic name for a blank image.
- */
-define('K_BLANK_IMAGE', '_blank.png');
-
-/**
- * Page format.
- */
-define('PDF_PAGE_FORMAT', 'A4');
-
-/**
- * Page orientation (P=portrait, L=landscape).
- */
-define('PDF_PAGE_ORIENTATION', 'P');
-
-/**
- * Document creator.
- */
-define('PDF_CREATOR', 'TCPDF');
-
-/**
- * Document author.
- */
-define('PDF_AUTHOR', 'TCPDF');
-
-/**
- * Header title.
- */
-define('PDF_HEADER_TITLE', 'TCPDF Example');
-
-/**
- * Header description string.
- */
-define('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
-
-/**
- * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
- */
-define('PDF_UNIT', 'mm');
-
-/**
- * Header margin.
- */
-define('PDF_MARGIN_HEADER', 5);
-
-/**
- * Footer margin.
- */
-define('PDF_MARGIN_FOOTER', 10);
-
-/**
- * Top margin.
- */
-define('PDF_MARGIN_TOP', 27);
-
-/**
- * Bottom margin.
- */
-define('PDF_MARGIN_BOTTOM', 25);
-
-/**
- * Left margin.
- */
-define('PDF_MARGIN_LEFT', 15);
-
-/**
- * Right margin.
- */
-define('PDF_MARGIN_RIGHT', 15);
-
-/**
- * Default main font name.
- */
-define('PDF_FONT_NAME_MAIN', 'DejaVuSans');
-
-/**
- * Default main font size.
- */
-define('PDF_FONT_SIZE_MAIN', 10);
-
-/**
- * Default data font name.
- */
-define('PDF_FONT_NAME_DATA', 'DejaVuSans');
-
-/**
- * Default data font size.
- */
-define('PDF_FONT_SIZE_DATA', 8);
-
-/**
- * Default monospaced font name.
- */
-define('PDF_FONT_MONOSPACED', 'courier');
-
-/**
- * Ratio used to adjust the conversion of pixels to user units.
- */
-define('PDF_IMAGE_SCALE_RATIO', 1.25);
-
-/**
- * Magnification factor for titles.
- */
-define('HEAD_MAGNIFICATION', 1.1);
-
-/**
- * Height of cell respect font height.
- */
-define('K_CELL_HEIGHT_RATIO', 1.25);
-
-/**
- * Title magnification respect main font size.
- */
-define('K_TITLE_MAGNIFICATION', 1.3);
-
-/**
- * Reduction factor for small font.
- */
-define('K_SMALL_RATIO', 2 / 3);
-
-/**
- * Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language.
- */
-define('K_THAI_TOPCHARS', true);
-
-/**
- * If true allows to call TCPDF methods using HTML syntax
- * IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
- */
-define('K_TCPDF_CALLS_IN_HTML', true);
-
-/**
- * If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
- */
-define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
-
-/**
- * Default timezone for datetime functions
- */
-define('K_TIMEZONE', 'UTC');
-
-//============================================================+
-// END OF FILE
-//============================================================+
diff --git a/galette/config/paths.inc.php b/galette/config/paths.inc.php
deleted file mode 100644 (file)
index c37edd2..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-/**
- * Copyright © 2003-2024 The Galette Team
- *
- * This file is part of Galette (https://galette.eu).
- *
- * Galette is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Galette is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Galette. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * Various paths
- * Path to external libraries, logs files, exports directory, ...
- *
- * @author Johan Cwiklinski <johan@x-tnd.be>
- */
-
-if (file_exists(GALETTE_ROOT . 'config/local_paths.inc.php')) {
-    include GALETTE_ROOT . 'config/local_paths.inc.php';
-}
-
-//3rd party libs paths
-if (!defined('GALETTE_TCPDF_PATH')) {
-    define(
-        'GALETTE_TCPDF_PATH',
-        GALETTE_ROOT . '/vendor/tecnickcom/tcpdf'
-    );
-}
-if (!defined('GALETTE_XHPROF_PATH')) {
-    define('GALETTE_XHPROF_PATH', '/usr/share/xhprof/');
-}
-
-//Galette paths
-if (!defined('GALETTE_CONFIG_PATH')) {
-    define('GALETTE_CONFIG_PATH', GALETTE_ROOT . 'config/');
-}
-if (!defined('GALETTE_PLUGINS_PATH')) {
-    define('GALETTE_PLUGINS_PATH', GALETTE_ROOT . 'plugins/');
-}
-if (!defined('GALETTE_DATA_PATH')) {
-    define('GALETTE_DATA_PATH', GALETTE_ROOT . 'data/');
-}
-if (!defined('GALETTE_THEMES_PATH')) {
-    define('GALETTE_THEMES_PATH', GALETTE_ROOT . 'webroot/themes/');
-}
-if (!defined('GALETTE_LOGS_PATH')) {
-    define('GALETTE_LOGS_PATH', GALETTE_DATA_PATH . 'logs/');
-}
-if (!defined('GALETTE_CACHE_DIR')) {
-    define('GALETTE_CACHE_DIR', GALETTE_DATA_PATH . 'cache/' . GALETTE_VERSION . '/');
-}
-if (!defined('GALETTE_EXPORTS_PATH')) {
-    define('GALETTE_EXPORTS_PATH', GALETTE_DATA_PATH . 'exports/');
-}
-if (!defined('GALETTE_IMPORTS_PATH')) {
-    define('GALETTE_IMPORTS_PATH', GALETTE_DATA_PATH . 'imports/');
-}
-if (!defined('GALETTE_PHOTOS_PATH')) {
-    define('GALETTE_PHOTOS_PATH', GALETTE_DATA_PATH . 'photos/');
-}
-if (!defined('GALETTE_DOCUMENTS_PATH')) {
-    define('GALETTE_DOCUMENTS_PATH', GALETTE_DATA_PATH . 'documents/');
-}
-if (!defined('GALETTE_ATTACHMENTS_PATH')) {
-    define('GALETTE_ATTACHMENTS_PATH', GALETTE_DATA_PATH . 'attachments/');
-}
-if (!defined('GALETTE_FILES_PATH')) {
-    define('GALETTE_FILES_PATH', GALETTE_DATA_PATH . 'files/');
-}
-if (!defined('GALETTE_TEMPIMAGES_PATH')) {
-    define('GALETTE_TEMPIMAGES_PATH', GALETTE_DATA_PATH . 'tempimages/');
-}
-if (!defined('GALETTE_TELEMETRY_URI')) {
-    define('GALETTE_TELEMETRY_URI', 'https://telemetry.galette.eu/');
-}
-
-if (!defined('GALETTE_TPL_THEME_DIR')) {
-    define('GALETTE_TPL_THEME_DIR', GALETTE_ROOT . 'templates/default/');
-}
-
-if (!defined('GALETTE_DOWNLOADS_URI')) {
-    define('GALETTE_DOWNLOADS_URI', 'https://galette.eu/download/');
-}
diff --git a/galette/config/versions.inc.php b/galette/config/versions.inc.php
deleted file mode 100644 (file)
index 2073745..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * Copyright © 2003-2024 The Galette Team
- *
- * This file is part of Galette (https://galette.eu).
- *
- * Galette is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Galette is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Galette. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * External libraries versions
- * Defines various library versions, to avoid use of problematic symlinks under windows or via FTP.
- *
- * @author Johan Cwiklinski <johan@x-tnd.be>
- */
-
-define('GALETTE_PHP_MIN', '8.1');
-define('GALETTE_MYSQL_MIN', '5.7');
-define('GALETTE_MARIADB_MIN', '10.4');
-define('GALETTE_PGSQL_MIN', '11')  ;
-define('GALETTE_NIGHTLY', false);
-define('GALETTE_VERSION', 'v1.1.0-dev');
-define('GALETTE_COMPAT_VERSION', '1.1.0');
-define('GALETTE_DB_VERSION', '1.100');
\ No newline at end of file
index 512ede333557c24fb22990589555f6a012fad3ca..211a539eea529a0aa49bff68a0ab1d08c4fc8a58 100644 (file)
@@ -24,8 +24,8 @@ if (!defined('GALETTE_ROOT')) {
     define('GALETTE_ROOT', __DIR__ . '/../');
 }
 
-require_once GALETTE_ROOT . 'config/versions.inc.php';
-require_once GALETTE_ROOT . 'config/paths.inc.php';
+require_once GALETTE_ROOT . '/includes/sys_config/versions.inc.php';
+require_once GALETTE_ROOT . '/includes/sys_config/paths.inc.php';
 
 // check required PHP version...
 if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
diff --git a/galette/includes/sys_config/exports.yaml b/galette/includes/sys_config/exports.yaml
new file mode 100644 (file)
index 0000000..bc1bef3
--- /dev/null
@@ -0,0 +1,19 @@
+- cotisations:
+  # Model: List all cotisations amounts, begin and end dates with adherent name and town
+  name: Cotisations
+  description: Export de l'état des cotisations pour l'ensemble des adhérents
+  filename: galette_cotisations.csv
+  query: |-
+    SELECT nom_adh, prenom_adh, ville_adh, montant_cotis, date_debut_cotis, date_fin_cotis 
+      FROM galette_cotisations 
+      INNER JOIN galette_adherents 
+        ON (galette_cotisations.id_adh=galette_adherents.id_adh)
+  headers:
+    - Name
+    - Surname
+    - Town
+    - Amount
+    - Begin date
+    - End date
+  separator: ;
+  quote: \"
diff --git a/galette/includes/sys_config/galette_tcpdf_config.php b/galette/includes/sys_config/galette_tcpdf_config.php
new file mode 100644 (file)
index 0000000..bcb90cd
--- /dev/null
@@ -0,0 +1,247 @@
+<?php
+
+/**
+ * Copyright © 2003-2024 The Galette Team
+ *
+ * This file is part of Galette (https://galette.eu).
+ *
+ * Galette is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Galette is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Galette. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//============================================================+
+// File name   : tcpdf_config.php
+// Begin       : 2004-06-11
+// Last Update : 2013-05-16
+//
+// Description : Configuration file for TCPDF.
+// Author      : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
+// License     : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
+// -------------------------------------------------------------------
+// Copyright (C) 2004-2013  Nicola Asuni - Tecnick.com LTD
+//
+// This file is part of TCPDF software library.
+//
+// TCPDF is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// TCPDF is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
+//
+// See LICENSE.TXT file for more information.
+//============================================================+
+
+/**
+ * Alternative configuration file for TCPDF.
+ * @author Nicola Asuni
+ * @package com.tecnick.tcpdf
+ * @version 4.9.005
+ * @since 2004-10-27
+ */
+
+/**
+ * Define the following constant to ignore the default configuration file.
+ */
+define('K_TCPDF_EXTERNAL_CONFIG', true);
+
+/**
+ * Installation path (/var/www/tcpdf/).
+ * By default it is automatically calculated but you can also set it as a fixed string to improve performances.
+ */
+define('K_PATH_MAIN', GALETTE_TCPDF_PATH);
+
+/**
+ * URL path to tcpdf installation folder (http://localhost/tcpdf/).
+ * By default it is automatically set but you can also set it as a fixed string to improve performances.
+ */
+//define ('K_PATH_URL', '');
+
+/**
+ * Path for PDF fonts.
+ * By default it is automatically set but you can also set it as a fixed string to improve performances.
+ */
+define('K_PATH_FONTS', GALETTE_TCPDF_PATH . '/fonts/');
+
+/**
+ * Default images directory.
+ * By default it is automatically set but you can also set it as a fixed string to improve performances.
+ */
+define('K_PATH_IMAGES', GALETTE_PHOTOS_PATH);
+
+/**
+ * Deafult image logo used be the default Header() method.
+ * Please set here your own logo or an empty string to disable it.
+ */
+//define ('PDF_HEADER_LOGO', '');
+
+/**
+ * Header logo image width in user units.
+ */
+//define ('PDF_HEADER_LOGO_WIDTH', 0);
+
+/**
+ * Cache directory for temporary files (full path).
+ */
+define('K_PATH_CACHE', GALETTE_CACHE_DIR);
+
+/**
+ * Generic name for a blank image.
+ */
+define('K_BLANK_IMAGE', '_blank.png');
+
+/**
+ * Page format.
+ */
+define('PDF_PAGE_FORMAT', 'A4');
+
+/**
+ * Page orientation (P=portrait, L=landscape).
+ */
+define('PDF_PAGE_ORIENTATION', 'P');
+
+/**
+ * Document creator.
+ */
+define('PDF_CREATOR', 'TCPDF');
+
+/**
+ * Document author.
+ */
+define('PDF_AUTHOR', 'TCPDF');
+
+/**
+ * Header title.
+ */
+define('PDF_HEADER_TITLE', 'TCPDF Example');
+
+/**
+ * Header description string.
+ */
+define('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
+
+/**
+ * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
+ */
+define('PDF_UNIT', 'mm');
+
+/**
+ * Header margin.
+ */
+define('PDF_MARGIN_HEADER', 5);
+
+/**
+ * Footer margin.
+ */
+define('PDF_MARGIN_FOOTER', 10);
+
+/**
+ * Top margin.
+ */
+define('PDF_MARGIN_TOP', 27);
+
+/**
+ * Bottom margin.
+ */
+define('PDF_MARGIN_BOTTOM', 25);
+
+/**
+ * Left margin.
+ */
+define('PDF_MARGIN_LEFT', 15);
+
+/**
+ * Right margin.
+ */
+define('PDF_MARGIN_RIGHT', 15);
+
+/**
+ * Default main font name.
+ */
+define('PDF_FONT_NAME_MAIN', 'DejaVuSans');
+
+/**
+ * Default main font size.
+ */
+define('PDF_FONT_SIZE_MAIN', 10);
+
+/**
+ * Default data font name.
+ */
+define('PDF_FONT_NAME_DATA', 'DejaVuSans');
+
+/**
+ * Default data font size.
+ */
+define('PDF_FONT_SIZE_DATA', 8);
+
+/**
+ * Default monospaced font name.
+ */
+define('PDF_FONT_MONOSPACED', 'courier');
+
+/**
+ * Ratio used to adjust the conversion of pixels to user units.
+ */
+define('PDF_IMAGE_SCALE_RATIO', 1.25);
+
+/**
+ * Magnification factor for titles.
+ */
+define('HEAD_MAGNIFICATION', 1.1);
+
+/**
+ * Height of cell respect font height.
+ */
+define('K_CELL_HEIGHT_RATIO', 1.25);
+
+/**
+ * Title magnification respect main font size.
+ */
+define('K_TITLE_MAGNIFICATION', 1.3);
+
+/**
+ * Reduction factor for small font.
+ */
+define('K_SMALL_RATIO', 2 / 3);
+
+/**
+ * Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language.
+ */
+define('K_THAI_TOPCHARS', true);
+
+/**
+ * If true allows to call TCPDF methods using HTML syntax
+ * IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
+ */
+define('K_TCPDF_CALLS_IN_HTML', true);
+
+/**
+ * If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
+ */
+define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
+
+/**
+ * Default timezone for datetime functions
+ */
+define('K_TIMEZONE', 'UTC');
+
+//============================================================+
+// END OF FILE
+//============================================================+
diff --git a/galette/includes/sys_config/paths.inc.php b/galette/includes/sys_config/paths.inc.php
new file mode 100644 (file)
index 0000000..4815381
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+
+/**
+ * Copyright © 2003-2024 The Galette Team
+ *
+ * This file is part of Galette (https://galette.eu).
+ *
+ * Galette is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Galette is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Galette. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Various paths
+ * Path to external libraries, logs files, exports directory, ...
+ *
+ * @author Johan Cwiklinski <johan@x-tnd.be>
+ */
+
+if (file_exists(GALETTE_ROOT . 'config/local_paths.inc.php')) {
+    include GALETTE_ROOT . 'config/local_paths.inc.php';
+}
+
+//3rd party libs paths
+if (!defined('GALETTE_TCPDF_PATH')) {
+    define(
+        'GALETTE_TCPDF_PATH',
+        GALETTE_ROOT . '/vendor/tecnickcom/tcpdf'
+    );
+}
+if (!defined('GALETTE_XHPROF_PATH')) {
+    define('GALETTE_XHPROF_PATH', '/usr/share/xhprof/');
+}
+
+//Galette paths
+const GALETTE_SYSCONFIG_PATH = GALETTE_ROOT . 'includes/sys_config/';
+if (!defined('GALETTE_CONFIG_PATH')) {
+    define('GALETTE_CONFIG_PATH', GALETTE_ROOT . 'config/');
+}
+
+if (!defined('GALETTE_PLUGINS_PATH')) {
+    define('GALETTE_PLUGINS_PATH', GALETTE_ROOT . 'plugins/');
+}
+if (!defined('GALETTE_DATA_PATH')) {
+    define('GALETTE_DATA_PATH', GALETTE_ROOT . 'data/');
+}
+if (!defined('GALETTE_THEMES_PATH')) {
+    define('GALETTE_THEMES_PATH', GALETTE_ROOT . 'webroot/themes/');
+}
+if (!defined('GALETTE_LOGS_PATH')) {
+    define('GALETTE_LOGS_PATH', GALETTE_DATA_PATH . 'logs/');
+}
+if (!defined('GALETTE_CACHE_DIR')) {
+    define('GALETTE_CACHE_DIR', GALETTE_DATA_PATH . 'cache/' . GALETTE_VERSION . '/');
+}
+if (!defined('GALETTE_EXPORTS_PATH')) {
+    define('GALETTE_EXPORTS_PATH', GALETTE_DATA_PATH . 'exports/');
+}
+if (!defined('GALETTE_IMPORTS_PATH')) {
+    define('GALETTE_IMPORTS_PATH', GALETTE_DATA_PATH . 'imports/');
+}
+if (!defined('GALETTE_PHOTOS_PATH')) {
+    define('GALETTE_PHOTOS_PATH', GALETTE_DATA_PATH . 'photos/');
+}
+if (!defined('GALETTE_DOCUMENTS_PATH')) {
+    define('GALETTE_DOCUMENTS_PATH', GALETTE_DATA_PATH . 'documents/');
+}
+if (!defined('GALETTE_ATTACHMENTS_PATH')) {
+    define('GALETTE_ATTACHMENTS_PATH', GALETTE_DATA_PATH . 'attachments/');
+}
+if (!defined('GALETTE_FILES_PATH')) {
+    define('GALETTE_FILES_PATH', GALETTE_DATA_PATH . 'files/');
+}
+if (!defined('GALETTE_TEMPIMAGES_PATH')) {
+    define('GALETTE_TEMPIMAGES_PATH', GALETTE_DATA_PATH . 'tempimages/');
+}
+if (!defined('GALETTE_TELEMETRY_URI')) {
+    define('GALETTE_TELEMETRY_URI', 'https://telemetry.galette.eu/');
+}
+
+if (!defined('GALETTE_TPL_THEME_DIR')) {
+    define('GALETTE_TPL_THEME_DIR', GALETTE_ROOT . 'templates/default/');
+}
+
+if (!defined('GALETTE_DOWNLOADS_URI')) {
+    define('GALETTE_DOWNLOADS_URI', 'https://galette.eu/download/');
+}
diff --git a/galette/includes/sys_config/versions.inc.php b/galette/includes/sys_config/versions.inc.php
new file mode 100644 (file)
index 0000000..d66992a
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Copyright © 2003-2024 The Galette Team
+ *
+ * This file is part of Galette (https://galette.eu).
+ *
+ * Galette is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Galette is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Galette. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * External libraries versions
+ * Defines various library versions, to avoid use of problematic symlinks under windows or via FTP.
+ *
+ * @author Johan Cwiklinski <johan@x-tnd.be>
+ */
+
+define('GALETTE_PHP_MIN', '8.1');
+define('GALETTE_MYSQL_MIN', '5.7');
+define('GALETTE_MARIADB_MIN', '10.4');
+define('GALETTE_PGSQL_MIN', '11')  ;
+define('GALETTE_NIGHTLY', false);
+define('GALETTE_VERSION', 'v1.1.0-dev');
+define('GALETTE_COMPAT_VERSION', '1.1.0');
+define('GALETTE_DB_VERSION', '1.100');
index 0487e05db9d6d4abfd99ae7a4b092752c03246d3..ccb14fb079f0dc78ae318ad684afbd28cc6d5495 100644 (file)
@@ -30,7 +30,7 @@ use Analog\Analog;
  *
  * Install the pecl/xhprof extension
  *
- * Add XHPROF_PATH and XHPROF_URL in config/config_path.php (if needed)
+ * Add XHPROF_PATH and XHPROF_URL in config/local_paths.inc.php (if needed)
  *
  * Before the code
  *    $prof = new XHProf("something useful");
index d7c5471778e7fac1308f3256648a41b799eeb309..5144e80b394184c8905e1fd004545f5f96ba0293 100644 (file)
@@ -38,7 +38,6 @@ class CsvOut extends Csv
 {
     public const DEFAULT_DIRECTORY = GALETTE_EXPORTS_PATH;
 
-    private string $parameted_path;
     private string $legacy_parameted_file = 'exports.xml';
     private string $parameted_file = 'exports.yaml';
 
@@ -48,9 +47,12 @@ class CsvOut extends Csv
     public function __construct()
     {
         parent::__construct(self::DEFAULT_DIRECTORY);
-        $this->parameted_path = GALETTE_CONFIG_PATH;
-        $this->parameted_file = $this->parameted_path . $this->parameted_file;
-        $this->legacy_parameted_file = $this->parameted_path . $this->legacy_parameted_file;
+        if (file_exists(GALETTE_CONFIG_PATH . $this->parameted_file)) {
+            $this->parameted_file = GALETTE_CONFIG_PATH . $this->parameted_file;
+        } else {
+            $this->parameted_file = GALETTE_SYSCONFIG_PATH . $this->parameted_file;
+        }
+        $this->legacy_parameted_file = GALETTE_CONFIG_PATH . $this->legacy_parameted_file;
     }
 
     /**
index 75510523077651b57cbf4668992ce184e9f66c36..92511313688f1f38aa5f92afe06230531addc9c1 100644 (file)
@@ -31,7 +31,7 @@ use TCPDF;
 /*
  * TCPDF configuration file for Galette
  */
-require_once GALETTE_CONFIG_PATH . 'galette_tcpdf_config.php';
+require_once GALETTE_SYSCONFIG_PATH . 'galette_tcpdf_config.php';
 
 /**
  * PDF class for galette
index 153e2b5c2d3b5c87120a35d7996d3cff5dfec2a3..16e75198259572ddbb7c1623120e39208daa8776 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 define('GALETTE_ROOT', __DIR__ . '/../');
-require_once GALETTE_ROOT . 'config/versions.inc.php';
-require_once GALETTE_ROOT . 'config/paths.inc.php';
+require_once GALETTE_ROOT . 'includes/sys_config/versions.inc.php';
+require_once GALETTE_ROOT . 'includes/sys_config/paths.inc.php';
 
 $phpok = !version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<');
 $php_message = PHP_VERSION;
index c674ed2828dd2dedd0415c1c9ee7e23362b18065..d02df737b0478711aa5f12610556ffe25b0409b7 100644 (file)
@@ -27,7 +27,7 @@ if (!defined('GALETTE_BASE_PATH')) {
 define('GALETTE_ROOT', __DIR__ . '/../');
 
 // check PHP version
-require_once GALETTE_ROOT . 'config/versions.inc.php';
+require_once GALETTE_ROOT . 'includes/sys_config/versions.inc.php';
 if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
     header('location: ' . GALETTE_BASE_PATH . 'compat_test.php');
     die(1);
index 40b4bd49f01dd2d35bad08c83030ce2f4a7bb08c..cd660564e8d01c6867435b08d70f052df8441a3c 100644 (file)
@@ -35,7 +35,7 @@ define('GALETTE_MODE', 'INSTALL');
 
 // check PHP modules
 require_once GALETTE_ROOT . '/vendor/autoload.php';
-require_once GALETTE_ROOT . 'config/versions.inc.php';
+require_once GALETTE_ROOT . 'includes/sys_config/versions.inc.php';
 
 if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<') || !extension_loaded('intl')) {
     header('location: compat_test.php');
index 93363e6e4506571b8e5fe5b48d72edc4d875c58b..61939b6816049206a1e75d4bdae37e5dfa526d2a 100644 (file)
@@ -5,10 +5,10 @@ parameters:
     paths:
         - galette/lib/
     scanFiles:
-        - galette/config/paths.inc.php
-        - galette/config/versions.inc.php
+        - galette/includes/sys_config/paths.inc.php
+        - galette/includes/sys_config/versions.inc.php
         - galette/config/config.inc.php.dist
-        - galette/config/galette_tcpdf_config.php
+        - galette/includes/sys_config/galette_tcpdf_config.php
     scanDirectories:
         - galette/includes/
     dynamicConstantNames: