diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-07 19:31:15 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-07 19:31:15 +0000 |
commit | 9c6d7136a17628ad1e087da138ef27c32ba251f9 (patch) | |
tree | 3d093feb2d88d286d9cb6e7f912112492c7138cc /central | |
parent | a7e5c508d476eb46d13d0c2fa40266c72f7c0ed4 (diff) | |
download | instadisc-9c6d7136a17628ad1e087da138ef27c32ba251f9.tar.gz instadisc-9c6d7136a17628ad1e087da138ef27c32ba251f9.tar.bz2 instadisc-9c6d7136a17628ad1e087da138ef27c32ba251f9.zip |
Central: Fixed a few errors
Diffstat (limited to 'central')
-rw-r--r-- | central/trunk/instadisc.php | 3 | ||||
-rw-r--r-- | central/trunk/xmlrpc.php | 18 |
2 files changed, 16 insertions, 5 deletions
diff --git a/central/trunk/instadisc.php b/central/trunk/instadisc.php index 826a830..c671316 100644 --- a/central/trunk/instadisc.php +++ b/central/trunk/instadisc.php | |||
@@ -127,7 +127,8 @@ function instaDisc_sendDatabase($cserver) | |||
127 | $msg = new xmlrpcmsg("InstaDisc.sendDatabase", array( new xmlrpcval($cserver2, 'string'), | 127 | $msg = new xmlrpcmsg("InstaDisc.sendDatabase", array( new xmlrpcval($cserver2, 'string'), |
128 | new xmlrpcval(md5($cserver2 . ":" . $getuk3['code'] . ":" . $verID), 'string'), | 128 | new xmlrpcval(md5($cserver2 . ":" . $getuk3['code'] . ":" . $verID), 'string'), |
129 | new xmlrpcval($verID, 'int'), | 129 | new xmlrpcval($verID, 'int'), |
130 | new xmlrpcval($db, 'array'))); | 130 | new xmlrpcval(serialize($db), 'string'), |
131 | new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'string'))); | ||
131 | $client->send($msg); | 132 | $client->send($msg); |
132 | } | 133 | } |
133 | 134 | ||
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 | } |