streaming-website/view/embed.php
Jannik Beyerstedt dc57652519 PHP 8: Handle more errors explicitly
The error control operator "@" has changed behavior in PHP8 and generally seems
like a quite bad hack. So let's handle array/ dict access errors explicitly.
2023-10-27 20:18:21 +02:00

32 lines
721 B
PHP

<?php
$room = $conference->getRoom($_GET['room']);
if(!$room->hasEmbed())
throw new NotFoundException('Embedding is not enabled in this room');
$selection = $_GET['selection'];
$language = $_GET['language'];
if ($language !== 'native') {
if (! $room->hasTranslation()) {
throw new NotFoundException('Not translated');
}
if (! $room->isValidLanguage($language)) {
throw new NotFoundException('Language not found');
}
}
$stream = $room->selectStream($selection, $language);
echo $tpl->render(array(
'page' => 'embed',
'naked' => true, // no header/footer
'title' => $stream->getDisplay(),
'room' => $room,
'stream' => $stream,
'autoplay' => isset($_GET['autoplay']) ? $_GET['autoplay'] : false,
));