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