about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-08-08 13:23:20 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-08-08 13:23:20 +0000
commit8bbbfe024dbe6d585598e919a26ece82cccc71a1 (patch)
treeef67385a27bc9cd8ae1bee864a022de2986f88e8
parent4116da2199a163a72860f6265d52a2ae0b860967 (diff)
downloadinstadisc-8bbbfe024dbe6d585598e919a26ece82cccc71a1.tar.gz
instadisc-8bbbfe024dbe6d585598e919a26ece82cccc71a1.tar.bz2
instadisc-8bbbfe024dbe6d585598e919a26ece82cccc71a1.zip
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
-rw-r--r--central/trunk/instadisc.php4
-rw-r--r--central/trunk/instadisc.sql1
-rw-r--r--central/trunk/install.php1
-rw-r--r--central/trunk/subscription.php9
-rw-r--r--central/trunk/xmlrpc.php8
5 files changed, 17 insertions, 6 deletions
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)
95function instaDisc_sendUpdateNotice($softwareVersion) 95function instaDisc_sendUpdateNotice($softwareVersion)
96{ 96{
97 $username = instaDisc_getConfig('owner'); 97 $username = instaDisc_getConfig('owner');
98 $subscription = 'http://' . $_SERVER['HTTP_HOST']; 98 $subscription = 'http://fourisland.com/' . $_SERVER['SERVER_NAME'] . '/';
99 $title = 'Update your software to ' . $software; 99 $title = 'Update your software to ' . $software;
100 $author = 'Hatkirby'; 100 $author = 'Hatkirby';
101 $url = 'http://fourisland.com/projects/instadisc/wiki/CentralSoftwareUpdate'; 101 $url = 'http://fourisland.com/projects/instadisc/wiki/CentralSoftwareUpdate';
@@ -312,7 +312,7 @@ function instaDisc_addSubscription($username, $url)
312 { 312 {
313 if ($header['Key'] == $getcode3['code']) 313 if ($header['Key'] == $getcode3['code'])
314 { 314 {
315 $inssub = "INSERT INTO subscriptions (username,url,owner) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($header['Subscription']) . "\", \"true\")"; 315 $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']) . "\")";
316 $inssub2 = mysql_query($inssub); 316 $inssub2 = mysql_query($inssub);
317 317
318 return true; 318 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` (
108 `username` varchar(255) NOT NULL, 108 `username` varchar(255) NOT NULL,
109 `url` varchar(255) NOT NULL, 109 `url` varchar(255) NOT NULL,
110 `owner` varchar(5) NOT NULL, 110 `owner` varchar(5) NOT NULL,
111 `category` varchar(255) NOT NULL,
111 PRIMARY KEY (`id`) 112 PRIMARY KEY (`id`)
112) ENGINE=MyISAM DEFAULT CHARSET=latin1; 113) ENGINE=MyISAM DEFAULT CHARSET=latin1;
113 114
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']))
198 $sql[10] = "INSERT INTO config (name,value) VALUES (\"databaseVersion\",\"1\")"; 198 $sql[10] = "INSERT INTO config (name,value) VALUES (\"databaseVersion\",\"1\")";
199 $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']) . "\")"; 199 $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']) . "\")";
200 $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') . "\")"; 200 $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') . "\")";
201 $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\")";
201 202
202 foreach ($sql as $name => $value) 203 foreach ($sql as $name => $value)
203 { 204 {
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 @@
1<?php
2
3/* InstaDisc Server - A Four Island Project */
4
5include('instadisc.php');
6
7?>Subscription: http://fourisland.com/<?php echo($_SERVER['SERVER_NAME'] . "\n"); ?>
8Title: <?php echo(instaDisc_getConfig('siteName') . "\n"); ?>
9Category: 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
80{ 80{
81 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) 81 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password'))
82 { 82 {
83 $getusubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"true\""; 83 $getusubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"true\" AND category <> \"instadisc\"";
84 $getusubs2 = mysql_query($getusubs); 84 $getusubs2 = mysql_query($getusubs);
85 $getusubs3 = mysql_fetch_array($getusubs2); 85 $getusubs3 = mysql_fetch_array($getusubs2);
86 if ($getusubs3['username'] == $username) 86 if ($getusubs3['username'] == $username)
@@ -163,7 +163,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription
163 instaDisc_sendDatabase($cserver); 163 instaDisc_sendDatabase($cserver);
164 } 164 }
165 165
166 $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"false\""; 166 $getsed = "SELECT * FROM subscriptions WHERE url = \"" . mysql_real_escape_string($subscription) . "\" AND owner = \"false\" AND category <> \"instadisc\"";
167 $getsed2 = mysql_query($getsed); 167 $getsed2 = mysql_query($getsed);
168 $i=0; 168 $i=0;
169 while ($getsed3[$i] = mysql_fetch_array($getsed2)) 169 while ($getsed3[$i] = mysql_fetch_array($getsed2))
@@ -227,7 +227,7 @@ function deleteSubscription($username, $verification, $verificationID, $subscrip
227 return new xmlrpcresp(new xmlrpcval(1, "int")); 227 return new xmlrpcresp(new xmlrpcval(1, "int"));
228} 228}
229 229
230function addSubscription($username, $verification, $verificationID, $subscription) 230function addSubscription($username, $verification, $verificationID, $subscription, $category)
231{ 231{
232 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) 232 if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password'))
233 { 233 {
@@ -236,7 +236,7 @@ function addSubscription($username, $verification, $verificationID, $subscriptio
236 $getsub3 = mysql_fetch_array($getsub2); 236 $getsub3 = mysql_fetch_array($getsub2);
237 if ($getsub3['url'] == $subscription) 237 if ($getsub3['url'] == $subscription)
238 { 238 {
239 $inssub = "INSERT INTO subscriptions (url, username, owner) VALUES (\"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($username) . "\", \"false\")"; 239 $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) . "\")";
240 $inssub2 = mysql_query($inssub); 240 $inssub2 = mysql_query($inssub);
241 241
242 return new xmlrpcresp(new xmlrpcval(0, "int")); 242 return new xmlrpcresp(new xmlrpcval(0, "int"));