summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-11 05:16:20 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-11 05:16:20 +0000
commit689517e332c874ac09bb41398602622a1fc36af8 (patch)
treec97a077bd164e594211ed213405eb0cfbbf77b1c /lib/class
parent7327a025db941554501bbbe79c057fa308fb205c (diff)
downloadampache-689517e332c874ac09bb41398602622a1fc36af8.tar.gz
ampache-689517e332c874ac09bb41398602622a1fc36af8.tar.bz2
ampache-689517e332c874ac09bb41398602622a1fc36af8.zip
fixed preferences mostly, also fixed some genre issues and other stuff I am forgetting now
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/album.class.php2
-rw-r--r--lib/class/genre.class.php34
-rw-r--r--lib/class/localplay.class.php18
-rw-r--r--lib/class/user.class.php2
4 files changed, 24 insertions, 32 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index 513256d6..af9cadb8 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -108,7 +108,7 @@ class Album {
private function _get_extra_info() {
$sql = "SELECT COUNT(DISTINCT(song.artist)) as artist_count,COUNT(song.id) AS song_count,artist.name AS artist_name" .
- ",artist.prefix AS artist_prefix,album_data.art AS has_art,album_data.thumb AS has_thumb ".
+ ",artist.prefix AS artist_prefix,album_data.art AS has_art,album_data.thumb AS has_thumb, artist.id AS artist_id ".
"FROM `song` " .
"INNER JOIN `artist` ON `artist`.`id`=`song`.`artist` " .
"LEFT JOIN `album_data` ON `album_data`.`album_id` = `song`.`album` " .
diff --git a/lib/class/genre.class.php b/lib/class/genre.class.php
index 7e311fda..90db7d53 100644
--- a/lib/class/genre.class.php
+++ b/lib/class/genre.class.php
@@ -91,34 +91,30 @@ class Genre {
/**
* get_album_count
* Returns the number of albums that contain a song of this genre
- * @package Genre
- * @catagory Class
*/
- function get_album_count() {
+ public function get_album_count() {
- $sql = "SELECT COUNT(DISTINCT(song.album)) FROM song WHERE genre='" . $this->id . "'";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT COUNT(DISTINCT(song.album)) FROM `song` WHERE `genre`='" . $this->id . "'";
+ $db_results = Dba::query($sql);
- $total_items = mysql_fetch_array($db_results);
+ $total_items = Dba::fetch_row($db_results);
- return $total_items[0];
+ return $total_items['0'];
} // get_album_count
/**
* get_artist_count
* Returns the number of artists who have at least one song in this genre
- * @package Genre
- * @catagory Class
*/
- function get_artist_count() {
+ public function get_artist_count() {
- $sql = "SELECT COUNT(DISTINCT(song.artist)) FROM song WHERE genre='" . $this->id . "'";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT COUNT(DISTINCT(`song`.`artist`)) FROM `song` WHERE `genre`='" . $this->id . "'";
+ $db_results = Dba::query($sql);
- $total_items = mysql_fetch_array($db_results);
+ $total_items = Dba::fetch_row($db_results);
- return $total_items[0];
+ return $total_items['0'];
} // get_artist_count
@@ -169,15 +165,13 @@ class Genre {
*/
function get_albums() {
- $sql = "SELECT DISTINCT(song.album) FROM song WHERE genre='" . $this->id . "'";
- $db_results = mysql_query($sql,dbh());
+ $sql = "SELECT DISTINCT(`song`.`album`) FROM `song` WHERE `genre`='" . $this->id . "'";
+ $db_results = Dba::query($sql);
$results = array();
- while ($r = mysql_fetch_assoc($db_results)) {
- $album = new Album($r['album']);
- $album->format_album();
- $results[] = $album;
+ while ($r = Dba::fetch_row($db_results)) {
+ $results[] = $r['0'];
}
return $results;
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index 4c12aaef..78a3c70e 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -23,15 +23,15 @@
class Localplay {
/* Base Variables */
- var $type;
+ public $type;
/* Built Variables */
- var $_function_map = array();
- var $_template;
- var $_preferences = array();
- var $_player;
+ public $_function_map = array();
+ public $_template;
+ public $_preferences = array();
+ public $_player;
/**
@@ -42,7 +42,6 @@ class Localplay {
*/
function Localplay($type) {
-
$this->type = $type;
$this->_get_info();
@@ -57,11 +56,10 @@ class Localplay {
* any failures, fatal errors will actually return something to the
* gui
*/
- function _get_info() {
+ private function _get_info() {
$this->_load_player();
-
} // _get_info
@@ -71,11 +69,11 @@ class Localplay {
* Will interface with in order to make all this magical stuf work
* all LocalPlay modules should be located in /modules/<name>/<name>.class.php
*/
- function _load_player() {
+ private function _load_player() {
if (!$this->type) { return false; }
- $filename = conf('prefix') . '/modules/localplay/' . $this->type . '.controller.php';
+ $filename = Config::get('prefix') . '/modules/localplay/' . $this->type . '.controller.php';
$include = require_once ($filename);
if (!$include) {
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 876b4a36..5b4b77b6 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -154,7 +154,7 @@ class User {
ksort($type_array[$type]);
$results[$type] = array ('title'=>ucwords($type),'admin'=>$admin,'prefs'=>$type_array[$type]);
} // end while
-
+
return $results;
} // get_preferences