From bcad40a05ab2dc2a341a3227e30b96668bce4500 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Thu, 9 Jun 2005 16:34:40 +0000 Subject: New Import --- lib/xmlrpc.php | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 lib/xmlrpc.php (limited to 'lib/xmlrpc.php') diff --git a/lib/xmlrpc.php b/lib/xmlrpc.php new file mode 100644 index 00000000..7b810dd6 --- /dev/null +++ b/lib/xmlrpc.php @@ -0,0 +1,143 @@ + smallint(1) T/F boolean mojo + $sql = "SELECT song.id FROM song WHERE song.status='enabled' AND"; + + // Get the catalogs and build the query! + while ($r = mysql_fetch_object($db_results)) { + if (preg_match("/catalog/",$sql)) { + $sql .= " OR song.catalog='$r->id'"; + } + else { + $sql .= " song.catalog='$r->id'"; + } + } // build query + + $db_results = mysql_query($sql, dbh()); + + // Recurse through the songs and build a results + // array that is base64_encoded + while ($r = mysql_fetch_object($db_results)) { + + $song = new Song($r->id); + $song->album = $song->get_album_name(); + $song->artist = $song->get_artist_name(); + $song->genre = $song->get_genre_name(); + + // Format the output + $output = ''; + $output = $song->artist . "::" . $song->album . "::" . $song->title . "::" . $song->comment . + "::" . $song->year . "::" . $song->bitrate . "::" . $song->rate . "::" . $song->mode . + "::" . $song->size . "::" . $song->time . "::" . $song->track . "::" . $song->genre . "::" . $r->id; + $output = base64_encode($output); + $results[] = $output; + + // Prevent Timeout + set_time_limit(0); + + } // while songs + + set_time_limit(0); + $encoded_array = old_xmlrpc_encode($results); + return new xmlrpcresp($encoded_array); + +} // remote_song_query + +/*! + @function remote_server_denied + @discussion Access Denied Sucka! +*/ +function remote_server_denied() { + + $result = array(); + + $result['access_denied'] = "Access Denied: Sorry, but " . $_SERVER['REMOTE_ADDR'] . " does not have access to " . + "this server's catalog. Please make sure that you have been added to this server's access list.\n"; + + $encoded_array = old_xmlrpc_encode($result); + return new xmlrpcresp($encoded_array); + +} // remote_server_deniee + + + + + + + + + + + + + + + + + +?> -- cgit