summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-21 21:09:50 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-21 21:09:50 +0000
commit7b49a436d0eb128b26cb2a427731074f0a9fce2b (patch)
tree9253d2ed30ec0ab1d8979464fe8fc845d0103b73
parent7935a4a78558ed918e009d9a3f84f242dfaa88ea (diff)
downloadampache-7b49a436d0eb128b26cb2a427731074f0a9fce2b.tar.gz
ampache-7b49a436d0eb128b26cb2a427731074f0a9fce2b.tar.bz2
ampache-7b49a436d0eb128b26cb2a427731074f0a9fce2b.zip
patched flaw in getid3() fixed a problem with vainfo and songs with no tags and fixed the xml_from_array() function
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--lib/class/song.class.php9
-rw-r--r--lib/ui.lib.php1
-rw-r--r--modules/id3/getid3/module.tag.id3v2.php4
-rwxr-xr-xmodules/id3/vainfo.class.php11
-rw-r--r--server/xml.server.php46
6 files changed, 53 insertions, 20 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index c716770b..53e96e17 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,8 @@
--------------------------------------------------------------------------
v.3.3.3-Alpha1
+ - Fixed a problem with vainfo ignoring file pattern if no other
+ tags were found
- Added new version of getid3() library which will hopefully
resolve some PHP5 related issues
- Fixed security issue that allowed users to gain gues access to
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index b437692a..f72506f8 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -708,13 +708,18 @@ class Song {
* a stream URL taking into account the downsampling mojo and everything
* else, this is used or will be used by _EVERYTHING_
*/
- function get_url() {
+ function get_url($session_id='') {
/* Define Variables we are going to need */
$username = $GLOBALS['user']->username;
$song_id = $this->id;
if (conf('require_session')) {
- $session_string = "&sid=" . session_id();
+ if ($session_id) {
+ $session_string = "&sid=" . $session_id;
+ }
+ else {
+ $session_string = "&sid=" . session_id();
+ }
} // if they are requiring a session
$type = $this->type;
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index e08cab14..f4f5e3bd 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -1343,6 +1343,7 @@ function get_user_icon($name) {
function xml_from_array($array,$callback=0) {
foreach ($array as $key=>$value) {
+ if (is_numeric($key)) { $key = 'item'; }
if (is_array($value)) {
$value = xml_from_array($value,1);
$string .= "\t<$key>$value</$key>\n";
diff --git a/modules/id3/getid3/module.tag.id3v2.php b/modules/id3/getid3/module.tag.id3v2.php
index 16f517e8..c6e6bcb5 100644
--- a/modules/id3/getid3/module.tag.id3v2.php
+++ b/modules/id3/getid3/module.tag.id3v2.php
@@ -2932,9 +2932,9 @@ class getid3_id3v2
TBP bpm
TBPM bpm
TCM composer
- TCO content_type
+ TCO genre
TCOM composer
- TCON content_type
+ TCON genre
TCOP copyright_message
TCR copyright_message
TDA date
diff --git a/modules/id3/vainfo.class.php b/modules/id3/vainfo.class.php
index 74d276d9..c6192ded 100755
--- a/modules/id3/vainfo.class.php
+++ b/modules/id3/vainfo.class.php
@@ -170,6 +170,9 @@ class vainfo {
$results = array();
+ /* Gather Tag information from the filenames */
+ $results['file'] = $this->_parse_filename($this->filename);
+
/* Return false if we don't have
* any tags to look at
*/
@@ -206,9 +209,6 @@ class vainfo {
} // end foreach
- /* Gather Tag information from the filenames */
- $results['file'] = $this->_parse_filename($this->filename);
-
return $results;
} // _get_tags
@@ -358,9 +358,8 @@ class vainfo {
case 'track_number':
$array['track'] = $this->_clean_tag($data['0'],$this->_file_encoding);
break;
- case 'content_type':
- $data['0'] = preg_replace("/^\(\d+\)/","",$data['0']);
- $array['genre'] = $this->_clean_tag($data['0'],$this->_file_encoding);
+ //case 'content_type':
+ // $array['genre'] = $this->_clean_tag($data['0'],$this->_file_encoding);
break;
case 'comments':
$array['comment'] = $this->_clean_tag($data['0'],$this->_file_encoding);
diff --git a/server/xml.server.php b/server/xml.server.php
index d7ca0249..7ce510fa 100644
--- a/server/xml.server.php
+++ b/server/xml.server.php
@@ -28,8 +28,11 @@
$no_session = true;
require_once('../lib/init.php');
-/* Verify the existance of the Session they passed in */
-if (!session_exists($_REQUEST['sessid'])) { exit(); }
+/**
+ * Verify the existance of the Session they passed in we do allow them to
+ * login via this interface so we do have an exception for action=login
+ */
+if (!session_exists($_REQUEST['sessid']) AND $_REQUEST['action'] !== 'login') { exit(); }
$GLOBALS['user'] = new User($_REQUEST['user_id']);
$action = scrub_in($_REQUEST['action']);
@@ -46,8 +49,7 @@ switch ($action) {
while ($r = mysql_fetch_assoc($db_results)) {
$artist = new Artist($r['id']);
$artist->format_artist();
- $artist_id = "id_" . $artist->id;
- $results[$artist_id] = $artist->full_name;
+ $results[] = array('id'=>$artist->id,'name'=>$artist->full_name);
} // end while results
$xml_doc = xml_from_array($results);
@@ -59,8 +61,7 @@ switch ($action) {
while ($r = mysql_fetch_assoc($db_results)) {
$album = new Album($r['id']);
- $album_id = "id_" . $album->id;
- $results[$album_id] = array('year'=>$album->year,'name'=>$album->name);
+ $results[] = array('id'=>$r['id'],'year'=>$album->year,'name'=>$album->name);
} // end while results
$xml_doc = xml_from_array($results);
@@ -72,8 +73,7 @@ switch ($action) {
while ($r = mysql_fetch_assoc($db_results)) {
$genre = new Genre($r['id']);
- $genre_id = "id_" . $genre->id;
- $results[$genre_id] = $genre->name;
+ $results[] = array('id'=>$r['id'],'name'=>$genre->name);
}
$xml_doc = xml_from_array($results);
@@ -90,11 +90,11 @@ switch ($action) {
* xml.. turn it into an array
*/
foreach ($data as $song) {
- $song_id = 'id_' . $song->id;
$genre = $song->get_genre_name();
$artist = $song->get_artist_name();
$album = $song->get_album_name();
- $results[$song_id] = array('title'=>$song->title,
+ $results[] = array('id'=>$song->id,
+ 'title'=>$song->title,
'genre'=>$genre,
'artist'=>$artist,
'album'=>$album);
@@ -104,6 +104,32 @@ switch ($action) {
echo $xml_doc;
break;
+ /* This takes a object_id/object_type and returns the correct PLAY url for it */
+ case 'play_url':
+ /* We need the type and id */
+ $object_type = scrub_in($_REQUEST['object_type']);
+ $object_id = scrub_in($_REQUEST['object_id']);
+
+ switch ($object_type) {
+ case 'song':
+ $song = new Song($object_id);
+ $url = $song->get_url($_REQUEST['sessid']);
+ $results[] = $url;
+ break;
+ default:
+ // Rien a faire
+ break;
+ } // end switch on object_type
+
+ $xml_doc = xml_from_array($results);
+ echo $xml_doc;
+
+ break;
+ /* This allows you to login via the xml mojo */
+ case 'login':
+
+
+ break;
default:
// Rien a faire
break;