From 1ad668d889d1d8a5da93c25591793f5b2ccde121 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Sep 2008 16:02:31 +0000 Subject: Series: Added initSubscription() Refs #55 --- series/trunk/xmlrpc.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'series/trunk/xmlrpc.php') diff --git a/series/trunk/xmlrpc.php b/series/trunk/xmlrpc.php index 5756dd4..114296e 100644 --- a/series/trunk/xmlrpc.php +++ b/series/trunk/xmlrpc.php @@ -35,7 +35,7 @@ function getPasswordInfo($id) } } -function sendFromUpdate($username, $verification, $verificationID, $seriesURL, $seriesID, $subscriptionURL, $subscriptionTitle, $subscriptionCategory, $subscriptionPersonal, $title, $author, $url, $semantics, $encryptionID) +function sendFromUpdate($username, $verification, $verificationID, $seriesURL, $seriesID, $title, $author, $url, $semantics, $encryptionID) { if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) { @@ -74,9 +74,33 @@ function sendFromUpdate($username, $verification, $verificationID, $seriesURL, $ return new xmlrpcresp(new xmlrpcval('1', 'int')); } +function initSubscription($username, $verification, $verificationID, $seriesURL, $subscriptionID, $subscriptionURL, $subscriptionTitle, $subscriptionCategory, $subscriptionPersonal) +{ + if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) + { + $getsub = "SELECT * FROM subscriptions WHERE identity = \"" . mysql_real_escape_string($seriesID) . "\""; + $getsub2 = mysql_query($getsub); + $getsub3 = mysql_fetch_array($getsub2); + if ($getsub3['identity'] == $seriesID) + { + if ($getsub3['username'] != $username) + { + return new xmlrpcresp(new xmlrpcval('1', 'int')); + } + + $setsub = "UPDATE subscriptions SET title = \"" . mysql_real_escape_string($subscriptionTitle) . "\", url = \"" . mysql_real_escape_string($subscriptionURL) . "\", category = \"" . mysql_real_escape_string($subscriptionCategory) . "\", personal = \"" . mysql_real_escape_string($subscriptionPersonal) . "\""; + $setsub2 = mysql_query($setsub); + } else { + $inssub = "INSERT INTO subscriptions (identity, title, url, category, personal, username) VALUES (\"" . mysql_real_escape_string($seriesID) . "\",\"" . mysql_real_escape_string($subscriptionTitle) . "\",\"" . mysql_real_escape_string($subscriptionURL) . "\",\"" . mysql_real_escape_string($subscriptionCategory) . "\",\"" . mysql_real_escape_string($subscriptionPersonal) . "\",\"" . mysql_real_escape_string($username) . "\")"; + $inssub2 = mysql_query($inssub); + } + } +} + $s = new xmlrpc_server(array( "InstaDisc.subscriptionInfo" => array('function' => 'subscriptionInfo'), "InstaDisc.getPasswordInfo" => array('function' => 'getPasswordInfo'), - "InstaDisc.sendFromUpdate" => array('function' => 'sendFromUpdate') + "InstaDisc.sendFromUpdate" => array('function' => 'sendFromUpdate'), + "InstaDisc.initSubscription" => array('function' => 'initSubscription') ), 0); $s->functions_parameters_type = 'phpvals'; $s->service(); -- cgit 1.4.1