1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 10:19:25 +02:00

Fix code style

This commit is contained in:
Afterster 2013-11-23 01:11:19 +01:00
parent 619ca48ffe
commit 1745e204cd
17 changed files with 120 additions and 117 deletions

View file

@ -59,7 +59,7 @@ switch ($_REQUEST['action']) {
break; break;
case 'album': case 'album':
$browse->set_filter('catalog',$_SESSION['catalog']); $browse->set_filter('catalog',$_SESSION['catalog']);
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
$browse->set_sort('name','ASC'); $browse->set_sort('name','ASC');
$browse->show_objects(); $browse->show_objects();
break; break;
@ -83,19 +83,19 @@ switch ($_REQUEST['action']) {
break; break;
case 'artist': case 'artist':
$browse->set_filter('catalog',$_SESSION['catalog']); $browse->set_filter('catalog',$_SESSION['catalog']);
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
$browse->set_sort('name','ASC'); $browse->set_sort('name','ASC');
$browse->show_objects(); $browse->show_objects();
break; break;
case 'song': case 'song':
$browse->set_filter('catalog',$_SESSION['catalog']); $browse->set_filter('catalog',$_SESSION['catalog']);
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
$browse->set_sort('title','ASC'); $browse->set_sort('title','ASC');
$browse->show_objects(); $browse->show_objects();
break; break;
case 'live_stream': case 'live_stream':
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
$browse->set_sort('name','ASC'); $browse->set_sort('name','ASC');
$browse->show_objects(); $browse->show_objects();
break; break;
@ -113,7 +113,7 @@ switch ($_REQUEST['action']) {
$browse->show_objects(); $browse->show_objects();
break; break;
case 'video': case 'video':
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
$browse->set_sort('title','ASC'); $browse->set_sort('title','ASC');
$browse->show_objects(); $browse->show_objects();
break; break;

View file

@ -128,10 +128,10 @@ class Album extends database_object
"`artist`.`id` AS `artist_id`, `song`.`album`" . "`artist`.`id` AS `artist_id`, `song`.`album`" .
"FROM `song` " . "FROM `song` " .
"INNER JOIN `artist` ON `artist`.`id`=`song`.`artist` " . "INNER JOIN `artist` ON `artist`.`id`=`song`.`artist` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `song`.`album` IN $idlist " . "WHERE `song`.`album` IN $idlist " .
"AND `catalog`.`enabled` = '1' " . "AND `catalog`.`enabled` = '1' " .
"GROUP BY `song`.`album`"; "GROUP BY `song`.`album`";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
@ -171,9 +171,9 @@ class Album extends database_object
"`artist`.`id` AS `artist_id` " . "`artist`.`id` AS `artist_id` " .
"FROM `song` INNER JOIN `artist` " . "FROM `song` INNER JOIN `artist` " .
"ON `artist`.`id`=`song`.`artist` " . "ON `artist`.`id`=`song`.`artist` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `song`.`album` = ? " . "WHERE `song`.`album` = ? " .
"AND `catalog`.`enabled` = '1' " . "AND `catalog`.`enabled` = '1' " .
"GROUP BY `song`.`album`"; "GROUP BY `song`.`album`";
$db_results = Dba::read($sql, array($this->id)); $db_results = Dba::read($sql, array($this->id));
@ -277,14 +277,14 @@ class Album extends database_object
$results = array(); $results = array();
$sql = "SELECT `song`.`id` FROM `song` "; $sql = "SELECT `song`.`id` FROM `song` ";
$sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` "; $sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
$sql .= "WHERE `song`.`album` = ? "; $sql .= "WHERE `song`.`album` = ? ";
$params = array($this->id); $params = array($this->id);
if (strlen($artist)) { if (strlen($artist)) {
$sql .= "AND `artist` = ? "; $sql .= "AND `artist` = ? ";
$params[] = $artist; $params[] = $artist;
} }
$sql .= "AND `catalog`.`enabled` = '1' "; $sql .= "AND `catalog`.`enabled` = '1' ";
$sql .= "ORDER BY `song`.`track`, `song`.`title`"; $sql .= "ORDER BY `song`.`track`, `song`.`title`";
if ($limit) { if ($limit) {
$sql .= " LIMIT " . intval($limit); $sql .= " LIMIT " . intval($limit);
@ -443,16 +443,16 @@ class Album extends database_object
{ {
$results = false; $results = false;
$sql = "SELECT `album`.`id` FROM `album` " . $sql = "SELECT `album`.`id` FROM `album` " .
"LEFT JOIN `song` ON `song`.`album` = `album`.`id` " . "LEFT JOIN `song` ON `song`.`album` = `album`.`id` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` "; "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
$where = "WHERE `catalog`.`enabled` = '1' "; $where = "WHERE `catalog`.`enabled` = '1' ";
if ($with_art) { if ($with_art) {
$sql .= "LEFT JOIN `image` ON (`image`.`object_type` = 'album' AND `image`.`object_id` = `album`.`id`) "; $sql .= "LEFT JOIN `image` ON (`image`.`object_type` = 'album' AND `image`.`object_id` = `album`.`id`) ";
$where .="AND `image`.`id` IS NOT NULL "; $where .="AND `image`.`id` IS NOT NULL ";
} }
$sql .= $where; $sql .= $where;
$sql .= "ORDER BY RAND() LIMIT " . intval($count); $sql .= "ORDER BY RAND() LIMIT " . intval($count);
$db_results = Dba::read($sql); $db_results = Dba::read($sql);

View file

@ -146,12 +146,12 @@ class Artist extends database_object
*/ */
public function get_albums($catalog = null) public function get_albums($catalog = null)
{ {
$catalog_where = ""; $catalog_where = "";
$catalog_join = "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`"; $catalog_join = "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
if ($catalog) { if ($catalog) {
$catalog_where .= " AND `catalog`.`id` = '$catalog'"; $catalog_where .= " AND `catalog`.`id` = '$catalog'";
} }
$catalog_where .= " AND `catalog`.`enabled` = '1'"; $catalog_where .= " AND `catalog`.`enabled` = '1'";
$results = array(); $results = array();
@ -181,7 +181,7 @@ class Artist extends database_object
public function get_songs() public function get_songs()
{ {
$sql = "SELECT `song`.`id` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . $sql = "SELECT `song`.`id` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `song`.`artist`='" . Dba::escape($this->id) . "' AND `catalog`.`enabled` = '1' ORDER BY album, track"; "WHERE `song`.`artist`='" . Dba::escape($this->id) . "' AND `catalog`.`enabled` = '1' ORDER BY album, track";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) { while ($r = Dba::fetch_assoc($db_results)) {
@ -201,7 +201,7 @@ class Artist extends database_object
$results = array(); $results = array();
$sql = "SELECT `song`.`id` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . $sql = "SELECT `song`.`id` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `song`.`artist`='$this->id' AND `catalog`.`enabled` = '1' ORDER BY RAND()"; "WHERE `song`.`artist`='$this->id' AND `catalog`.`enabled` = '1' ORDER BY RAND()";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) { while ($r = Dba::fetch_assoc($db_results)) {
@ -224,11 +224,11 @@ class Artist extends database_object
} else { } else {
$uid = Dba::escape($this->id); $uid = Dba::escape($this->id);
$sql = "SELECT `song`.`artist`,COUNT(`song`.`id`) AS `song_count`, COUNT(DISTINCT `song`.`album`) AS `album_count`, SUM(`song`.`time`) AS `time` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . $sql = "SELECT `song`.`artist`,COUNT(`song`.`id`) AS `song_count`, COUNT(DISTINCT `song`.`album`) AS `album_count`, SUM(`song`.`time`) AS `time` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `song`.`artist`='$uid' "; "WHERE `song`.`artist`='$uid' ";
if ($catalog) { if ($catalog) {
$sql .= "AND (`song`.`catalog` = '$catalog') "; $sql .= "AND (`song`.`catalog` = '$catalog') ";
} }
$sql .= " AND `catalog`.`enabled` = '1'"; $sql .= " AND `catalog`.`enabled` = '1'";
$sql .= "GROUP BY `song`.`artist`"; $sql .= "GROUP BY `song`.`artist`";

View file

@ -266,7 +266,7 @@ abstract class Catalog extends database_object
return true; return true;
} }
/** /**
* update_enabled * update_enabled
* sets the enabled flag * sets the enabled flag
*/ */

View file

@ -101,7 +101,7 @@ class Query
'exact_match', 'exact_match',
'alpha_match', 'alpha_match',
'catalog', 'catalog',
'catalog_enabled' 'catalog_enabled'
), ),
'artist' => array( 'artist' => array(
'add_lt', 'add_lt',
@ -113,7 +113,7 @@ class Query
'starts_with', 'starts_with',
'tag', 'tag',
'catalog', 'catalog',
'catalog_enabled' 'catalog_enabled'
), ),
'song' => array( 'song' => array(
'add_lt', 'add_lt',
@ -125,12 +125,12 @@ class Query
'starts_with', 'starts_with',
'tag', 'tag',
'catalog', 'catalog',
'catalog_enabled' 'catalog_enabled'
), ),
'live_stream' => array( 'live_stream' => array(
'alpha_match', 'alpha_match',
'starts_with', 'starts_with',
'catalog_enabled' 'catalog_enabled'
), ),
'playlist' => array( 'playlist' => array(
'alpha_match', 'alpha_match',
@ -321,7 +321,7 @@ class Query
case 'add_gt': case 'add_gt':
case 'update_lt': case 'update_lt':
case 'update_gt': case 'update_gt':
case 'catalog_enabled': case 'catalog_enabled':
$this->_state['filter'][$key] = intval($value); $this->_state['filter'][$key] = intval($value);
break; break;
case 'exact_match': case 'exact_match':
@ -1074,10 +1074,10 @@ class Query
$filter_sql = " `song`.`catalog` = '$value' AND "; $filter_sql = " `song`.`catalog` = '$value' AND ";
} }
break; break;
case 'catalog_enabled': case 'catalog_enabled':
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100); $this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
$filter_sql = " `catalog`.`enabled` = '1' AND "; $filter_sql = " `catalog`.`enabled` = '1' AND ";
break; break;
default: default:
// Rien a faire // Rien a faire
break; break;
@ -1114,7 +1114,7 @@ class Query
$this->set_join('left','`song`','`album`.`id`','`song`.`album`', 100); $this->set_join('left','`song`','`album`.`id`','`song`.`album`', 100);
$this->set_join('left','`catalog`','`song`.`catalog`','`catalog`.`id`', 100); $this->set_join('left','`catalog`','`song`.`catalog`','`catalog`.`id`', 100);
$filter_sql = " (`song`.`catalog` = '$value') AND "; $filter_sql = " (`song`.`catalog` = '$value') AND ";
} }
break; break;
case 'update_lt': case 'update_lt':
$this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100); $this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100);
@ -1124,11 +1124,11 @@ class Query
$this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100); $this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100);
$filter_sql = " `song`.`update_time` >= '" . Dba::escape($value) . "' AND "; $filter_sql = " `song`.`update_time` >= '" . Dba::escape($value) . "' AND ";
break; break;
case 'catalog_enabled': case 'catalog_enabled':
$this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100); $this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100);
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100); $this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
$filter_sql = " `catalog`.`enabled` = '1' AND "; $filter_sql = " `catalog`.`enabled` = '1' AND ";
break; break;
default: default:
// Rien a faire // Rien a faire
break; break;
@ -1172,11 +1172,11 @@ class Query
$this->set_join('left', '`song`', '`song`.`artist`', '`artist`.`id`', 100); $this->set_join('left', '`song`', '`song`.`artist`', '`artist`.`id`', 100);
$filter_sql = " `song`.`update_time` >= '" . Dba::escape($value) . "' AND "; $filter_sql = " `song`.`update_time` >= '" . Dba::escape($value) . "' AND ";
break; break;
case 'catalog_enabled': case 'catalog_enabled':
$this->set_join('left', '`song`', '`song`.`artist`', '`artist`.`id`', 100); $this->set_join('left', '`song`', '`song`.`artist`', '`artist`.`id`', 100);
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100); $this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
$filter_sql = " `catalog`.`enabled` = '1' AND "; $filter_sql = " `catalog`.`enabled` = '1' AND ";
break; break;
default: default:
// Rien a faire // Rien a faire
break; break;
@ -1190,10 +1190,10 @@ class Query
case 'starts_with': case 'starts_with':
$filter_sql = " `live_stream`.`name` LIKE '" . Dba::escape($value) . "%' AND "; $filter_sql = " `live_stream`.`name` LIKE '" . Dba::escape($value) . "%' AND ";
break; break;
case 'catalog_enabled': case 'catalog_enabled':
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`live_stream`.`catalog`', 100); $this->set_join('left', '`catalog`', '`catalog`.`id`', '`live_stream`.`catalog`', 100);
$filter_sql = " `catalog`.`enabled` = '1' AND "; $filter_sql = " `catalog`.`enabled` = '1' AND ";
break; break;
default: default:
// Rien a faire // Rien a faire
break; break;

