diff options
-rwxr-xr-x | docs/CHANGELOG | 2 | ||||
-rw-r--r-- | lib/class/radio.class.php | 7 | ||||
-rw-r--r-- | lib/class/random.class.php | 4 | ||||
-rw-r--r-- | lib/class/rating.class.php | 4 | ||||
-rw-r--r-- | lib/search.php | 25 | ||||
-rw-r--r-- | radio.php | 6 | ||||
-rw-r--r-- | search.php | 2 | ||||
-rw-r--r-- | server/localplay.ajax.php | 2 | ||||
-rw-r--r-- | templates/show_add_live_stream.inc.php | 8 | ||||
-rw-r--r-- | templates/show_random.inc.php | 2 |
10 files changed, 42 insertions, 20 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 76dd2444..ca001da1 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.4-Beta3 + - Fixed Rating display and Rating Advanced Search + - Added ability to specify new Genre when adding a Radio Station - Fixed Recently Played to do Distinct over last X rather then distinct over all time - Added update the attempts to correct the charset on the db diff --git a/lib/class/radio.class.php b/lib/class/radio.class.php index 7665c887..99232944 100644 --- a/lib/class/radio.class.php +++ b/lib/class/radio.class.php @@ -1,7 +1,7 @@ <?php /* - Copyright 2001 - 2007 Ampache.org + Copyright Ampache.org All Rights Reserved This program is free software; you can redistribute it and/or @@ -168,6 +168,11 @@ class Radio { Error::add('url','Invalid URL must be http:// or https://'); } + // If they specified other try to use that + if (strlen($data['other_genre'])) { + $data['genre'] = Catalog::check_genre($data['other_genre']); + } + // Make sure it's a real genre $genre = new Genre($data['genre']); if (!$genre->name) { diff --git a/lib/class/random.class.php b/lib/class/random.class.php index 8a042bad..0865f23f 100644 --- a/lib/class/random.class.php +++ b/lib/class/random.class.php @@ -1,7 +1,7 @@ <?php /* - Copyright 2001 - 2007 Ampache.org + Copyright Ampache.org All Rights Reserved This program is free software; you can redistribute it and/or @@ -281,7 +281,7 @@ class Random { } // end if matchlist switch ($data['random_type']) { - case 'full_aldum': + case 'full_album': $query = "SELECT `album`.`id` FROM `song` INNER JOIN `album` ON `song`.`album`=`album`.`id` " . "WHERE $where GROUP BY `song`.`album` ORDER BY RAND() $limit_sql"; $db_results = Dba::query($query); diff --git a/lib/class/rating.class.php b/lib/class/rating.class.php index d844cea1..51555c10 100644 --- a/lib/class/rating.class.php +++ b/lib/class/rating.class.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2008 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -45,7 +45,7 @@ class Rating { $this->type = Dba::escape($type); // Check for the users rating - if ($rating == $this->get_user($GLOBALS['user']->id)) { + if ($rating = $this->get_user($GLOBALS['user']->id)) { $this->rating = $rating; $this->preciserating = $rating; } diff --git a/lib/search.php b/lib/search.php index 03042c10..b5d300a0 100644 --- a/lib/search.php +++ b/lib/search.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2006 ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -181,11 +181,24 @@ function search_song($data,$operator,$method,$limit) { break; case 'rating': $value = intval($value); - $select_sql .= "AVG(`rating`.`rating`) AS avgrating,"; - $group_sql .= " rating.object_id,"; - $where_sql .= " (`rating`.`rating` >= '$value' AND `rating`.`object_type`='song')"; - $table_sql .= " RIGHT JOIN `rating` ON `rating`.`object_id`=`song`.`id`"; - $limit_sql .= " ORDER BY avgrating DESC"; + + // This is a little more complext, pull a list of IDs that have this average rating + $rating_sql = "SELECT `object_id`,AVG(`rating`.`rating`) AS avgrating FROM `rating` " . + "WHERE `object_type`='song' GROUP BY `object_id`"; + $db_results = Dba::query($rating_sql); + + $where_sql .= " `song`.`id` IN ("; + $end_rating = ''; + + while ($row = Dba::fetch_assoc($db_results)) { + if ($row['avgrating'] < $value) { continue; } + $where_sql .= $row['object_id'] . ','; + $end_rating = ") $operator"; + } + + $where_sql = rtrim($where_sql,"`song`.`id` IN ("); + $where_sql = rtrim($where_sql,",") . $end_rating; + default: // Notzing! break; @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -26,7 +26,7 @@ show_header(); // Switch on Action switch ($_REQUEST['action']) { case 'show_create': - if (!$GLOBALS['user']->has_access('25')) { + if (!Access::check('interface','25')) { access_denied(); exit; } @@ -35,7 +35,7 @@ switch ($_REQUEST['action']) { break; case 'create': - if (!$GLOBALS['user']->has_access('25') || Config::get('demo_mode')) { + if (!Access::check('interface','25') || Config::get('demo_mode')) { access_denied(); exit; } @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All Rights Reserved This program is free software; you can redistribute it and/or diff --git a/server/localplay.ajax.php b/server/localplay.ajax.php index d5945a3a..d60513d0 100644 --- a/server/localplay.ajax.php +++ b/server/localplay.ajax.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or diff --git a/templates/show_add_live_stream.inc.php b/templates/show_add_live_stream.inc.php index 7acf1b80..2dc9382d 100644 --- a/templates/show_add_live_stream.inc.php +++ b/templates/show_add_live_stream.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -54,13 +54,15 @@ <tr> <td><?php echo _('Callsign'); ?></td> <td> - <input type="text" name="call_sign" value="<?Php echo scrub_out($_REQUEST['call_sign']); ?>" /> + <input type="text" name="call_sign" value="<?php echo scrub_out($_REQUEST['call_sign']); ?>" /> </td> </tr> <tr> - <td><?php echo _('Genre'); ?></td> + <td valign="top"><?php echo _('Genre'); ?></td> <td> <?php echo show_genre_select('genre',intval($_REQUEST['genre'])); ?> + <br /><?php echo _('OR'); ?><br /> + <input type="text" name="other_genre" value="<?php echo scrub_out($_REQUEST['other_genre']); ?>" /> </td> </tr> <tr> diff --git a/templates/show_random.inc.php b/templates/show_random.inc.php index 4abae8d2..92c47049 100644 --- a/templates/show_random.inc.php +++ b/templates/show_random.inc.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2006 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or |