\n";
switch ($type) {
case "popularalbum":
$date = time() - (86400*7);
/* Select Top objects counting by # of rows */
$sql = "SELECT object_id,COUNT(id) AS `count` FROM object_count" .
" WHERE object_type='album' AND date >= '$date'" .
" GROUP BY object_id ORDER BY `count` DESC LIMIT 10";
$db_result = mysql_query($sql, $dbh);
echo " \n $rss_popularalbum_title\n";
echo " $web_path\n $rss_main_description\n";
echo " $rss_main_copyright\n";
echo " $today\n $rss_main_language\n";
while ( $r = @mysql_fetch_object($db_result) ) {
echo "- \n";
$album = new Album($r->object_id);
echo " name ($r->count)]]>\n";
echo " $web_path/albums.php?action=show&album=$r->object_id\n";
echo " name - $album->artist ($r->count)]]>\n";
echo "
\n";
}
echo "\n";
break;
case "popularartist";
$date = time() - (86400*7);
/* Select Top objects counting by # of rows */
$sql = "SELECT object_id,COUNT(id) AS `count` FROM object_count" .
" WHERE object_type='artist' AND date >= '$date'" .
" GROUP BY object_id ORDER BY `count` DESC LIMIT 10";
$db_result = mysql_query($sql, $dbh);
echo " \n $rss_popularartist_title\n";
echo " $web_path\n $rss_main_description\n";
echo " $rss_main_copyright\n";
echo " $today\n $rss_main_language\n";
while ( $r = @mysql_fetch_object($db_result) ) {
echo "- \n";
$artist = new Artist($r->object_id);
echo " name ($r->count)]]>\n";
echo " $web_path/artists.php?action=show&artist=$r->object_id\n";
echo " name - $artist->albums ($r->count)]]>\n";
echo "
\n";
}
echo "\n";
break;
case "popularsong";
$date = time() - (86400*7);
/* Select Top objects counting by # of rows */
$sql = "SELECT object_id,COUNT(id) AS `count` FROM object_count" .
" WHERE object_type='song' AND date >= '$date'" .
" GROUP BY object_id ORDER BY `count` DESC LIMIT 10";
$db_result = mysql_query($sql, $dbh);
echo " \n $rss_popularsong_title\n";
echo " $web_path\n $rss_main_description\n";
echo " $rss_main_copyright\n";
echo " $today\n $rss_main_language\n";
while ( $r = @mysql_fetch_object($db_result) ) {
echo "- \n";
$song = new Song($r->object_id);
$artist = $song->get_artist_name();
echo " title ($r->count)]]>\n";
echo " $web_path/song.php?action=single_song&song_id=$r->object_id\n";
echo " title ($r->count)]]>\n";
echo "
\n";
}
echo "\n";
break;
case "latestartist":
$sql = "SELECT DISTINCT artist,album FROM song ORDER BY addition_time DESC LIMIT 10";
$db_result = mysql_query($sql, $dbh);
$items = array();
echo " \n $rss_latestartist_title\n";
echo " $web_path\n $rss_main_description\n";
echo " $rss_main_copyright\n";
echo " $today\n $rss_main_language\n";
while ( $item = mysql_fetch_row($db_result) ) {
echo " - \n";
$artist = new Artist($item[0]);
$album = new Album($item[1]);
$album->format_album();
$artist->format_artist();
echo " full_name]]>\n";
echo " $web_path/artists.php?action=show&artist=$item[0]\n";
echo " full_name - $album->name]]>\n";
echo "
\n";
}
echo " \n";
break;
case "latestalbum":
$sql = "SELECT DISTINCT album FROM song ORDER BY addition_time DESC LIMIT 10";
$db_result = mysql_query($sql, $dbh);
$items = array();
echo " \n $rss_latestalbum_title\n";
echo " $web_path\n $rss_main_description\n";
echo " $rss_main_copyright\n";
echo " $today\n $rss_main_language\n";
while ( $item = mysql_fetch_row($db_result) ) {
echo "- \n";
$album = new Album($item[0]);
$album->format_album();
echo " name]]>\n";
echo " $web_path/albums.php?action=show&album=$item[0]\n";
echo " name - $album->artist]]>\n";
echo "
\n";
}
echo "\n";
break;
default:
if ($username) {
$user = get_user_from_username($username);
$constraint = " WHERE user='" . sql_escape($user->username) . "' ";
}
$sql = "SELECT * FROM now_playing $constraint ORDER BY start_time DESC";
$db_result = mysql_query($sql, $dbh);
$rss_song_description = $rss_description;
echo " \n $rss_main_title\n";
echo " $web_path\n $rss_main_description\n";
echo " $rss_main_copyright\n";
echo " $today\n $rss_main_language\n";
while ($r = mysql_fetch_object($db_result)) {
$song = new Song($r->song_id);
$song->format_song();
if (is_object($song)) {
$artist = $song->f_artist;
$album = $song->get_album_name();
$text = "$artist - $song->f_title played by $r->user";
echo "- \n";
echo " \n";
echo " $web_path/albumart.php?id=$song->album\n";
echo " $web_path/albums.php?action=show&album=$song->album\n";
echo " f_title @ $album is played by $r->user]]>\n";
echo " $today\n";
echo "
\n";
}
}
echo "\n";
break;
}
}
?>