diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-13 01:40:34 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-13 01:40:34 +0000 |
commit | 9c7e9acc5c17acf42193efacb8e8183e28c2e402 (patch) | |
tree | 198fe47d86f8fc5f4131b2f8c428f4333339257c | |
parent | c98908daa9cb992bf485a13ba837aea331419222 (diff) | |
download | instadisc-9c7e9acc5c17acf42193efacb8e8183e28c2e402.tar.gz instadisc-9c7e9acc5c17acf42193efacb8e8183e28c2e402.tar.bz2 instadisc-9c7e9acc5c17acf42193efacb8e8183e28c2e402.zip |
Central: Added encryption key support
See [127]. Refs #10
-rw-r--r-- | central/trunk/instadisc.php | 9 | ||||
-rw-r--r-- | central/trunk/instadisc.sql | 1 | ||||
-rw-r--r-- | central/trunk/xmlrpc.php | 7 |
3 files changed, 12 insertions, 5 deletions
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) | |||
80 | $out .= $name . ': ' . $value . "\r\n"; | 80 | $out .= $name . ': ' . $value . "\r\n"; |
81 | } | 81 | } |
82 | 82 | ||
83 | if ($getitem3['encryptionID'] != 0) | ||
84 | { | ||
85 | $out .= 'Encryption-ID: ' . $getitem3['encryptionID'] . "\r\n"; | ||
86 | } | ||
87 | |||
83 | $out .= "\r\n\r\n"; | 88 | $out .= "\r\n\r\n"; |
84 | 89 | ||
85 | fwrite($fp, $out); | 90 | fwrite($fp, $out); |
@@ -132,7 +137,7 @@ function instaDisc_sendDatabase($cserver) | |||
132 | $client->send($msg); | 137 | $client->send($msg); |
133 | } | 138 | } |
134 | 139 | ||
135 | function instaDisc_addItem($username, $subscription, $title, $author, $url, $semantics) | 140 | function instaDisc_addItem($username, $subscription, $title, $author, $url, $semantics, $encryptionID) |
136 | { | 141 | { |
137 | $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; | 142 | $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; |
138 | $getuser2 = mysql_query($getuser); | 143 | $getuser2 = mysql_query($getuser); |
@@ -143,7 +148,7 @@ function instaDisc_addItem($username, $subscription, $title, $author, $url, $sem | |||
143 | $setuser = "UPDATE users SET nextItemID = nextItemID+1 WHERE username = \"" . mysql_real_escape_string($username) . "\""; | 148 | $setuser = "UPDATE users SET nextItemID = nextItemID+1 WHERE username = \"" . mysql_real_escape_string($username) . "\""; |
144 | $setuser2 = mysql_query($setuser); | 149 | $setuser2 = mysql_query($setuser); |
145 | 150 | ||
146 | $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) . "\")"; | 151 | $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 . "\")"; |
147 | $insitem2 = mysql_query($insitem); | 152 | $insitem2 = mysql_query($insitem); |
148 | 153 | ||
149 | instaDisc_sendItem($username, $itemID); | 154 | 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` ( | |||
52 | `author` varchar(255) NOT NULL, | 52 | `author` varchar(255) NOT NULL, |
53 | `url` varchar(255) NOT NULL, | 53 | `url` varchar(255) NOT NULL, |
54 | `semantics` text NOT NULL, | 54 | `semantics` text NOT NULL, |
55 | `encryptionID` int(11) NOT NULL, | ||
55 | PRIMARY KEY (`id`) | 56 | PRIMARY KEY (`id`) |
56 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 57 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
57 | 58 | ||
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) | |||
76 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 76 | return new xmlrpcresp(new xmlrpcval(1, "int")); |
77 | } | 77 | } |
78 | 78 | ||
79 | function sendFromUpdate($username, $verification, $verificationID, $subscription, $title, $author, $url, $semantics) | 79 | function sendFromUpdate($username, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID) |
80 | { | 80 | { |
81 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) | 81 | if (instaDisc_checkVerification($username, $verification, $verificationID, 'users', 'username', 'password')) |
82 | { | 82 | { |
@@ -106,6 +106,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription | |||
106 | new xmlrpcval($author, 'string'), | 106 | new xmlrpcval($author, 'string'), |
107 | new xmlrpcval($url, 'string'), | 107 | new xmlrpcval($url, 'string'), |
108 | new xmlrpcval($semantics, 'string'), | 108 | new xmlrpcval($semantics, 'string'), |
109 | new xmlrpcval($encryptionID, 'int'), | ||
109 | new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), | 110 | new xmlrpcval(instaDisc_getConfig('softwareVersion'), 'int'), |
110 | new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); | 111 | new xmlrpcval(instaDisc_getConfig('databaseVersion'), 'int'))); |
111 | $client->send($msg); | 112 | $client->send($msg); |
@@ -119,7 +120,7 @@ function sendFromUpdate($username, $verification, $verificationID, $subscription | |||
119 | return new xmlrpcresp(new xmlrpcval(1, "int")); | 120 | return new xmlrpcresp(new xmlrpcval(1, "int")); |
120 | } | 121 | } |
121 | 122 | ||
122 | function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $softwareVersion, $databaseVersion) | 123 | function sendFromCentral($cserver, $verification, $verificationID, $subscription, $title, $author, $url, $semantics, $encryptionID, $softwareVersion, $databaseVersion) |
123 | { | 124 | { |
124 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) | 125 | if (instaDisc_checkVerification($cserver, $verification, $verificationID, 'centralServers', 'url', 'code')) |
125 | { | 126 | { |
@@ -168,7 +169,7 @@ function sendFromCentral($cserver, $verification, $verificationID, $subscription | |||
168 | $i=0; | 169 | $i=0; |
169 | while ($getsed3[$i] = mysql_fetch_array($getsed2)) | 170 | while ($getsed3[$i] = mysql_fetch_array($getsed2)) |
170 | { | 171 | { |
171 | instaDisc_addItem($getsed3[$i]['username'], $subscription, $title, $author, $url, $semantics); | 172 | instaDisc_addItem($getsed3[$i]['username'], $subscription, $title, $author, $url, $semantics, $encryptionID); |
172 | $i++; | 173 | $i++; |
173 | } | 174 | } |
174 | 175 | ||