diff options
Diffstat (limited to 'central/trunk/xmlrpc.php')
-rw-r--r-- | central/trunk/xmlrpc.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index 18aa6cb..c638401 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php | |||
@@ -231,19 +231,26 @@ function addSubscription($username, $verification, $verificationID, $subscriptio | |||
231 | { | 231 | { |
232 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | 232 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) |
233 | { | 233 | { |
234 | $inssub = "INSERT INTO subscriptions (url, username, owner) VALUES (\"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($username) . "\", \"false\")"; | 234 | $getsub = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND username = \"" . mysql_real_escape_string($username) . "\" AND owner = \"false\""; |
235 | $inssub2 = mysql_query($inssub); | 235 | $getsub2 = mysql_query($getsub); |
236 | $getsub3 = mysql_fetch_array($getsub2); | ||
237 | if ($getsub3['url'] == $subscription) | ||
238 | { | ||
239 | $inssub = "INSERT INTO subscriptions (url, username, owner) VALUES (\"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($username) . "\", \"false\")"; | ||
240 | $inssub2 = mysql_query($inssub); | ||
236 | 241 | ||
237 | return new xmlrpcresp(new xmlrpcval(0, "int")); | 242 | return new xmlrpcresp(new xmlrpcval(0, "int")); |
243 | } | ||
238 | } | 244 | } |
239 | 245 | ||
240 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 246 | return new xmlrpcresp(new xmlrpcval(1, "int")); |
241 | } | 247 | } |
242 | 248 | ||
243 | function sendDatabase($cserver, $verification, $verificationID, $db) | 249 | function sendDatabase($cserver, $verification, $verificationID, $db, $databaseVersion) |
244 | { | 250 | { |
245 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) | 251 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) |
246 | { | 252 | { |
253 | $db = unserialize($db); | ||
247 | if (isset($db['central.fourisland.com'])) | 254 | if (isset($db['central.fourisland.com'])) |
248 | { | 255 | { |
249 | $getfi = "SELECT * FROM centralServers WHERE url = \"central.fourisland.com\""; | 256 | $getfi = "SELECT * FROM centralServers WHERE url = \"central.fourisland.com\""; |
@@ -261,6 +268,9 @@ function sendDatabase($cserver, $verification, $verificationID, $db) | |||
261 | $insdb2 = mysql_query($insdb); | 268 | $insdb2 = mysql_query($insdb); |
262 | } | 269 | } |
263 | 270 | ||
271 | $setconfig = "UPDATE config SET value = " . $databaseVersion . " WHERE name = \"databaseVersion\""; | ||
272 | $setconfig2 = mysql_query($setconfig); | ||
273 | |||
264 | return new xmlrpcresp(new xmlrpcval("0", 'int')); | 274 | return new xmlrpcresp(new xmlrpcval("0", 'int')); |
265 | } | 275 | } |
266 | } | 276 | } |