mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 06:34:17 +00:00
PHP 8: Fix major compatibility issues
PHP8 deprecated, that class member variables can be created outside the class definition or constructor, which prevented the code to run at all. Additionally the error handling has changed, which has lead to multiple other errors during the runtime. Finally, strftime was deprecated in PHP 8.1.
This commit is contained in:
parent
0131d4aca8
commit
1cd3e2b60b
13 changed files with 956 additions and 910 deletions
|
@ -87,7 +87,7 @@ try {
|
|||
'conference' => new GenericConference(),
|
||||
));
|
||||
|
||||
if(startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
|
||||
if(isset($GLOBALS['CONFIG']['BASEURL']) && startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
|
||||
{
|
||||
$tpl->set(array(
|
||||
'httpsurl' => forceslash(forceslash('https:'.$GLOBALS['CONFIG']['BASEURL']).@$GLOBALS['MANDATOR']).forceslash($route).url_params(),
|
||||
|
@ -128,7 +128,7 @@ try {
|
|||
exit;
|
||||
}
|
||||
|
||||
@list($mandator, $route) = explode('/', $route, 2);
|
||||
list($mandator, $route) = array_pad(explode('/', $route, 2), 2, "");
|
||||
if(!$mandator)
|
||||
{
|
||||
// root requested
|
||||
|
|
|
@ -13,10 +13,12 @@ if(!function_exists('h'))
|
|||
class PhpTemplate
|
||||
{
|
||||
private $data = array();
|
||||
public $file;
|
||||
|
||||
public function __construct($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->data["naked"] = false;
|
||||
}
|
||||
|
||||
public function set($___data = array())
|
||||
|
|
|
@ -36,6 +36,9 @@ function joinpath($parts)
|
|||
|
||||
function forceslash($url)
|
||||
{
|
||||
if ($url == NULL) {
|
||||
$url = "";
|
||||
}
|
||||
$url = rtrim($url, '/');
|
||||
if(strlen($url) > 0)
|
||||
$url .= '/';
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,8 @@
|
|||
|
||||
class Overview
|
||||
{
|
||||
public $conference;
|
||||
|
||||
public function __construct(Conference $conference)
|
||||
{
|
||||
$this->conference = $conference;
|
||||
|
|
|
@ -50,12 +50,20 @@ class Room
|
|||
}
|
||||
|
||||
public function getSlug() {
|
||||
return $this->slug;
|
||||
if ($this->slug != NULL) {
|
||||
return $this->slug;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private function get($key, $fallbackValue = null) {
|
||||
$keychain = 'ROOMS.'.$this->getSlug().'.'.$key;
|
||||
return $this->conference->get($keychain, $fallbackValue ?: @$GLOBALS['CONFIG']['ROOM_DEFAULTS'][$key]);
|
||||
$fallback = null;
|
||||
if (isset($GLOBALS['CONFIG']['ROOM_DEFAULTS'][$key])) {
|
||||
$fallback = $GLOBALS['CONFIG']['ROOM_DEFAULTS'][$key];
|
||||
}
|
||||
return $this->conference->get($keychain, $fallbackValue ?: $fallback);
|
||||
}
|
||||
|
||||
private function has($key) {
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
class RoomSelection
|
||||
{
|
||||
public $room;
|
||||
public $selection;
|
||||
|
||||
public function __construct(Room $room, $selection)
|
||||
{
|
||||
$this->room = $room;
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
class RoomTab
|
||||
{
|
||||
public $room;
|
||||
public $tab;
|
||||
|
||||
public function __construct(Room $room, $tab)
|
||||
{
|
||||
$this->room = $room;
|
||||
|
|
|
@ -54,7 +54,8 @@ class Schedule
|
|||
|
||||
public function getMappedRoom($scheduleRoom) {
|
||||
$mapping = $this->getScheduleToRoomSlugMapping();
|
||||
return $this->getConference()->getRoomIfExists( @$mapping[$scheduleRoom] );
|
||||
$room = isset($mapping[$scheduleRoom]) ? $mapping[$scheduleRoom] : "";
|
||||
return $this->getConference()->getRoomIfExists( $room );
|
||||
}
|
||||
|
||||
public function getScheduleDisplayTime($basetime = null)
|
||||
|
@ -68,12 +69,16 @@ class Schedule
|
|||
|
||||
private function fetchSchedule()
|
||||
{
|
||||
$schedule = @file_get_contents($this->getScheduleCache());
|
||||
|
||||
if(!$schedule)
|
||||
try {
|
||||
$schedule = file_get_contents($this->getScheduleCache());
|
||||
|
||||
if(!$schedule)
|
||||
return null;
|
||||
|
||||
return simplexml_load_string($schedule);
|
||||
} catch (ErrorException $e) {
|
||||
return null;
|
||||
|
||||
return simplexml_load_string($schedule);
|
||||
}
|
||||
}
|
||||
|
||||
public function getRoomSchedule($roomName, $roomGuid) {
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
class Stream
|
||||
{
|
||||
public $room;
|
||||
public $selection;
|
||||
public $language;
|
||||
public $translation_label;
|
||||
|
||||
public function __construct(Room $room, $selection, $language, $translation_label = null)
|
||||
{
|
||||
$this->room = $room;
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label for="datetime">Date/Time</label>
|
||||
<input type="text" value="<?=h(strftime('%d.%m.%Y %H:%I'))?>" name="datetime" id="datetime" class="form-control" />
|
||||
<input type="text" value="<?=h(date('d.m.Y H:i'))?>" name="datetime" id="datetime" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -25,8 +25,13 @@
|
|||
<div class="room <? if(isset($room) && ($roomname == $room->getScheduleName() || ($scheduleRoom && $scheduleRoom->getId() === $room->getId()))): ?>highlight<? endif ?>" style="width: <?= h($totalWidth) ?>px">
|
||||
<? $fromstart = 0; ?>
|
||||
<? foreach($events as $event): ?>
|
||||
<? $special = isset($event['special']) ? $event['special'] : ''; ?>
|
||||
<? $event_is_optout = isset($event['optout']) ? $event['optout'] : false; ?>
|
||||
<? $event_guid = isset($event['guid']) ? $event['guid'] : ''; ?>
|
||||
<? $event_url = isset($event['url']) ? $event['url'] : ''; ?>
|
||||
<? $event_title = isset($event['title']) ? $event['title'] : ''; ?>
|
||||
<div
|
||||
class="block <?=h(@$event['special'] ?: 'event')?> <?=h((@$event['optout']) ? 'optout' : '')?>"
|
||||
class="block <?=h($special ?: 'event')?> <?=h($event_is_optout ? 'optout' : '')?>"
|
||||
style="width: <?=h(round($event['duration'] / $schedule->getScale()))?>px; left: <?=h(round($fromstart / $schedule->getScale()))?>px"
|
||||
data-start="<?=intval($event['start'])?>"
|
||||
data-end="<?=intval($event['end'])?>"
|
||||
|
@ -42,21 +47,21 @@
|
|||
href="<?=h($scheduleRoom->createTabObject()->getLink($roomname))?>"
|
||||
<? endif ?>
|
||||
title="Switch to <?=h($scheduleRoom->getDisplay())?>"
|
||||
onmouseover="showEventDetails(event, {title:'<?=@$event['title']?>', guid:'<?=@$event['guid']?>', url:'<?=@$event['url']?>', type:'<?=@$event['special']?>'})"
|
||||
onmouseover="showEventDetails(event, {title:'<?=$event_title?>', guid:'<?=$event_guid?>', url:'<?=$event_url?>', type:'<?=@$special?>'})"
|
||||
>
|
||||
<? else: ?>
|
||||
<div class="inner">
|
||||
<? endif ?>
|
||||
|
||||
<? if(@$event['special'] == 'daychange'): ?>
|
||||
<? if(@$special == 'daychange'): ?>
|
||||
|
||||
<h3><?=h($event['title'])?></h3>
|
||||
|
||||
<? elseif(@$event['special'] == 'gap'): ?>
|
||||
<? elseif(@$special == 'gap'): ?>
|
||||
|
||||
<!--h3>Gap</h3-->
|
||||
|
||||
<? elseif(@$event['special'] == 'pause'): ?>
|
||||
<? elseif(@$special == 'pause'): ?>
|
||||
|
||||
<h3><?=h($event['title'])?></h3>
|
||||
|
||||
|
@ -70,7 +75,7 @@
|
|||
</h4>
|
||||
<? endif ?>
|
||||
<h3 title="<?=$event['title']?>">
|
||||
<?=h($event['title'])?><? if (@$event['optout']): ?><i> (no recording)</i><? endif ?>
|
||||
<?=h($event['title'])?><? if ($event_is_optout): ?><i> (no recording)</i><? endif ?>
|
||||
</h3>
|
||||
<? if(! empty(trim($event['speaker']))): ?>
|
||||
<h5>by <?=h($event['speaker'])?></h5>
|
||||
|
|
|
@ -104,14 +104,15 @@
|
|||
$upcoming = @$upcomingTalksPerRoom[ $room->getSlug() ] ?: [];
|
||||
// echo var_dump($upcoming);
|
||||
$current = @$upcoming['current'];
|
||||
$next = @$upcoming['next']; ?>
|
||||
$next = @$upcoming['next'];
|
||||
$next_is_special = isset($next['special']) ? $next['special'] : false; ?>
|
||||
<div class="program-schedule">
|
||||
<? if($current && !@$current['special']): ?>
|
||||
<div class="talk current-talk" title="<?=h(@$current['title'] ?: 'none') ?>">
|
||||
<strong>Now (since <?=date('G:i', @$current['start']) ?>):</strong><br/>
|
||||
<span class="t"><?=h(@$current['title'] ?: 'none') ?></span>
|
||||
</div>
|
||||
<? endif; if($next && !@$next['special']): ?>
|
||||
<? endif; if($next && !$next_is_special): ?>
|
||||
<div class="talk next-talk" title="<?=h(@$next['title'] ?: 'none') ?>">
|
||||
<strong>Next (<?=date('G:i', @$next['start']) ?>):</strong><br/>
|
||||
<span class="t"><?=h(@$next['title'] ?: 'none') ?></span>
|
||||
|
|
Loading…
Reference in a new issue