fix(configuration): #74 fatal error when the CHANNELS is not defined

Closes: #74
This commit is contained in:
grandeljay 2023-03-13 14:40:50 +01:00
parent 4a79160b71
commit eab739f83a
2 changed files with 17 additions and 4 deletions

View file

@ -19,10 +19,12 @@ function redirect(string $target)
$isHostInChannel = false;
/** Determine if host is a defined channel */
foreach (CHANNELS as $channel) {
if ($channel['host'] === $_SERVER['HTTP_HOST']) {
$isHostInChannel = true;
break;
if (defined('CHANNELS') && is_array(CHANNELS)) {
foreach (CHANNELS as $channel) {
if ($channel['host'] === $_SERVER['HTTP_HOST']) {
$isHostInChannel = true;
break;
}
}
}

View file

@ -118,6 +118,17 @@ $page->navigation();
<a href="https://github.com/grandeljay/wishthis/issues/64" target="_blank">#64</a>
</li>
</ul>
<h3 class="ui header"><?= __('Fixed') ?></h3>
<ul>
<li>
<?php
/** TRANSLATORS: Changelog: Fixed */
echo __('A fatal error when the CHANNELS constant is removed from the config');
?>
<a href="https://github.com/grandeljay/wishthis/issues/74" target="_blank">#74</a>
</li>
</ul>
</div>
</div>