diff options
Diffstat (limited to 'central/trunk/xmlrpc.php')
-rw-r--r-- | central/trunk/xmlrpc.php | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index ecd0bfc..18c344b 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php | |||
@@ -21,12 +21,12 @@ function deleteItem($username, $verification, $verificationID, $id) | |||
21 | { | 21 | { |
22 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | 22 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) |
23 | { | 23 | { |
24 | $getitem = "SELECT * FROM inbox WHERE id = " . $id; | 24 | $getitem = "SELECT * FROM inbox WHERE username = \"" . $username . "\" AND itemID = " . $id; |
25 | $getitem2 = mysql_query($getitem); | 25 | $getitem2 = mysql_query($getitem); |
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 id = " . $id; | 29 | $delitem = "DELETE inbox WHERE username = \"" . $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")); |
@@ -40,12 +40,12 @@ function resendItem($username, $verification, $verificationID, $id) | |||
40 | { | 40 | { |
41 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | 41 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) |
42 | { | 42 | { |
43 | $getitem = "SELECT * FROM inbox WHERE id = " . $id; | 43 | $getitem = "SELECT * FROM inbox WHERE username = \"" . $username . "\" AND itemID = " . $id; |
44 | $getitem2 = mysql_query($getitem); | 44 | $getitem2 = mysql_query($getitem); |
45 | $getitem3 = mysql_fetch_array($getitem2); | 45 | $getitem3 = mysql_fetch_array($getitem2); |
46 | if ($getitem3['id'] == $id) | 46 | if ($getitem3['id'] == $id) |
47 | { | 47 | { |
48 | instaDisc_sendItem($id); | 48 | instaDisc_sendItem($username, $id); |
49 | 49 | ||
50 | return new xmlrpcresp(new xmlrpcval(0, "int")); | 50 | return new xmlrpcresp(new xmlrpcval(0, "int")); |
51 | } | 51 | } |
@@ -103,7 +103,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription | |||
103 | { | 103 | { |
104 | if ($softwareVersion > getConfig('softwareVersion')) | 104 | if ($softwareVersion > getConfig('softwareVersion')) |
105 | { | 105 | { |
106 | instaDisc_sendUpdateNotice(); | 106 | instaDisc_sendUpdateNotice($softwareVersion); |
107 | } else if ($softwareVersion < getConfig('softwareVersion')) | 107 | } else if ($softwareVersion < getConfig('softwareVersion')) |
108 | { | 108 | { |
109 | $cserver2 = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; | 109 | $cserver2 = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; |
@@ -162,7 +162,7 @@ function sendUpdateNotice($cserver, $verification, $verificationID, $softwareVer | |||
162 | { | 162 | { |
163 | if ($softwareVersion > getConfig('softwareVersion')) | 163 | if ($softwareVersion > getConfig('softwareVersion')) |
164 | { | 164 | { |
165 | instaDisc_sendUpdateNotice(); | 165 | instaDisc_sendUpdateNotice($softwareVersion); |
166 | 166 | ||
167 | return new xmlrpcresp(new xmlrpcval(0, "int")); | 167 | return new xmlrpcresp(new xmlrpcval(0, "int")); |
168 | } | 168 | } |
@@ -186,6 +186,25 @@ function askForDatabase($cserver, $verification, $verificationID, $databaseVersi | |||
186 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 186 | return new xmlrpcresp(new xmlrpcval(1, "int")); |
187 | } | 187 | } |
188 | 188 | ||
189 | function deleteSubscription($username, $verification, $verificationID, $subscription) | ||
190 | { | ||
191 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | ||
192 | { | ||
193 | $getsub = "SELECT * FROM subscriptions WHERE url = \"" . $subscription . "\" AND username = \"" . $username . "\" AND owner = \"false\""; | ||
194 | $getsub2 = mysql_query($getsub); | ||
195 | $getsub3 = mysql_fetch_array($getsub2); | ||
196 | if ($getsub3['url'] == $subscription) | ||
197 | { | ||
198 | $delsub = "DELETE subscriptions WHERE url = \"" . $subscription . "\" AND username = \"" . $username . "\" AND owner = \"false\""; | ||
199 | $delsub2 = mysql_query($delsub); | ||
200 | |||
201 | return new xmlrpcresp(new xmlrpcval(0, "int")); | ||
202 | } | ||
203 | } | ||
204 | |||
205 | return new xmlrpcresp(new xmlrpcval(1, "int")); | ||
206 | } | ||
207 | |||
189 | $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), | 208 | $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" => "checkRegistration"), |
190 | "InstaDisc.deleteItem" => array("function" => "deleteItem"), | 209 | "InstaDisc.deleteItem" => array("function" => "deleteItem"), |
191 | "InstaDisc.resendItem" => array("function" => "resendItem"), | 210 | "InstaDisc.resendItem" => array("function" => "resendItem"), |
@@ -193,7 +212,8 @@ $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function" | |||
193 | "InstaDisc.sendFromUpdate" => array("function" => "sendFromUpdate"), | 212 | "InstaDisc.sendFromUpdate" => array("function" => "sendFromUpdate"), |
194 | "InstaDisc.sendFromCentral" => array("function" => "sendFromCentral"), | 213 | "InstaDisc.sendFromCentral" => array("function" => "sendFromCentral"), |
195 | "InstaDisc.sendUpdateNotice" => array("function" => "sendUpdateNotice"), | 214 | "InstaDisc.sendUpdateNotice" => array("function" => "sendUpdateNotice"), |
196 | "InstaDisc.askForDatabase" => array("function" => "askForDatabase") | 215 | "InstaDisc.askForDatabase" => array("function" => "askForDatabase"), |
216 | "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription") | ||
197 | ),0); | 217 | ),0); |
198 | $s->functions_parameters_type = 'phpvals'; | 218 | $s->functions_parameters_type = 'phpvals'; |
199 | $s->service(); | 219 | $s->service(); |