diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-20 05:32:08 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-20 05:32:08 +0000 |
commit | c1829308f4207eda5fbfff668ad0fcd6e1f16143 (patch) | |
tree | 265c61d8ef168a20fb938d7c17f934d2c4fd1819 /lib | |
parent | b28c8ea49f75add9b2b97f9077ea8a6695f95a9a (diff) | |
download | ampache-c1829308f4207eda5fbfff668ad0fcd6e1f16143.tar.gz ampache-c1829308f4207eda5fbfff668ad0fcd6e1f16143.tar.bz2 ampache-c1829308f4207eda5fbfff668ad0fcd6e1f16143.zip |
more changes for the amarok hotness
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/access.class.php | 13 | ||||
-rw-r--r-- | lib/class/api.class.php | 1 | ||||
-rw-r--r-- | lib/class/artist.class.php | 1 | ||||
-rw-r--r-- | lib/class/update.class.php | 8 | ||||
-rw-r--r-- | lib/class/xmldata.class.php | 63 |
5 files changed, 80 insertions, 6 deletions
diff --git a/lib/class/access.class.php b/lib/class/access.class.php index 379ee626..f0b4fbbe 100644 --- a/lib/class/access.class.php +++ b/lib/class/access.class.php @@ -325,6 +325,19 @@ class Access { // Switch on the type they pass switch ($type) { case 'api': + $key = Dba::escape($key); + $time = time(); + $sql = "SELECT * FROM `session_api` WHERE `id`='$key' AND `expire` > '$time'"; + $db_results = Dba::query($sql); + + if (Dba::num_rows($db_results)) { + $time = $time + 3600; + $sql = "UPDATE `session_api` WHERE `id`='$key' SET `expire`='$time'"; + $db_results($db_results); + return true; + } + + return false; break; case 'stream': diff --git a/lib/class/api.class.php b/lib/class/api.class.php index fb0fd2f9..861b9b8d 100644 --- a/lib/class/api.class.php +++ b/lib/class/api.class.php @@ -36,7 +36,6 @@ class Api { } // constructor - /** * handshake * This is the function that handles the verifying a new handshake diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index b857c7b7..7116d979 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -207,6 +207,7 @@ class Artist { /* Combine prefix and name, trim then add ... if needed */ $name = truncate_with_ellipsis(trim($this->prefix . " " . $this->name)); $this->f_name = $name; + $this->f_full_name = trim($this->prefix . " " . $this->name); // If this is a fake object, we're done here if ($this->_fake) { return true; } diff --git a/lib/class/update.class.php b/lib/class/update.class.php index c51886c8..eda00d70 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -238,10 +238,9 @@ class Update { '- Change wording on Localplay preferences.<br />'; $version[] = array('version' => '340010','description'=>$update_string); - $update_string = '- Adjusted Tables to new democratic play methods.<br />' . - '- Added api session table, will eventually recombine.<br />'; + $update_string = '- Added api session table, will eventually recombine with others.<br />'; - //$version[] = array('version' => '340011','description'=>$update_string); + $version[] = array('version' => '340011','description'=>$update_string); return $version; @@ -1005,7 +1004,8 @@ class Update { ") ENGINE = MYISAM"; $db_results = Dba::query($sql); - + + self::set_version('db_version','340011'); } // 340011 diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index 2fea98db..de71fbc8 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -46,11 +46,72 @@ class xmlData { */ public static function error($string) { - $string = "<root>\n\t<error><![CDATA[$string]]></error>\n</root>"; + $string = self::_header() . "\t<error><![CDATA[$string]]></error>" . self::_footer(); return $string; } // error + /** + * artists + * This takes an array of artists and then returns a pretty xml document with the information + * we want + */ + public static function artists($artists) { + + foreach ($artists as $artist_id) { + $artist = new Artist($artist_id); + $artist->format(); + + $string .= "<artist id="$artist->id">\n" . + "\t<name>$artist->f_full_name</name>\n"; + "</artist>\n"; + } // end foreach artists + + $final = self::_header() . $string . self::_footer(); + return $final; + + } // artists + + /** + * _header + * this returns a standard header, there are a few types + * so we allow them to pass a type if they want to + */ + private static function _header($type='') { + + switch ($type) { + case 'xspf': + + break; + case 'itunes': + + break; + default: + $header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<root>\n"; + break; + } // end switch + + return $header; + + } // _header + + /** + * _footer + * this returns the footer for this document, these are pretty boring + */ + private static function _footer($type='') { + + switch ($type) { + default: + $footer = "\n</root>\n"; + break; + } // end switch on type + + + return $footer; + + } // _footer + } // xmlData ?> |