From fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 6 Sep 2008 21:42:34 +0000 Subject: Central: Started moving to Series Refs #28 --- central/trunk/activatesub.php | 124 ------------------------------ central/trunk/addsub.php | 94 ----------------------- central/trunk/includes/instadisc.php | 142 ----------------------------------- central/trunk/instadisc.sql | 54 ++++++------- central/trunk/mansub.php | 27 ------- central/trunk/theme/activatedsub.tpl | 14 ---- central/trunk/theme/activatesub.tpl | 51 ------------- central/trunk/theme/addedsub.tpl | 17 ----- central/trunk/theme/addsub.tpl | 50 ------------ central/trunk/theme/mansub.tpl | 30 -------- central/trunk/theme/userpanel.tpl | 6 +- central/trunk/xmlrpc.php | 83 ++++++++++---------- 12 files changed, 66 insertions(+), 626 deletions(-) delete mode 100644 central/trunk/activatesub.php delete mode 100644 central/trunk/addsub.php delete mode 100644 central/trunk/mansub.php delete mode 100644 central/trunk/theme/activatedsub.tpl delete mode 100644 central/trunk/theme/activatesub.tpl delete mode 100644 central/trunk/theme/addedsub.tpl delete mode 100644 central/trunk/theme/addsub.tpl delete mode 100644 central/trunk/theme/mansub.tpl (limited to 'central') diff --git a/central/trunk/activatesub.php b/central/trunk/activatesub.php deleted file mode 100644 index 46a05ec..0000000 --- a/central/trunk/activatesub.php +++ /dev/null @@ -1,124 +0,0 @@ - 0) - { - showForm($_POST['url'], $errors); - } else { - if ($_POST['submit'] == "Verify") - { - switch (instaDisc_addSubscription($_SESSION['username'], $_POST['url'])) - { - case 0: - $template = new FITemplate('activatedsub'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - $template->display(); - break; - - case 1: - addError($numOfErrors, $errors, '', 'Unknown error'); - showForm($_POST['url'], $errors); - break; - - case 2: - addError($numOfErrors, $errors, 'url', 'Subscription could not be found'); - showForm($_POST['url'], $errors); - break; - - case 3: - addError($numOfErrors, $errors, '', 'Subscription File is not well-formed'); - showForm($_POST['url'], $errors); - break; - - case 4: - addError($numOfErrors, $errors, '', 'Key in Subscription File is incorrect'); - showForm($_POST['url'], $errors); - break; - } - } else { - instaDisc_cancelSubscription($_SESSION['username'], $_POST['url']); - } - } - } -} else { - header('Location: index.php'); -} - -function showForm($url, $errors) -{ - $template = new FITemplate('activatesub'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - - if (isset($errors[1])) - { - $template->adds_block('ERROR', array('ex'=>'1')); - - foreach ($errors as $name => $value) - { - $template->adds_block('ERRORS', array( 'NAME' => $name, - 'MSG' => $value['msg'])); - } - } - - $template->add('URL_ERR', ifErrors($errors, 'url')); - - doErrors($template, $errors, 'url'); - - $template->add('URL', $url); - - $template->display(); -} - -function ifErrors($errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - return ' error'; - } - } - - return ''; -} - -function doErrors($template, $errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, - 'VALUE' => $value['msg'])); - } - } -} - -function addError(&$numOfErrors, &$errors, $field, $msg) -{ - $numOfErrors++; - $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); -} - -?> diff --git a/central/trunk/addsub.php b/central/trunk/addsub.php deleted file mode 100644 index fd46234..0000000 --- a/central/trunk/addsub.php +++ /dev/null @@ -1,94 +0,0 @@ - 0) - { - showForm($_POST['url'], $errors); - } else { - $key = instaDisc_generateSubscriptionActivation($_SESSION['username'], $_POST['url']); - if ($key !== FALSE) - { - $template = new FITemplate('addedsub'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - $template->add('KEY', $key); - $template->display(); - } else { - addError($numOfErrors, $errors, '', 'Unknown error'); - showForm($_POST['url'], $errors); - } - } -} - -function showForm($url, $errors) -{ - $template = new FITemplate('addsub'); - $template->add('SITENAME', instaDisc_getConfig('siteName')); - - if (isset($errors[1])) - { - $template->adds_block('ERROR', array('ex'=>'1')); - - foreach ($errors as $name => $value) - { - $template->adds_block('ERRORS', array( 'NAME' => $name, - 'MSG' => $value['msg'])); - } - } - - $template->add('URL_ERR', ifErrors($errors, 'url')); - - doErrors($template, $errors, 'url'); - - $template->add('URL', $url); - - $template->display(); -} - -function ifErrors($errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - return ' error'; - } - } - - return ''; -} - -function doErrors($template, $errors, $id) -{ - foreach ($errors as $name => $value) - { - if ($value['field'] == $id) - { - $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, - 'VALUE' => $value['msg'])); - } - } -} - -function addError(&$numOfErrors, &$errors, $field, $msg) -{ - $numOfErrors++; - $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); -} - -?> diff --git a/central/trunk/includes/instadisc.php b/central/trunk/includes/instadisc.php index d00893b..3f3922a 100644 --- a/central/trunk/includes/instadisc.php +++ b/central/trunk/includes/instadisc.php @@ -271,148 +271,6 @@ function instaDisc_getConfig($key) return $getconfig3['value']; } -function instaDisc_listSubscriptions($username) -{ - $getsubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND owner = \"true\""; - $getsubs2 = mysql_query($getsubs); - $i=0; - while ($getsubs3[$i] = mysql_fetch_array($getsubs2)) - { - $subs[$i] = $getsubs3[$i]['url']; - - $i++; - } - - $subs['size'] = $i; - return $subs; -} - -function instaDisc_addSubscription($username, $url) -{ - $getcode = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\""; - $getcode2 = mysql_query($getcode); - $getcode3 = mysql_fetch_array($getcode2); - if ($getcode3['username'] == $username) - { - $c = curl_init(); - curl_setopt($c, CURLOPT_URL, $url); - curl_setopt($c, CURLOPT_HEADER, false); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - $page_data = curl_exec($c); - curl_close($c); - - $headers = split("\n", $page_data); - foreach ($headers as $name => $value) - { - $header = split(": ", $value); - $headerMap[$header[0]] = $header[1]; - } - - if (isset($headerMap['Subscription'])) - { - if (isset($headerMap['Title'])) - { - if (isset($headerMap['Category'])) - { - if (isset($headerMap['Key'])) - { - if ($headerMap['Key'] == $getcode3['code']) - { - $inssub = "INSERT INTO subscriptions (username,url,owner,category) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($headerMap['Subscription']) . "\", \"true\", \"" . mysql_real_escape_string($headerMap['Category']) . "\")"; - $inssub2 = mysql_query($inssub); - - $delcode = "DELETE FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\""; - $delcode2 = mysql_query($delcode); - - return 0; - } else { - return 4; - } - } else { - return 3; - } - } else { - return 3; - } - } else { - return 3; - } - } else { - return 3; - } - } else { - return 2; - } - - return 1; -} - -function instaDisc_listPendingSubscriptions($username) -{ - $getsubs = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $getsubs2 = mysql_query($getsubs); - $i=0; - while ($getsubs3[$i] = mysql_fetch_array($getsubs2)) - { - $subs[$i] = array('url' => $getsubs3[$i]['url'], 'code' => $getsubs3[$i]['code']); - - $i++; - } - - $subs['size'] = $i; - return $subs; -} - -function instaDisc_generateSubscriptionActivation($username, $url) -{ - $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $getuser2 = mysql_query($getuser); - $getuser3 = mysql_fetch_array($getuser2); - if ($getuser3['username'] == $username) - { - $key = md5(rand(1,2147483647)); - - $inspending = "INSERT INTO pending2 (username, url, code) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($url) . "\", \"" . mysql_real_escape_string($key) . "\")"; - $inspending2 = mysql_query($inspending); - - return $key; - } - - return false; -} - -function instaDisc_deleteSubscription($username, $url) -{ - $getsub = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; - $getsub2 = mysql_query($getsub); - $getsub3 = mysql_fetch_array($getsub2); - if ($getsub3['username'] == $username) - { - $delsub = "DELETE FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; - $delsub2 = mysql_query($delsub); - - return true; - } - - return false; -} - -function instaDisc_cancelSubscription($username, $url) -{ - $getsub = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; - $getsub2 = mysql_query($getsub); - $getsub3 = mysql_fetch_array($getsub2); - if ($getsub3['username'] == $username) - { - $delsub = "DELETE FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")"; - $delsub2 = mysql_query($delsub); - - return true; - } - - return false; -} - function instaDisc_changePassword($username, $password) { $setpass = "UPDATE users WHERE username = \"" . mysql_real_escape_string($username) . "\" SET password = \"" . mysql_real_escape_string(md5($password)) . "\""; diff --git a/central/trunk/instadisc.sql b/central/trunk/instadisc.sql index 2019503..70e3c3b 100644 --- a/central/trunk/instadisc.sql +++ b/central/trunk/instadisc.sql @@ -3,11 +3,11 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Aug 03, 2008 at 04:54 PM +-- Generation Time: Sep 06, 2008 at 05:37 PM -- Server version: 5.0.51 -- PHP Version: 5.2.4-2ubuntu5.3 -- --- Database: `instadisc` +-- Database: `instadisc_central` -- -- -------------------------------------------------------- @@ -16,13 +16,14 @@ -- Table structure for table `centralServers` -- -CREATE TABLE IF NOT EXISTS `centralServers` ( +DROP TABLE IF EXISTS `centralServers`; +CREATE TABLE `centralServers` ( `id` int(11) NOT NULL auto_increment, `url` varchar(255) NOT NULL, `code` varchar(255) NOT NULL, `xmlrpc` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- @@ -30,12 +31,13 @@ CREATE TABLE IF NOT EXISTS `centralServers` ( -- Table structure for table `config` -- -CREATE TABLE IF NOT EXISTS `config` ( +DROP TABLE IF EXISTS `config`; +CREATE TABLE `config` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- @@ -43,7 +45,8 @@ CREATE TABLE IF NOT EXISTS `config` ( -- Table structure for table `inbox` -- -CREATE TABLE IF NOT EXISTS `inbox` ( +DROP TABLE IF EXISTS `inbox`; +CREATE TABLE `inbox` ( `id` int(11) NOT NULL auto_increment, `username` varchar(255) NOT NULL, `itemID` int(11) NOT NULL, @@ -54,7 +57,7 @@ CREATE TABLE IF NOT EXISTS `inbox` ( `semantics` text NOT NULL, `encryptionID` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- @@ -62,12 +65,13 @@ CREATE TABLE IF NOT EXISTS `inbox` ( -- Table structure for table `oldVerID` -- -CREATE TABLE IF NOT EXISTS `oldVerID` ( +DROP TABLE IF EXISTS `oldVerID`; +CREATE TABLE `oldVerID` ( `id` int(11) NOT NULL auto_increment, `username` varchar(255) NOT NULL, `verID` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- @@ -75,7 +79,8 @@ CREATE TABLE IF NOT EXISTS `oldVerID` ( -- Table structure for table `pending` -- -CREATE TABLE IF NOT EXISTS `pending` ( +DROP TABLE IF EXISTS `pending`; +CREATE TABLE `pending` ( `id` int(11) NOT NULL auto_increment, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, @@ -86,30 +91,16 @@ CREATE TABLE IF NOT EXISTS `pending` ( -- -------------------------------------------------------- --- --- Table structure for table `pending2` --- - -CREATE TABLE IF NOT EXISTS `pending2` ( - `id` int(11) NOT NULL auto_increment, - `username` varchar(255) NOT NULL, - `url` varchar(255) NOT NULL, - `code` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - -- -- Table structure for table `subscriptions` -- -CREATE TABLE IF NOT EXISTS `subscriptions` ( - `id` mediumint(11) NOT NULL auto_increment, +DROP TABLE IF EXISTS `subscriptions`; +CREATE TABLE `subscriptions` ( + `id` int(11) NOT NULL auto_increment, `username` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, - `owner` varchar(5) NOT NULL, - `category` varchar(255) NOT NULL, + `identity` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; @@ -119,7 +110,8 @@ CREATE TABLE IF NOT EXISTS `subscriptions` ( -- Table structure for table `users` -- -CREATE TABLE IF NOT EXISTS `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, @@ -127,5 +119,5 @@ CREATE TABLE IF NOT EXISTS `users` ( `ip` varchar(255) NOT NULL, `nextItemID` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/central/trunk/mansub.php b/central/trunk/mansub.php deleted file mode 100644 index b36966f..0000000 --- a/central/trunk/mansub.php +++ /dev/null @@ -1,27 +0,0 @@ -add('SITENAME', instaDisc_getConfig('siteName')); - - $subs = instaDisc_listSubscriptions($_SESSION['username']); - $i=0; - for ($i=0;$i<$subs['size'];$i++) - { - $template->adds_block('SUBSCRIPTIONS', array( 'URL' => $subs[$i], - 'ID' => $i, - 'EVEN' => (($i % 2 == 0) ? " CLASS=\"even\"" : ""))); - } - - $template->display(); -} else { - header('Location: index.php'); -} - -?> diff --git a/central/trunk/theme/activatedsub.tpl b/central/trunk/theme/activatedsub.tpl deleted file mode 100644 index 9bdcbf5..0000000 --- a/central/trunk/theme/activatedsub.tpl +++ /dev/null @@ -1,14 +0,0 @@ - - - <!--SITENAME--> InstaDisc Central Server - - - -
-

