2020-03-11 04:04:22 +09:00
|
|
|
<?php
|
|
|
|
|
2021-10-10 17:26:18 +09:00
|
|
|
declare(strict_types = 1);
|
|
|
|
|
2020-08-04 05:45:00 +09:00
|
|
|
use App\Core\ModuleManager;
|
2020-03-11 04:04:22 +09:00
|
|
|
use Symfony\Component\Dotenv\Dotenv;
|
|
|
|
|
2021-10-10 17:26:18 +09:00
|
|
|
$loader = require \dirname(__DIR__) . '/vendor/autoload.php';
|
2020-03-11 04:04:22 +09: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 17:26:18 +09: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-11 04:04:22 +09:00
|
|
|
foreach ($env as $k => $v) {
|
2021-10-10 17:26:18 +09:00
|
|
|
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && !str_starts_with($k, 'HTTP_') ? $_SERVER[$k] : $v);
|
2020-03-11 04:04:22 +09:00
|
|
|
}
|
2021-10-10 17:26:18 +09:00
|
|
|
} elseif (!class_exists(Dotenv::class)) {
|
2020-03-11 04:04:22 +09: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 21:04:20 +09:00
|
|
|
(new Dotenv())->loadEnv(\dirname(__DIR__) . '/.env');
|
2020-03-11 04:04:22 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
$_SERVER += $_ENV;
|
2021-10-10 17:26:18 +09: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-07 03:49:03 +09:00
|
|
|
// MERGE Change to https://gnu.io/social/
|
2021-10-10 17:26:18 +09:00
|
|
|
\define('GNUSOCIAL_PROJECT_URL', 'https://gnusocial.rocks/');
|
|
|
|
\define('GNUSOCIAL_ENGINE_URL', GNUSOCIAL_PROJECT_URL);
|
2021-09-07 03:49:03 +09:00
|
|
|
// MERGE Change to https://git.gnu.io/gnu/gnu-social
|
2021-10-10 17:26:18 +09:00
|
|
|
\define('GNUSOCIAL_REPOSITORY_URL', 'https://code.undefinedhackers.net/GNUsocial/gnu-social');
|
2021-09-07 03:49:03 +09:00
|
|
|
// Current base version, major.minor.patch
|
2021-10-10 17:26:18 +09:00
|
|
|
\define('GNUSOCIAL_BASE_VERSION', '3.0.0');
|
2021-09-07 03:49:03 +09:00
|
|
|
// 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
2021-10-10 17:26:18 +09:00
|
|
|
\define('GNUSOCIAL_LIFECYCLE', 'dev');
|
|
|
|
\define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
|
|
|
|
\define('GNUSOCIAL_CODENAME', 'Big bang');
|
2021-09-07 03:49:03 +09:00
|
|
|
|
2021-10-10 17:26:18 +09:00
|
|
|
\define('MODULE_CACHE_FILE', INSTALLDIR . '/var/cache/module_manager.php');
|
2021-09-07 04:59:36 +09:00
|
|
|
|
2021-09-14 21:40:50 +09: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 17:26:18 +09: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 21:40:50 +09:00
|
|
|
|
2021-09-07 03:49:03 +09:00
|
|
|
// Work internally in UTC
|
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
|
|
|
|
// Work internally with UTF-8
|
|
|
|
mb_internal_encoding('UTF-8');
|
|
|
|
|
2020-08-04 05:45:00 +09:00
|
|
|
ModuleManager::setLoader($loader);
|