diff options
Diffstat (limited to 'central/trunk/xmlrpc.php')
| -rw-r--r-- | central/trunk/xmlrpc.php | 36 |
1 files changed, 33 insertions, 3 deletions
| diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index 68ff92d..c10002a 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php | |||
| @@ -26,7 +26,7 @@ function deleteItem($username, $verification, $verificationID, $id) | |||
| 26 | $getitem3 = mysql_fetch_array($getitem2); | 26 | $getitem3 = mysql_fetch_array($getitem2); |
| 27 | if ($getitem3['id'] == $id) | 27 | if ($getitem3['id'] == $id) |
| 28 | { | 28 | { |
| 29 | $delitem = "DELETE inbox WHERE username = \"" . mysql_escape_string($username) . "\" AND itemID = " . $id; | 29 | $delitem = "DELETE FROM inbox WHERE username = \"" . mysql_escape_string($username) . "\" AND itemID = " . $id; |
| 30 | $delitem2 = mysql_query($delitem); | 30 | $delitem2 = mysql_query($delitem); |
| 31 | 31 | ||
| 32 | return new xmlrpcresp(new xmlrpcval(0, "int")); | 32 | return new xmlrpcresp(new xmlrpcval(0, "int")); |
| @@ -195,7 +195,7 @@ function deleteSubscription($username, $verification, $verificationID, $subscrip | |||
| 195 | $getsub3 = mysql_fetch_array($getsub2); | 195 | $getsub3 = mysql_fetch_array($getsub2); |
| 196 | if ($getsub3['url'] == $subscription) | 196 | if ($getsub3['url'] == $subscription) |
| 197 | { | 197 | { |
| 198 | $delsub = "DELETE subscriptions WHERE url = \"" . mysql_escape_string($subscription) . "\" AND username = \"" . mysql_escape_string($username . "\" AND owner = \"false\""; | 198 | $delsub = "DELETE FROM subscriptions WHERE url = \"" . mysql_escape_string($subscription) . "\" AND username = \"" . mysql_escape_string($username) . "\" AND owner = \"false\""; |
| 199 | $delsub2 = mysql_query($delsub); | 199 | $delsub2 = mysql_query($delsub); |
| 200 | 200 | ||
| 201 | return new xmlrpcresp(new xmlrpcval(0, "int")); | 201 | return new xmlrpcresp(new xmlrpcval(0, "int")); |
| @@ -218,6 +218,35 @@ function addSubscription($username, $verification, $verificationID, $subscriptio | |||
| 218 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 218 | return new xmlrpcresp(new xmlrpcval(1, "int")); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | function sendDatabase($cserver, $verification, $verificationID, $db) | ||
| 222 | { | ||
| 223 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'key')) | ||
| 224 | { | ||
| 225 | if (isset($db['central.fourisland.com'])) | ||
| 226 | { | ||
| 227 | $getfi = "SELECT * FROM centralServers WHERE url = \"central.fourisland.com\""; | ||
| 228 | $getfi2 = mysql_query($getfi); | ||
| 229 | $getfi3 = mysql_fetch_array($getfi2); | ||
| 230 | |||
| 231 | if ($db['central.fourisland.com'] == $getfi3['key']) | ||
| 232 | { | ||
| 233 | $deldb = "TRUNCATE TABLE centralServers"; | ||
| 234 | $deldb2 = mysql_query($deldb); | ||
| 235 | |||
| 236 | foreach($db as $name => $value) | ||
| 237 | { | ||
| 238 | $insdb = "INSERT INTO centralServers (url, key) VALUES (\"" . mysql_escape_string($name) . "\", \"" . mysql_escape_string($value) . "\")"; | ||
| 239 | $insdb2 = mysql_query($insdb); | ||
| 240 | } | ||
| 241 | |||
| 242 | return new xmlrpcresp(new xmlrpcval("0", 'int')); | ||
| 243 | } | ||
| 244 | } | ||
| 245 | } | ||
| 246 | |||
| 247 | return new xmlrpcresp(new xmlrpcval(1, "int")); | ||
| 248 | } | ||
| 249 | |||
| 221 | $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), | 250 | $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), |
| 222 | "InstaDisc.deleteItem" => array("function" => "deleteItem"), | 251 | "InstaDisc.deleteItem" => array("function" => "deleteItem"), |
| 223 | "InstaDisc.resendItem" => array("function" => "resendItem"), | 252 | "InstaDisc.resendItem" => array("function" => "resendItem"), |
| @@ -227,7 +256,8 @@ $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" | |||
| 227 | "InstaDisc.sendUpdateNotice" => array("function" => "sendUpdateNotice"), | 256 | "InstaDisc.sendUpdateNotice" => array("function" => "sendUpdateNotice"), |
| 228 | "InstaDisc.askForDatabase" => array("function" => "askForDatabase"), | 257 | "InstaDisc.askForDatabase" => array("function" => "askForDatabase"), |
| 229 | "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"), | 258 | "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"), |
| 230 | "InstaDisc.addSubscription" => array("function" => "addSubscription") | 259 | "InstaDisc.addSubscription" => array("function" => "addSubscription"), |
| 260 | "InstaDisc.sendDatabase" => array("function" => "sendDatabase") | ||
| 231 | ),0); | 261 | ),0); |
| 232 | $s->functions_parameters_type = 'phpvals'; | 262 | $s->functions_parameters_type = 'phpvals'; |
| 233 | $s->service(); | 263 | $s->service(); |
