From 8bbbfe024dbe6d585598e919a26ece82cccc71a1 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 8 Aug 2008 13:23:20 +0000 Subject: Central: Imposed "instadisc" category contract Now Central Servers will refuse to receive items with the category of "instadisc". However, the Client has to be modifed to send this data to the Central Server. Also added the Central Server Update Notice subscription to the database and provided a subscription file. Refs #26 --- central/trunk/instadisc.php | 4 ++-- central/trunk/instadisc.sql | 1 + central/trunk/install.php | 1 + central/trunk/subscription.php | 9 +++++++++ central/trunk/xmlrpc.php | 8 ++++---- 5 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 central/trunk/subscription.php (limited to 'central/trunk') diff --git a/central/trunk/instadisc.php b/central/trunk/instadisc.php index a1d491a..7af4c1f 100644 --- a/central/trunk/instadisc.php +++ b/central/trunk/instadisc.php @@ -95,7 +95,7 @@ function instaDisc_sendItem($username, $id) function instaDisc_sendUpdateNotice($softwareVersion) { $username = instaDisc_getConfig('owner'); - $subscription = 'http://' . $_SERVER['HTTP_HOST']; + $subscription = 'http://fourisland.com/' . $_SERVER['SERVER_NAME'] . '/'; $title = 'Update your software to ' . $software; $author = 'Hatkirby'; $url = 'http://fourisland.com/projects/instadisc/wiki/CentralSoftwareUpdate'; @@ -312,7 +312,7 @@ function instaDisc_addSubscription($username, $url) { if ($header['Key'] == $getcode3['code']) { - $inssub = "INSERT INTO subscriptions (username,url,owner) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($header['Subscription']) . "\", \"true\")"; + $inssub = "INSERT INTO subscriptions (username,url,owner,category) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($header['Subscription']) . "\", \"true\", \"" . mysql_real_escape_string($header['Category']) . "\")"; $inssub2 = mysql_query($inssub); return true; diff --git a/central/trunk/instadisc.sql b/central/trunk/instadisc.sql index b3de26e..ec42c64 100644 --- a/central/trunk/instadisc.sql +++ b/central/trunk/instadisc.sql @@ -108,6 +108,7 @@ CREATE TABLE IF NOT EXISTS `subscriptions` ( `username` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, `owner` varchar(5) NOT NULL, + `category` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/central/trunk/install.php b/central/trunk/install.php index 46300c8..2722b1f 100644 --- a/central/trunk/install.php +++ b/central/trunk/install.php @@ -198,6 +198,7 @@ if (!isset($_GET['submit'])) $sql[10] = "INSERT INTO config (name,value) VALUES (\"databaseVersion\",\"1\")"; $sql[11] = "INSERT INTO users (username, password, email, ip) VALUES (\"" . mysql_real_escape_string($_POST['adminUser']) . "\",\"" . mysql_real_escape_string(md5($_POST['adminPass'])) . "\",\"" . mysql_real_escape_string($_POST['adminEmail']) . "\",\"" . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . "\")"; $sql[12] = "INSERT INTO centralServers (url, code, xmlrpc) VALUES (\"" . mysql_real_escape_string('central.fourisland.com') . "\",\"" . mysql_real_escape_string(md5('central.fourisland.com')) . "\",\"" . mysql_real_escape_string('http://central.fourisland.com/xmlrpc.php') . "\")"; + $sql[13] = "INSERT INTO subscriptions (username, url, owner, category) VALUES (\"" . mysql_real_escape_string($_POST['adminUser']) . "\", \"" . mysql_real_escape_string('http://fourisland.com/' . $_SERVER['SERVER_NAME'] . '/') . "\", \"true\", \"instadisc\")"; foreach ($sql as $name => $value) { diff --git a/central/trunk/subscription.php b/central/trunk/subscription.php new file mode 100644 index 0000000..020f7d7 --- /dev/null +++ b/central/trunk/subscription.php @@ -0,0 +1,9 @@ +Subscription: http://fourisland.com/ +Title: +Category: instadisc diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index c638401..7dd5be7 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php @@ -80,7 +80,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription { 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\""; + $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) @@ -163,7 +163,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription instaDisc_sendDatabase($cserver); } - $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"false\""; + $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)) @@ -227,7 +227,7 @@ function deleteSubscription($username, $verification, $verificationID, $subscrip return new xmlrpcresp(new xmlrpcval(1, "int")); } -function addSubscription($username, $verification, $verificationID, $subscription) +function addSubscription($username, $verification, $verificationID, $subscription, $category) { if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) { @@ -236,7 +236,7 @@ function addSubscription($username, $verification, $verificationID, $subscriptio $getsub3 = mysql_fetch_array($getsub2); if ($getsub3['url'] == $subscription) { - $inssub = "INSERT INTO subscriptions (url, username, owner) VALUES (\"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($username) . "\", \"false\")"; + $inssub = "INSERT INTO subscriptions (url, username, owner, category) VALUES (\"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($username) . "\", \"false\", \"" . mysql_real_escape_string($category) . "\")"; $inssub2 = mysql_query($inssub); return new xmlrpcresp(new xmlrpcval(0, "int")); -- cgit 1.4.1