listen.php 1.55 KB
Newer Older
1 2
<?php

3
/* GNU FM -- a free network service for sharing your music listening habits
4

5
   Copyright (C) 2009 Free Software Foundation, Inc
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Affero General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Affero General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

require_once('database.php');
require_once('templating.php');

25
if (isset($_GET['tag'])) {
elleo's avatar
elleo committed
26
	$station = 'librefm://globaltags/' . $_GET['tag'];
27 28 29 30 31
	if(empty($_GET['tag'])) {
		// The user's just hit 'listen' without selecting a tag
		// so we default to the community station
		$station = "librefm://community/loved";
	}
32
} else if (isset($_GET['station'])) {
33 34 35
	$station = $_GET['station'];
}

36 37 38 39
if (isset($_GET['only_loved']) && $_GET['only_loved']) {
	$station .= '/loved';
}

40 41
if (isset($station)) {
	if (isset($this_user)) {
42
		$smarty->assign('station', $station);
43 44
	} else {
		$radio_session = Server::getRadioSession($station);
45
		$smarty->assign('radio_session', $radio_session);
46
	}
47
}
48
$smarty->assign('pageheading', _('Go ahead, listen all you want'));
elleo's avatar
elleo committed
49
$smarty->display('listen.tpl');