Subversion Repository Public Repository

Nextrek

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
<?php
require_once 'database.php';
$data = array();

if (sql_connect())
{
	$query = 'SELECT nome, streaming_url, (SELECT COUNT(*) FROM `palinsesto` WHERE canale=nome) as `hasEPG` FROM `canali`';

	if (array_key_exists('channel',$_REQUEST))
	{
		$canali = explode(',',$_REQUEST['channel']);
		if (count($canali)>0)
		{
			$where = array();
			foreach($canali as &$canale)
			{
				if (strtolower($canale)=='streaming_live')
				{
					$where[] = '(streaming_url<>\'\'))';
				} else {
					$where[] = 'nome='.sql_quote($canale);
				}
			}
			$query .= ' WHERE ('.implode(' OR ',$where).')';
		}
	}

	$query .= ' ORDER BY nome';
	$cursor = sql_cursor_open($query);
	while ($row = sql_fetch_row($cursor))
	{
		$row['logo'] = 'logo/'.$row['nome'].'.png';
		if ($row['hasEPG']>0)
		{
			$row['hasEPG'] = TRUE;
		} else {
			$row['hasEPG'] = FALSE;
		}
		$data[$row['nome']] = $row;
	}
	sql_cursor_close($cursor);
	sql_disconnect();
}

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
echo json_encode($data);
exit;
?>

Commits for Nextrek/Web/epg/get_channels.php

Diff revisions: vs.
Revision Author Commited Message
9 DRuega picture DRuega Mon 06 May, 2013 21:54:02 +0000

Ripristinato EPG