From 063e67887b48ea9ba5570638dcfaf5439f0337da Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Fri, 15 Sep 2006 06:12:52 +0000 Subject: browse by title and page header hotness --- lib/artist.lib.php | 2 ++ lib/class/song.class.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'lib') diff --git a/lib/artist.lib.php b/lib/artist.lib.php index 3e8964c6..f2857921 100644 --- a/lib/artist.lib.php +++ b/lib/artist.lib.php @@ -115,6 +115,8 @@ function show_artists ($match = '') { } if (count($artists)) { + /* Ack horrible hack :( */ + $GLOBALS['view'] = $view; require ( conf('prefix') . "/templates/show_artists.inc"); } diff --git a/lib/class/song.class.php b/lib/class/song.class.php index d85e0a53..b437692a 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -806,6 +806,54 @@ class Song { } // end stream_cmd + /** + * get_sql_from_match + * This is specificly for browsing it takes the match and returns the sql call that we want to use + * @package Song + * @catagory Class + */ + function get_sql_from_match($match) { + + switch ($match) { + case 'Show_All': + case 'show_all': + $sql = "SELECT id FROM song"; + break; + case 'Browse': + case 'show_genres': + $sql = "SELECT id FROM song"; + break; + default: + $sql = "SELECT id FROM song WHERE title LIKE '" . sql_escape($match) . "%'"; + break; + } // end switch on match + + return $sql; + + } // get_sql_from_match + + /** + * get_genres + * this returns an array of songs based on a sql statement that's passed + * @package songs + * @catagory Class + */ + function get_songs($sql) { + + $db_results = mysql_query($sql, dbh()); + + $results = array(); + + while ($r = mysql_fetch_assoc($db_results)) { + $results[] = $r['id']; + } + + return $results; + + } // get_genres + + + } // end of song class ?> -- cgit