1*8d0ebef0SGreg Roach<?php 2*8d0ebef0SGreg Roach/** 3*8d0ebef0SGreg Roach * webtrees: online genealogy 4*8d0ebef0SGreg Roach * Copyright (C) 2018 webtrees development team 5*8d0ebef0SGreg Roach * This program is free software: you can redistribute it and/or modify 6*8d0ebef0SGreg Roach * it under the terms of the GNU General Public License as published by 7*8d0ebef0SGreg Roach * the Free Software Foundation, either version 3 of the License, or 8*8d0ebef0SGreg Roach * (at your option) any later version. 9*8d0ebef0SGreg Roach * This program is distributed in the hope that it will be useful, 10*8d0ebef0SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 11*8d0ebef0SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*8d0ebef0SGreg Roach * GNU General Public License for more details. 13*8d0ebef0SGreg Roach * You should have received a copy of the GNU General Public License 14*8d0ebef0SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 15*8d0ebef0SGreg Roach */ 16*8d0ebef0SGreg Roachdeclare(strict_types=1); 17*8d0ebef0SGreg Roach 18*8d0ebef0SGreg Roachnamespace Fisharebest\Webtrees; 19*8d0ebef0SGreg Roach 20*8d0ebef0SGreg Roachuse ErrorException; 21*8d0ebef0SGreg Roachuse function date_default_timezone_set; 22*8d0ebef0SGreg Roachuse function error_reporting; 23*8d0ebef0SGreg Roachuse function set_error_handler; 24*8d0ebef0SGreg Roach 25*8d0ebef0SGreg Roach/** 26*8d0ebef0SGreg Roach * Definitions for the webtrees application. 27*8d0ebef0SGreg Roach */ 28*8d0ebef0SGreg Roachclass Webtrees 29*8d0ebef0SGreg Roach{ 30*8d0ebef0SGreg Roach // Location of the file containing the database connection details. 31*8d0ebef0SGreg Roach const CONFIG_FILE = __DIR__ . '/../data/config.ini.php'; 32*8d0ebef0SGreg Roach 33*8d0ebef0SGreg Roach // Enable debugging on development builds. 34*8d0ebef0SGreg Roach const DEBUG = self::STABILITY !== ''; 35*8d0ebef0SGreg Roach 36*8d0ebef0SGreg Roach // We want to know about all PHP errors during development, and fewer in production. 37*8d0ebef0SGreg Roach const ERROR_REPORTING = self::DEBUG ? E_ALL | E_STRICT | E_NOTICE | E_DEPRECATED : E_ALL; 38*8d0ebef0SGreg Roach 39*8d0ebef0SGreg Roach // The name of the application. 40*8d0ebef0SGreg Roach const NAME = 'webtrees'; 41*8d0ebef0SGreg Roach 42*8d0ebef0SGreg Roach // Required version of database tables/columns/indexes/etc. 43*8d0ebef0SGreg Roach const SCHEMA_VERSION = 40; 44*8d0ebef0SGreg Roach 45*8d0ebef0SGreg Roach // e.g. "dev", "alpha", "beta.3", etc. 46*8d0ebef0SGreg Roach const STABILITY = 'dev'; 47*8d0ebef0SGreg Roach 48*8d0ebef0SGreg Roach // Project website. 49*8d0ebef0SGreg Roach const URL = 'https://www.webtrees.net/'; 50*8d0ebef0SGreg Roach 51*8d0ebef0SGreg Roach // Version number 52*8d0ebef0SGreg Roach const VERSION = '2.0.0' . (self::STABILITY === '' ? '' : '-') . self::STABILITY; 53*8d0ebef0SGreg Roach 54*8d0ebef0SGreg Roach // Location of our modules and themes. These are used as URLs and folder paths. 55*8d0ebef0SGreg Roach const MODULES_PATH = 'modules_v3/'; 56*8d0ebef0SGreg Roach 57*8d0ebef0SGreg Roach // Location of themes (core and custom). 58*8d0ebef0SGreg Roach const THEMES_PATH = 'themes/'; 59*8d0ebef0SGreg Roach 60*8d0ebef0SGreg Roach // Location of CSS/JS/etc. assets. See also webpack.mix.js. 61*8d0ebef0SGreg Roach const ASSETS_PATH = 'public/assets-2.0.0/'; 62*8d0ebef0SGreg Roach 63*8d0ebef0SGreg Roach // Location of our installation of CK editor. 64*8d0ebef0SGreg Roach const CKEDITOR_PATH = 'public/ckeditor-4.5.2-custom/'; 65*8d0ebef0SGreg Roach 66*8d0ebef0SGreg Roach /** 67*8d0ebef0SGreg Roach * Initialise the application. 68*8d0ebef0SGreg Roach * 69*8d0ebef0SGreg Roach * @return void 70*8d0ebef0SGreg Roach */ 71*8d0ebef0SGreg Roach public static function init() 72*8d0ebef0SGreg Roach { 73*8d0ebef0SGreg Roach // Show all errors and warnings in development, fewer in production. 74*8d0ebef0SGreg Roach error_reporting(self::ERROR_REPORTING); 75*8d0ebef0SGreg Roach 76*8d0ebef0SGreg Roach // PHP requires a time zone to be set. We'll set a better one later on. 77*8d0ebef0SGreg Roach date_default_timezone_set('UTC'); 78*8d0ebef0SGreg Roach 79*8d0ebef0SGreg Roach // Convert PHP warnings/notices into exceptions 80*8d0ebef0SGreg Roach set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline): bool { 81*8d0ebef0SGreg Roach // Ignore errors that are silenced with '@' 82*8d0ebef0SGreg Roach if (error_reporting() & $errno) { 83*8d0ebef0SGreg Roach throw new ErrorException($errstr, 0, $errno, $errfile, $errline); 84*8d0ebef0SGreg Roach } 85*8d0ebef0SGreg Roach 86*8d0ebef0SGreg Roach return true; 87*8d0ebef0SGreg Roach }); 88*8d0ebef0SGreg Roach 89*8d0ebef0SGreg Roach } 90*8d0ebef0SGreg Roach} 91