mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 17:59:21 +02:00
Fix code style
This commit is contained in:
parent
619ca48ffe
commit
1745e204cd
17 changed files with 120 additions and 117 deletions
12
browse.php
12
browse.php
|
@ -59,7 +59,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
case 'album':
|
||||
$browse->set_filter('catalog',$_SESSION['catalog']);
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -83,19 +83,19 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
case 'artist':
|
||||
$browse->set_filter('catalog',$_SESSION['catalog']);
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'song':
|
||||
$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->show_objects();
|
||||
break;
|
||||
case 'live_stream':
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -113,7 +113,7 @@ switch ($_REQUEST['action']) {
|
|||
$browse->show_objects();
|
||||
break;
|
||||
case 'video':
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
$browse->set_sort('title','ASC');
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
|
|
@ -128,10 +128,10 @@ class Album extends database_object
|
|||
"`artist`.`id` AS `artist_id`, `song`.`album`" .
|
||||
"FROM `song` " .
|
||||
"INNER JOIN `artist` ON `artist`.`id`=`song`.`artist` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `song`.`album` IN $idlist " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"GROUP BY `song`.`album`";
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `song`.`album` IN $idlist " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"GROUP BY `song`.`album`";
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
|
@ -171,9 +171,9 @@ class Album extends database_object
|
|||
"`artist`.`id` AS `artist_id` " .
|
||||
"FROM `song` 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` = ? " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"GROUP BY `song`.`album`";
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
|
||||
|
@ -277,14 +277,14 @@ class Album extends database_object
|
|||
$results = array();
|
||||
|
||||
$sql = "SELECT `song`.`id` FROM `song` ";
|
||||
$sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
$sql .= "WHERE `song`.`album` = ? ";
|
||||
$sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
$sql .= "WHERE `song`.`album` = ? ";
|
||||
$params = array($this->id);
|
||||
if (strlen($artist)) {
|
||||
$sql .= "AND `artist` = ? ";
|
||||
$params[] = $artist;
|
||||
}
|
||||
$sql .= "AND `catalog`.`enabled` = '1' ";
|
||||
$sql .= "AND `catalog`.`enabled` = '1' ";
|
||||
$sql .= "ORDER BY `song`.`track`, `song`.`title`";
|
||||
if ($limit) {
|
||||
$sql .= " LIMIT " . intval($limit);
|
||||
|
@ -429,7 +429,7 @@ class Album extends database_object
|
|||
} // if updated
|
||||
|
||||
Tag::update_tag_list($data['edit_tags'], 'album', $current_id);
|
||||
|
||||
|
||||
return $current_id;
|
||||
|
||||
} // update
|
||||
|
@ -443,16 +443,16 @@ class Album extends database_object
|
|||
{
|
||||
$results = false;
|
||||
|
||||
$sql = "SELECT `album`.`id` FROM `album` " .
|
||||
"LEFT JOIN `song` ON `song`.`album` = `album`.`id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
$where = "WHERE `catalog`.`enabled` = '1' ";
|
||||
$sql = "SELECT `album`.`id` FROM `album` " .
|
||||
"LEFT JOIN `song` ON `song`.`album` = `album`.`id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
$where = "WHERE `catalog`.`enabled` = '1' ";
|
||||
if ($with_art) {
|
||||
$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);
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
|
|
|
@ -146,12 +146,12 @@ class Artist extends database_object
|
|||
*/
|
||||
public function get_albums($catalog = null)
|
||||
{
|
||||
$catalog_where = "";
|
||||
$catalog_join = "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
$catalog_where = "";
|
||||
$catalog_join = "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
if ($catalog) {
|
||||
$catalog_where .= " AND `catalog`.`id` = '$catalog'";
|
||||
}
|
||||
$catalog_where .= " AND `catalog`.`enabled` = '1'";
|
||||
$catalog_where .= " AND `catalog`.`enabled` = '1'";
|
||||
|
||||
$results = array();
|
||||
|
||||
|
@ -181,7 +181,7 @@ class Artist extends database_object
|
|||
public function get_songs()
|
||||
{
|
||||
$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);
|
||||
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
|
@ -200,8 +200,8 @@ class Artist extends database_object
|
|||
{
|
||||
$results = array();
|
||||
|
||||
$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()";
|
||||
$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()";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
|
@ -224,11 +224,11 @@ class Artist extends database_object
|
|||
} else {
|
||||
$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` " .
|
||||
"WHERE `song`.`artist`='$uid' ";
|
||||
"WHERE `song`.`artist`='$uid' ";
|
||||
if ($catalog) {
|
||||
$sql .= "AND (`song`.`catalog` = '$catalog') ";
|
||||
}
|
||||
$sql .= " AND `catalog`.`enabled` = '1'";
|
||||
$sql .= " AND `catalog`.`enabled` = '1'";
|
||||
|
||||
$sql .= "GROUP BY `song`.`artist`";
|
||||
|
||||
|
@ -409,7 +409,7 @@ class Artist extends database_object
|
|||
Rating::gc();
|
||||
Userflag::gc();
|
||||
} // if updated
|
||||
|
||||
|
||||
Tag::update_tag_list($data['edit_tags'], 'artist', $current_id);
|
||||
|
||||
return $current_id;
|
||||
|
|
|
@ -265,8 +265,8 @@ abstract class Catalog extends database_object
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* update_enabled
|
||||
* sets the enabled flag
|
||||
*/
|
||||
|
|
|
@ -101,7 +101,7 @@ class Query
|
|||
'exact_match',
|
||||
'alpha_match',
|
||||
'catalog',
|
||||
'catalog_enabled'
|
||||
'catalog_enabled'
|
||||
),
|
||||
'artist' => array(
|
||||
'add_lt',
|
||||
|
@ -113,7 +113,7 @@ class Query
|
|||
'starts_with',
|
||||
'tag',
|
||||
'catalog',
|
||||
'catalog_enabled'
|
||||
'catalog_enabled'
|
||||
),
|
||||
'song' => array(
|
||||
'add_lt',
|
||||
|
@ -125,12 +125,12 @@ class Query
|
|||
'starts_with',
|
||||
'tag',
|
||||
'catalog',
|
||||
'catalog_enabled'
|
||||
'catalog_enabled'
|
||||
),
|
||||
'live_stream' => array(
|
||||
'alpha_match',
|
||||
'starts_with',
|
||||
'catalog_enabled'
|
||||
'catalog_enabled'
|
||||
),
|
||||
'playlist' => array(
|
||||
'alpha_match',
|
||||
|
@ -321,7 +321,7 @@ class Query
|
|||
case 'add_gt':
|
||||
case 'update_lt':
|
||||
case 'update_gt':
|
||||
case 'catalog_enabled':
|
||||
case 'catalog_enabled':
|
||||
$this->_state['filter'][$key] = intval($value);
|
||||
break;
|
||||
case 'exact_match':
|
||||
|
@ -769,7 +769,7 @@ class Query
|
|||
{
|
||||
// Only allow it to be set once
|
||||
if (strlen($this->_state['base']) && !$force) { return true; }
|
||||
|
||||
|
||||
// Custom sql base
|
||||
if ($force && !empty($custom_base)) {
|
||||
$this->_state['custom'] = true;
|
||||
|
@ -977,7 +977,7 @@ class Query
|
|||
}
|
||||
$final_sql .= $order_sql . $limit_sql;
|
||||
debug_event("Catalog", "catalog sql: " . $final_sql, "6");
|
||||
|
||||
|
||||
return $final_sql;
|
||||
|
||||
} // get_sql
|
||||
|
@ -1074,10 +1074,10 @@ class Query
|
|||
$filter_sql = " `song`.`catalog` = '$value' AND ";
|
||||
}
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
|
@ -1114,7 +1114,7 @@ class Query
|
|||
$this->set_join('left','`song`','`album`.`id`','`song`.`album`', 100);
|
||||
$this->set_join('left','`catalog`','`song`.`catalog`','`catalog`.`id`', 100);
|
||||
$filter_sql = " (`song`.`catalog` = '$value') AND ";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'update_lt':
|
||||
$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);
|
||||
$filter_sql = " `song`.`update_time` >= '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100);
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`song`', '`song`.`album`', '`album`.`id`', 100);
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
|
@ -1172,11 +1172,11 @@ class Query
|
|||
$this->set_join('left', '`song`', '`song`.`artist`', '`artist`.`id`', 100);
|
||||
$filter_sql = " `song`.`update_time` >= '" . Dba::escape($value) . "' AND ";
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`song`', '`song`.`artist`', '`artist`.`id`', 100);
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`song`', '`song`.`artist`', '`artist`.`id`', 100);
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`song`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
|
@ -1190,10 +1190,10 @@ class Query
|
|||
case 'starts_with':
|
||||
$filter_sql = " `live_stream`.`name` LIKE '" . Dba::escape($value) . "%' AND ";
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`live_stream`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
case 'catalog_enabled':
|
||||
$this->set_join('left', '`catalog`', '`catalog`.`id`', '`live_stream`.`catalog`', 100);
|
||||
$filter_sql = " `catalog`.`enabled` = '1' AND ";
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
|
|
|
@ -51,11 +51,11 @@ class Random implements media
|
|||
public static function artist()
|
||||
{
|
||||
$sql = "SELECT `artist`.`id` FROM `artist` " .
|
||||
"LEFT JOIN `song` ON `song`.`artist` = `artist`.`id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"GROUP BY `artist`.`id` " .
|
||||
"ORDER BY RAND() LIMIT 1";
|
||||
"LEFT JOIN `song` ON `song`.`artist` = `artist`.`id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"GROUP BY `artist`.`id` " .
|
||||
"ORDER BY RAND() LIMIT 1";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
$results = Dba::fetch_assoc($db_results);
|
||||
|
@ -133,9 +133,9 @@ class Random implements media
|
|||
$results = array();
|
||||
|
||||
$sql = "SELECT `song`.`id` FROM `song` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"ORDER BY RAND() LIMIT $limit";
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"ORDER BY RAND() LIMIT $limit";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
|
@ -162,9 +162,9 @@ class Random implements media
|
|||
}
|
||||
|
||||
$sql = "SELECT `song`.`id` FROM `song` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"$where_sql ORDER BY RAND() LIMIT $limit";
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"$where_sql ORDER BY RAND() LIMIT $limit";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
|
@ -190,9 +190,9 @@ class Random implements media
|
|||
}
|
||||
|
||||
$sql = "SELECT `song`.`id` FROM `song` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"$where_sql ORDER BY RAND() LIMIT $limit";
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `catalog`.`enabled` = '1' " .
|
||||
"$where_sql ORDER BY RAND() LIMIT $limit";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
|
@ -234,10 +234,10 @@ class Random implements media
|
|||
"FROM `song` ";
|
||||
if ($search_info) {
|
||||
$sql .= $search_info['table_sql'];
|
||||
}
|
||||
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
$sql .= " WHERE `catalog`.`enabled` = '1'";
|
||||
if ($search_info) {
|
||||
}
|
||||
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
$sql .= " WHERE `catalog`.`enabled` = '1'";
|
||||
if ($search_info) {
|
||||
$sql .= ' AND ' . $search_info['where_sql'];
|
||||
}
|
||||
break;
|
||||
|
@ -248,10 +248,10 @@ class Random implements media
|
|||
}
|
||||
if ($search_info) {
|
||||
$sql .= $search_info['table_sql'];
|
||||
}
|
||||
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
$sql .= " WHERE `catalog`.`enabled` = '1'";
|
||||
if ($search_info) {
|
||||
}
|
||||
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
$sql .= " WHERE `catalog`.`enabled` = '1'";
|
||||
if ($search_info) {
|
||||
$sql .= ' AND ' . $search_info['where_sql'];
|
||||
}
|
||||
$sql .= ' GROUP BY `album`.`id`';
|
||||
|
@ -263,10 +263,10 @@ class Random implements media
|
|||
}
|
||||
if ($search_info) {
|
||||
$sql .= $search_info['table_sql'];
|
||||
}
|
||||
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
$sql .= " WHERE `catalog`.`enabled` = '1'";
|
||||
if ($search_info) {
|
||||
}
|
||||
$sql .= " LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
$sql .= " WHERE `catalog`.`enabled` = '1'";
|
||||
if ($search_info) {
|
||||
$sql .= ' AND ' . $search_info['where_sql'];
|
||||
}
|
||||
$sql .= ' GROUP BY `artist`.`id`';
|
||||
|
|
|
@ -176,7 +176,7 @@ class Rating extends database_object
|
|||
" GROUP BY object_id ORDER BY `rating` ";
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get_highest
|
||||
* Get objects with the highest average rating.
|
||||
|
|
|
@ -272,7 +272,7 @@ class Search extends playlist_object
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (Config::get('show_played_times')) {
|
||||
$this->types[] = array(
|
||||
'name' => 'played_times',
|
||||
|
|
|
@ -176,9 +176,9 @@ class Song extends database_object implements media
|
|||
'FROM `song` LEFT JOIN `tag_map` ' .
|
||||
'ON `tag_map`.`object_id`=`song`.`id` ' .
|
||||
"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 " .
|
||||
"AND `catalog`.`enabled` = '1' ";
|
||||
"AND `catalog`.`enabled` = '1' ";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
|
|
|
@ -116,11 +116,11 @@ class Stats
|
|||
$user_id = $user_id ? $user_id : $GLOBALS['user']->id;
|
||||
|
||||
$sql = "SELECT * FROM `object_count` " .
|
||||
"LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"ORDER BY `object_count`.`date` DESC LIMIT 1";
|
||||
"LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"ORDER BY `object_count`.`date` DESC LIMIT 1";
|
||||
$db_results = Dba::read($sql, array($user_id));
|
||||
|
||||
$results = Dba::fetch_assoc($db_results);
|
||||
|
@ -139,10 +139,10 @@ class Stats
|
|||
$user_id = $user_id ? $user_id : $GLOBALS['user']->id;
|
||||
|
||||
$sql = "SELECT * FROM `object_count` " .
|
||||
"LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' AND `object_count`.`date` >= ? " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"LEFT JOIN `song` ON `song`.`id` = `object_count`.`object_id` " .
|
||||
"LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `object_count`.`user` = ? AND `object_count`.`object_type`='song' AND `object_count`.`date` >= ? " .
|
||||
"AND `catalog`.`enabled` = '1' " .
|
||||
"ORDER BY `object_count`.`date` DESC";
|
||||
$db_results = Dba::read($sql, array($user_id, $time));
|
||||
|
||||
|
@ -155,12 +155,13 @@ class Stats
|
|||
return $results;
|
||||
|
||||
} // get_object_history
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
/* If they don't pass one, then use the preference */
|
||||
if (!$threshold) {
|
||||
|
@ -299,12 +300,13 @@ class Stats
|
|||
} // end switch
|
||||
|
||||
} // validate_type
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
$sql = "SELECT DISTINCT(`$type`) as `id`, MIN(`addition_time`) AS `real_atime` FROM `song` GROUP BY `$type` ORDER BY `real_atime` ";
|
||||
|
|
|
@ -490,7 +490,7 @@ class Tag extends database_object
|
|||
return $results;
|
||||
|
||||
} // get_display
|
||||
|
||||
|
||||
/**
|
||||
* update_tag_list
|
||||
* 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)
|
||||
{
|
||||
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);
|
||||
$editedTags = explode(",", $tags_comma);
|
||||
|
||||
|
||||
foreach ($ctags as $ctid => $ctv) {
|
||||
$ctag = new Tag($ctid);
|
||||
foreach ($editedTags as $tk => $tv) {
|
||||
|
@ -517,14 +517,14 @@ class Tag extends database_object
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Look if we need to add some new tags
|
||||
foreach ($editedTags as $tk => $tv) {
|
||||
debug_event('tag.class', 'Adding new tag {'.$tv.'}', '5');
|
||||
Tag::add($type, $object_id, $tv, false);
|
||||
}
|
||||
} // update_tag_list
|
||||
|
||||
|
||||
/**
|
||||
* count
|
||||
* This returns the count for the all objects associated with this tag
|
||||
|
|
|
@ -159,13 +159,14 @@ class Userflag extends database_object
|
|||
* get_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)) {
|
||||
$user_id = $GLOBALS['user']->id;
|
||||
}
|
||||
$user_id = intval($user_id);
|
||||
$type = Stats::validate_type($type);
|
||||
|
||||
|
||||
$sql = "SELECT `object_id` as `id` FROM user_flag" .
|
||||
" WHERE object_type = '" . $type . "' AND `user` = '" . $user_id . "'" .
|
||||
" ORDER BY `date` DESC ";
|
||||
|
|
|
@ -83,7 +83,7 @@ switch ($page) {
|
|||
case 'index':
|
||||
require_once Config::get('prefix') . '/server/index.ajax.php';
|
||||
exit;
|
||||
case 'catalog':
|
||||
case 'catalog':
|
||||
require_once Config::get('prefix') . '/server/catalog.ajax.php';
|
||||
exit;
|
||||
break;
|
||||
|
@ -165,7 +165,7 @@ switch ($_REQUEST['action']) {
|
|||
$_POST[$key] = unhtmlentities(scrub_in($data));
|
||||
debug_event('ajax_server', $key.'='.$_POST[$key], '5');
|
||||
}
|
||||
|
||||
|
||||
$level = '50';
|
||||
|
||||
if ($_POST['type'] == 'playlist_row' || $_POST['type'] == 'playlist_title') {
|
||||
|
|
|
@ -68,7 +68,7 @@ function forceIframe()
|
|||
$(document).ready(function(){
|
||||
$("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false});
|
||||
});
|
||||
|
||||
|
||||
// Using the following work-around to set ajex.server.php path available from any javascript script.
|
||||
var jsAjaxUrl = "<?php echo Config::get('ajax_url') ?>";
|
||||
</script>
|
||||
|
|
|
@ -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&catalogs[]=<?php echo $catalog->id; ?>"><?php echo T_('Update'); ?></a>
|
||||
| <a href="<?php echo $web_path; ?>/admin/catalog.php?action=gather_album_art&catalogs[]=<?php echo $catalog->id; ?>"><?php echo T_('Gather Art'); ?></a>
|
||||
| <a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_delete_catalog&catalog_id=<?php echo $catalog->id; ?>"><?php echo T_('Delete'); ?></a>
|
||||
| <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); ?>
|
||||
</span>
|
||||
| <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); ?>
|
||||
</span>
|
||||
</td>
|
||||
|
|
|
@ -57,4 +57,4 @@
|
|||
<input type="hidden" name="id" value="<?php echo $album->id; ?>" />
|
||||
<input type="hidden" name="type" value="album_row" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -37,4 +37,4 @@
|
|||
<input type="hidden" name="id" value="<?php echo $artist->id; ?>" />
|
||||
<input type="hidden" name="type" value="artist_row" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue