user-groups.php 1.99 KB
Newer Older
tobyink's avatar
tobyink committed
1 2
<?php

3
/* GNU FM -- a free network service for sharing your music listening habits
tobyink's avatar
tobyink committed
4

5
   Copyright (C) 2009 Free Software Foundation, Inc
tobyink's avatar
tobyink committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

   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');
require_once('data/Group.php');
require_once('data/User.php');
require_once('data/TagCloud.php');
require_once('data/Server.php');


30
if (!isset($_GET['user']) && $logged_in == false) {
31
	displayError("Error", "User not set. You shouldn't be here.");
tobyink's avatar
tobyink committed
32 33
}

34
try {
35
	$user = new User($_GET['user']);
36
} catch (Exception $e) {
Jonas Haraldsson's avatar
Jonas Haraldsson committed
37
	displayError("User not found", "User not found, shall I call in a missing persons report?");
tobyink's avatar
tobyink committed
38
}
39 40 41 42

$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
try {
	$aUserTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $user->uniqueid);
43 44
	$smarty->assign('user_tagcloud', $aUserTagCloud);
} catch (Exception $e) {}
45 46 47 48 49 50 51 52
$smarty->assign('isme', ($_SESSION['user']->name == $user->name));
$smarty->assign('me', $user);
$smarty->assign('profile', true);

$smarty->assign('groups', Group::groupList($user));

$smarty->assign('extra_head_links', array(
			array(
53 54
				'rel'   => 'meta',
				'type'  => 'application/rdf+xml',
55
				'title' => 'FOAF',
56
				'href'  => $base_url . '/rdf.php?fmt=xml&page=' . rawurlencode(str_replace($base_url, '', $user->getURL('groups')))
57
				)
58 59 60
			));

$smarty->display('user-groups.tpl');