View file

@ -51,11 +51,11 @@ class Random implements media
public static function artist() public static function artist()
{ {
$sql = "SELECT `artist`.`id` FROM `artist` " . $sql = "SELECT `artist`.`id` FROM `artist` " .
"LEFT JOIN `song` ON `song`.`artist` = `artist`.`id` " . "LEFT JOIN `song` ON `song`.`artist` = `artist`.`id` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `catalog`.`enabled` = '1' " . "WHERE `catalog`.`enabled` = '1' " .
"GROUP BY `artist`.`id` " . "GROUP BY `artist`.`id` " .
"ORDER BY RAND() LIMIT 1"; "ORDER BY RAND() LIMIT 1";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results); $results = Dba::fetch_assoc($db_results);
@ -133,9 +133,9 @@ class Random implements media
$results = array(); $results = array();
$sql = "SELECT `song`.`id` FROM `song` " . $sql = "SELECT `song`.`id` FROM `song` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `catalog`.`enabled` = '1' " . "WHERE `catalog`.`enabled` = '1' " .
"ORDER BY RAND() LIMIT $limit"; "ORDER BY RAND() LIMIT $limit";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {
@ -162,9 +162,9 @@ class Random implements media
} }
$sql = "SELECT `song`.`id` FROM `song` " . $sql = "SELECT `song`.`id` FROM `song` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `catalog`.`enabled` = '1' " . "WHERE `catalog`.`enabled` = '1' " .
"$where_sql ORDER BY RAND() LIMIT $limit"; "$where_sql ORDER BY RAND() LIMIT $limit";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {
@ -190,9 +190,9 @@ class Random implements media
} }
$sql = "SELECT `song`.`id` FROM `song` " . $sql = "SELECT `song`.`id` FROM `song` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `catalog`.`enabled` = '1' " . "WHERE `catalog`.`enabled` = '1' " .
"$where_sql ORDER BY RAND() LIMIT $limit"; "$where_sql ORDER BY RAND() LIMIT $limit";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {
@ -234,10 +234,10 @@ class Random implements media
"FROM `song` "; "FROM `song` ";
if ($search_info) { if ($search_info) {
$sql .= $search_info['table_sql']; $sql .= $search_info['table_sql'];
} }
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`"; $sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
$sql .= " WHERE `catalog`.`enabled` = '1'"; $sql .= " WHERE `catalog`.`enabled` = '1'";
if ($search_info) { if ($search_info) {
$sql .= ' AND ' . $search_info['where_sql']; $sql .= ' AND ' . $search_info['where_sql'];
} }
break; break;
@ -248,10 +248,10 @@ class Random implements media
} }
if ($search_info) { if ($search_info) {
$sql .= $search_info['table_sql']; $sql .= $search_info['table_sql'];
} }
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`"; $sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
$sql .= " WHERE `catalog`.`enabled` = '1'"; $sql .= " WHERE `catalog`.`enabled` = '1'";
if ($search_info) { if ($search_info) {
$sql .= ' AND ' . $search_info['where_sql']; $sql .= ' AND ' . $search_info['where_sql'];
} }
$sql .= ' GROUP BY `album`.`id`'; $sql .= ' GROUP BY `album`.`id`';
@ -263,10 +263,10 @@ class Random implements media
} }
if ($search_info) { if ($search_info) {
$sql .= $search_info['table_sql']; $sql .= $search_info['table_sql'];
} }
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`"; $sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
$sql .= " WHERE `catalog`.`enabled` = '1'"; $sql .= " WHERE `catalog`.`enabled` = '1'";
if ($search_info) { if ($search_info) {
$sql .= ' AND ' . $search_info['where_sql']; $sql .= ' AND ' . $search_info['where_sql'];
} }
$sql .= ' GROUP BY `artist`.`id`'; $sql .= ' GROUP BY `artist`.`id`';

View file

@ -176,9 +176,9 @@ class Song extends database_object implements media
'FROM `song` LEFT JOIN `tag_map` ' . 'FROM `song` LEFT JOIN `tag_map` ' .
'ON `tag_map`.`object_id`=`song`.`id` ' . 'ON `tag_map`.`object_id`=`song`.`id` ' .
"AND `tag_map`.`object_type`='song' " . "AND `tag_map`.`object_type`='song' " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `song`.`id` IN $idlist " . "WHERE `song`.`id` IN $idlist " .
"AND `catalog`.`enabled` = '1' "; "AND `catalog`.`enabled` = '1' ";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {

View file

@ -116,11 +116,11 @@ class Stats
$user_id = $user_id ? $user_id : $GLOBALS['user']->id; $user_id = $user_id ? $user_id : $GLOBALS['user']->id;
$sql = "SELECT * FROM `object_count` " . $sql = "SELECT * FROM `object_count` " .
"LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " . "LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' " . "WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' " .
"AND `catalog`.`enabled` = '1' " . "AND `catalog`.`enabled` = '1' " .
"ORDER BY `object_count`.`date` DESC LIMIT 1"; "ORDER BY `object_count`.`date` DESC LIMIT 1";
$db_results = Dba::read($sql, array($user_id)); $db_results = Dba::read($sql, array($user_id));
$results = Dba::fetch_assoc($db_results); $results = Dba::fetch_assoc($db_results);
@ -139,10 +139,10 @@ class Stats
$user_id = $user_id ? $user_id : $GLOBALS['user']->id; $user_id = $user_id ? $user_id : $GLOBALS['user']->id;
$sql = "SELECT * FROM `object_count` " . $sql = "SELECT * FROM `object_count` " .
"LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " . "LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " .
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " . "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
"WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' AND `object_count`.`date` >= ? " . "WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' AND `object_count`.`date` >= ? " .
"AND `catalog`.`enabled` = '1' " . "AND `catalog`.`enabled` = '1' " .
"ORDER BY `object_count`.`date` DESC"; "ORDER BY `object_count`.`date` DESC";
$db_results = Dba::read($sql, array($user_id, $time)); $db_results = Dba::read($sql, array($user_id, $time));
@ -160,7 +160,8 @@ class Stats
* get_top_sql * get_top_sql
* This returns the get_top sql * This returns the get_top sql
*/ */
public static function get_top_sql($type, $threshold = '') { public static function get_top_sql($type, $threshold = '')
{
$type = self::validate_type($type); $type = self::validate_type($type);
/* If they don't pass one, then use the preference */ /* If they don't pass one, then use the preference */
if (!$threshold) { if (!$threshold) {
@ -304,7 +305,8 @@ class Stats
* get_newest_sql * get_newest_sql
* This returns the get_newest sql * This returns the get_newest sql
*/ */
public static function get_newest_sql($type) { public static function get_newest_sql($type)
{
$type = self::validate_type($type); $type = self::validate_type($type);
$sql = "SELECT DISTINCT(`$type`) as `id`, MIN(`addition_time`) AS `real_atime` FROM `song` GROUP BY `$type` ORDER BY `real_atime` "; $sql = "SELECT DISTINCT(`$type`) as `id`, MIN(`addition_time`) AS `real_atime` FROM `song` GROUP BY `$type` ORDER BY `real_atime` ";

View file

@ -159,7 +159,8 @@ class Userflag extends database_object
* get_latest_sql * get_latest_sql
* Get the latest sql * Get the latest sql
*/ */
public static function get_latest_sql($type, $user_id=null) { public static function get_latest_sql($type, $user_id=null)
{
if (is_null($user_id)) { if (is_null($user_id)) {
$user_id = $GLOBALS['user']->id; $user_id = $GLOBALS['user']->id;
} }

View file

@ -83,7 +83,7 @@ switch ($page) {
case 'index': case 'index':
require_once Config::get('prefix') . '/server/index.ajax.php'; require_once Config::get('prefix') . '/server/index.ajax.php';
exit; exit;
case 'catalog': case 'catalog':
require_once Config::get('prefix') . '/server/catalog.ajax.php'; require_once Config::get('prefix') . '/server/catalog.ajax.php';
exit; exit;
break; break;

View file

@ -37,7 +37,7 @@ $button_flip_state_id = 'button_flip_state_' . $catalog->id;
| <a href="<?php echo $web_path; ?>/admin/catalog.php?action=full_service&amp;catalogs[]=<?php echo $catalog->id; ?>"><?php echo T_('Update'); ?></a> | <a href="<?php echo $web_path; ?>/admin/catalog.php?action=full_service&amp;catalogs[]=<?php echo $catalog->id; ?>"><?php echo T_('Update'); ?></a>
| <a href="<?php echo $web_path; ?>/admin/catalog.php?action=gather_album_art&amp;catalogs[]=<?php echo $catalog->id; ?>"><?php echo T_('Gather Art'); ?></a> | <a href="<?php echo $web_path; ?>/admin/catalog.php?action=gather_album_art&amp;catalogs[]=<?php echo $catalog->id; ?>"><?php echo T_('Gather Art'); ?></a>
| <a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_delete_catalog&amp;catalog_id=<?php echo $catalog->id; ?>"><?php echo T_('Delete'); ?></a> | <a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_delete_catalog&amp;catalog_id=<?php echo $catalog->id; ?>"><?php echo T_('Delete'); ?></a>
| <span id="<?php echo($button_flip_state_id); ?>"> | <span id="<?php echo($button_flip_state_id); ?>">
<?php echo Ajax::button('?page=catalog&action=flip_state&catalog_id=' . $catalog->id, $icon, T_(ucfirst($icon)),'flip_state_' . $catalog->id); ?> <?php echo Ajax::button('?page=catalog&action=flip_state&catalog_id=' . $catalog->id, $icon, T_(ucfirst($icon)),'flip_state_' . $catalog->id); ?>
</span> </span>
</td> </td>