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-06 21:42:34 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-06 21:42:34 +0000
commitfe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0 (patch)
treeef4aca9adde8522de8d3e6f56107045be00799f1 /central/trunk/xmlrpc.php
parent0b80d600e22ac218a59e1c09967a3caee91b1981 (diff)
downloadinstadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.tar.gz
instadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.tar.bz2
instadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.zip
Central: Started moving to Series
Refs #28
Diffstat (limited to 'central/trunk/xmlrpc.php')
-rw-r--r--central/trunk/xmlrpc.php83
1 files changed, 41 insertions, 42 deletions
diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index a451d93..64dc4f7 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php
@@ -75,45 +75,40 @@ function requestRetained($username, $verification, $verificationID)
75 return new xmlrpcresp(new xmlrpcval(1, "int")); 75 return new xmlrpcresp(new xmlrpcval(1, "int"));
76} 76}
77 77
78function sendFromUpdate($username, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID) 78function sendFromUpdate($username, $verification, $verificationID, $subscriptionSeriesURL, $subscriptionID, $title, $author, $url, $semantics, $encryptionID)
79{ 79{
80 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) 80 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password'))
81 { 81 {
82 $getusubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"true\" AND category <> \"instadisc\""; 82 $cserver = $_SERVER['SERVER_NAME'];
83 $getusubs2 = mysql_query($getusubs); 83 $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\"";
84 $getusubs3 = mysql_fetch_array($getusubs2); 84 $getuk2 = mysql_query($getuk);
85 if ($getusubs3['username'] == $username) 85 $getuk3 = mysql_fetch_array($getuk2);
86 {
87 $cserver = $_SERVER['SERVER_NAME'];
88 $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\"";
89 $getuk2 = mysql_query($getuk);
90 $getuk3 = mysql_fetch_array($getuk2);
91 86
92 $getcs = "SELECT * FROM centralServers"; 87 $getcs = "SELECT * FROM centralServers";
93 $getcs2 = mysql_query($getcs); 88 $getcs2 = mysql_query($getcs);
94 $i=0; 89 $i=0;
95 while ($getcs3[$i] = mysql_fetch_array($getcs2)) 90 while ($getcs3[$i] = mysql_fetch_array($getcs2))
96 { 91 {
97 $verID = rand(1,2147483647); 92 $verID = rand(1,2147483647);
98
99 $client = new xmlrpc_client($getcs3[$i]['xmlrpc']);
100 $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'),
101 new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'),
102 new xmlrpcval($verID, 'int'),
103 new xmlrpcval($subscription, 'string'),
104 new xmlrpcval($title, 'string'),
105 new xmlrpcval($author, 'string'),
106 new xmlrpcval($url, 'string'),
107 new xmlrpcval($semantics, 'string'),
108 new xmlrpcval($encryptionID, 'int'),
109 new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'),
110 new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int')));
111 $client->send($msg);
112 $i++;
113 }
114 93
115 return new xmlrpcresp(new xmlrpcval(0, "int")); 94 $client = new xmlrpc_client($getcs3[$i]['xmlrpc']);
95 $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'),
96 new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'),
97 new xmlrpcval($verID, 'int'),
98 new xmlrpcval($subscriptionSeriesURL, 'string'),
99 new xmlrpcval($subscriptionID, 'string'),
100 new xmlrpcval($title, 'string'),
101 new xmlrpcval($author, 'string'),
102 new xmlrpcval($url, 'string'),
103 new xmlrpcval($semantics, 'string'),
104 new xmlrpcval($encryptionID, 'int'),
105 new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'),
106 new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int')));
107 $client->send($msg);
108 $i++;
116 } 109 }
110
111 return new xmlrpcresp(new xmlrpcval(0, "int"));
117 } else { 112 } else {
118 return new xmlrpcresp(new xmlrpcval(2, "int")); 113 return new xmlrpcresp(new xmlrpcval(2, "int"));
119 } 114 }
@@ -121,7 +116,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription
121 return new xmlrpcresp(new xmlrpcval(1, "int")); 116 return new xmlrpcresp(new xmlrpcval(1, "int"));
122} 117}
123 118
124function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion) 119function sendFromCentral($cserver, $verification, $verificationID, $subscriptionSeriesURL, $subscriptionID, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion)
125{ 120{
126 if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) 121 if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code'))
127 { 122 {
@@ -165,16 +160,20 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription
165 instaDisc_sendDatabase($cserver); 160 instaDisc_sendDatabase($cserver);
166 } 161 }
167 162
168 $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"false\" AND category <> \"instadisc\""; 163 $subscriptionURL = instaDisc_resolveSubscription($subscriptionSeriesURL, $subscriptionID);
169 $getsed2 = mysql_query($getsed); 164 if ($subscriptionURL != 'false')
170 $i=0;
171 while ($getsed3[$i] = mysql_fetch_array($getsed2))
172 { 165 {
173 instaDisc_addItem($getsed3[$i]['username'], $subscription, $title, $author, $url, $semantics, $encryptionID); 166 $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscriptionSeriesURL) . "\" AND identity = \"" . mysql_real_escape_string($subscriptionID) . "\"";
174 $i++; 167 $getsed2 = mysql_query($getsed);
175 } 168 $i=0;
169 while ($getsed3[$i] = mysql_fetch_array($getsed2))
170 {
171 instaDisc_addItem($getsed3[$i]['username'], $subscriptionURL, $title, $author, $url, $semantics, $encryptionID);
172 $i++;
173 }
176 174
177 return new xmlrpcresp(new xmlrpcval(0, "int")); 175 return new xmlrpcresp(new xmlrpcval(0, "int"));
176 }
178 } 177 }
179 178
180 return new xmlrpcresp(new xmlrpcval(1, "int")); 179 return new xmlrpcresp(new xmlrpcval(1, "int"));