. /** * Main GNU social entry point * * @package GNUsocial * @category Framework * * @author Brenda Wallace * @author Brion Vibber * @author Brion Vibber * @author Christopher Vollick * @author CiaranG * @author Craig Andrews * @author Craig Andrews * @author Evan Prodromou * @author Evan Prodromou * @author Evan Prodromou * @author Evan Prodromou * @author Gina Haeussge * @author James Walker * @author Jeffery To * @author Jeffery To * @author Mikael Nordfeldth * @author Mike Cochrane * @author Robin Millette * @author Sarven Capadisli * @author Sarven Capadisli * @author Siebrand Mazeland * @author Tom Adams * @author Tom Adams * @author Zach Copley * @author Diogo Cordeiro * @author Hugo Sales * @copyright 2010, 2018-2020 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ namespace App\Util; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Contracts\Translation\TranslatorInterface; class GNUsocial implements EventSubscriberInterface { protected ContainerInterface $container; protected LoggerInterface $logger; protected TranslatorInterface $translator; public function __construct(ContainerInterface $container, LoggerInterface $logger, TranslatorInterface $translator) { $this->container = $container; $this->logger = $logger; $this->translator = $translator; if (!\defined('INSTALLDIR')) { define('INSTALLDIR', dirname(__DIR__)); define('SRCDIR', INSTALLDIR . '/src'); define('PUBLICDIR', INSTALLDIR . '/public'); define('GNUSOCIAL_ENGINE', 'GNU social'); // MERGE Change to https://gnu.io/social/ define('GNUSOCIAL_ENGINE_URL', 'https://gnusocial.network/'); // MERGE Change to https://git.gnu.io/gnu/gnu-social define('GNUSOCIAL_ENGINE_REPO_URL', 'https://notabug.org/diogo/gnu-social/'); // Current base version, major.minor.patch define('GNUSOCIAL_BASE_VERSION', '3.0.0'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release' define('GNUSOCIAL_LIFECYCLE', 'dev'); define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE); define('GNUSOCIAL_CODENAME', 'Big bang'); // Work internally in UTC date_default_timezone_set('UTC'); // Work internally with UTF-8 mb_internal_encoding('UTF-8'); } } public function onKernelRequest(RequestEvent $event, string $event_name, $event_dispatcher): RequestEvent { if (!\defined('INSTALLDIR')) { Log::setLogger($this->logger); GSEvent::setDispatcher($event_dispatcher); I18n::setTranslator($this->translator); } return $event; } public static function getSubscribedEvents() { return [KernelEvents::REQUEST => 'onKernelRequest']; } }