From 970ec85cad2cc833f0ba4c9e9488952b9aa33575 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Sep 2008 13:33:19 +0000 Subject: Series: Integrated Update Refs #55 --- series/trunk/instadisc.sql | 20 ++++++++++++++++++-- series/trunk/xmlrpc.php | 29 ++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) (limited to 'series/trunk') diff --git a/series/trunk/instadisc.sql b/series/trunk/instadisc.sql index 8954446..4c9a816 100644 --- a/series/trunk/instadisc.sql +++ b/series/trunk/instadisc.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Sep 06, 2008 at 05:38 PM +-- Generation Time: Sep 13, 2008 at 09:16 AM -- Server version: 5.0.51 -- PHP Version: 5.2.4-2ubuntu5.3 -- @@ -38,7 +38,23 @@ CREATE TABLE `subscriptions` ( `category` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `personal` varchar(5) NOT NULL, + `username` varchar(255) NOT NULL, + `lastUpdated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `identity` (`identity`,`url`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +CREATE TABLE `users` ( + `id` int(11) NOT NULL auto_increment, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/series/trunk/xmlrpc.php b/series/trunk/xmlrpc.php index 9024ae2..7bb7f10 100644 --- a/series/trunk/xmlrpc.php +++ b/series/trunk/xmlrpc.php @@ -39,7 +39,34 @@ function sendFromUpdate($username, $verification, $verificationID, $seriesURL, $ { 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); + } + + $client = xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); + $msg = new xmlrpcmsg("InstaDisc.sendFromSeries", array( new xmlrpcval($seriesURL, 'string'), + new xmlrpcval($seriesID, 'string'), + new xmlrpcval($title, 'string'), + new xmlrpcval($author, 'string'), + new xmlrpcval($url, 'string'), + new xmlrpcval($semantics, 'string'), + new xmlrpcval($encryptionID, 'int'))); + $client->send($msg); + + return new xmlrpcresp(new xmlrpcval('0', 'int')); } else { return new xmlrpcresp(new xmlrpcval('2', 'int')); } -- cgit 1.4.1