InstaDisc Subscription Activation

- -

You've sucessfully activated your subscription! Back to User Panel -

- - - diff --git a/central/trunk/theme/activatesub.tpl b/central/trunk/theme/activatesub.tpl deleted file mode 100644 index f6dd6a0..0000000 --- a/central/trunk/theme/activatesub.tpl +++ /dev/null @@ -1,51 +0,0 @@ - - - <!--SITENAME--> InstaDisc Central Server - - - - -
-

InstaDisc Subscription Activation

- -

If you've already requested a subscription be sponsered and added its Activation Key to its Subscription File, you can activate the subscription here: -

- -
- - -
Uh oh! Validation errors!

-

    - - - -
  1. - - - -
-
- - -
- User Details - -
- -

* - -

- - - - -
-
- -
- - -
-
- - diff --git a/central/trunk/theme/addedsub.tpl b/central/trunk/theme/addedsub.tpl deleted file mode 100644 index 9efa010..0000000 --- a/central/trunk/theme/addedsub.tpl +++ /dev/null @@ -1,17 +0,0 @@ - - - <!--SITENAME--> InstaDisc Central Server - - - -
-

InstaDisc Add Subscription

- -

Thank you for submitting! An activation key has been generated for you. Here it is: -

-

Please place that in your Subscription File and return here to activate your subscription. -

