core: Define path to whitelist.txt in rssbridge.php

This commit is contained in:
logmanoriginal 2018-11-10 19:51:37 +01:00
parent ecdac1b089
commit 9379854f7a
3 changed files with 7 additions and 9 deletions

View file

@ -28,9 +28,6 @@ if(file_exists('DEBUG')) {
require_once __DIR__ . '/lib/rssbridge.php';
// Specify path for whitelist file
define('WHITELIST_FILE', __DIR__ . '/whitelist.txt');
Configuration::verifyInstallation();
Configuration::loadConfiguration();
@ -80,13 +77,13 @@ $whitelist_default = array(
try {
if(!file_exists(WHITELIST_FILE)) {
if(!file_exists(WHITELIST)) {
$whitelist_selection = $whitelist_default;
$whitelist_write = implode("\n", $whitelist_default);
file_put_contents(WHITELIST_FILE, $whitelist_write);
file_put_contents(WHITELIST, $whitelist_write);
} else {
$whitelist_file_content = file_get_contents(WHITELIST_FILE);
$whitelist_file_content = file_get_contents(WHITELIST);
if($whitelist_file_content != "*\n") {
$whitelist_selection = explode("\n", $whitelist_file_content);
} else {

View file

@ -34,9 +34,9 @@ class Configuration {
if(!is_writable(PATH_CACHE))
die('RSS-Bridge does not have write permissions for ' . PATH_CACHE . '!');
// Check whitelist file permissions (only in DEBUG mode)
if(!file_exists(WHITELIST_FILE) && !is_writable(dirname(WHITELIST_FILE)))
die('RSS-Bridge does not have write permissions for ' . WHITELIST_FILE . '!');
// Check whitelist file permissions
if(!file_exists(WHITELIST) && !is_writable(dirname(WHITELIST)))
die('RSS-Bridge does not have write permissions for ' . WHITELIST . '!');
}

View file

@ -6,6 +6,7 @@ define('PATH_LIB_BRIDGES', __DIR__ . '/../bridges/'); // Path to bridges library
define('PATH_LIB_FORMATS', __DIR__ . '/../formats/'); // Path to formats library
define('PATH_LIB_CACHES', __DIR__ . '/../caches/'); // Path to caches library
define('PATH_CACHE', __DIR__ . '/../cache/'); // Path to cache folder
define('WHITELIST', __DIR__ . '/../whitelist.txt'); // Path to whitelist file
define('REPOSITORY', 'https://github.com/RSS-Bridge/rss-bridge/');
// Interfaces