]> git.agnieray.net Git - galette.git/blobdiff - galette/includes/galette.inc.php
Bump version
[galette.git] / galette / includes / galette.inc.php
index 5cc62b20ef15195c6f6b39001bdca1c67b0ff138..e8b59483700c7e1c0eb26bef858388f9abcf7186 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2009-2018 The Galette Team
+ * Copyright © 2009-2023 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   Galette
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2007-2018 The Galette Team
+ * @copyright 2007-2023 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     Available since 0.7-dev - 2007-10-07
@@ -72,7 +72,7 @@ if (!$installed && !$installer) {
 
 if (
     file_exists(GALETTE_CONFIG_PATH . 'behavior.inc.php')
-    && !defined('GALETTE_TESTS') && !$cron
+    && !defined('GALETTE_TESTS')
 ) {
     include_once GALETTE_CONFIG_PATH . 'behavior.inc.php';
 }
@@ -100,40 +100,43 @@ if (
 }
 
 define('GALETTE_NIGHTLY', false);
-define('GALETTE_VERSION', 'v0.9.4.2');
+define('GALETTE_VERSION', 'v1.0.0rc2');
 
 //Version to display
 if (!defined('GALETTE_HIDE_VERSION')) {
     define('GALETTE_DISPLAY_VERSION', \Galette\Core\Galette::gitVersion(false));
 }
 
-define('GALETTE_COMPAT_VERSION', '0.9.2');
-define('GALETTE_DB_VERSION', '0.940');
+define('GALETTE_COMPAT_VERSION', '1.0.0');
+define('GALETTE_DB_VERSION', '0.960');
 if (!defined('GALETTE_MODE')) {
-    define('GALETTE_MODE', 'PROD'); //DEV, PROD, MAINT or DEMO
+    define('GALETTE_MODE', \Galette\Core\Galette::MODE_PROD);
 }
 
 if (!isset($_COOKIE['show_galette_dashboard'])) {
     setcookie(
         'show_galette_dashboard',
         true,
-        time() + 31536000 //valid for a year
+        [
+            'expires'   => time() + 31536000, //valid for a year
+            'path'      => '/'
+        ]
     );
 }
 
-if (!defined('GALETTE_DISPLAY_ERRORS')) {
-    if (GALETTE_MODE === 'DEV') {
-        define('GALETTE_DISPLAY_ERRORS', 1);
-    } else {
-        define('GALETTE_DISPLAY_ERRORS', 0);
-    }
-}
-ini_set('display_errors', 0);
+ini_set('display_errors', (defined('GALETTE_TESTS') ? '1' : '0'));
 
 /*------------------------------------------------------------------------------
 Logger stuff
 ------------------------------------------------------------------------------*/
 
+error_reporting(E_ALL);
+set_error_handler(function ($severity, $message, $file, $line) {
+    if (error_reporting() & $severity) {
+        throw new \ErrorException($message, 0, $severity, $file, $line);
+    }
+});
+
 //change default format so the 3rd param is a string for level name
 Analog::$format = "%s - %s - %s - %s\n";
 $galette_run_log = null;
@@ -158,7 +161,7 @@ if (defined('GALETTE_TESTS')) {
         //logs everything in galette log file
         if (!isset($logfile)) {
             //if no filename has been setted (ie. from install), set default one
-            $logfile = 'galette_run';
+            $logfile = 'galette';
         }
         $log_path = GALETTE_LOGS_PATH . $logfile . '.log';
         $galette_run_log = LevelName::init(Handler\File::init($log_path));
@@ -179,7 +182,7 @@ if (!$installer and !defined('GALETTE_TESTS')) {
     include_once GALETTE_CONFIG_PATH . 'config.inc.php';
 
     /**
-     * Database instanciation
+     * Database instantiation
      */
     $zdb = new Core\Db();
 
@@ -198,13 +201,6 @@ if (!$installer and !defined('GALETTE_TESTS')) {
             GALETTE_THEMES_PATH . $preferences->pref_theme . '/'
         );
 
-        if (!defined('GALETTE_TPL_SUBDIR')) {
-            define(
-                'GALETTE_TPL_SUBDIR',
-                'templates/' . $preferences->pref_theme . '/'
-            );
-        }
-
         if (!defined('GALETTE_THEME')) {
             define(
                 'GALETTE_THEME',
@@ -215,3 +211,7 @@ if (!$installer and !defined('GALETTE_TESTS')) {
         $needs_update = true;
     }
 }
+
+$plugins = new Galette\Core\Plugins();
+//make sure plugins autoload is called before session start
+$plugins->autoload(GALETTE_PLUGINS_PATH);