librefm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Librefm-commits] [1654] partial merge from trunk


From: Clint Adams
Subject: [Librefm-commits] [1654] partial merge from trunk
Date: Sat, 16 May 2009 14:27:52 +0000

Revision: 1654
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1654
Author:   clint
Date:     2009-05-16 14:27:52 +0000 (Sat, 16 May 2009)
Log Message:
-----------
partial merge from trunk

Modified Paths:
--------------
    branches/stable/nixtape/album.php
    branches/stable/nixtape/api/ArtistXML.php
    branches/stable/nixtape/api/UserXML.php
    branches/stable/nixtape/artist.php
    branches/stable/nixtape/data/Artist.php
    branches/stable/nixtape/data/Group.php
    branches/stable/nixtape/data/Server.php
    branches/stable/nixtape/data/TagCloud.php
    branches/stable/nixtape/data/User.php
    branches/stable/nixtape/edit_group.php
    branches/stable/nixtape/explore.php
    branches/stable/nixtape/group.php
    branches/stable/nixtape/index.php
    branches/stable/nixtape/listen.php
    branches/stable/nixtape/track.php
    branches/stable/nixtape/user-edit.php
    branches/stable/nixtape/user-groups.php
    branches/stable/nixtape/user-journal.php
    branches/stable/nixtape/user-profile.php
    branches/stable/nixtape/user-recent-tracks.php
    branches/stable/nixtape/user-stats.php

Modified: branches/stable/nixtape/album.php
===================================================================
--- branches/stable/nixtape/album.php   2009-05-16 04:49:05 UTC (rev 1653)
+++ branches/stable/nixtape/album.php   2009-05-16 14:27:52 UTC (rev 1654)
@@ -32,7 +32,7 @@
 $smarty->assign('artist', $artist);
 $smarty->assign('album', $album);
 $aAlbumTracks = $album->getTracks();
