Commit 4c53aa76 authored by habarnam's avatar habarnam

* testing for errors before passing data to smarty

parent b8909e85
......@@ -28,7 +28,10 @@ $album = new Album($_GET['album'], $_GET['artist']);
$smarty->assign("name", $album->name);
$smarty->assign("artist", $album->artist_name);
$smarty->assign("tracks", $album->getTracks());
$aAlbumTracks = $album->getTracks();
if (!PEAR::isError($aAlbumTracks )) {
$smarty->assign("tracks", $aAlbumTracks);
}
$smarty->display("album.tpl");
......
......@@ -28,7 +28,11 @@ $artist = new Artist($_GET['artist']);
$smarty->assign("name", $artist->name);
$smarty->assign("bio_summary", $artist->bio_summary);
$smarty->assign("albums", $artist->getAlbums());
$aArtistAlbums = $artist->getAlbums();
if (!PEAR::isError($aArtistAlbums)) {
$smarty->assign("albums", $aArtistAlbums);
}
$smarty->display("artist.tpl");
......
......@@ -33,18 +33,27 @@ if(!isset($_GET['user']) && $logged_in == false) {
$user = new User($_GET['user']);
if(isset($user->name)) {
if(isset($user->name)) {
$smarty->assign('user', $user->name);
$smarty->assign('email', $user->email);
$smarty->assign('fullname', $user->fullname);
$smarty->assign('bio', $user->bio);
$smarty->assign('homepage', $user->homepage);
$smarty->assign('location', $user->location);
$smarty->assign('scrobbles', $user->getScrobbles(20));
$aUserScrobbles = $user->getScrobbles(20);
if (!PEAR::isError ($aUserScrobbles)) {
$smarty->assign('scrobbles', $aUserScrobbles);
}
$smarty->assign('userlevel', $user->userlevel);
$smarty->assign('avatar', $user->getAvatar());
$smarty->assign('nowplaying', $user->getNowPlaying(10));
$smarty->assign('user_tagcloud', TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name));
$aUserNowPlaying = $user->getNowPlaying(10);
if (!PEAR::isError ($aUserNowPlaying)) {
$smarty->assign('nowplaying', $aUserNowPlaying);
}
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
$smarty->assign('profile', true);
$smarty->display('profile.tpl');
} else {
......
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