aboutsummaryrefslogtreecommitdiff
path: root/view/room.php
blob: 4484a14f12dab39dc214c012721f45cb4f0d84cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php

$room = $_GET['room'];
$language = $_GET['language'];
$selection = $_GET['selection'];

if(!has("ROOMS.$room"))
	return include('pages/404.php');

$formats = get("ROOMS.$room.FORMATS");
$has_translation = get("ROOMS.$room.TRANSLATION");

$protos = array();
$selections = array();
$tabs = array();
$videores = array();

if(room_has_hd($room))
	$selections[] = $videores[] = 'hd';

if(room_has_sd($room))
	$selections[] = $videores[] = 'sd';

if(room_has_video($room))
	$tabs[] = 'video';


if(room_has_audio($room))
	$selections[] = $tabs[] = 'audio';

if(room_has_music($room))
	$selections[] = $tabs[] = 'music';

if(room_has_slides($room))
	$selections[] = $tabs[] = 'slides';


if(room_has_rtmp($room))
	$protos[] = 'rtmp';

if(room_has_webm($room))
	$protos[] = 'webm';

if(room_has_hls($room))
	$protos[] = 'hls';



// default page
if(!$selection)
	$selection = $selections[0];

if(!in_array($selection, $selections))
	return include('pages/404.php');



switch($selection) {
	case 'audio':
		$tab = 'audio';
		$title = 'Audio';
		break;

	case 'music':
		$tab = 'music';
		$title = 'Music';
		break;

	case 'slides':
		$tab = 'slides';
		$title = 'Slides';
		$width = 1024;
		$height = 576;
		break;

	case 'hd':
		$tab = 'video';
		$title = 'FullHD Video';
		$width = 1920;
		$height = 1080;
		break;

	case 'sd':
		$tab = 'video';
		$title = 'SD Video';
		$width = 1024;
		$height = 576;
		break;
}

if($language == 'translated')
{
	if(!$has_translation)
		return include('pages/404.php');

	$title = 'Translated '.$title;
}

echo $tpl->render(array(
	'page' => 'room',

	'title' => get("ROOMS.$room.DISPLAY").' – '.$title,
	'room' => $room,

	'program' => program(),

	'tab' => $tab,
	'tabs' => $tabs,

	'width' => @$width,
	'height' => @$height,
	'language' => $language,
	'translated' => ($language == 'translated'),
	'selection' => $selection,
	'hlsformat' => ($selection == 'hd' ? 'auto' : $selection),

	'has_translation' => $has_translation,
	'formats' => $formats,
	'protos' => $protos,
	'videores' => $videores,
));