Don't know how to add the key to your subscription file? Well, simply go to Four Island, find the type of Update Server you are using, and there should be instructions on how to add an Activation Key to your subscription file. -

Back to the User Panel -

- - diff --git a/central/trunk/theme/addsub.tpl b/central/trunk/theme/addsub.tpl deleted file mode 100644 index 148b67c..0000000 --- a/central/trunk/theme/addsub.tpl +++ /dev/null @@ -1,50 +0,0 @@ - - - <!--SITENAME--> InstaDisc Central Server - - - - -
-

InstaDisc Add Subscription

- -

If you would like to have us sponser a subscription for you, please fill out the form below: -

- -
- - -
Uh oh! Validation errors!

-

    - - - -
  1. - - - -
-
- - -
- Subscription Details - -
- -

* - -

- - - - -
-
- -
- -
-
- - diff --git a/central/trunk/theme/mansub.tpl b/central/trunk/theme/mansub.tpl deleted file mode 100644 index 23639b1..0000000 --- a/central/trunk/theme/mansub.tpl +++ /dev/null @@ -1,30 +0,0 @@ - - - <!--SITENAME--> InstaDisc Central Server - - - - -
-

InstaDisc Subscription Management

- -

If you've sponsered subscriptions here but have decided you want to move elsewhere you can delete subscriptions using the table below: - - - - - - - - - > - - - - -
Subscription URLActions
Delete
- -

