mirror of https://github.com/flarum/flarum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1017 B
38 lines
1017 B
<?php
|
|
|
|
use Flarum\Core;
|
|
use Zend\Diactoros\Server;
|
|
use Zend\Stratigility\MiddlewarePipe;
|
|
|
|
// Instantiate the application, register providers etc.
|
|
$app = require __DIR__.'/flarum/bootstrap.php';
|
|
|
|
// Set up everything we need for the frontend
|
|
$app->register('Flarum\Admin\AdminServiceProvider');
|
|
|
|
// Build a middleware pipeline for Flarum
|
|
$admin = new MiddlewarePipe();
|
|
$admin->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
|
|
$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin'));
|
|
|
|
$adminPath = parse_url(Core::config('admin_url'), PHP_URL_PATH);
|
|
$admin->pipe($adminPath, $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')]));
|
|
|
|
// Handle errors
|
|
if (Core::inDebugMode()) {
|
|
$admin->pipe(new \Franzl\Middleware\Whoops\Middleware());
|
|
} else {
|
|
$admin->pipe(new \Flarum\Forum\Middleware\HandleErrors(base_path('error')));
|
|
}
|
|
|
|
$server = Server::createServer(
|
|
$admin,
|
|
$_SERVER,
|
|
$_GET,
|
|
$_POST,
|
|
$_COOKIE,
|
|
$_FILES
|
|
);
|
|
|
|
$server->listen();
|