2017-07-15 20:44:06 +00:00
|
|
|
<?php
|
|
|
|
namespace JKingWeb\Arsse;
|
2017-08-29 14:50:31 +00:00
|
|
|
|
2017-10-02 19:42:15 +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
|
|
|
|
(new REST)->dispatch()->output();
|
2017-08-29 14:50:31 +00:00
|
|
|
}
|