Back to User Panel -

- - diff --git a/central/trunk/theme/userpanel.tpl b/central/trunk/theme/userpanel.tpl index c10c0dc..37d5ec0 100644 --- a/central/trunk/theme/userpanel.tpl +++ b/central/trunk/theme/userpanel.tpl @@ -14,12 +14,10 @@
  • Log out
  • -

    If you own a subscription and wish to have this Central Server sponser it, you can use the options below: +

    If you own a subscription and wish to have this Central Server sponser it, you can use the option below:

    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) return new xmlrpcresp(new xmlrpcval(1, "int")); } -function sendFromUpdate($username, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID) +function sendFromUpdate($username, $verification, $verificationID, $subscriptionSeriesURL, $subscriptionID, $title, $author, $url, $semantics, $encryptionID) { if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) { - $getusubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"true\" AND category <> \"instadisc\""; - $getusubs2 = mysql_query($getusubs); - $getusubs3 = mysql_fetch_array($getusubs2); - if ($getusubs3['username'] == $username) - { - $cserver = $_SERVER['SERVER_NAME']; - $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\""; - $getuk2 = mysql_query($getuk); - $getuk3 = mysql_fetch_array($getuk2); + $cserver = $_SERVER['SERVER_NAME']; + $getuk = "SELECT * FROM centralServers WHERE url = \"" . mysql_real_escape_string($cserver) . "\""; + $getuk2 = mysql_query($getuk); + $getuk3 = mysql_fetch_array($getuk2); - $getcs = "SELECT * FROM centralServers"; - $getcs2 = mysql_query($getcs); - $i=0; - while ($getcs3[$i] = mysql_fetch_array($getcs2)) - { - $verID = rand(1,2147483647); - - $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); - $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), - new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'), - new xmlrpcval($verID, 'int'), - new xmlrpcval($subscription, 'string'), - new xmlrpcval($title, 'string'), - new xmlrpcval($author, 'string'), - new xmlrpcval($url, 'string'), - new xmlrpcval($semantics, 'string'), - new xmlrpcval($encryptionID, 'int'), - new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), - new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); - $client->send($msg); - $i++; - } + $getcs = "SELECT * FROM centralServers"; + $getcs2 = mysql_query($getcs); + $i=0; + while ($getcs3[$i] = mysql_fetch_array($getcs2)) + { + $verID = rand(1,2147483647); - return new xmlrpcresp(new xmlrpcval(0, "int")); + $client = new xmlrpc_client($getcs3[$i]['xmlrpc']); + $msg = new xmlrpcmsg("InstaDisc.sendFromCentral", array( new xmlrpcval($cserver, 'string'), + new xmlrpcval(md5($cserver . ":" . $getuk3['code'] . ":" . $verID), 'string'), + new xmlrpcval($verID, 'int'), + new xmlrpcval($subscriptionSeriesURL, 'string'), + new xmlrpcval($subscriptionID, 'string'), + new xmlrpcval($title, 'string'), + new xmlrpcval($author, 'string'), + new xmlrpcval($url, 'string'), + new xmlrpcval($semantics, 'string'), + new xmlrpcval($encryptionID, 'int'), + new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), + new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); + $client->send($msg); + $i++; } + + return new xmlrpcresp(new xmlrpcval(0, "int")); } else { return new xmlrpcresp(new xmlrpcval(2, "int")); } @@ -121,7 +116,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription return new xmlrpcresp(new xmlrpcval(1, "int")); } -function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion) +function sendFromCentral($cserver, $verification, $verificationID, $subscriptionSeriesURL, $subscriptionID, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion) { if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) { @@ -165,16 +160,20 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription instaDisc_sendDatabase($cserver); } - $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"false\" AND category <> \"instadisc\""; - $getsed2 = mysql_query($getsed); - $i=0; - while ($getsed3[$i] = mysql_fetch_array($getsed2)) + $subscriptionURL = instaDisc_resolveSubscription($subscriptionSeriesURL, $subscriptionID); + if ($subscriptionURL != 'false') { - instaDisc_addItem($getsed3[$i]['username'], $subscription, $title, $author, $url, $semantics, $encryptionID); - $i++; - } + $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscriptionSeriesURL) . "\" AND identity = \"" . mysql_real_escape_string($subscriptionID) . "\""; + $getsed2 = mysql_query($getsed); + $i=0; + while ($getsed3[$i] = mysql_fetch_array($getsed2)) + { + instaDisc_addItem($getsed3[$i]['username'], $subscriptionURL, $title, $author, $url, $semantics, $encryptionID); + $i++; + } - return new xmlrpcresp(new xmlrpcval(0, "int")); + return new xmlrpcresp(new xmlrpcval(0, "int")); + } } return new xmlrpcresp(new xmlrpcval(1, "int")); -- cgit 1.4.1