1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +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);
@ -429,7 +429,7 @@ class Album extends database_object
} // if updated } // if updated
Tag::update_tag_list($data['edit_tags'], 'album', $current_id); Tag::update_tag_list($data['edit_tags'], 'album', $current_id);
return $current_id; return $current_id;
} // update } // update
@ -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)) {
@ -200,8 +200,8 @@ 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`";
@ -409,7 +409,7 @@ class Artist extends database_object
Rating::gc(); Rating::gc();
Userflag::gc(); Userflag::gc();
} // if updated } // if updated
Tag::update_tag_list($data['edit_tags'], 'artist', $current_id); Tag::update_tag_list($data['edit_tags'], 'artist', $current_id);
return $current_id; return $current_id;

View file

@ -265,8 +265,8 @@ 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':
@ -769,7 +769,7 @@ class Query
{ {
// Only allow it to be set once // Only allow it to be set once
if (strlen($this->_state['base']) && !$force) { return true; } if (strlen($this->_state['base']) && !$force) { return true; }
// Custom sql base // Custom sql base
if ($force && !empty($custom_base)) { if ($force && !empty($custom_base)) {
$this->_state['custom'] = true; $this->_state['custom'] = true;
@ -977,7 +977,7 @@ class Query
} }
$final_sql .= $order_sql . $limit_sql; $final_sql .= $order_sql . $limit_sql;
debug_event("Catalog", "catalog sql: " . $final_sql, "6"); debug_event("Catalog", "catalog sql: " . $final_sql, "6");
return $final_sql; return $final_sql;
} // get_sql } // get_sql
@ -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,7 +176,7 @@ class Rating extends database_object
" GROUP BY object_id ORDER BY `rating` "; " GROUP BY object_id ORDER BY `rating` ";
return $sql; return $sql;
} }
/** /**
* get_highest * get_highest
* Get objects with the highest average rating. * Get objects with the highest average rating.

View file

@ -272,7 +272,7 @@ class Search extends playlist_object
) )
); );
} }
if (Config::get('show_played_times')) { if (Config::get('show_played_times')) {
$this->types[] = array( $this->types[] = array(
'name' => 'played_times', 'name' => 'played_times',

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));
@ -155,12 +155,13 @@ class Stats
return $results; return $results;
} // get_object_history } // get_object_history
/** /**
* 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) {
@ -299,12 +300,13 @@ class Stats
} // end switch } // end switch
} // validate_type } // validate_type
/** /**
* 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

@ -490,7 +490,7 @@ class Tag extends database_object
return $results; return $results;
} // get_display } // get_display
/** /**
* update_tag_list * update_tag_list
* Update the tags list based on commated list (ex. tag1,tag2,tag3,..) * Update the tags list based on commated list (ex. tag1,tag2,tag3,..)
@ -498,10 +498,10 @@ class Tag extends database_object
public static function update_tag_list($tags_comma, $type, $object_id) public static function update_tag_list($tags_comma, $type, $object_id)
{ {
debug_event('tag.class', 'Updating tags for values {'.$tags_comma.'} type {'.$type.'} object_id {'.$object_id.'}', '5'); debug_event('tag.class', 'Updating tags for values {'.$tags_comma.'} type {'.$type.'} object_id {'.$object_id.'}', '5');
$ctags = Tag::get_top_tags($type, $object_id); $ctags = Tag::get_top_tags($type, $object_id);
$editedTags = explode(",", $tags_comma); $editedTags = explode(",", $tags_comma);
foreach ($ctags as $ctid => $ctv) { foreach ($ctags as $ctid => $ctv) {
$ctag = new Tag($ctid); $ctag = new Tag($ctid);
foreach ($editedTags as $tk => $tv) { foreach ($editedTags as $tk => $tv) {
@ -517,14 +517,14 @@ class Tag extends database_object
} }
} }
} }
// Look if we need to add some new tags // Look if we need to add some new tags
foreach ($editedTags as $tk => $tv) { foreach ($editedTags as $tk => $tv) {
debug_event('tag.class', 'Adding new tag {'.$tv.'}', '5'); debug_event('tag.class', 'Adding new tag {'.$tv.'}', '5');
Tag::add($type, $object_id, $tv, false); Tag::add($type, $object_id, $tv, false);
} }
} // update_tag_list } // update_tag_list
/** /**
* count * count
* This returns the count for the all objects associated with this tag * This returns the count for the all objects associated with this tag

View file

@ -159,13 +159,14 @@ 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;
} }
$user_id = intval($user_id); $user_id = intval($user_id);
$type = Stats::validate_type($type); $type = Stats::validate_type($type);
$sql = "SELECT `object_id` as `id` FROM user_flag" . $sql = "SELECT `object_id` as `id` FROM user_flag" .
" WHERE object_type = '" . $type . "' AND `user` = '" . $user_id . "'" . " WHERE object_type = '" . $type . "' AND `user` = '" . $user_id . "'" .
" ORDER BY `date` DESC "; " ORDER BY `date` DESC ";

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;
@ -165,7 +165,7 @@ switch ($_REQUEST['action']) {
$_POST[$key] = unhtmlentities(scrub_in($data)); $_POST[$key] = unhtmlentities(scrub_in($data));
debug_event('ajax_server', $key.'='.$_POST[$key], '5'); debug_event('ajax_server', $key.'='.$_POST[$key], '5');
} }
$level = '50'; $level = '50';
if ($_POST['type'] == 'playlist_row' || $_POST['type'] == 'playlist_title') { if ($_POST['type'] == 'playlist_row' || $_POST['type'] == 'playlist_title') {

View file

@ -68,7 +68,7 @@ function forceIframe()
$(document).ready(function(){ $(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false}); $("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false});
}); });
// Using the following work-around to set ajex.server.php path available from any javascript script. // Using the following work-around to set ajex.server.php path available from any javascript script.
var jsAjaxUrl = "<?php echo Config::get('ajax_url') ?>"; var jsAjaxUrl = "<?php echo Config::get('ajax_url') ?>";
</script> </script>

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>

View file

@ -57,4 +57,4 @@
<input type="hidden" name="id" value="<?php echo $album->id; ?>" /> <input type="hidden" name="id" value="<?php echo $album->id; ?>" />
<input type="hidden" name="type" value="album_row" /> <input type="hidden" name="type" value="album_row" />
</form> </form>
</div> </div>

View file

@ -37,4 +37,4 @@
<input type="hidden" name="id" value="<?php echo $artist->id; ?>" /> <input type="hidden" name="id" value="<?php echo $artist->id; ?>" />
<input type="hidden" name="type" value="artist_row" /> <input type="hidden" name="type" value="artist_row" />
</form> </form>
</div> </div>