From 9c7e9acc5c17acf42193efacb8e8183e28c2e402 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 13 Aug 2008 01:40:34 +0000 Subject: Central: Added encryption key support See [127]. Refs #10 --- central/trunk/instadisc.php | 9 +++++++-- central/trunk/instadisc.sql | 1 + central/trunk/xmlrpc.php | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'central') diff --git a/central/trunk/instadisc.php b/central/trunk/instadisc.php index 4c12a39..75a9bf1 100644 --- a/central/trunk/instadisc.php +++ b/central/trunk/instadisc.php @@ -80,6 +80,11 @@ function instaDisc_sendItem($username, $id) $out .= $name . ': ' . $value . "\r\n"; } + if ($getitem3['encryptionID'] != 0) + { + $out .= 'Encryption-ID: ' . $getitem3['encryptionID'] . "\r\n"; + } + $out .= "\r\n\r\n"; fwrite($fp, $out); @@ -132,7 +137,7 @@ function instaDisc_sendDatabase($cserver) $client->send($msg); } -function instaDisc_addItem($username, $subscription, $title, $author, $url, $semantics) +function instaDisc_addItem($username, $subscription, $title, $author, $url, $semantics, $encryptionID) { $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; $getuser2 = mysql_query($getuser); @@ -143,7 +148,7 @@ function instaDisc_addItem($username, $subscription, $title, $author, $url, $sem $setuser = "UPDATE users SET nextItemID = nextItemID+1 WHERE username = \"" . mysql_real_escape_string($username) . "\""; $setuser2 = mysql_query($setuser); - $insitem = "INSERT INTO inbox (username, itemID, subscription, title, author, url, semantics) VALUES (\"" . mysql_real_escape_string($username) . "\", " . $itemID . ", \"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($title) . "\", \"" . mysql_real_escape_string($author) . "\", \"" . mysql_real_escape_string($url) . "\", \"" . mysql_real_escape_string($semantics) . "\")"; + $insitem = "INSERT INTO inbox (username, itemID, subscription, title, author, url, semantics, encryptionID) VALUES (\"" . mysql_real_escape_string($username) . "\", " . $itemID . ", \"" . mysql_real_escape_string($subscription) . "\", \"" . mysql_real_escape_string($title) . "\", \"" . mysql_real_escape_string($author) . "\", \"" . mysql_real_escape_string($url) . "\", \"" . mysql_real_escape_string($semantics) . "\",\" . $encryptionID . "\")"; $insitem2 = mysql_query($insitem); instaDisc_sendItem($username, $itemID); diff --git a/central/trunk/instadisc.sql b/central/trunk/instadisc.sql index ec42c64..2019503 100644 --- a/central/trunk/instadisc.sql +++ b/central/trunk/instadisc.sql @@ -52,6 +52,7 @@ CREATE TABLE IF NOT EXISTS `inbox` ( `author` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, `semantics` text NOT NULL, + `encryptionID` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/central/trunk/xmlrpc.php b/central/trunk/xmlrpc.php index 7dd5be7..37c3216 100644 --- a/central/trunk/xmlrpc.php +++ b/central/trunk/xmlrpc.php @@ -76,7 +76,7 @@ function requestRetained($username, $verification, $verificationID) return new xmlrpcresp(new xmlrpcval(1, "int")); } -function sendFromUpdate($username, $verification, $verificationID, $subscription, $title, $author, $url, $semantics) +function sendFromUpdate($username, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID) { if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) { @@ -106,6 +106,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription 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); @@ -119,7 +120,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription return new xmlrpcresp(new xmlrpcval(1, "int")); } -function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $softwareVersion, $databaseVersion) +function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion) { if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) { @@ -168,7 +169,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription $i=0; while ($getsed3[$i] = mysql_fetch_array($getsed2)) { - instaDisc_addItem($getsed3[$i]['username'], $subscription, $title, $author, $url, $semantics); + instaDisc_addItem($getsed3[$i]['username'], $subscription, $title, $author, $url, $semantics, $encryptionID); $i++; } -- cgit 1.4.1