-if (!$aAlbumTracks ) {
+if ($aAlbumTracks) {
        $smarty->assign('tracks', $aAlbumTracks);
 }
 

Modified: branches/stable/nixtape/api/ArtistXML.php
===================================================================
--- branches/stable/nixtape/api/ArtistXML.php   2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/api/ArtistXML.php   2009-05-16 14:27:52 UTC (rev 
1654)
@@ -42,7 +42,7 @@
 
                $artist = new Artist($artistName, $mbid);
 
-               if (PEAR::isError($artist)) {
+               if (!$artist) {
                        return(XML::error('failed', '7', 'Invalid resource 
specified'));
                }
 
@@ -66,7 +66,7 @@
 
                $artist = new Artist($artistName);
 
-               if (PEAR::isError($artist)) {
+               if (!$artist) {
                        return(XML::error('failed', '7', 'Invalid resource 
specified'));
                }
 

Modified: branches/stable/nixtape/api/UserXML.php
===================================================================
--- branches/stable/nixtape/api/UserXML.php     2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/api/UserXML.php     2009-05-16 14:27:52 UTC (rev 
1654)
@@ -27,7 +27,7 @@
        public static function getInfo($username) {
 
                $user = new User($username);
-               if (PEAR::isError($user)) {
+               if (!$user) {
                        return(XML::error('failed', '7', 'Invalid resource 
specified'));
                }
 

Modified: branches/stable/nixtape/artist.php
===================================================================
--- branches/stable/nixtape/artist.php  2009-05-16 04:49:05 UTC (rev 1653)
+++ branches/stable/nixtape/artist.php  2009-05-16 14:27:52 UTC (rev 1654)
@@ -33,12 +33,12 @@
 $smarty->assign('bio_summary', $artist->bio_summary);
 
 $aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
-if (!$aTagCloud) {
+if ($aTagCloud) {
         $smarty->assign('tagcloud', $aTagCloud);
 }
 
 $aArtistAlbums = $artist->getAlbums();
-if (!$aArtistAlbums) {
+if ($aArtistAlbums) {
        $smarty->assign('albums', $aArtistAlbums);
 }
 

Modified: branches/stable/nixtape/data/Artist.php
===================================================================
--- branches/stable/nixtape/data/Artist.php     2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/data/Artist.php     2009-05-16 14:27:52 UTC (rev 
1654)
@@ -53,7 +53,7 @@
                        . 'mbid = ' . $adodb->qstr($mbid) . ' OR '
                        . 'name = ' . $adodb->qstr($name));
                if(!$row) {
-                       return(new PEAR_Error('No such artist: ' . $name));
+                       throw new Exception('No such artist' . $name);
                } else {
                        $this->name = $row['name'];
                        $this->mbid = $row['mbid'];

Modified: branches/stable/nixtape/data/Group.php
===================================================================
--- branches/stable/nixtape/data/Group.php      2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/data/Group.php      2009-05-16 14:27:52 UTC (rev 
1654)
@@ -194,10 +194,10 @@
                                , (int)($grp)
                                , (int)($owner->uniqueid)
                                , time());
-               $res = $adodb->Execute($q);
-               if (PEAR::isError($res))
-               {
-                       return $res;
+               try {
+                       $res = $adodb->Execute($q);
+               } catch (exception $e) {
+                       return null;
                }
 
                // Return the newly created group. Callers should check the 
return value.

Modified: branches/stable/nixtape/data/Server.php
===================================================================
--- branches/stable/nixtape/data/Server.php     2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/data/Server.php     2009-05-16 14:27:52 UTC (rev 
1654)
@@ -41,7 +41,7 @@
         * Retrieves a list of recent scrobbles
         *
         * @param int $number The number of scrobbles to return
-        * @return An array of scrobbles or a PEAR_Error in case of failure
+        * @return An array of scrobbles or null in case of failure
         */
        static function getRecentScrobbles($number=10, $username=false) {
                global $adodb;
@@ -106,7 +106,7 @@
                }
                }
                catch (exception $e) {
-                       return $false;
+                       return null;
                }
 
                foreach($res as &$i) {
@@ -150,7 +150,7 @@
         * Retrieves a list of popular artists
         *
         * @param int $number The number of artists to return
-        * @return An array of artists or a PEAR_Error in case of failure
+        * @return An array of artists or null in case of failure
        */
        static function getTopArtists($number=20) {
                global $adodb;
@@ -160,7 +160,7 @@
                $data = $adodb->CacheGetAll(720, 'SELECT COUNT(artist) as c, 
artist FROM Scrobbles GROUP BY artist ORDER BY c DESC LIMIT 20');
                }
                catch (exception $e) {
-                       return false;
+                       return null;
                }
 
                foreach($data as &$i) {
@@ -176,7 +176,7 @@
         * Retrieves a list of the currently playing tracks
         *
         * @param int $number The maximum number of tracks to return
-        * @return An array of now playing data or a PEAR_Error in case of 
failure
+        * @return An array of now playing data or null in case of failure
         */
        static function getNowPlaying($number, $username=false) {
                global $adodb;
@@ -233,7 +233,7 @@
                }
                }
                catch (exception $e) {
-                       return false;
+                       return null;
                }
 
                foreach($data as &$i) {

Modified: branches/stable/nixtape/data/TagCloud.php
===================================================================
--- branches/stable/nixtape/data/TagCloud.php   2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/data/TagCloud.php   2009-05-16 14:27:52 UTC (rev 
1654)
@@ -53,7 +53,7 @@
                $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
                $res = $adodb->CacheGetAll(7200,$query);
                if (!$res) {
-                       return(new PEAR_Error('ERROR ' . $query));
+                       throw new Exception('ERROR ' . $query);
                } else {
                        foreach($res as $count => &$i) {
                                $i['size'] = $sizes[(int) 
($count/(count($res)/7))];

Modified: branches/stable/nixtape/data/User.php
===================================================================
--- branches/stable/nixtape/data/User.php       2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/data/User.php       2009-05-16 14:27:52 UTC (rev 
1654)
@@ -55,7 +55,7 @@
                        $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
                        $row = $adodb->CacheGetRow(7200,$query);
                        if (!$row) {
-                               return(new PEAR_Error('ERROR ' . $query));
+                               throw new Exception('ERROR ' . $query);
                        }
                }
 
@@ -141,11 +141,10 @@
                                , time()
                                , $adodb->qstr($this->name));
 
-               $res = $adodb->Execute($q);
-
-               if(PEAR::isError($res)) {
+               try {
+                       $res = $adodb->Execute($q);
+               } catch (exception $e) {
                        header('Content-Type: text/plain');
-                       //($res);
                        exit;
                }
 
@@ -232,7 +231,7 @@
                $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
                $data = $adodb->CacheGetAll(7200,$query);
                if (!$data) {
-                       return(new PEAR_Error('ERROR ' . $query));
+                       throw new Exception('ERROR ' . $query);
                }
 
                $maxcount = 0;

Modified: branches/stable/nixtape/edit_group.php
===================================================================
--- branches/stable/nixtape/edit_group.php      2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/edit_group.php      2009-05-16 14:27:52 UTC (rev 
1654)
@@ -37,29 +37,26 @@
 {
        if ($_REQUEST['new'])
        {
-         $result = Group::create(strtolower($_REQUEST['new']), $this_user);
-
-               if ($result instanceof Group)
-               {
-                       header('Location: ' . $base_url . 
'/edit_group.php?group=' . $_REQUEST['new']);
-                       exit();
-               }
-               elseif (!$result)
-               {
+               try {
+                       $result = Group::create(strtolower($_REQUEST['new']), 
$this_user);
+               } catch (exception $e) {
                        $smarty->assign('error', 'Error!');
-                       $smarty->assign('details', $result->getMessage());
+                       $smarty->assign('details', $e->getMessage());
                        $smarty->display('error.tpl');
                        die();
                }
+               if ($result instanceof Group) {
+                       header('Location: ' . $base_url . 
'/edit_group.php?group=' . $_REQUEST['new']);
+                       exit();
+               }
        }
        else
        {
                $smarty->assign('newform', true);
-               $aTagCloud = 
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
-               if (!$aTagCloud)
-               {
+               try {
+                       $aTagCloud = 
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
                        $smarty->assign('tagcloud', $aTagCloud);
-               }
+               } catch (exception $e) {}
                $smarty->display('edit_group.tpl');
                exit();
        }
@@ -163,11 +160,10 @@
        # And display the page.
        $smarty->assign('errors', $errors);
        $smarty->assign('newform', false);
-       $aUserTagCloud = $group->tagCloudData();
-       if (!$aTagCloud)
-       {
+       try {
+               $aUserTagCloud = $group->tagCloudData();
                $smarty->assign('tagcloud', $aTagCloud);
-       }
+       } catch (exception $e) {}
        $smarty->display('edit_group.tpl');
 }
 

Modified: branches/stable/nixtape/explore.php
===================================================================
--- branches/stable/nixtape/explore.php 2009-05-16 04:49:05 UTC (rev 1653)
+++ branches/stable/nixtape/explore.php 2009-05-16 14:27:52 UTC (rev 1654)
@@ -27,13 +27,13 @@
 require_once('data/TagCloud.php');
 
 // This should be contextual based on the mode= parameter?
+try {
 $aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
-if (!$aTagCloud) {
         $smarty->assign('tagcloud', $aTagCloud);
-}
+} catch (exception $e) {}
 
 $aTopArtists = Server::getTopArtists(20);
-if (!$aTopArtists) {
+if (!PEAR::isError ($aTopArtists)) {
     $smarty->assign('topartists', $aTopArtists);
 }
 $smarty->assign('explore', true);

Modified: branches/stable/nixtape/group.php
===================================================================
--- branches/stable/nixtape/group.php   2009-05-16 04:49:05 UTC (rev 1653)
+++ branches/stable/nixtape/group.php   2009-05-16 14:27:52 UTC (rev 1654)
@@ -29,18 +29,17 @@
 {
        $smarty->assign('groups', Group::groupList());
        $smarty->assign('extra_head_links', array(
-                       array(
-                               'rel' => 'meta',
-                               'type' => 'application/rdf+xml' ,
-                               'title' => 'FOAF',
-                               'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$_SERVER['REQUEST_URI']))
-                               )
-               ));
-       $aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 
'artist');
-       if (!$aTagCloud)
-       {
+                               array(
+                                       'rel' => 'meta',
+                                       'type' => 'application/rdf+xml' ,
+                                       'title' => 'FOAF',
+                                       'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$_SERVER['REQUEST_URI']))
+                                    )
+                               ));
+       try {
+               $aTagCloud = 
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
                $smarty->assign('tagcloud', $aTagCloud);
-       }
+       } catch (exception $e) {}
        $smarty->display('group-list.tpl');
        exit;
 }
@@ -68,10 +67,10 @@
        $smarty->assign('homepage', $group->homepage);
        $smarty->assign('avatar', $group->getAvatar());
 
-       $aUserTagCloud = $group->tagCloudData();
-       if (!$aUserTagCloud) {
+       try {
+               $aUserTagCloud = $group->tagCloudData();
                $smarty->assign('group_tagcloud',$aUserTagCloud);
-       }
+       } catch (exception $e) {}
 
        $smarty->assign('userlist', $group->getUsers());
 
@@ -83,13 +82,13 @@
        $smarty->assign('link', $group->getURL());
 
        $smarty->assign('extra_head_links', array(
-                       array(
-                               'rel' => 'meta',
-                               'type' => 'application/rdf+xml' ,
-                               'title' => 'FOAF',
-                               'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$_SERVER['REQUEST_URI']))
-                               )
-               ));
+                               array(
+                                       'rel' => 'meta',
+                                       'type' => 'application/rdf+xml' ,
+                                       'title' => 'FOAF',
+                                       'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$_SERVER['REQUEST_URI']))
+                                    )
+                               ));
 
        $smarty->assign('profile', true);
        $smarty->display('group.tpl');

Modified: branches/stable/nixtape/index.php
===================================================================
--- branches/stable/nixtape/index.php   2009-05-16 04:49:05 UTC (rev 1653)
+++ branches/stable/nixtape/index.php   2009-05-16 14:27:52 UTC (rev 1654)
@@ -23,23 +23,15 @@
 require_once('templating.php');
 require_once('data/sanitize.php');
 require_once('data/Server.php');
-require_once('data/TagCloud.php');
 
-$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
-if ($aTagCloud) {
-       $smarty->assign('tagcloud', $aTagCloud);
-}
+$smarty->assign('welcome', true);
 
-$aLastScrobbles = Server::getRecentScrobbles(20);
-if ($aLastScrobbles) {
-       $smarty->assign('recenttracks', $aLastScrobbles);
+$station = 'librefm://globaltags/rock';
+if(isset($this_user)) {
+       $radio_session = $this_user->getRadioSession($station);
+} else {
+       $radio_session = Server::getRadioSession($station);
 }
-
-$aNowPlaying = Server::getNowPlaying(10);
-if ($aNowPlaying) {
-       $smarty->assign('nowplaying', $aNowPlaying);
-}
-
-$smarty->assign('welcome', true);
+$smarty->assign('radio_session', $radio_session);
 $smarty->display('welcome.tpl');
 ?>

Modified: branches/stable/nixtape/listen.php
===================================================================
--- branches/stable/nixtape/listen.php  2009-05-16 04:49:05 UTC (rev 1653)
+++ branches/stable/nixtape/listen.php  2009-05-16 14:27:52 UTC (rev 1654)
@@ -23,10 +23,10 @@
 require_once('templating.php');
 require_once('data/TagCloud.php');
 
+try {
 $aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
-if (!$aTagCloud) {
         $smarty->assign('tagcloud', $aTagCloud);
-}
+} catch (exception $e) {}
 
 if(isset($_GET['tag'])) {
        $station = 'librefm://globaltags/' . $_GET['tag'];

Modified: branches/stable/nixtape/track.php
===================================================================
--- branches/stable/nixtape/track.php   2009-05-16 04:49:05 UTC (rev 1653)
+++ branches/stable/nixtape/track.php   2009-05-16 14:27:52 UTC (rev 1654)
@@ -35,10 +35,10 @@
 $smarty->assign('artist', $artist);
 
 // no idea how this would be track-relevant
+try {
 $aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
-if (!$aTagCloud) {
         $smarty->assign('tagcloud', $aTagCloud);
-}
+} catch (exception $e) {}
 
 $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
 $res = $adodb->GetAll('SELECT * FROM Track WHERE lower(artist_name) = ' . 
$adodb->qstr(mb_strtolower($track->artist_name, 'UTF-8')) . ' AND lower(name) = 
' . $adodb->qstr(mb_strtolower($track->name, 'UTF-8')));

Modified: branches/stable/nixtape/user-edit.php
===================================================================
--- branches/stable/nixtape/user-edit.php       2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/user-edit.php       2009-05-16 14:27:52 UTC (rev 
1654)
@@ -170,11 +170,10 @@
        }
 
        # And display the page.
-       $aTagCloud = 
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, 
$this_user->name);
-       if (!$aTagCloud)
-       {
+       try {
+               $aTagCloud = 
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, 
$this_user->name);
                $smarty->assign('tagcloud', $aTagCloud);
-       }
+       } catch (exception $e) {}
        $smarty->assign('errors', $errors);
        $smarty->display('user-edit.tpl');
 }

Modified: branches/stable/nixtape/user-groups.php
===================================================================
--- branches/stable/nixtape/user-groups.php     2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/user-groups.php     2009-05-16 14:27:52 UTC (rev 
1654)
@@ -39,10 +39,10 @@
 if(isset($user->name)) {
 
        $smarty->assign('geo', Server::getLocationDetails($user->location_uri));
-       $aUserTagCloud =  
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, 
$user->name);
-       if (!$aUserTagCloud) {
+       try {
+               $aUserTagCloud =  
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, 
$user->name);
                $smarty->assign('user_tagcloud',$aUserTagCloud);
-       }
+       } catch (exception $e) {}
        $smarty->assign('isme', ($_SESSION['user']->name == $user->name));
        $smarty->assign('me', $user);
        $smarty->assign('profile', true);
@@ -50,13 +50,13 @@
        $smarty->assign('groups', Group::groupList($user));
 
        $smarty->assign('extra_head_links', array(
-                       array(
-                               'rel' => 'meta',
-                               'type' => 'application/rdf+xml' ,
-                               'title' => 'FOAF',
-                               'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$user->getURL('groups')))
-                               )
-               ));
+                               array(
+                                       'rel' => 'meta',
+                                       'type' => 'application/rdf+xml' ,
+                                       'title' => 'FOAF',
+                                       'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$user->getURL('groups')))
+                                    )
+                               ));
 
        $smarty->display('user-groups.tpl');
 } else {

Modified: branches/stable/nixtape/user-journal.php
===================================================================
--- branches/stable/nixtape/user-journal.php    2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/user-journal.php    2009-05-16 14:27:52 UTC (rev 
1654)
@@ -66,28 +66,28 @@
        }
 }
 
-$aUserTagCloud =  TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 
'artist', 40, $user->name);
-if (!$aUserTagCloud) {
+try {
+       $aUserTagCloud =  
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, 
$user->name);
        $smarty->assign('user_tagcloud',$aUserTagCloud);
-}
+} catch (exception $e) {}
 $smarty->assign('isme', ($this_user->name == $user->name));
 $smarty->assign('me', $user);
 $smarty->assign('geo', Server::getLocationDetails($user->location_uri));
 $smarty->assign('profile', true);
 $smarty->assign('items', $items);
 $smarty->assign('extra_head_links', array(
-               array(
-                       'rel'=>'alternate',
-                       'type' => 'application/rss+xml' ,
-                       'title' => 'RSS 1.0 Feed (Journal)',
-                       'href' => $user->journal_rss
-                       ),
-               array(
-                       'rel' => 'meta',
-                       'type' => 'application/rdf+xml' ,
-                       'title' => 'FOAF',
-                       'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$user->getURL()))
-                       )
-       ));
+                       array(
+                               'rel'=>'alternate',
+                               'type' => 'application/rss+xml' ,
+                               'title' => 'RSS 1.0 Feed (Journal)',
+                               'href' => $user->journal_rss
+                            ),
+                       array(
+                               'rel' => 'meta',
+                               'type' => 'application/rdf+xml' ,
+                               'title' => 'FOAF',
+                               'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$user->getURL()))
+                            )
+                       ));
 $smarty->display('user-journal.tpl');
 

Modified: branches/stable/nixtape/user-profile.php
===================================================================
--- branches/stable/nixtape/user-profile.php    2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/user-profile.php    2009-05-16 14:27:52 UTC (rev 
1654)
@@ -37,43 +37,43 @@
 if(isset($user->name)) {
 
        $smarty->assign('geo', Server::getLocationDetails($user->location_uri));
-       $aUserScrobbles = $user->getScrobbles(10);
-       if (!$aUserScrobbles) {
+       try {
+               $aUserScrobbles = $user->getScrobbles(10);
                $smarty->assign('scrobbles', $aUserScrobbles);
-       }
+       } catch (exception $e) {}
+       try {
        $aUserNowPlaying = $user->getNowPlaying(10);
-       if (!$aUserNowPlaying) {
                $smarty->assign('nowplaying', $aUserNowPlaying);
-       }
+       } catch (exception $e) {}
+       try {
        $aUserTagCloud =  
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, 
$user->name);
-       if (!$aUserTagCloud) {
                $smarty->assign('user_tagcloud',$aUserTagCloud);
-       }
+       } catch (exception $e) {}
        $smarty->assign('isme', ($this_user->name == $user->name));
        $smarty->assign('me', $user);
        $smarty->assign('sidebar', true);
        $smarty->assign('sidebartemplate', 'profile-sidebar.tpl');
 
        $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='.urlencode(str_replace($base_url, '', 
$user->getURL('recent-tracks')))
-                               ),
-                       array(
-                               'rel'=>'alternate',
-                               'type' => 'application/rss+xml' ,
-                               'title' => 'RSS 1.0 Feed (Journal)',
-                               'href' => $user->journal_rss
-                               ),
-                       array(
-                               'rel' => 'meta',
-                               'type' => 'application/rdf+xml' ,
-                               'title' => 'FOAF',
-                               'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$user->getURL()))
-                               )
-               ));
+                               array(
+                                       'rel'=>'alternate',
+                                       'type' => 'application/rss+xml' ,
+                                       'title' => 'RSS 1.0 Feed (Recent 
plays)',
+                                       'href' => 
$base_url.'/rdf.php?fmt=rss&page='.urlencode(str_replace($base_url, '', 
$user->getURL('recent-tracks')))
+                                    ),
+                               array(
+                                       'rel'=>'alternate',
+                                       'type' => 'application/rss+xml' ,
+                                       'title' => 'RSS 1.0 Feed (Journal)',
+                                       'href' => $user->journal_rss
+                                    ),
+                               array(
+                                       'rel' => 'meta',
+                                       'type' => 'application/rdf+xml' ,
+                                       'title' => 'FOAF',
+                                       'href' => 
$base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', 
$user->getURL()))
+                                    )
+                               ));
 
        $smarty->display('user-profile.tpl');
 } else {

Modified: branches/stable/nixtape/user-recent-tracks.php
===================================================================
--- branches/stable/nixtape/user-recent-tracks.php      2009-05-16 04:49:05 UTC 
(rev 1653)
+++ branches/stable/nixtape/user-recent-tracks.php      2009-05-16 14:27:52 UTC 
(rev 1654)
@@ -42,14 +42,14 @@
 if(isset($user->name)) {
 
        $smarty->assign('geo', Server::getLocationDetails($user->location_uri));
+       try {
        $aUserScrobbles = $user->getScrobbles( $scrobbleCount );
-       if (!$aUserScrobbles) {
                $smarty->assign('scrobbles', $aUserScrobbles);
-       }
+       } catch (exception $e) {}
+       try {
        $aUserTagCloud =  
TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, 
$user->name);
-       if (!$aUserTagCloud) {
                $smarty->assign('user_tagcloud',$aUserTagCloud);
-       }
+       } catch (exception $e) {}
        $smarty->assign('isme', ($this_user->name == $user->name));
        $smarty->assign('me', $user);
        $smarty->assign('profile', true);

Modified: branches/stable/nixtape/user-stats.php
===================================================================
--- branches/stable/nixtape/user-stats.php      2009-05-16 04:49:05 UTC (rev 
1653)
+++ branches/stable/nixtape/user-stats.php      2009-05-16 14:27:52 UTC (rev 
1654)
@@ -42,15 +42,15 @@
 #      }
 
        $smarty->assign('stat_barwidth', 320);
+try {
        $aUserPlayStat =  Statistic::GeneratePlayStats('Scrobbles', 'artist', 
40, $user->name, 300);
-       if (!$aUserPlayStat) {
                $smarty->assign('user_playstats',$aUserPlayStat);
-       }
+       } catch (exception $e) {}
 
+try {
        $aUserDayStat =  Statistic::generatePlayByDays('Scrobbles', 40, 
$user->name, 300);
-       if (!$aUserDayStat) {
                $smarty->assign('user_daystats',$aUserDayStat);
-       }
+       } catch (exception $e) {}
 
        $smarty->assign('toptracks', $user->getTopTracks(40));
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]