-
Notifications
You must be signed in to change notification settings - Fork 1
/
profile.php
81 lines (73 loc) · 2.57 KB
/
profile.php
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
include("include/libs.php");
if (isset($_REQUEST['key'])) {
$u = new User($_REQUEST['key']);
?>
<div class="profile <?php print $_REQUEST['view']; ?>">
<img src="<?php print $u->icon; ?>" width="64" height="64" align="left"/>
<h1><?php print $u->firstName." ".$u->lastName; ?></h1>
<h2>aka: <?php print $u->username; ?></h2>
<h2>Requests available:
<?php
$left = $u->requestsLeft();
print $left;
if ($left<=0) {
print " (renew in ".intval(($u->requestsRenew()-time())/60)." minutes)";
}
?></h2>
<br style="clear: both;" />
<?php
if ($_REQUEST['view']=='full') {
?>
<br />
<ol>
<h3>Top Artists</h3>
<?php
foreach ($u->getTopArtists() as $artist) {
print '<li><a href="#!/'.$artist->key.'">'.$artist->name."</a></li>\n";
}
?>
<li class="export"> </li>
</ol>
<ol>
<h3>Top Songs</h3>
<?php
$rs = $u->getTopTracks();
$trackKeys = Array();
foreach ($rs as $key=>$track) {
$trackKeys[] = $track->key;
print '<li><a href="#!/'.$track->artistKey.'/'.$track->albumKey.'/'.$track->key.'" class="'.($track->canStream?'':'unstreamable').'">'.$track->name." - ".$track->artist."</a></li>\n";
}
?>
<li class="export" rel="<?php print implode(',',$trackKeys); ?>" title="Save this as an Rdio playlist">Export these songs to an Rdio playlist</li>
</ol>
<ol>
<h3>Recent Requests</h3>
<?php
$keys = $u->getRecentRequests();
$rs = $rdio->get(array('keys'=>implode(',',$keys)));
$trackKeys = Array();
foreach ($keys as $key) {
$trackKeys[] = $key;
print '<li><a href="#!/'.$rs->result->$key->artistKey.'/'.$rs->result->$key->albumKey.'/'.$rs->result->$key->key.'" class="'.($rs->result->$key->canStream?'':'unstreamable').'">'.$rs->result->$key->name." - ".$rs->result->$key->artist."</a></li>\n";
}
?>
<li class="export" rel="<?php print implode(',',array_reverse($trackKeys)); ?>" title="Save this as an Rdio playlist">Export these songs to an Rdio playlist</li>
</ol>
<ol>
<h3>Favorite Songs</h3>
<?php
$rs = $rdio->get(array('keys'=>implode(',',$u->getFavoriteTracks())));
$trackKeys = Array();
foreach ($rs->result as $key=>$track) {
$trackKeys[] = $track->key;
print '<li><a href="#!/'.$track->artistKey.'/'.$track->albumKey.'/'.$track->key.'" class="'.($rs->result->$key->canStream?'':'unstreamable').'">'.$track->name." - ".$track->artist."</a></li>\n";
}
?>
<li class="export" rel="<?php print implode(',',$trackKeys); ?>" title="Save this as an Rdio playlist">Export these songs to an Rdio playlist</li>
</ol>
</div>
<?php
}
}
?>