ini_set("display_errors", 1); error_reporting(E_WARNING); // Load the autoloader if (file_exists(__DIR__ . "/vendor/autoload.php")) { require_once __DIR__ . "/vendor/autoload.php"; } else { throw new Exception("vendor/autoload.php not found, make sure you run composer install"); } // Require the config if (file_exists(__DIR__ . "/config/config.php")) { require_once __DIR__ . "/config/config.php"; } else { throw new Exception("config.php not found (you might wanna start by copying config_new.php)"); } // Init Slim $app = new \ProjectRena\RenaApp($config["slim"]); // Session $session = new SessionHandler(); session_set_save_handler($session, true); session_cache_limiter(false); session_start(); // Launch Whoops $app->add(new WhoopsMiddleware()); // Load the translator $translator = new \Symfony\Component\Translation\Translator("en_US", new \Symfony\Component\Translation\MessageSelector()); $translator->setFallbackLocales(array("en_US")); $translator->addLoader("php", new \Symfony\Component\Translation\Loader\PhpFileLoader()); $languageFiles = glob(__DIR__ . "/lang/*.php"); foreach ($languageFiles as $langFile) { $translator->addResource("php", $langFile, str_replace(".php", "", basename($langFile))); }
ini_set("display_errors", 1); error_reporting(E_WARNING); // Load the autoloader if (file_exists(__DIR__ . "/vendor/autoload.php")) { require_once __DIR__ . "/vendor/autoload.php"; } else { throw new Exception("vendor/autoload.php not found, make sure you run composer install"); } // Require the config if (file_exists(__DIR__ . "/config/config.php")) { require_once __DIR__ . "/config/config.php"; } else { throw new Exception("config.php not found (you might wanna start by copying config_new.php)"); } // Init Slim $app = new \ProjectRena\RenaApp($config["slim"]); // Session $session = new SessionHandler(); session_set_save_handler($session, true); session_cache_limiter(false); session_start(); // Launch Whoops $app->add(new WhoopsMiddleware()); // Load the translator // replace en_US with the language that the user has selected, and stored in a cookie (aka: load cookie, get language, use language) $translator = new \Symfony\Component\Translation\Translator("en_US", new \Symfony\Component\Translation\MessageSelector()); $translator->setFallbackLocales(array("en_US")); $translator->addLoader("php", new \Symfony\Component\Translation\Loader\PhpFileLoader()); $languageFiles = glob(__DIR__ . "/lang/*.php"); foreach ($languageFiles as $langFile) { $translator->addResource("php", $langFile, str_replace(".php", "", basename($langFile)));