d4e867f240
Default bridges are currently statically defined in index.php, which is not the right place if we want to keep responsibilities separated. This commit introduces a new file whitelist.default.txt that holds the default bridges and which is loaded automatically, if whitelist.txt doesn't exist. Due to this it is also no longer necessary to have write permission for the root directory. References #1001
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/lib/rssbridge.php';
|
|
|
|
Configuration::verifyInstallation();
|
|
Configuration::loadConfiguration();
|
|
|
|
Authentication::showPromptIfNeeded();
|
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
/*
|
|
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;
|
|
}
|
|
|
|
define('USER_AGENT',
|
|
'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20121202 Firefox/30.0(rss-bridge/'
|
|
. Configuration::$VERSION
|
|
. ';+'
|
|
. REPOSITORY
|
|
. ')'
|
|
);
|
|
|
|
ini_set('user_agent', USER_AGENT);
|
|
|
|
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());
|
|
}
|