diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-06-10 21:17:25 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-06-10 21:17:25 +0000 |
commit | b0fdd250fc4f06dba29629fed73f7185afd997b6 (patch) | |
tree | 84ac4b32f56cd03cf231dd05fb8e3d6a754bd519 /lib | |
parent | 11f28a1d4a752fc9aa29699c1c129e0c723fb8b7 (diff) | |
download | ampache-b0fdd250fc4f06dba29629fed73f7185afd997b6.tar.gz ampache-b0fdd250fc4f06dba29629fed73f7185afd997b6.tar.bz2 ampache-b0fdd250fc4f06dba29629fed73f7185afd997b6.zip |
added rightbar and fixed genre playback
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/genre.class.php | 22 | ||||
-rw-r--r-- | lib/ui.lib.php | 17 |
2 files changed, 25 insertions, 14 deletions
diff --git a/lib/class/genre.class.php b/lib/class/genre.class.php index b2eac58a..2886e245 100644 --- a/lib/class/genre.class.php +++ b/lib/class/genre.class.php @@ -125,17 +125,15 @@ class Genre { /** * get_songs * This gets all of the songs in this genre and returns an array of song objects - * @package Genre - * @catagory Class */ - function get_songs() { + public function get_songs() { - $sql = "SELECT song.id FROM song WHERE genre='" . $this->id . "'"; - $db_results = mysql_query($sql, dbh()); + $sql = "SELECT `song`.`id` FROM `song` WHERE `genre`='" . $this->id . "'"; + $db_results = Dba::query($sql); $results = array(); - while ($r = mysql_fetch_assoc($db_results)) { + while ($r = Dba::fetch_assoc($db_results)) { $results[] = $r['id']; } @@ -147,19 +145,15 @@ class Genre { * get_random_songs * This is the same as get_songs except it returns a random assortment of songs from this * genre - * @package Genre - * @catagory Class */ - function get_random_songs() { - - $limit = rand(1,$this->get_song_count()); + public function get_random_songs() { - $sql = "SELECT song.id FROM song WHERE genre='" . $this->id . "' ORDER BY RAND() LIMIT $limit"; - $db_results = mysql_query($sql, dbh()); + $sql = "SELECT `song`.`id` FROM `song` WHERE `genre`='" . $this->id . "' ORDER BY RAND()"; + $db_results = Dba::query($sql); $results = array(); - while ($r = mysql_fetch_assoc($db_results)) { + while ($r = Dba::fetch_assoc($db_results)) { $results[] = $r['id']; } diff --git a/lib/ui.lib.php b/lib/ui.lib.php index be447091..1476307a 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -1411,4 +1411,21 @@ function get_users($sql) { } // get_users +/** + * ajax_include + * This does an ob_start, getcontents, clean + * on the specified require, only works if you + * don't need to pass data in + */ +function ajax_include($include) { + + ob_start(); + require_once Config::get('prefix') . '/templates/' . $include; + $results = ob_get_contents(); + ob_end_clean(); + + return $results; + +} // ajax_include + ?> |