git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit f4c26049 authored by Mike Sheldon's avatar Mike Sheldon

Merge changes from master

parents 5eb6dd7f 3dbf3e94
This diff is collapsed.
......@@ -22,6 +22,7 @@ require_once('../database.php');
require_once('../templating.php');
require_once('../data/Track.php');
require_once('../data/Server.php');
require_once('../data/RemoteUser.php');
require_once('../utils/resolve-external.php');
function radio_title_from_url($url) {
......@@ -132,7 +133,11 @@ function make_playlist($session, $old_format = false, $format='xml') {
$res = get_loved_tracks(array($requser->uniqueid));
} else if (preg_match('@l(ast|ibre)fm://user/(.*)/recommended@', $url, $regs)) {
try {
$requser = new User($regs[2]);
if(strstr($regs[2], '@')) {
$requser = new RemoteUser($regs[2]);
} else {
$requser = new User($regs[2]);
}
} catch (Exception $e) {
die("FAILED\n"); // this should return a blank dummy playlist instead
}
......
......@@ -2,10 +2,14 @@
<center>
<h4>
{if $type != 'loved'}<a href='{$me->getURL('station')}'>{/if}{t name=$me->name|capitalize}%1's Loved Radio{/t}{if $type != 'loved'}</a>{/if} |
{if $type != 'recommended'}<a href='{$me->getURL('station', 'type=recommended')}'>{/if}{t name=$me->name|capitalize}%1's Recommended Radio{/t}{if $type != 'recommended'}</a>{/if} |
{if $type != 'mix'}<a href='{$me->getURL('station', 'type=mix')}'>{/if}{t name=$me->name|capitalize}%1's Mix Radio{/t}{if $type != 'mix'}</a>{/if} |
{if $type != 'neighbours'}<a href='{$me->getURL('station', 'type=neighbours')}'>{/if}{t name=$me->name|capitalize}%1's Neighbourhood Radio{/t}{if $type != 'neighbours'}</a>{/if}
{if !$remote}
{if $type != 'loved'}<a href='{$me->getURL('station')}'>{/if}{t name=$me->name|capitalize}%1's Loved Radio{/t}{if $type != 'loved'}</a>{/if} |
{/if}
{if $type != 'recommended'}<a href='{$me->getURL('station', 'type=recommended')}'>{/if}{t name=$me->name|capitalize}%1's Recommended Radio{/t}{if $type != 'recommended'}</a>{/if}
{if !$remote}
| {if $type != 'mix'}<a href='{$me->getURL('station', 'type=mix')}'>{/if}{t name=$me->name|capitalize}%1's Mix Radio{/t}{if $type != 'mix'}</a>{/if} |
{if $type != 'neighbours'}<a href='{$me->getURL('station', 'type=neighbours')}'>{/if}{t name=$me->name|capitalize}%1's Neighbourhood Radio{/t}{if $type != 'neighbours'}</a>{/if}
{/if}
</h4>
<div id='player-container' style='float: none; text-align: center;'>
......
......@@ -23,6 +23,7 @@ require_once('database.php');
require_once('user-menu.php');
require_once('templating.php');
require_once('data/User.php');
require_once('data/RemoteUser.php');
require_once('data/TagCloud.php');
require_once('data/Server.php');
......@@ -34,7 +35,11 @@ if (!isset($_GET['user']) && $logged_in == false) {
}
try {
$user = new User($_GET['user']);
if(strstr($_GET['user'], '@')) {
$user = new RemoteUser($_GET['user']);
} else {
$user = new User($_GET['user']);
}
} catch (Exception $e) {
$error = 'User not found';
}
......@@ -53,8 +58,14 @@ if (isset($user->name)) {
if ($user->hasLoved()) {
$recommendedArtists = $user->getRecommended(10);
$smarty->assign('recommendedArtists', $recommendedArtists);
$lovedArtists = TagCloud::generateTagCloud('loved', 'artist', 10, 'userid', $user->uniqueid);
$smarty->assign('lovedArtists', $lovedArtists);
if($user->remote) {
// Just get the 10 most recently loved artists from a remote user
$lovedArtists = $user->getLovedArtists(10);
$smarty->assign('lovedArtists', $lovedArtists);
} else {
$lovedArtists = TagCloud::generateTagCloud('loved', 'artist', 10, 'userid', $user->uniqueid);
$smarty->assign('lovedArtists', $lovedArtists);
}
}
$smarty->assign('isme', ($this_user->name == $user->name));
$smarty->assign('me', $user);
......
......@@ -23,6 +23,7 @@ require_once('database.php');
require_once('templating.php');
require_once('user-menu.php');
require_once('data/User.php');
require_once('data/RemoteUser.php');
require_once('data/TagCloud.php');
require_once('data/Server.php');
......@@ -34,7 +35,11 @@ if (!isset($_GET['user']) && $logged_in == false) {
}
try {
$user = new User($_GET['user']);
if(strstr($_GET['user'], '@')) {
$user = new RemoteUser($_GET['user']);
} else {
$user = new User($_GET['user']);
}
} catch (Exception $e) {
$smarty->assign('pageheading', 'User not found');
$smarty->assign('details', 'Shall I call in a missing persons report?');
......
......@@ -23,6 +23,7 @@ require_once('database.php');
require_once('user-menu.php');
require_once('templating.php');
require_once('data/User.php');
require_once('data/RemoteUser.php');
require_once('data/TagCloud.php');
require_once('data/Server.php');
......@@ -34,7 +35,13 @@ if (!isset($_GET['user']) && $logged_in == false) {
}
try {
$user = new User($_GET['user']);
if(strstr($_GET['user'], '@')) {
$user = new RemoteUser($_GET['user']);
$remote = true;
} else {
$user = new User($_GET['user']);
$remote = false;
}
} catch (Exception $e) {
$error = 'User not found';
}
......@@ -42,6 +49,8 @@ try {
if (isset($user->name)) {
if (isset($_GET['type'])) {
$type = $_GET['type'];
} elseif($remote) {
$type = 'recommended';
} else {
$type = 'loved';
}
......@@ -59,7 +68,7 @@ if (isset($user->name)) {
$submenu = user_menu($user, 'Radio Stations');
$smarty->assign('submenu', $submenu);
$smarty->assign('type', $type);
$smarty->assign('remote', $remote);
$smarty->display('user-station.tpl');
} else {
$smarty->assign('pageheading', $error);
......
......@@ -23,6 +23,7 @@ require_once('database.php');
require_once('templating.php');
require_once('user-menu.php');
require_once('data/User.php');
require_once('data/RemoteUser.php');
require_once('data/TagCloud.php');
require_once('data/Statistic.php');
require_once('data/GraphTypes.php');
......@@ -35,7 +36,11 @@ if (!isset($_GET['user']) && $logged_in == false) {
}
try {
$user = new User($_GET['user']);
if(strstr($_GET['user'], '@')) {
$user = new RemoteUser($_GET['user']);
} else {
$user = new User($_GET['user']);
}
} catch (Exception $e) {
if ($e->getCode() == 22) {
echo('We had some trouble locating that user. Are you sure you spelled it correctly?' . "\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment