params['0']->me['int']; $step = $params->params['1']->me['int']; // Get me a list of all local catalogs $sql = "SELECT catalog.id FROM catalog WHERE catalog_type='local'"; $db_results = mysql_query($sql, dbh()); $results = array(); $sql = "SELECT song.id FROM song WHERE song.enabled='1' AND ("; // Get the catalogs and build the query! while ($r = mysql_fetch_object($db_results)) { $sql .= " song.catalog='$r->id' OR"; } // build query $sql = rtrim($sql,"OR"); $sql .= ") LIMIT $start,$step"; $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 = php_xmlrpc_encode($results); if (conf('debug')) { log_event($_SESSION['userdata']['username'],' xmlrpc-server ',"Encoded Song Query Results ($start,$step) : " . count($results)); } return new xmlrpcresp($encoded_array); } // remote_song_query /** * remote_session_verify * This checks the session on THIS server and returns a true false * @package XMLRPC * @catagory Server * @todo Public/Private Key handshake? */ function remote_session_verify($params) { /* We may need to do this correctly.. :S */ $sid = $params->params['0']->me['string']; if (session_exists($sid)) { $data = true; } else { $data = false; } $encoded_data = php_xmlrpc_encode($data); if (conf('debug')) { log_event($_SESSION['userdata']['username'],' xmlrpc-server ',"Encoded Session Verify: $data Recieved: $sid"); } return new xmlrpcresp($encoded_data); } // remote_session_verify /** * remote_server_denied * Access Denied Sucka! * @package XMLRPC * @catagory Server */ 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 = php_xmlrpc_encode($result); if (conf('debug')) { log_event($_SESSION['userdata']['username'], 'xmlrpc-server',"Access Denied: " . $_SERVER['REMOTE_ADDR']); } return new xmlrpcresp($encoded_array); } // remote_server_denied ?>