forked from blallo/rss-bridge
[index] Use constant instead of variable for the whitelist file path
Like the cache folder the whitelist file is assumed static and thus should be defined as constant.
This commit is contained in:
parent
cbda060b86
commit
f1534c91e2
1 changed files with 6 additions and 4 deletions
10
index.php
10
index.php
|
@ -25,6 +25,9 @@ error_reporting(0);
|
||||||
// Specify directory for cached files (using FileCache)
|
// Specify directory for cached files (using FileCache)
|
||||||
define('CACHE_DIR', __DIR__ . '/cache');
|
define('CACHE_DIR', __DIR__ . '/cache');
|
||||||
|
|
||||||
|
// Specify path for whitelist file
|
||||||
|
define('WHITELIST_FILE', __DIR__ . '/whitelist.txt');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a file named 'DEBUG' for enabling debug mode.
|
Create a file named 'DEBUG' for enabling debug mode.
|
||||||
For further security, you may put whitelisted IP addresses
|
For further security, you may put whitelisted IP addresses
|
||||||
|
@ -77,7 +80,6 @@ $userAgent .= '+https://github.com/RSS-Bridge/rss-bridge)';
|
||||||
ini_set('user_agent', $userAgent);
|
ini_set('user_agent', $userAgent);
|
||||||
|
|
||||||
// default whitelist
|
// default whitelist
|
||||||
$whitelist_file = './whitelist.txt';
|
|
||||||
$whitelist_default = array(
|
$whitelist_default = array(
|
||||||
"BandcampBridge",
|
"BandcampBridge",
|
||||||
"CryptomeBridge",
|
"CryptomeBridge",
|
||||||
|
@ -102,13 +104,13 @@ try {
|
||||||
Format::setDir(__DIR__ . '/formats/');
|
Format::setDir(__DIR__ . '/formats/');
|
||||||
Cache::setDir(__DIR__ . '/caches/');
|
Cache::setDir(__DIR__ . '/caches/');
|
||||||
|
|
||||||
if(!file_exists($whitelist_file)) {
|
if(!file_exists(WHITELIST_FILE)) {
|
||||||
$whitelist_selection = $whitelist_default;
|
$whitelist_selection = $whitelist_default;
|
||||||
$whitelist_write = implode("\n", $whitelist_default);
|
$whitelist_write = implode("\n", $whitelist_default);
|
||||||
file_put_contents($whitelist_file, $whitelist_write);
|
file_put_contents(WHITELIST_FILE, $whitelist_write);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$whitelist_file_content = file_get_contents($whitelist_file);
|
$whitelist_file_content = file_get_contents(WHITELIST_FILE);
|
||||||
if($whitelist_file_content != "*\n") {
|
if($whitelist_file_content != "*\n") {
|
||||||
$whitelist_selection = explode("\n", $whitelist_file_content);
|
$whitelist_selection = explode("\n", $whitelist_file_content);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue