2020-03-10 19:04:22 +00:00
|
|
|
<?php
|
|
|
|
|
2021-10-10 09:26:18 +01:00
|
|
|
declare(strict_types = 1);
|
|
|
|
|
2020-08-03 21:45:00 +01:00
|
|
|
use App\Core\ModuleManager;
|
2020-03-10 19:04:22 +00:00
|
|
|
use Symfony\Component\Dotenv\Dotenv;
|
|
|
|
|
2021-10-10 09:26:18 +01:00
|
|
|
$loader = require \dirname(__DIR__) . '/vendor/autoload.php';
|
2020-03-10 19:04:22 +00:00
|
|
|
|
|
|
|
// Load cached env vars if the .env.local.php file exists
|
|
|
|
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
|
2021-10-10 09:26:18 +01:00
|
|
|
if (\is_array($env = @include \dirname(__DIR__) . '/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
|
2020-03-10 19:04:22 +00:00
|
|
|
foreach ($env as $k => $v) {
|
2021-10-10 09:26:18 +01:00
|
|
|
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && !str_starts_with($k, 'HTTP_') ? $_SERVER[$k] : $v);
|
2020-03-10 19:04:22 +00:00
|
|
|
}
|
2021-10-10 09:26:18 +01:00
|
|
|
} elseif (!class_exists(Dotenv::class)) {
|
2020-03-10 19:04:22 +00:00
|
|
|
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
|
|
|
|
} else {
|
|
|
|
// load all the .env files
|
2020-06-08 13:04:20 +01:00
|
|
|
(new Dotenv())->loadEnv(\dirname(__DIR__) . '/.env');
|
2020-03-10 19:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$_SERVER += $_ENV;
|
2021-10-10 09:26:18 +01:00
|
|
|
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
|
|
|
|
$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
|
|
|
|
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
|
|
|
|
|
|
|
|
\define('INSTALLDIR', \dirname(__DIR__));
|
|
|
|
\define('SRCDIR', INSTALLDIR . '/src');
|
|
|
|
\define('PUBLICDIR', INSTALLDIR . '/public');
|
|
|
|
\define('GNUSOCIAL_ENGINE_NAME', 'GNU social');
|
2021-09-06 19:49:03 +01:00
|
|
|
// MERGE Change to https://gnu.io/social/
|
2021-10-10 09:26:18 +01:00
|
|
|
\define('GNUSOCIAL_PROJECT_URL', 'https://gnusocial.rocks/');
|
|
|
|
\define('GNUSOCIAL_ENGINE_URL', GNUSOCIAL_PROJECT_URL);
|
2021-09-06 19:49:03 +01:00
|
|
|
// MERGE Change to https://git.gnu.io/gnu/gnu-social
|
2021-10-10 09:26:18 +01:00
|
|
|
\define('GNUSOCIAL_REPOSITORY_URL', 'https://code.undefinedhackers.net/GNUsocial/gnu-social');
|
2021-09-06 19:49:03 +01:00
|
|
|
// Current base version, major.minor.patch
|
2021-10-10 09:26:18 +01:00
|
|
|
\define('GNUSOCIAL_BASE_VERSION', '3.0.0');
|
2021-09-06 19:49:03 +01:00
|
|
|
// 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
2021-10-10 09:26:18 +01:00
|
|
|
\define('GNUSOCIAL_LIFECYCLE', 'dev');
|
|
|
|
\define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
|
|
|
|
\define('GNUSOCIAL_CODENAME', 'Big bang');
|
2021-09-06 19:49:03 +01:00
|
|
|
|
2021-10-10 09:26:18 +01:00
|
|
|
\define('MODULE_CACHE_FILE', INSTALLDIR . '/var/cache/module_manager.php');
|
2021-09-06 20:59:36 +01:00
|
|
|
|
2021-09-14 13:40:50 +01:00
|
|
|
/**
|
|
|
|
* StatusNet had this string as valid path characters: '\pN\pL\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\'\@'
|
|
|
|
* Some of those characters can be troublesome when auto-linking plain text. Such as "http://some.com/)"
|
|
|
|
* URL encoding should be used whenever a weird character is used, the following strings are not definitive.
|
|
|
|
*/
|
2021-10-10 09:26:18 +01:00
|
|
|
\define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\!\.\:\-\_\+\/\@\=\;\%\~\*\(\)');
|
|
|
|
\define('URL_REGEX_VALID_QSTRING_CHARS', URL_REGEX_VALID_PATH_CHARS . '\&');
|
|
|
|
\define('URL_REGEX_VALID_FRAGMENT_CHARS', URL_REGEX_VALID_QSTRING_CHARS . '\?\#');
|
|
|
|
\define('URL_REGEX_EXCLUDED_END_CHARS', '\?\.\,\!\#\:\''); // don't include these if they are directly after a URL
|
|
|
|
\define('URL_REGEX_DOMAIN_NAME', '(?:(?!-)[A-Za-z0-9\-]{1,63}(?<!-)\.)+[A-Za-z]{2,10}');
|
2021-09-14 13:40:50 +01:00
|
|
|
|
2021-09-06 19:49:03 +01:00
|
|
|
// Work internally in UTC
|
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
|
|
|
|
// Work internally with UTF-8
|
|
|
|
mb_internal_encoding('UTF-8');
|
|
|
|
|
2020-08-03 21:45:00 +01:00
|
|
|
ModuleManager::setLoader($loader);
|