mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-27 03:50:42 +03:00
d62b977394
* refactor: ./tests * test: consolidate testsuites * refactor: move config setup into rssbridge.php Makes it easier to unit test. * lint
33 lines
816 B
PHP
33 lines
816 B
PHP
<?php
|
|
|
|
require_once __DIR__ . '/lib/rssbridge.php';
|
|
|
|
/*
|
|
Move the CLI arguments to the $_GET array, in order to be able to use
|
|
rss-bridge from the command line
|
|
*/
|
|
if (isset($argv)) {
|
|
parse_str(implode('&', array_slice($argv, 1)), $cliArgs);
|
|
$params = array_merge($_GET, $cliArgs);
|
|
} else {
|
|
$params = $_GET;
|
|
}
|
|
|
|
try {
|
|
|
|
$actionFac = new \ActionFactory();
|
|
$actionFac->setWorkingDir(PATH_LIB_ACTIONS);
|
|
|
|
if(array_key_exists('action', $params)) {
|
|
$action = $actionFac->create($params['action']);
|
|
$action->setUserData($params);
|
|
$action->execute();
|
|
} else {
|
|
$showInactive = filter_input(INPUT_GET, 'show_inactive', FILTER_VALIDATE_BOOLEAN);
|
|
echo BridgeList::create($showInactive);
|
|
}
|
|
} catch(\Exception $e) {
|
|
error_log($e);
|
|
header('Content-Type: text/plain', true, $e->getCode());
|
|
die($e->getMessage());
|
|
}
|