diff options
Diffstat (limited to 'series')
| -rw-r--r-- | series/trunk/instadisc.sql | 20 | ||||
| -rw-r--r-- | series/trunk/xmlrpc.php | 29 |
2 files changed, 46 insertions, 3 deletions
| 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 @@ | |||
| 3 | -- http://www.phpmyadmin.net | 3 | -- http://www.phpmyadmin.net |
| 4 | -- | 4 | -- |
| 5 | -- Host: localhost | 5 | -- Host: localhost |
| 6 | -- Generation Time: Sep 06, 2008 at 05:38 PM | 6 | -- Generation Time: Sep 13, 2008 at 09:16 AM |
| 7 | -- Server version: 5.0.51 | 7 | -- Server version: 5.0.51 |
| 8 | -- PHP Version: 5.2.4-2ubuntu5.3 | 8 | -- PHP Version: 5.2.4-2ubuntu5.3 |
| 9 | -- | 9 | -- |
| @@ -38,7 +38,23 @@ CREATE TABLE `subscriptions` ( | |||
| 38 | `category` varchar(255) NOT NULL, | 38 | `category` varchar(255) NOT NULL, |
| 39 | `password` varchar(255) NOT NULL, | 39 | `password` varchar(255) NOT NULL, |
| 40 | `personal` varchar(5) NOT NULL, | 40 | `personal` varchar(5) NOT NULL, |
| 41 | `username` varchar(255) NOT NULL, | ||
| 42 | `lastUpdated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, | ||
| 41 | PRIMARY KEY (`id`), | 43 | PRIMARY KEY (`id`), |
| 42 | UNIQUE KEY `identity` (`identity`,`url`) | 44 | UNIQUE KEY `identity` (`identity`,`url`) |
| 43 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 45 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
| 46 | |||
| 47 | -- -------------------------------------------------------- | ||
| 48 | |||
| 49 | -- | ||
| 50 | -- Table structure for table `users` | ||
| 51 | -- | ||
| 52 | |||
| 53 | DROP TABLE IF EXISTS `users`; | ||
| 54 | CREATE TABLE `users` ( | ||
| 55 | `id` int(11) NOT NULL auto_increment, | ||
| 56 | `username` varchar(255) NOT NULL, | ||
| 57 | `password` varchar(255) NOT NULL, | ||
| 58 | PRIMARY KEY (`id`) | ||
| 59 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 44 | 60 | ||
| 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, $ | |||
| 39 | { | 39 | { |
| 40 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | 40 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) |
| 41 | { | 41 | { |
| 42 | 42 | $getsub = "SELECT * FROM subscriptions WHERE identity = \"" . mysql_real_escape_string($seriesID) . "\""; | |
| 43 | $getsub2 = mysql_query($getsub); | ||
| 44 | $getsub3 = mysql_fetch_array($getsub2); | ||
| 45 | if ($getsub3['identity'] == $seriesID) | ||
| 46 | { | ||
| 47 | if ($getsub3['username'] != $username) | ||
| 48 | { | ||
| 49 | return new xmlrpcresp(new xmlrpcval('1', 'int')); | ||
| 50 | } | ||
| 51 | |||
| 52 | $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) . "\""; | ||
| 53 | $setsub2 = mysql_query($setsub); | ||
| 54 | } else { | ||
| 55 | $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) . "\")"; | ||
| 56 | $inssub2 = mysql_query($inssub); | ||
| 57 | } | ||
| 58 | |||
| 59 | $client = xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); | ||
| 60 | $msg = new xmlrpcmsg("InstaDisc.sendFromSeries", array( new xmlrpcval($seriesURL, 'string'), | ||
| 61 | new xmlrpcval($seriesID, 'string'), | ||
| 62 | new xmlrpcval($title, 'string'), | ||
| 63 | new xmlrpcval($author, 'string'), | ||
| 64 | new xmlrpcval($url, 'string'), | ||
| 65 | new xmlrpcval($semantics, 'string'), | ||
| 66 | new xmlrpcval($encryptionID, 'int'))); | ||
| 67 | $client->send($msg); | ||
| 68 | |||
| 69 | return new xmlrpcresp(new xmlrpcval('0', 'int')); | ||
| 43 | } else { | 70 | } else { |
| 44 | return new xmlrpcresp(new xmlrpcval('2', 'int')); | 71 | return new xmlrpcresp(new xmlrpcval('2', 'int')); |
| 45 | } | 72 | } |
