18d0ebef0SGreg Roach<?php 28d0ebef0SGreg Roach/** 38d0ebef0SGreg Roach * webtrees: online genealogy 48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 58d0ebef0SGreg Roach * This program is free software: you can redistribute it and/or modify 68d0ebef0SGreg Roach * it under the terms of the GNU General Public License as published by 78d0ebef0SGreg Roach * the Free Software Foundation, either version 3 of the License, or 88d0ebef0SGreg Roach * (at your option) any later version. 98d0ebef0SGreg Roach * This program is distributed in the hope that it will be useful, 108d0ebef0SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 118d0ebef0SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 128d0ebef0SGreg Roach * GNU General Public License for more details. 138d0ebef0SGreg Roach * You should have received a copy of the GNU General Public License 148d0ebef0SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 158d0ebef0SGreg Roach */ 168d0ebef0SGreg Roachdeclare(strict_types=1); 178d0ebef0SGreg Roach 188d0ebef0SGreg Roachnamespace Fisharebest\Webtrees; 198d0ebef0SGreg Roach 208d0ebef0SGreg Roachuse ErrorException; 218d0ebef0SGreg Roachuse function date_default_timezone_set; 228d0ebef0SGreg Roachuse function error_reporting; 238d0ebef0SGreg Roachuse function set_error_handler; 248d0ebef0SGreg Roach 258d0ebef0SGreg Roach/** 268d0ebef0SGreg Roach * Definitions for the webtrees application. 278d0ebef0SGreg Roach */ 288d0ebef0SGreg Roachclass Webtrees 298d0ebef0SGreg Roach{ 308d0ebef0SGreg Roach // Location of the file containing the database connection details. 31*16d6367aSGreg Roach public const CONFIG_FILE = __DIR__ . '/../data/config.ini.php'; 328d0ebef0SGreg Roach 338d0ebef0SGreg Roach // Enable debugging on development builds. 34*16d6367aSGreg Roach public const DEBUG = self::STABILITY !== ''; 358d0ebef0SGreg Roach 368d0ebef0SGreg Roach // We want to know about all PHP errors during development, and fewer in production. 37*16d6367aSGreg Roach public const ERROR_REPORTING = self::DEBUG ? E_ALL | E_STRICT | E_NOTICE | E_DEPRECATED : E_ALL; 388d0ebef0SGreg Roach 398d0ebef0SGreg Roach // The name of the application. 40*16d6367aSGreg Roach public const NAME = 'webtrees'; 418d0ebef0SGreg Roach 428d0ebef0SGreg Roach // Required version of database tables/columns/indexes/etc. 43*16d6367aSGreg Roach public const SCHEMA_VERSION = 41; 448d0ebef0SGreg Roach 458d0ebef0SGreg Roach // e.g. "dev", "alpha", "beta.3", etc. 46*16d6367aSGreg Roach public const STABILITY = 'dev'; 478d0ebef0SGreg Roach 488d0ebef0SGreg Roach // Project website. 49*16d6367aSGreg Roach public const URL = 'https://www.webtrees.net/'; 508d0ebef0SGreg Roach 518d0ebef0SGreg Roach // Version number 52*16d6367aSGreg Roach public const VERSION = '2.0.0' . (self::STABILITY === '' ? '' : '-') . self::STABILITY; 538d0ebef0SGreg Roach 548d0ebef0SGreg Roach // Location of our modules and themes. These are used as URLs and folder paths. 55*16d6367aSGreg Roach public const MODULES_PATH = 'modules_v3/'; 568d0ebef0SGreg Roach 578d0ebef0SGreg Roach // Location of themes (core and custom). 58*16d6367aSGreg Roach public const THEMES_PATH = 'themes/'; 598d0ebef0SGreg Roach 608d0ebef0SGreg Roach // Location of CSS/JS/etc. assets. See also webpack.mix.js. 61*16d6367aSGreg Roach public const ASSETS_PATH = 'public/assets-2.0.0/'; 628d0ebef0SGreg Roach 638d0ebef0SGreg Roach // Location of our installation of CK editor. 64*16d6367aSGreg Roach public const CKEDITOR_PATH = 'public/ckeditor-4.5.2-custom/'; 658d0ebef0SGreg Roach 668d0ebef0SGreg Roach /** 678d0ebef0SGreg Roach * Initialise the application. 688d0ebef0SGreg Roach * 698d0ebef0SGreg Roach * @return void 708d0ebef0SGreg Roach */ 718d0ebef0SGreg Roach public static function init() 728d0ebef0SGreg Roach { 738d0ebef0SGreg Roach // Show all errors and warnings in development, fewer in production. 748d0ebef0SGreg Roach error_reporting(self::ERROR_REPORTING); 758d0ebef0SGreg Roach 768d0ebef0SGreg Roach // PHP requires a time zone to be set. We'll set a better one later on. 778d0ebef0SGreg Roach date_default_timezone_set('UTC'); 788d0ebef0SGreg Roach 798d0ebef0SGreg Roach // Convert PHP warnings/notices into exceptions 808d0ebef0SGreg Roach set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline): bool { 818d0ebef0SGreg Roach // Ignore errors that are silenced with '@' 828d0ebef0SGreg Roach if (error_reporting() & $errno) { 838d0ebef0SGreg Roach throw new ErrorException($errstr, 0, $errno, $errfile, $errline); 848d0ebef0SGreg Roach } 858d0ebef0SGreg Roach 868d0ebef0SGreg Roach return true; 878d0ebef0SGreg Roach }); 888d0ebef0SGreg Roach } 898d0ebef0SGreg Roach} 90