From 2c33a04e24aefdb75d35841f976875c693893973 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 6 Sep 2008 22:22:05 +0000 Subject: Central: Moved to Series Refs #28 --- central/trunk/includes/instadisc.php | 15 ++++++++++ central/trunk/theme/userpanel.tpl | 6 ---- central/trunk/xmlrpc.php | 57 +++++++++++++++++++----------------- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/central/trunk/includes/instadisc.php b/central/trunk/includes/instadisc.php index 3f3922a..f35d021 100644 --- a/central/trunk/includes/instadisc.php +++ b/central/trunk/includes/instadisc.php @@ -277,4 +277,19 @@ function instaDisc_changePassword($username, $password) $setpass2 = mysql_query($setpass); } +function instaDisc_resolveSubscription($seriesURL, $id) +{ + $client = new xmlrpc_client($seriesURL); + $msg = new xmlrpcmsg('InstaDisc.subscriptionInfo', array( new xmlrpcval($id, 'string'))); + $resp = $client->send($msg); + $val = $resp->value()->scalarVal(); + + if ($val == 'false') + { + return 'false'; + } else { + return unserialize($val); + } +} + ?> diff --git a/central/trunk/theme/userpanel.tpl b/central/trunk/theme/userpanel.tpl index 37d5ec0..cde93d4 100644 --- a/central/trunk/theme/userpanel.tpl +++ b/central/trunk/theme/userpanel.tpl @@ -14,12 +14,6 @@
  • Log out
  • -

    If you own a subscription and wish to have this Central Server sponser it, you can use the option below: - -

    -

    Since you are the almighty admin of this Central Server, you can edit configurational values! diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index 64dc4f7..48f1e5e 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php @@ -79,36 +79,39 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription { if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) { - $cserver = $_SERVER['SERVER_NAME']; - $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\""; - $getuk2 = mysql_query($getuk); - $getuk3 = mysql_fetch_array($getuk2); - - $getcs = "SELECT * FROM centralServers"; - $getcs2 = mysql_query($getcs); - $i=0; - while ($getcs3[$i] = mysql_fetch_array($getcs2)) + if (instaDisc_resolveSubscription($subscriptionSeriesURL, $subscriptionID) != 'false') { - $verID = rand(1,2147483647); + $cserver = $_SERVER['SERVER_NAME']; + $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\""; + $getuk2 = mysql_query($getuk); + $getuk3 = mysql_fetch_array($getuk2); - $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); - $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), - new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'), - new xmlrpcval($verID, 'int'), - new xmlrpcval($subscriptionSeriesURL, 'string'), - new xmlrpcval($subscriptionID, 'string'), - new xmlrpcval($title, 'string'), - new xmlrpcval($author, 'string'), - new xmlrpcval($url, 'string'), - new xmlrpcval($semantics, 'string'), - new xmlrpcval($encryptionID, 'int'), - new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), - new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); - $client->send($msg); - $i++; - } + $getcs = "SELECT * FROM centralServers"; + $getcs2 = mysql_query($getcs); + $i=0; + while ($getcs3[$i] = mysql_fetch_array($getcs2)) + { + $verID = rand(1,2147483647); + + $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); + $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), + new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'), + new xmlrpcval($verID, 'int'), + new xmlrpcval($subscriptionSeriesURL, 'string'), + new xmlrpcval($subscriptionID, 'string'), + new xmlrpcval($title, 'string'), + new xmlrpcval($author, 'string'), + new xmlrpcval($url, 'string'), + new xmlrpcval($semantics, 'string'), + new xmlrpcval($encryptionID, 'int'), + new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), + new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); + $client->send($msg); + $i++; + } - return new xmlrpcresp(new xmlrpcval(0, "int")); + return new xmlrpcresp(new xmlrpcval(0, "int")); + } } else { return new xmlrpcresp(new xmlrpcval(2, "int")); } -- cgit 1.4.1