From 866a1d8567457b451d61339064b52973419b2b0b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 7 Sep 2008 13:33:30 +0000 Subject: Series: Added getPasswordInfo() to XML-RPC interface Refs #28 --- series/core/trunk/xmlrpc.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/series/core/trunk/xmlrpc.php b/series/core/trunk/xmlrpc.php index 60ada6a..01664ad 100644 --- a/series/core/trunk/xmlrpc.php +++ b/series/core/trunk/xmlrpc.php @@ -17,7 +17,26 @@ function subscriptionInfo($id) )); } -$s = new xmlrpc_server(array( "InstaDisc.subscriptionInfo" => array('function' => 'subscriptionInfo') +function getPasswordInfo($id) +{ + if (!instaDisc_subscriptionExists($id)) + { + return new xmlrpcresp(new xmlrpcval('false', 'string')); + } + + $sub = instaDisc_getSubscription($id); + if ($sub['password'] == '') + { + return new xmlrpcresp(new xmlrpcval('false', 'string')); + } else { + $verID = rand(1,2147483647); + + return new xmlrpcresp(new xmlrpcval(md5($sub['password'] . ':' . $verID) . ':' . $verID, 'string')); + } +} + +$s = new xmlrpc_server(array( "InstaDisc.subscriptionInfo" => array('function' => 'subscriptionInfo'), + "InstaDisc.getPasswordInfo" => array('function' => 'getPasswordInfo') ), 0); $s->functions_parameters_type = 'phpvals'; $s->service(); -- cgit 1.4.1