summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-24 20:09:03 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-24 20:09:03 +0000
commitde19302633973fa059b7d0771db92ec2479ba699 (patch)
tree33a88cca9b5beb45cd1e1a4a4b81747cbc17a88e /lib
parentbf4e0e46c94861a7da4288b248c67252b18d9af2 (diff)
downloadampache-de19302633973fa059b7d0771db92ec2479ba699.tar.gz
ampache-de19302633973fa059b7d0771db92ec2479ba699.tar.bz2
ampache-de19302633973fa059b7d0771db92ec2479ba699.zip
fixed random play
Diffstat (limited to 'lib')
-rw-r--r--lib/general.lib.php4
-rw-r--r--lib/ui.lib.php30
2 files changed, 32 insertions, 2 deletions
diff --git a/lib/general.lib.php b/lib/general.lib.php
index decd5fc1..4b5374ea 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -512,7 +512,6 @@ function set_memory_limit($new_limit) {
function get_random_songs( $options, $matchlist) {
$dbh = dbh();
-
/* Define the options */
$limit = $options['limit'];
@@ -532,7 +531,7 @@ function get_random_songs( $options, $matchlist) {
}
$where .= " ) ";
}
- else {
+ elseif (strlen($value)) {
$value = sql_escape($value);
$where .= " AND $type='$value' ";
}
@@ -568,6 +567,7 @@ function get_random_songs( $options, $matchlist) {
else {
$query = "SELECT id FROM song WHERE $where ORDER BY RAND() " . $options['limit'];
}
+ echo $query;
$db_result = mysql_query($query, $dbh);
$songs = array();
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 168d4146..6c1be64a 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -987,6 +987,36 @@ function show_artist_pulldown ($artist_id,$select_name='artist') {
} // show_artist_pulldown
/**
+ * show_catalog_pulldown
+ * This has been changed, first is the name of the
+ * dropdown select, the second is the style to be applied
+ *
+ */
+function show_catalog_pulldown ($name='catalog',$style) {
+
+ $sql = "SELECT id,name FROM catalog ORDER BY name";
+ $db_result = mysql_query($sql, dbh());
+
+ echo "\n<select name=\"" . $name . "\" style=\"" . $style . "\">\n";
+
+ echo "<option value=\"-1\">All</option>\n";
+
+ while ($r = mysql_fetch_assoc($db_result)) {
+ $catalog_name = scrub_out($r['name']);
+
+ if ( $catalog == $r['id'] ) {
+ echo " <option value=\"" .$r['id'] . "\" selected=\"selected\">$catalog_name</option>\n";
+ }
+ else {
+ echo " <option value=\"" . $r['id'] . "\">$catalog_name</option>\n";
+ }
+ }
+ echo "\n</select>\n";
+
+} // show_catalog_pulldown
+
+
+/**
* show_submenu
* This shows the submenu mojo for the sidebar, and I guess honestly anything
* else you would want it to... takes an array of items which have ['url'] ['title']