From 1763a1518ccf887e44eb3186a4d0b52c44fa24f3 Mon Sep 17 00:00:00 2001 From: Teromene Date: Wed, 8 Mar 2017 10:56:39 +0000 Subject: [PATCH] Restore the ability to whitelist all the bridges by putting a wildcard into the whitelist file. --- index.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index 80ca78cf..a99c5be0 100644 --- a/index.php +++ b/index.php @@ -93,20 +93,26 @@ $whitelist_default = array( "WikipediaBridge", "YoutubeBridge"); -if(!file_exists($whitelist_file)){ - $whitelist_selection = $whitelist_default; - $whitelist_write = implode("\n", $whitelist_default); - file_put_contents($whitelist_file, $whitelist_write); -} else { - $whitelist_selection = explode("\n", file_get_contents($whitelist_file)); -} - try { Bridge::setDir(__DIR__ . '/bridges/'); Format::setDir(__DIR__ . '/formats/'); Cache::setDir(__DIR__ . '/caches/'); + if(!file_exists($whitelist_file)){ + $whitelist_selection = $whitelist_default; + $whitelist_write = implode("\n", $whitelist_default); + file_put_contents($whitelist_file, $whitelist_write); + } else { + + $whitelist_file_content = file_get_contents($whitelist_file); + if($whitelist_file_content != "*\n") { + $whitelist_selection = explode("\n", $whitelist_file_content); + } else { + $whitelist_selection = Bridge::listBridges(); + } + } + $action = filter_input(INPUT_GET, 'action'); $bridge = filter_input(INPUT_GET, 'bridge');