about summary refs log tree commit diff stats
path: root/update/plugin/wordpress/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'update/plugin/wordpress/trunk')
-rw-r--r--update/plugin/wordpress/trunk/instadisc/instadisc.php46
1 files changed, 44 insertions, 2 deletions
diff --git a/update/plugin/wordpress/trunk/instadisc/instadisc.php b/update/plugin/wordpress/trunk/instadisc/instadisc.php index 6716b01..854b6cb 100644 --- a/update/plugin/wordpress/trunk/instadisc/instadisc.php +++ b/update/plugin/wordpress/trunk/instadisc/instadisc.php
@@ -184,6 +184,12 @@ function sendPost($id)
184 $authorName = $author->display_name; 184 $authorName = $author->display_name;
185 $url = get_permalink($id); 185 $url = get_permalink($id);
186 186
187 $encID = 0;
188 if (get_option('instaDisc_blogPost_password') != '')
189 {
190 $encID = encryptData($title, $author, $url, get_option('instaDisc_blogPost_password'));
191 }
192
187 $verID = rand(1,2147483647); 193 $verID = rand(1,2147483647);
188 194
189 $client = new xmlrpc_client(get_option('instaDisc_blogPost_centralServer')); 195 $client = new xmlrpc_client(get_option('instaDisc_blogPost_centralServer'));
@@ -194,7 +200,8 @@ function sendPost($id)
194 new xmlrpcval($title, 'string'), 200 new xmlrpcval($title, 'string'),
195 new xmlrpcval($authorName, 'string'), 201 new xmlrpcval($authorName, 'string'),
196 new xmlrpcval($url, 'string'), 202 new xmlrpcval($url, 'string'),
197 new xmlrpcval(serialize(array()), 'string'))); 203 new xmlrpcval(serialize(array()), 'string'),
204 new xmlrpcval($encID, 'int')));
198 $resp = $client->send($msg); 205 $resp = $client->send($msg);
199 $val = $resp->value()->scalarVal(); 206 $val = $resp->value()->scalarVal();
200 207
@@ -214,6 +221,12 @@ function sendComment($id)
214 $author = $comment->comment_author; 221 $author = $comment->comment_author;
215 $url = get_permalink($comment->comment_post_ID) . "#comments"; 222 $url = get_permalink($comment->comment_post_ID) . "#comments";
216 223
224 $encID = 0;
225 if (get_option('instaDisc_comment_password') != '')
226 {
227 $encID = encryptData($title, $author, $url, get_option('instaDisc_comment_password'));
228 }
229
217 $verID = rand(1,2147483647); 230 $verID = rand(1,2147483647);
218 231
219 $client = new xmlrpc_client(get_option('instaDisc_comment_centralServer')); 232 $client = new xmlrpc_client(get_option('instaDisc_comment_centralServer'));
@@ -224,7 +237,8 @@ function sendComment($id)
224 new xmlrpcval($title, 'string'), 237 new xmlrpcval($title, 'string'),
225 new xmlrpcval($author, 'string'), 238 new xmlrpcval($author, 'string'),
226 new xmlrpcval($url, 'string'), 239 new xmlrpcval($url, 'string'),
227 new xmlrpcval(serialize(array()), 'string'))); 240 new xmlrpcval(serialize(array()), 'string'),
241 new xmlrpcval($encID, 'int')));
228 $resp = $client->send($msg); 242 $resp = $client->send($msg);
229 $val = $resp->value()->scalarVal(); 243 $val = $resp->value()->scalarVal();
230 244
@@ -234,4 +248,32 @@ function sendComment($id)
234 } 248 }
235} 249}
236 250
251function encryptData(&$title, &$author, &$url, $password)
252{
253 $encID = rand(1,2147483647);
254
255 $cipher = "rijndael-128";
256 $mode = "cbc";
257 $key = substr(md5(substr(str_pad($password,16,$encID),0,16)),0,16);
258
259 $td = mcrypt_module_open($cipher, "", $mode, "");
260
261 $title = encryptString($td, $key, $title);
262 $author = encryptString($td, $key, $author);
263 $url = encryptString($td, $key, $url);
264
265 mcrypt_module_close($td);
266
267 return $encID;
268}
269
270function encryptString($td, $key, $string)
271{
272 mcrypt_generic_init($td, $key, strrev($key));
273 $string = bin2hex(mcrypt_generic($td, $string));
274 mcrypt_generic_deinit($td);
275
276 return $string;
277}
278
237?> 279?>