1<?php 2 3use App\Autoloader; 4use App\Template\Engine; 5 6// Dual PSR-4 compatible class autoloader. When Composer is not available, an 7// application specific replacement class is used. Once Composer can be added 8// to the deployment step with rsync this can be simplified and only Composer's 9// autoload.php will be used. 10if (file_exists(__DIR__.'/../vendor/autoload.php')) { 11 require_once __DIR__.'/../vendor/autoload.php'; 12} else { 13 require_once __DIR__.'/../src/Autoloader.php'; 14 15 $loader = new Autoloader(); 16 $loader->addNamespace('App\\', __DIR__.'/../src/'); 17 18 $loader->addClassmap('Horde_Text_Diff', __DIR__.'/../src/Horde/Text/Diff.php'); 19 $loader->addClassmap('Horde_Text_Diff_Engine_Native', __DIR__.'/../src/Horde/Text/Diff/Engine/Native.php'); 20 $loader->addClassmap('Horde_Text_Diff_Op_Add', __DIR__.'/../src/Horde/Text/Diff/Op/Add.php'); 21 $loader->addClassmap('Horde_Text_Diff_Op_Base', __DIR__.'/../src/Horde/Text/Diff/Op/Base.php'); 22 $loader->addClassmap('Horde_Text_Diff_Op_Change', __DIR__.'/../src/Horde/Text/Diff/Op/Change.php'); 23 $loader->addClassmap('Horde_Text_Diff_Op_Copy', __DIR__.'/../src/Horde/Text/Diff/Op/Copy.php'); 24 $loader->addClassmap('Horde_Text_Diff_Op_Delete', __DIR__.'/../src/Horde/Text/Diff/Op/Delete.php'); 25 $loader->addClassmap('Horde_Text_Diff_Renderer', __DIR__.'/../src/Horde/Text/Diff/Renderer.php'); 26} 27 28// Configuration 29$site = 'php'; 30$siteBig = 'PHP'; 31$ROOT_DIR = realpath(__DIR__ . '/../'); 32 33$localConfigFile = __DIR__.'/../local_config.php'; 34if (file_exists($localConfigFile)) { 35 require $localConfigFile; 36} else { 37 $site_data = [ 38 'method' => 'https', 39 'url' => 'bugs.php.net', 40 'basedir' => '', 41 'email' => 'php-bugs@lists.php.net', 42 'doc_email' => 'doc-bugs@lists.php.net', 43 'security_email' => 'security@php.net', 44 'db' => 'phpbugsdb', 45 'db_user' => 'nobody', 46 'db_pass' => '', 47 'db_host' => 'localhost', 48 'patch_tmp' => __DIR__.'/../uploads/patches/', 49 ]; 50 define('DEVBOX', false); 51} 52 53if (!isset($site_data['security_email'])) { 54 $site_data['security_email'] = 'security@php.net'; 55} 56 57// DO NOT EDIT ANYTHING BELOW THIS LINE, edit $site_data above instead! 58$logged_in = false; 59$site_method = $site_data['method']; 60$site_url = $site_data['url']; 61$bugEmail = $site_data['email']; 62$docBugEmail = $site_data['doc_email']; 63$secBugEmail = $site_data['security_email']; 64$basedir = $site_data['basedir']; 65 66// Container initialization 67$container = require_once __DIR__.'/../config/container.php'; 68 69// Configure errors based on the environment. 70if ('dev' === $container->get('env')) { 71 ini_set('display_errors', '1'); 72} else { 73 ini_set('display_errors', '0'); 74} 75 76// Obtain the functions and variables used throughout the bug system. 77require_once __DIR__.'/functions.php'; 78 79// Database connection with vanilla PDO to understand app architecture in no time. 80$dbh = $container->get(\PDO::class); 81 82// Last updated. 83$tmp = filectime($_SERVER['SCRIPT_FILENAME']); 84$LAST_UPDATED = date('D M d H:i:s Y', $tmp - date('Z', $tmp)) . ' UTC'; 85 86// Initialize template engine. 87$template = $container->get(Engine::class); 88$template->assign([ 89 'lastUpdated' => $LAST_UPDATED, 90 'siteScheme' => $container->get('site_scheme'), 91 'siteUrl' => $container->get('site_url'), 92]); 93