about summary refs log tree commit diff stats
path: root/central/trunk/xmlrpc.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 16:26:50 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 16:26:50 +0000
commitbd90f0965333b247a5e50422d0a1d9292dd9fd5a (patch)
treeb98a1dd2fe95b9d240fa42eb9ffcb734d790b0a7 /central/trunk/xmlrpc.php
parenteefbd2e03bed592549bc6a61b16e076ccccd819f (diff)
downloadinstadisc-bd90f0965333b247a5e50422d0a1d9292dd9fd5a.tar.gz
instadisc-bd90f0965333b247a5e50422d0a1d9292dd9fd5a.tar.bz2
instadisc-bd90f0965333b247a5e50422d0a1d9292dd9fd5a.zip
Central: Completed steps 10 and 11
Refs #69
Diffstat (limited to 'central/trunk/xmlrpc.php')
-rw-r--r--central/trunk/xmlrpc.php82
1 files changed, 72 insertions, 10 deletions
diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index 2e3aa62..0e66940 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php
@@ -44,9 +44,18 @@ function resendItem($username, $verification, $verificationID, $id)
44 $getitem3 = mysql_fetch_array($getitem2); 44 $getitem3 = mysql_fetch_array($getitem2);
45 if ($getitem3['itemID'] == $id) 45 if ($getitem3['itemID'] == $id)
46 { 46 {
47 instaDisc_sendItem($username, $id); 47 $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\"";
48 $getuser2 = mysql_query($getuser);
49 $getuser3 = mysql_fetch_array($getuser2);
50 if ($getuser3['downloadItemMode'] == 'Push')
51 {
52 instaDisc_sendItem($username, $id);
48 53
49 return new xmlrpcresp(new xmlrpcval(0, "int")); 54 return new xmlrpcresp(new xmlrpcval(0, "int"));
55 } else if ($getuser3['downloadItemMode'] == 'Pull')
56 {
57 return new xmlrpcresp(new xmlrpcval(instaDisc_formItem($username, $id), 'string'));
58 }
50 } 59 }
51 } 60 }
52 61
@@ -57,24 +66,76 @@ function requestRetained($username, $verification, $verificationID)
57{ 66{
58 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) 67 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password'))
59 { 68 {
60 $getitems = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\""; 69 $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\"";
61 $getitems2 = mysql_query($getitems); 70 $getuser2 = mysql_query($getuser);
62 $i=0; 71 $getuser3 = mysql_fetch_array($getuser2);
63 while ($getitems3[$i] = mysql_fetch_array($getitems2)) 72 if ($getuser3['downloadItemMode'] == 'Push')
73 {
74 $getitems = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\"";
75 $getitems2 = mysql_query($getitems);
76 $i=0;
77 while ($getitems3[$i] = mysql_fetch_array($getitems2))
78 {
79 if (!instaDisc_sendItem($username, $getitems3[$i]['itemID']))
80 {
81 return new xmlrpcresp(new xmlrpcval(1, "int"));
82 }
83 $i++;
84 }
85
86 return new xmlrpcresp(new xmlrpcval(0, "int"));
87 } else if ($getuser3['downloadItemMode'] == 'Pull')
64 { 88 {
65 if (!instaDisc_sendItem($username, $getitems3[$i]['itemID'])) 89 $getitems = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\" LIMIT 0,2";
90 $getitems2 = mysql_query($getitems);
91 $getitems3 = mysql_fetch_array($getitems2);
92 $getitems4 = mysql_fetch_array($getitems2);
93 if ($getitems3['username'] == $username)
66 { 94 {
67 return new xmlrpcresp(new xmlrpcval(1, "int")); 95 $item = instaDisc_formItem($username, $getitems3['id']);
96 if ($getitems4['username'] == $username)
97 {
98 $item .= 'More: ' . $getitems4['id'] . "\n";
99 }
100
101 return new xmlrpcresp(new xmlrpcval($item, 'string'));
68 } 102 }
69 $i++;
70 } 103 }
104 }
71 105
72 return new xmlrpcresp(new xmlrpcval(0, "int")); 106 return new xmlrpcresp(new xmlrpcval(1, "int"));
107}
108
109function sendItem($username, $verification, $verificationID, $id)
110{
111 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password'))
112 {
113 $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\"";
114 $getuser2 = mysql_query($getuser);
115 $getuser3 = mysql_fetch_array($getuser2);
116 if ($getuser3['downloadItemMode'] == 'Pull')
117 {
118 $getitems = "SELECT * FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\" AND itemID > " . ($id-1) . " LIMIT 0,2";
119 $getitems2 = mysql_query($getitems);
120 $getitems3 = mysql_fetch_array($getitems2);
121 $getitems4 = mysql_fetch_array($getitems2);
122 if ($getitems3['username'] == $username)
123 {
124 $item = instaDisc_formItem($username, $getitems3['id']);
125 if ($getitems4['username'] == $username)
126 {
127 $item .= 'More: ' . $getitems4['id'] . "\n";
128 }
129
130 return new xmlrpcresp(new xmlrpcval($item, 'string'));
131 }
132 }
73 } 133 }
74 134
75 return new xmlrpcresp(new xmlrpcval(1, "int")); 135 return new xmlrpcresp(new xmlrpcval(1, "int"));
76} 136}
77 137
138
78function sendFromUpdate($subscriptionURL, $title, $author, $url, $semantics, $encryptionID) 139function sendFromUpdate($subscriptionURL, $title, $author, $url, $semantics, $encryptionID)
79{ 140{
80 $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscriptionURL) . "\""; 141 $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscriptionURL) . "\"";
@@ -180,6 +241,7 @@ $s = new xmlrpc_server( array( "InstaDisc.checkRegistration" => array("function"
180 "InstaDisc.deleteItem" => array("function" => "deleteItem"), 241 "InstaDisc.deleteItem" => array("function" => "deleteItem"),
181 "InstaDisc.resendItem" => array("function" => "resendItem"), 242 "InstaDisc.resendItem" => array("function" => "resendItem"),
182 "InstaDisc.requestRetained" => array("function" => "requestRetained"), 243 "InstaDisc.requestRetained" => array("function" => "requestRetained"),
244 "InstaDisc.sendItem" => array("function" => "sendItem"),
183 "InstaDisc.sendFromUpdate" => array("function" => "sendFromUpdate"), 245 "InstaDisc.sendFromUpdate" => array("function" => "sendFromUpdate"),
184 "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"), 246 "InstaDisc.deleteSubscription" => array("function" => "deleteSubscription"),
185 "InstaDisc.addSubscription" => array("function" => "addSubscription"), 247 "InstaDisc.addSubscription" => array("function" => "addSubscription"),