blob: f118d5009e69b8e87865149ce0e0b63c02938b96 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?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();
if (array_key_exists('action', $params)) {
$action = $actionFac->create($params['action']);
$action->userData = $params;
$action->execute();
} else {
$showInactive = filter_input(INPUT_GET, 'show_inactive', FILTER_VALIDATE_BOOLEAN);
echo BridgeList::create($showInactive);
}
} catch (\Throwable $e) {
error_log($e);
$code = $e->getCode();
if ($code !== -1) {
header('Content-Type: text/plain', true, $code);
}
$message = sprintf("Uncaught Exception %s: '%s'\n", get_class($e), $e->getMessage());
print $message;
}
|