flarum/admin.php
Toby Zerner 07856bd53e Load extensions after other service providers
And let them know what kind of request this is via a “type” binding on
the container. Not sure if there is a better way to do this. But they
need to know somehow, so extenders can act selectively (e.g. the
ForumClient extender should only act on forum requests, not on API or
admin requests)
2015-06-18 17:46:49 +09:30

31 lines
891 B
PHP

<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Server;
use Zend\Stratigility\MiddlewarePipe;
// Instantiate the application, register providers etc.
$app = require __DIR__.'/system/bootstrap.php';
// Set up everything we need for the frontend
$app->instance('type', 'admin');
$app->register('Flarum\Admin\AdminServiceProvider');
$app->register('Flarum\Support\Extensions\ExtensionsServiceProvider');
$admin = new MiddlewarePipe();
$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin'));
$admin->pipe('/admin', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')]));
$admin->pipe(new \Franzl\Middleware\Whoops\Middleware());
$server = Server::createServer(
$admin,
$_SERVER,
$_GET,
$_POST,
$_COOKIE,
$_FILES
);
$server->listen();