summaryrefslogtreecommitdiffstats
path: root/lib/class/xmlrpcserver.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/class/xmlrpcserver.class.php')
-rw-r--r--lib/class/xmlrpcserver.class.php50
1 files changed, 27 insertions, 23 deletions
diff --git a/lib/class/xmlrpcserver.class.php b/lib/class/xmlrpcserver.class.php
index 3801dc09..a5687c21 100644
--- a/lib/class/xmlrpcserver.class.php
+++ b/lib/class/xmlrpcserver.class.php
@@ -43,7 +43,7 @@ class xmlRpcServer {
// Check it and make sure we're super green
if (!vauth::session_exists('xml-rpc',$key)) {
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
- return new xmlrpcresp(0,'503','Key/IP Mis-match Access Denied');
+ return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
}
// Go ahead and gather up the information they are legit
@@ -62,11 +62,10 @@ class xmlRpcServer {
// to return to the client
set_time_limit(0);
- $encoded_array = php_xmlrpc_encode($results);
+ $encoded_array = XML_RPC_encode($results);
debug_event('XMLSERVER','Returning data about ' . count($results) . ' catalogs to ' . $_SERVER['REMOTE_ADDR'],'5');
- return new xmlrpcresp($encoded_array);
-
+ return new XML_RPC_Response($encoded_array);
} // get_catalogs
/**
@@ -80,6 +79,7 @@ class xmlRpcServer {
// We're going to be here a while
set_time_limit(0);
+
// Pull out the key
$variable = $xmlrpc_object->getParam(0);
$key = $variable->scalarval();
@@ -87,7 +87,7 @@ class xmlRpcServer {
// Check it and make sure we're super green
if (!vauth::session_exists('xml-rpc',$key)) {
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
- return new xmlrpcresp(0,'503','Key/IP Mis-match Access Denied');
+ return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
}
// Now pull out the start and end
@@ -111,17 +111,17 @@ class xmlRpcServer {
$song = new Song($row['id']);
$song->fill_ext_info();
$song->album = $song->get_album_name();
- $song->artist = $song->get_artist_name();
- $song->genre = $song->get_genre_name();
+ $song->artist = $song->get_artist_name();
+ //$song->genre = $song->get_genre_name(); // TODO: Needs to be implemented
$output = serialize($song);
- $results[] = $output;
+ $results[] = $output ;
} // end while
- $encoded_array = php_xmlrpc_encode($results);
+ $encoded_array = XML_RPC_encode($results);
debug_event('XMLSERVER','Encoded ' . count($results) . ' songs (' . $start . ',' . $end . ')','5');
- return new xmlrpcresp($encoded_array);
+ return new XML_RPC_Response($encoded_array);
} // get_songs
@@ -138,18 +138,15 @@ class xmlRpcServer {
// Check it and make sure we're super green
if (!vauth::session_exists('xml-rpc',$key)) {
debug_event('XMLSERVER','Error ' . $_SERVER['REMOTE_ADDR'] . ' with key ' . $key . ' does not match any ACLs','1');
- return new xmlrpcresp(0,'503','Key/IP Mis-match Access Denied');
+ return new XML_RPC_Response(0,'503','Key/IP Mis-match Access Denied');
}
if (!Stream::insert_session($key,'-1')) {
debug_event('XMLSERVER','Failed to create stream session','1');
- return new xmlrpcresp(0,'503','Failed to Create Stream Session','1');
+ return new XML_RPC_Response(0,'503','Failed to Create Stream Session','1');
}
- $encoded_array = php_xmlrpc_encode($key);
-
- return new xmlrpcresp($encoded_array);
-
+ return new XML_RPC_Response(XML_RPC_encode($key));
} // create_stream_session
/**
@@ -158,7 +155,13 @@ class xmlRpcServer {
* used in all further communication
*/
public static function handshake($xmlrpc_object) {
-
+ /*
+ ob_start();
+ print_r ($xmlrpc_object);
+ $got = ob_get_clean();
+ debug_event('XMLSERVER','handshake: ' . $got,'1');
+ */
+
// Pull out the params
$encoded_key = $xmlrpc_object->params['0']->me['string'];
$timestamp = $xmlrpc_object->params['1']->me['int'];
@@ -166,11 +169,11 @@ class xmlRpcServer {
// Check the timestamp make sure it's recent
if ($timestamp < (time() - 14400)) {
debug_event('XMLSERVER','Handshake failure, timestamp too old','1');
- return new xmlrpcresp(0,'503','Handshaek failure, timestamp too old');
+ return new XML_RPC_Response(0,'503','Handshake failure, timestamp too old');
}
-
+
// Log the attempt
- debug_event('XMLSERVER','Login Attempt, IP: ' . $_SERVER['REMOTE_ADDR'] . ' Time: ' . $timestamp . ' Hash:' . $encoded_key,'5');
+ debug_event('XMLSERVER','Login Attempt, IP: ' . $_SERVER['REMOTE_ADDR'] . ' Time: ' . $timestamp . ' Hash:' . $encoded_key,'1');
// Convert the IP Address to an int
$ip = sprintf("%u",ip2long($_SERVER['REMOTE_ADDR']));
@@ -187,13 +190,14 @@ class xmlRpcServer {
$data['type'] = 'xml-rpc';
$data['username'] = 'System';
$data['value'] = 'Handshake';
- $token = vauth::session_create($data);
- return new xmlrpcresp(php_xmlrpc_encode($token));
+ $token = vauth::session_create($data);
+
+ return new XML_RPC_Response(XML_RPC_encode($token));
}
} // end while rows
- return new xmlrpcresp(0,'503','Handshake failure, Key/IP Incorrect');
+ return new XML_RPC_Response(0,'503', 'Handshake failure, Key/IP Incorrect');
} // handshake