diff options
Diffstat (limited to 'update/library/trunk')
| -rw-r--r-- | update/library/trunk/instadisc.php | 45 |
1 files changed, 41 insertions, 4 deletions
| diff --git a/update/library/trunk/instadisc.php b/update/library/trunk/instadisc.php index fc3ac08..3f9f945 100644 --- a/update/library/trunk/instadisc.php +++ b/update/library/trunk/instadisc.php | |||
| @@ -11,12 +11,17 @@ $idusSubscriptionURI = array(); | |||
| 11 | $idusSubscriptionTitle = array(); | 11 | $idusSubscriptionTitle = array(); |
| 12 | $idusSubscriptionCategory = array(); | 12 | $idusSubscriptionCategory = array(); |
| 13 | $idusActivationKey = array(); | 13 | $idusActivationKey = array(); |
| 14 | $idusEncryptionKey = array(); | ||
| 14 | $instaDisc_subCount = 0; | 15 | $instaDisc_subCount = 0; |
| 15 | 16 | ||
| 16 | function instaDisc_sendItem($id, $title, $author, $url, $semantics) | 17 | function instaDisc_sendItem($id, $title, $author, $url, $semantics, $verID = 0) |
| 17 | { | 18 | { |
| 18 | global $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI; | 19 | global $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI; |
| 19 | $verID = rand(1,65536); | 20 | |
| 21 | if ($verID == 0) | ||
| 22 | { | ||
| 23 | $verID = rand(1,65536); | ||
| 24 | } | ||
| 20 | 25 | ||
| 21 | $client = new xmlrpc_client($idusCentralServer[$id]); | 26 | $client = new xmlrpc_client($idusCentralServer[$id]); |
| 22 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($idusUsername[$id], 'string'), | 27 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($idusUsername[$id], 'string'), |
| @@ -30,9 +35,40 @@ function instaDisc_sendItem($id, $title, $author, $url, $semantics) | |||
| 30 | $client->send($msg); | 35 | $client->send($msg); |
| 31 | } | 36 | } |
| 32 | 37 | ||
| 33 | function instaDisc_addSubscription($username, $password, $central, $uri, $title, $category, $key = '') | 38 | function instaDisc_sendEncrypted($id, $title, $author, $url, $semantics) |
| 39 | { | ||
| 40 | global $idusEncryptionKey; | ||
| 41 | |||
| 42 | $verID = 0; | ||
| 43 | while ($verID == 0) | ||
| 44 | { | ||
| 45 | $verID = rand(1,65536); | ||
| 46 | } | ||
| 47 | |||
| 48 | $cipher = "rijndael-128"; | ||
| 49 | $mode = "cbc"; | ||
| 50 | $key = substr(md5(substr(str_pad($idusEncryptionKey[$id],16,$verID),0,16)),0,16); | ||
| 51 | |||
| 52 | $td = mcrypt_module_open($cipher, "", $mode, ""); | ||
| 53 | mcrypt_generic_init($td, $key, strrev($key)); | ||
| 54 | $title = bin2hex(mcrypt_generic($td, $title)); | ||
| 55 | $author = bin2hex(mcrypt_generic($td, $author)); | ||
| 56 | $url = bin2hex(mcrypt_generic($td, $url)); | ||
| 57 | |||
| 58 | foreach ($semantics as $name => $value) | ||
| 59 | { | ||
| 60 | $semantics[$name] = bin2hex(mcrypt_generic($td, $value)); | ||
| 61 | } | ||
| 62 | |||
| 63 | mcrypt_generic_deinit($td); | ||
| 64 | mcrypt_module_close($td); | ||
| 65 | |||
| 66 | instaDisc_sendItem($id, $title, $author, $url, $semantics, $verID); | ||
| 67 | } | ||
| 68 | |||
| 69 | function instaDisc_addSubscription($username, $password, $central, $uri, $title, $category, $key = '', $enc = '') | ||
| 34 | { | 70 | { |
| 35 | global $instaDisc_subCount, $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI, $idusSubscriptionTitle, $idusSubscriptionCategory, $idusActivationKey; | 71 | global $instaDisc_subCount, $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI, $idusSubscriptionTitle, $idusSubscriptionCategory, $idusActivationKey, $idusEncryptionKey; |
| 36 | $idusUsername[$instaDisc_subCount] = $username; | 72 | $idusUsername[$instaDisc_subCount] = $username; |
| 37 | $idusPassword[$instaDisc_subCount] = $password; | 73 | $idusPassword[$instaDisc_subCount] = $password; |
| 38 | $idusCentralServer[$instaDisc_subCount] = $central; | 74 | $idusCentralServer[$instaDisc_subCount] = $central; |
| @@ -40,6 +76,7 @@ function instaDisc_addSubscription($username, $password, $central, $uri, $title, | |||
| 40 | $idusSubscriptionTitle[$instaDisc_subCount] = $title; | 76 | $idusSubscriptionTitle[$instaDisc_subCount] = $title; |
| 41 | $idusSubscriptionCategory[$instaDisc_subCount] = $category; | 77 | $idusSubscriptionCategory[$instaDisc_subCount] = $category; |
| 42 | $idusActivationKey[$instaDisc_subCount] = $key; | 78 | $idusActivationKey[$instaDisc_subCount] = $key; |
| 79 | $idusEncryptionKey[$instaDisc_subCount] = $enc; | ||
| 43 | $instaDisc_subCount++; | 80 | $instaDisc_subCount++; |
| 44 | } | 81 | } |
| 45 | 82 | ||
