summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-02 04:57:56 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-02 04:57:56 +0000
commit9457b75fb16f05347c08b484db6fe2b848efba15 (patch)
tree18245ab1b8a2fc7953c9fc04e541d46791737ec8 /lib/class
parentd54efca7bd1ee28683506b452f58742f8a8f678f (diff)
downloadampache-9457b75fb16f05347c08b484db6fe2b848efba15.tar.gz
ampache-9457b75fb16f05347c08b484db6fe2b848efba15.tar.bz2
ampache-9457b75fb16f05347c08b484db6fe2b848efba15.zip
fixed some catalog update issues, fixed some genre pages and made the sql sort stuff for show songs work
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/artist.class.php12
-rw-r--r--lib/class/browse.class.php29
-rw-r--r--lib/class/catalog.class.php35
-rw-r--r--lib/class/genre.class.php12
-rw-r--r--lib/class/user.class.php2
5 files changed, 50 insertions, 40 deletions
diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php
index 7de2f62d..eb18b539 100644
--- a/lib/class/artist.class.php
+++ b/lib/class/artist.class.php
@@ -189,8 +189,6 @@ class Artist {
//FIXME: This shouldn't be scrubing right here!!!!
$this->full_name = scrub_out(trim($this->prefix . " " . $this->name));
- //FIXME: This should be f_link
-
$this->f_name_link = "<a href=\"" . Config::get('web_path') . "/artists.php?action=show&amp;artist=" . $this->id . "\" title=\"" . $this->full_name . "\">" . $name . "</a>";
// Get the counts
@@ -200,16 +198,6 @@ class Artist {
} // format
- /**
- * format_artist
- * DEFUNCT, do not use anymore
- */
- function format_artist() {
-
- $this->format();
-
- } // format_artist
-
/*!
@function rename
@discussion changes the name of the artist in the db,
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index c5258c0c..b4c2361a 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -107,7 +107,12 @@ class Browse {
if ($_SESSION['browse']['type'] == 'song') {
switch ($sort) {
case'title':
- $_SESSION['browse']['sort']['title'] = 'ASC';
+ if ($_SESSION['browse']['sort'][$sort] == 'DESC') {
+ $_SESSION['browse']['sort'][$sort] = 'ASC';
+ }
+ else {
+ $_SESSION['browse']['sort'][$sort] = 'DESC';
+ }
break;
}
}
@@ -189,16 +194,18 @@ class Browse {
// Now Add the Order
$order_sql = "ORDER BY ";
+ // If we don't have a sort, then go ahead and return it now
+ if (!is_array($_SESSION['browse']['sort'])) { return $sql; }
+
foreach ($_SESSION['browse']['sort'] as $key=>$value) {
- $order_sql .= self::sql_sort($value);
+ $order_sql .= self::sql_sort($key,$value);
}
-
// Clean her up
$order_sql = rtrim($order_sql,"ORDER BY ");
$order_sql = rtrim($order_sql,",");
- self::$sql = $sql . $order_sql;
-
+ $sql = $sql . $order_sql;
+
return $sql;
} // get_sql
@@ -279,7 +286,7 @@ class Browse {
if ($order != 'DESC') { $order == 'ASC'; }
-
+
if ($_SESSION['browse']['type'] == 'song') {
switch($field) {
case 'title';
@@ -294,7 +301,7 @@ class Browse {
} // end switch
} // end if song
- return $sql . "$order,";
+ return "$sql $order,";
} // sql_sort
@@ -308,17 +315,17 @@ class Browse {
switch ($_SESSION['browse']['type']) {
case 'song':
- show_box_top();
+ show_box_top(_('Songs'));
require_once Config::get('prefix') . '/templates/show_songs.inc.php';
show_box_bottom();
break;
case 'album':
- show_box_top();
+ show_box_top(_('Albums'));
require_once Config::get('prefix') . '/templates/show_albums.inc.php';
show_box_bottom();
break;
case 'genre':
- show_box_top();
+ show_box_top(_('Genres'));
require_once Config::get('prefix') . '/templates/show_genres.inc.php';
show_box_bottom();
break;
@@ -328,7 +335,7 @@ class Browse {
show_box_bottom();
break;
case 'artist':
- show_box_top();
+ show_box_top(_('Artists'));
require_once Config::get('prefix') . '/templates/show_artists.inc.php';
show_box_bottom();
break;
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index 1ceaf9ce..0befc219 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -131,6 +131,23 @@ class Catalog {
} // get_stats
/**
+ * clear_stats
+ * This clears all stats for _everything_
+ */
+ public static function clear_stats() {
+
+ /* Whip out everything */
+ $sql = "TRUNCATE `object_count`";
+ $db_results = Dba::query($sql);
+
+ $sql = "UDPATE `song` SET `player`='0'";
+ $db_results = Dba::query($sql);
+
+ return true;
+
+ } // clear_stats
+
+ /**
* create
* This creates a new catalog entry and then returns the insert id
* it checks to make sure this path is not already used before creating
@@ -741,17 +758,17 @@ class Catalog {
* update_settings
* This function updates the basic setting of the catalog
*/
- function update_settings($data) {
+ public static function update_settings($data) {
- $id = sql_escape($data['catalog_id']);
- $name = sql_escape($data['name']);
- $key = sql_escape($data['key']);
- $rename = sql_escape($data['rename_pattern']);
- $sort = sql_escape($data['sort_pattern']);
+ $id = Dba::escape($data['catalog_id']);
+ $name = Dba::escape($data['name']);
+ $key = Dba::escape($data['key']);
+ $rename = Dba::escape($data['rename_pattern']);
+ $sort = Dba::escape($data['sort_pattern']);
- $sql = "UPDATE catalog SET name='$name', `key`='$key', rename_pattern='$rename', " .
- "sort_pattern='$sort' WHERE id = '$id'";
- $db_results = mysql_query($sql, dbh());
+ $sql = "UPDATE `catalog` SET `name`='$name', `key`='$key', `rename_pattern`='$rename', " .
+ "`sort_pattern`='$sort' WHERE `id` = '$id'";
+ $db_results = Dba::query($sql);
return true;
diff --git a/lib/class/genre.class.php b/lib/class/genre.class.php
index 90db7d53..c0780591 100644
--- a/lib/class/genre.class.php
+++ b/lib/class/genre.class.php
@@ -181,18 +181,16 @@ class Genre {
/**
* get_artists
* This gets all of the artists who have at least one song in this genre
- * @package Genre
- * @catagory Class
*/
- function get_artists() {
+ public function get_artists() {
- $sql = "SELECT DISTINCT(song.artist) FROM song WHERE genre='" . $this->id . "'";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT DISTINCT(`song`.`artist`) FROM `song` WHERE `genre`='" . $this->id . "'";
+ $db_results = Dba::query($sql);
$results = array();
- while ($r = mysql_fetch_assoc($db_results)) {
- $results[] = get_artist_info($r['artist']);
+ while ($r = Dba::fetch_assoc($db_results)) {
+ $results[] = $r['artist'];
}
return $results;
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index ce014179..44f37bed 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -689,7 +689,7 @@ class User {
}
$item = "[$data->count] - $data->f_name";
- $results[]->f_link = $item;
+ $results[]->f_name_link = $item;
} // end foreach items
return $results;