2017-07-15 20:44:06 +00:00
|
|
|
<?php
|
2017-11-17 01:23:18 +00:00
|
|
|
/** @license MIT
|
|
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
|
2017-07-15 20:44:06 +00:00
|
|
|
namespace JKingWeb\Arsse;
|
2017-08-29 14:50:31 +00:00
|
|
|
|
2017-10-01 13:33:49 +00:00
|
|
|
const BASE = __DIR__.DIRECTORY_SEPARATOR;
|
|
|
|
const NS_BASE = __NAMESPACE__."\\";
|
|
|
|
|
|
|
|
require_once BASE."vendor".DIRECTORY_SEPARATOR."autoload.php";
|
|
|
|
ignore_user_abort(true);
|
|
|
|
|
2017-07-15 20:44:06 +00:00
|
|
|
|
2017-08-29 14:50:31 +00:00
|
|
|
if (\PHP_SAPI=="cli") {
|
2017-07-21 21:15:43 +00:00
|
|
|
// initialize the CLI; this automatically handles --help and --version
|
|
|
|
$cli = new CLI;
|
2017-08-20 03:56:32 +00:00
|
|
|
// handle other CLI requests; some do not require configuration
|
2017-07-21 21:15:43 +00:00
|
|
|
$cli->dispatch();
|
2017-07-15 20:44:06 +00:00
|
|
|
} else {
|
2017-07-21 21:15:43 +00:00
|
|
|
// load configuration
|
|
|
|
Arsse::load(new Conf());
|
2017-08-29 14:50:31 +00:00
|
|
|
if (file_exists(BASE."config.php")) {
|
2017-08-18 03:05:08 +00:00
|
|
|
Arsse::$conf->importFile(BASE."config.php");
|
|
|
|
}
|
2017-07-21 21:15:43 +00:00
|
|
|
// handle Web requests
|
2018-01-06 17:02:45 +00:00
|
|
|
$emitter = new \Zend\Diactoros\Response\SapiEmitter();
|
|
|
|
$response = (new REST)->dispatch();
|
|
|
|
$emitter->emit($response);
|
2017-08-29 14:50:31 +00:00
|
|
|
}
|