1<?php 2require_once __DIR__ . '/lib/rssbridge.php'; 3 4Configuration::verifyInstallation(); 5Configuration::loadConfiguration(); 6 7Authentication::showPromptIfNeeded(); 8 9/* 10Move the CLI arguments to the $_GET array, in order to be able to use 11rss-bridge from the command line 12*/ 13if (isset($argv)) { 14 parse_str(implode('&', array_slice($argv, 1)), $cliArgs); 15 $params = array_merge($_GET, $cliArgs); 16} else { 17 $params = $_GET; 18} 19 20define('USER_AGENT', 21 'Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0(rss-bridge/' 22 . Configuration::$VERSION 23 . ';+' 24 . REPOSITORY 25 . ')' 26); 27 28ini_set('user_agent', USER_AGENT); 29 30try { 31 32 $actionFac = new \ActionFactory(); 33 $actionFac->setWorkingDir(PATH_LIB_ACTIONS); 34 35 if(array_key_exists('action', $params)) { 36 $action = $actionFac->create($params['action']); 37 $action->setUserData($params); 38 $action->execute(); 39 } else { 40 $showInactive = filter_input(INPUT_GET, 'show_inactive', FILTER_VALIDATE_BOOLEAN); 41 echo BridgeList::create($showInactive); 42 } 43} catch(\Exception $e) { 44 error_log($e); 45 header('Content-Type: text/plain', true, $e->getCode()); 46 die($e->getMessage()); 47} 48