summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--image.php4
-rw-r--r--lib/class/democratic.class.php9
-rw-r--r--lib/class/song.class.php2
-rw-r--r--lib/class/stream.class.php14
-rw-r--r--lib/class/update.class.php61
-rw-r--r--lib/class/xmldata.class.php4
-rw-r--r--lib/ui.lib.php29
-rw-r--r--server/democratic.ajax.php2
8 files changed, 81 insertions, 44 deletions
diff --git a/image.php b/image.php
index ad604b5f..3a5c4465 100644
--- a/image.php
+++ b/image.php
@@ -46,7 +46,7 @@ switch ($_REQUEST['thumb']) {
case '2':
$size['height'] = '128';
$size['width'] = '128';
- // $return_raw = true;
+ $return_raw = true;
break;
case '3':
/* This is used by the flash player */
@@ -57,7 +57,7 @@ switch ($_REQUEST['thumb']) {
default:
$size['height'] = '275';
$size['width'] = '275';
- // $return_raw = true;
+ $return_raw = true;
break;
} // define size based on thumbnail
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php
index 9e72251a..3088effa 100644
--- a/lib/class/democratic.class.php
+++ b/lib/class/democratic.class.php
@@ -336,9 +336,9 @@ class Democratic extends tmpPlaylist {
public function vote($items) {
/* Itterate through the objects if no vote, add to playlist and vote */
- foreach ($items as $type=>$object_id) {
- //FIXME: This is a hack until we fix everything else
- if (intval($type) == $type) { $type = 'song'; }
+ foreach ($items as $element) {
+ $type = array_shift($element);
+ $object_id = array_shift($element);
if (!$this->has_vote($object_id,$type)) {
$this->add_vote($object_id,$type);
}
@@ -541,8 +541,7 @@ class Democratic extends tmpPlaylist {
self::prune_tracks();
// Clean the votes
- self::clean_votes();
-
+ self::clear_votes();
return true;
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 3e1a124c..519abda1 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -867,7 +867,7 @@ class Song extends database_object implements media {
$song_name = rawurlencode($song->f_artist_full . " - " . $song->title . "." . $type);
- $url = Stream::get_base_url() . "/play/index.php?oid=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name";
+ $url = Stream::get_base_url() . "oid=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name";
return $url;
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index ec8308e5..9bfb4d78 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -236,7 +236,7 @@ class Stream {
public function create_simple_m3u() {
header("Cache-control: public");
- header("Content-Disposition: filename=playlist.m3u");
+ header("Content-Disposition: filename=ampache_playlist.m3u");
header("Content-Type: audio/x-mpegurl;");
// Flip for the poping!
@@ -434,7 +434,7 @@ class Stream {
} // type
$xml = array();
- $xml['track']['location'] = call_user_func($type,'play_url',$media->id) . $flash_hack;
+ $xml['track']['location'] = call_user_func(array($type,'play_url'),$media->id) . $flash_hack;
$xml['track']['identifier'] = $xml['track']['location'];
$xml['track']['duration'] = $length * 1000;
@@ -445,7 +445,7 @@ class Stream {
xmlData::set_type('xspf');
header("Cache-control: public");
- header("Content-Disposition: filename=ampache-playlist.xspf");
+ header("Content-Disposition: filename=ampache_playlist.xspf");
header("Content-Type: application/xspf+xml; charset=utf-8");
echo xmlData::header();
echo $result;
@@ -569,11 +569,11 @@ class Stream {
public function create_ram() {
header("Cache-control: public");
- header("Content-Disposition: filename=playlist.ram");
+ header("Content-Disposition: filename=ampache_playlist.ram");
header("Content-Type: audio/x-pn-realaudio ram;");
- foreach ($this->media as $song_id) {
- $song = new Song($song_id);
- echo $song->get_url();
+ foreach ($this->media as $element) {
+ $type = array_shift($element);
+ echo $url = call_user_func(array($type,'play_url'),array_shift($element)) . "\n";
} // foreach songs
} // create_ram
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 156a972c..7778c673 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -1606,10 +1606,71 @@ class Update {
$sql = "INSERT INTO `user_preference` VALUES (1,69,'0')";
$db_results = Dba::write($sql);
+ $sql = "SELECT `id` FROM `user`";
+ $db_results = Dba::query($sql);
+
+ User::fix_preferences('-1');
+
+ while ($r = Dba::fetch_assoc($db_results)) {
+ User::fix_preferences($r['id']);
+ } // while we're fixing the useres stuff
+
self::set_version('db_version','350006');
return true;
+
} // update_350006
+ /**
+ * update_350007
+ * This update adds in the random rules tables, and also increases the size of the blobs
+ * on the album and artist data. Also add track to tmp_playlist_data
+ */
+ public static function update_350007() {
+
+ // We need to clear the thumbs as they will need to be re-generated
+ $sql = "UPDATE `album_data` SET `thumb`=NULL";
+ $db_results = Dba::write($sql);
+
+ $sql = "UPDATE `artist_data` SET `thumb`=NULL";
+ $db_results = Dba::write($sql);
+
+ // Change the db thumb sizes
+ $sql = "ALTER TABLE `album_data` CHANGE `thumb` `thumb` MEDIUMBLOB NULL";
+ $db_results = Dba::write($sql);
+
+ $sql = "ALTER TABLE `artist_data` CHANGE `thumb` `thumb` MEDIUMBLOB NULL";
+ $db_results = Dba::write($sql);
+
+ // Remove dead column
+ $sql = "ALTER TABLE `playlist_data` DROP `dynamic_song`";
+ $db_results = Dba::write($sql);
+
+ $sql = "ALTER TABLE `playlist` DROP `genre`";
+ $db_results = Dba::write($sql);
+
+ // Add track item to tmp_playlist_data so we can order this stuff manually
+ $sql = "ALTER TABLE `tmp_playlist_data` ADD `track` INT ( 11 ) UNSIGNED NULL";
+ $db_results = Dba::write($sql);
+
+ $sql = "DROP TABLE `genre`";
+ $db_results = Dba::write($sql);
+
+ // Clean up the catalog and add last_clean to it
+ $sql = "ALTER TABLE `catalog` ADD `last_clean` INT ( 11 ) UNSIGNED NULL AFTER `last_update`";
+ $db_results = Dba::write($sql);
+
+ $sql = "ALTER TABLE `catalog` DROP `add_path`";
+ $db_results = Dba::write($sql);
+
+
+
+ self::set_version('db_version','350007');
+
+ return true;
+
+ } // update_350007
+
+
} // end update class
?>
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php
index 894ab541..2fb18f19 100644
--- a/lib/class/xmldata.class.php
+++ b/lib/class/xmldata.class.php
@@ -345,7 +345,7 @@ class xmlData {
switch (self::$type) {
case 'xspf':
$header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" .
- "<!-- XML Generated by Ampache v." . Config::get('version') . " -->";
+ "<!-- XML Generated by Ampache v." . Config::get('version') . " -->\n";
"<playlist version = \"1\" xmlns=\"http://xspf.org/ns/0/\">\n ".
"<title>Ampache XSPF Playlist</title>\n" .
"<creator>" . Config::get('site_title') . "</creator>\n" .
@@ -355,7 +355,7 @@ class xmlData {
break;
case 'itunes':
$header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
- "<!-- XML Generated by Ampache v." . Config::get('version') . " -->";
+ "<!-- XML Generated by Ampache v." . Config::get('version') . " -->\n";
"<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n" .
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" .
"<plist version=\"1.0\">\n" .
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 3af00f8d..6ee09789 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -132,30 +132,6 @@ function return_referer() {
} // return_referer
/**
- * show_alphabet_list
- * shows the A-Z,0-9 lists for albums and artist page
- * It takes a selected and an action
- */
-function show_alphabet_list () {
-
- $list = array(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,"0",_('All'));
-
- $selected = $_SESSION['browse']['filter']['alpha_match'];
-
- echo "<div class=\"alphabet\">";
- foreach ($list as $l) {
- $style_name = "style_" . strtolower($l);
- $class = "link";
- if ($l==$selected) $class .=" active";
- $value = ($l==_('All'))?'':$l;
- echo "<span class=\"" . $class . "\" onclick=\"ajaxPut('". Config::get('ajax_url') ."?page=browse&action=browse&amp;key=alpha_match&amp;value=$value');return true;\">" .
- $l . "</span>\n";
- }
- echo "</div>";
-
-} // show_alphabet_list
-
-/**
* truncate_with_ellipsis
* Correct Spelling function that truncates text to a specific lenght
* and appends three dots, or an ellipsis to the end
@@ -259,8 +235,9 @@ function img_resize($image,$size,$type,$album_id) {
$width = imagesx($src);
$height = imagesy($src);
- $new_w = $size['width'];
- $new_h = $size['height'];
+ // Make it the largest always
+ $new_w = '275';
+ $new_h = '275';
$img = imagecreatetruecolor($new_w,$new_h);
diff --git a/server/democratic.ajax.php b/server/democratic.ajax.php
index 3778ae0b..aa21995d 100644
--- a/server/democratic.ajax.php
+++ b/server/democratic.ajax.php
@@ -88,7 +88,7 @@ switch ($_REQUEST['action']) {
$democratic->clear();
ob_start();
- $object_ids = $democratic->get_items();
+ $object_ids = array();
Browse::set_type('democratic');
Browse::reset();
Browse::set_static_content(1);