1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-30 21:30:14 +02:00

core: Add Debug::isEnabled() and Debug::isSecure()

Also adds documentation to Debug.php!

* Debug::isEnabled()

Checks if the DEBUG file exists on disk on the first call (stored in
memory for the duration of the instance). Returns true if debug mode
is enabled for the client.

This function also sets the internal flag for Debug::isSecure()!

* Debug::isSecure()

Returns true if debuging is enabled for specific IP addresses, false
otherwise. This is checked on the first call of Debug::isEnabled().
If you call this function before Debug::isEnabled(), the default value
is false.
This commit is contained in:
logmanoriginal
2018-11-10 20:44:23 +01:00
parent c63af2e7ad
commit a0490e3673
5 changed files with 87 additions and 36 deletions

View File

@@ -57,16 +57,16 @@ EOD;
private static function getHeader() {
$warning = '';
if(defined('DEBUG') && DEBUG === true) {
if(defined('DEBUG_INSECURE') && DEBUG_INSECURE === true) {
if(Debug::isEnabled()) {
if(!Debug::isSecure()) {
$warning .= <<<EOD
<section class="critical-warning">Warning : Debug mode is active from any location,
make sure only you can access RSS-Bridge.</section>
<section class="critical-warning">Warning : Debug mode is active from any location,
make sure only you can access RSS-Bridge.</section>
EOD;
} else {
$warning .= <<<EOD
<section class="warning">Warning : Debug mode is active from your IP address,
your requests will bypass the cache.</section>
<section class="warning">Warning : Debug mode is active from your IP address,
your requests will bypass the cache.</section>
EOD;
}
}