Commit dab925ca authored by tobyink's avatar tobyink

Add "recent tracks" page to profiles.

parent 48402d82
......@@ -2,8 +2,9 @@ Options +FollowSymLinks
RewriteEngine on
RewriteRule ^user/([^/]+)/?$ user-profile.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/journal?$ user-journal.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/groups?$ user-groups.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/journal/?$ user-journal.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/groups/?$ user-groups.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/recent-tracks/?$ user-recent-tracks.php?user=$1 [B,NC]
RewriteRule ^artist/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&track=$2 [B,NC]
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&album=$2&track=$3 [B,NC]
RewriteRule ^artist/([^/]+)/album/([^/]+)/?$ album.php?artist=$1&album=$2 [B,NC]
......
......@@ -53,7 +53,8 @@
</dl>
<div style="text-align:right;clear:right;font-size:80%">
<a{if $this_page_absolute != $me->getURL()}rel="rdfs:seeAlso" href="{$me->getURL()|escape:'html':'UTF-8'}"{/if}>profile</a>
<a{if $this_page_absolute != $me->getURL()} rel="rdfs:seeAlso" href="{$me->getURL()|escape:'html':'UTF-8'}"{/if}>profile</a>
&middot; <a{if $this_page_absolute != $me->getURL('recent-tracks')} rel="rdfs:seeAlso" href="{$me->getURL('recent-tracks')|escape:'html':'UTF-8'}"{/if}>recent tracks</a>
{if $me->journal_rss} &middot; <a{if $this_page_absolute != $me->getURL('journal')} rel="rdfs:seeAlso" href="{$me->getURL('journal')|escape:'html':'UTF-8'}"{/if}>journal</a>{/if}
</div>
<hr style="border: 1px solid transparent; clear: both;" rel="foaf:page" rev="foaf:primaryTopic" resource="" />
......
{include file='header.tpl'}
<h2 property="dc:title">{$me->name|escape:'html':'UTF-8'}'s recent tracks</h2>
{include file='maxiprofile.tpl'}
<div about="[_:seq1]" typeof="rdf:Seq" rev="rss:items">
<h3 typeof="rss:channel" property="rss:title" rel="rss:link" resource="#latest_plays" id="latest_plays" content="{$me->name|escape:'html':'UTF-8'}'s Latest Plays">Latest {$scrobbles|@count} Plays:</h3>
</div>
<ul class="gobbles" about="{$me->id|escape:'html':'UTF-8'}" rev="gob:user">
{section name=i loop=$scrobbles}
<li class="play {if $scrobbles[i].license > 0}libre{/if}" about="{$scrobbles[i].id|escape:'html':'UTF-8'}" typeof="rss:item gob:ScrobbleEvent" rel="gob:track_played">
<div about="{$scrobbles[i].id_track|escape:'html':'UTF-8'}" typeof="mo:Track" class="haudio">
<div rev="mo:track">
<div about="{$scrobbles[i].id_album|escape:'html':'UTF-8'}" typeof="mo:Record"{if $scrobbles[i].album} property="dc:title" content="{$scrobbles[i].album|escape:'html':'UTF-8'}"{/if}>
{if $scrobbles[i].albumurl}<a rel="foaf:page" href="{$scrobbles[i].albumurl|escape:'html':'UTF-8'}">{/if}
<span{if $scrobbles[i].album_image} rel="foaf:depiction"{/if}{if $scrobbles[i].albumurl} about="{$scrobbles[i].id_album|escape:'html':'UTF-8'}"{/if}>
<img height="50" width="50"
src="{if !$scrobbles[i].album_image}/i/qm50.png{else}{$scrobbles[i].album_image|escape:'html':'UTF-8'}{/if}"
class="albumart{if !$scrobbles[i].album_image} photo{/if}"
{if $scrobbles[i].album}title="{$scrobbles[i].album|escape:'html':'UTF-8'}" alt="Album: {$scrobbles[i].album|escape:'html':'UTF-8'}"{else}alt="Unknown album"{/if} />
</span>
{if $scrobbles[i].albumurl}</a>{/if}
</div>
</div>
<div rel="foaf:maker" class="contributor vcard">
<a about="{$scrobbles[i].id_artist|escape:'html':'UTF-8'}" typeof="mo:MusicArtist" property="foaf:name" rel="foaf:page"
class="fn url" href="{$scrobbles[i].artisturl|escape:'html':'UTF-8'}"
>{$scrobbles[i].artist|escape:'html':'UTF-8'}</a>
</div>
<div><a class="fn" property="dc:title" rel="foaf:page" href="{$scrobbles[i].trackurl|escape:'html':'UTF-8'}">{$scrobbles[i].track|escape:'html':'UTF-8'}</a></div>
<small about="{$scrobbles[i].id|escape:'html':'UTF-8'}" property="dc:date" content="{$scrobbles[i].timeiso}" datatype="xsd:dateTime">{$scrobbles[i].timehuman}</small>
<span about="{$scrobbles[i].id|escape:'html':'UTF-8'}" property="rss:link" content="{$scrobbles[i].trackurl|escape:'html':'UTF-8'}">
<span property="rss:description" content="{if $scrobbles[i].album}{$scrobbles[i].album}{else}Unknown album{/if}">
<span property="rss:title" content="{$scrobbles[i].artist|escape:'html':'UTF-8'}: {$scrobbles[i].track|escape:'html':'UTF-8'}" rev="rdf:_{$smarty.section.i.index_next}" resource="[_:seq1]"></span>
</span>
</span>
</div>
</li>
{/section}
</ul>
<!-- Column break -->
</div></div><div class="yui-u" id="sidebar"><div style="padding: 10px;">
<h3>{$me->name}'s top artists</h3>
<ul class="tagcloud" about="{$me->id}">
{section name=i loop=$user_tagcloud}
<li style="font-size:{$user_tagcloud[i].size}"><a
href="{$user_tagcloud[i].pageurl|escape:'html':'UTF-8'}" rel="{if $user_tagcloud[i].size|substr:-5 ==
'large'}foaf:interest {/if}tag">{$user_tagcloud[i].artist|escape:"html":"UTF-8"}</a></li>
{/section}
</ul>
<div id="adbard">
<!--Ad Bard advertisement snippet, begin -->
<script type='text/javascript'>
var ab_h = '4bcaab930d3bdfded68fd7be730d7db4';
var ab_s = '55fd9cde6d855a75f9ca43d854272f6b';
</script>
<script type='text/javascript' src='http://cdn1.adbard.net/js/ab1.js'></script>
<!--Ad Bard, end -->
</div>
{include file='footer.tpl'}
......@@ -37,7 +37,7 @@ $user = new User($_GET['user']);
if(isset($user->name)) {
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
$aUserScrobbles = $user->getScrobbles(20);
$aUserScrobbles = $user->getScrobbles(10);
if (!PEAR::isError ($aUserScrobbles)) {
$smarty->assign('scrobbles', $aUserScrobbles);
}
......
<?php
/* Libre.fm -- a free network service for sharing your music listening habits
Copyright (C) 2009 Libre.fm Project
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/User.php');
require_once('data/TagCloud.php');
require_once('data/Server.php');
if(!isset($_GET['user']) && $logged_in == false) {
$smarty->assign('error', 'Error!');
$smarty->assign('details', 'User not set! You shouldn\'t be here!');
$smarty->display('error.tpl');
die();
}
$user = new User($_GET['user']);
if(isset($user->name)) {
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
$aUserScrobbles = $user->getScrobbles(100);
if (!PEAR::isError ($aUserScrobbles)) {
$smarty->assign('scrobbles', $aUserScrobbles);
}
$smarty->assign('userlevel', $user->userlevel);
$smarty->assign('avatar', $user->getAvatar());
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
$smarty->assign('isme', ($_SESSION['user']->name == $user->name));
$smarty->assign('me', $user);
$smarty->assign('profile', true);
$smarty->assign('extra_head_links', array(
array(
'rel'=>'alternate',
'type' => 'application/rss+xml' ,
'title' => 'RSS 1.0 Feed (Recent plays)',
'href' => $base_url.'/rdf.php?fmt=rss&page='.htmlentities($_SERVER['REQUEST_URI'])
),
array(
'rel' => 'meta',
'type' => 'application/rdf+xml' ,
'title' => 'FOAF',
'href' => $base_url.'/rdf.php?fmt=xml&page='.htmlentities($_SERVER['REQUEST_URI'])
)
));
$smarty->display('user-profile.tpl');
} else {
$smarty->assign('error', 'User not found');
$smarty->assign('details', 'Shall I call in a missing persons report?');
$smarty->display('error.tpl');
}
?>
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