summaryrefslogtreecommitdiffstats
path: root/lib/album.lib.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-07 20:35:49 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-07 20:35:49 +0000
commitb6cfe134badb2d4393e9081b13b2dfca011ed736 (patch)
tree4f6213e626fa90b4b280b5e663e791559c4a7f8f /lib/album.lib.php
parent90d2acbc54b24b6e8207e12f1cabcbc7541ca447 (diff)
downloadampache-b6cfe134badb2d4393e9081b13b2dfca011ed736.tar.gz
ampache-b6cfe134badb2d4393e9081b13b2dfca011ed736.tar.bz2
ampache-b6cfe134badb2d4393e9081b13b2dfca011ed736.zip
* Re-worked Main page of Ampache, adding Album of the moment.
* Moved stats to /stats.php page * Fixed logic error in resize that could cause nothign to display if resize was on, but it still failed * Fixed Upload Album art from Find Album Art * Added Menu to the TV page * Fixed logic error that showed localplay if user had access regardless of global config * Changed default action of browse.php to song browse
Diffstat (limited to 'lib/album.lib.php')
-rw-r--r--lib/album.lib.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/album.lib.php b/lib/album.lib.php
index d01691b2..134e040e 100644
--- a/lib/album.lib.php
+++ b/lib/album.lib.php
@@ -59,4 +59,28 @@ function get_image_from_source($data) {
} // get_image_from_source
+/**
+ * get_random_albums
+ * This returns a random number of albums from the catalogs
+ * this is used by the index to return some 'potential' albums to play
+ */
+function get_random_albums($count='') {
+
+ if (!$count) { $count = 5; }
+
+ $count = sql_escape($count);
+
+ $sql = "SELECT id FROM album ORDER BY RAND() LIMIT $count";
+ $db_results = mysql_query($sql,dbh());
+
+ $results = array();
+
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $results[] = $r['id'];
+ }
+
+ return $results;
+
+} // get_random_albums
+
?>