send($msg); if ($resp->value() == 2) { return instaDisc_sendItem($id, $title, $author, $url, $semantics, $encryptionID); } else if ($resp->value() == 0) { return TRUE; } else { return FALSE; } } function instaDisc_sendEncrypted($id, $title, $author, $url, $semantics) { global $idusEncryptionKey; $encID = 0; while ($encID == 0) { $encID = rand(1,2147483647); } $cipher = "rijndael-128"; $mode = "cbc"; $key = substr(md5(substr(str_pad($idusEncryptionKey[$id],16,$encID),0,16)),0,16); $td = mcrypt_module_open($cipher, "", $mode, ""); mcrypt_generic_init($td, $key, strrev($key)); $title = bin2hex(mcrypt_generic($td, $title)); mcrypt_generic_deinit($td); mcrypt_generic_init($td, $key, strrev($key)); $author = bin2hex(mcrypt_generic($td, $author)); mcrypt_generic_deinit($td); mcrypt_generic_init($td, $key, strrev($key)); $url = bin2hex(mcrypt_generic($td, $url)); mcrypt_generic_deinit($td); foreach ($semantics as $name => $value) { mcrypt_generic_init($td, $key, strrev($key)); $semantics[$name] = bin2hex(mcrypt_generic($td, $value)); mcrypt_generic_deinit($td); } mcrypt_module_close($td); return instaDisc_sendItem($id, $title, $author, $url, $semantics, $encID); } function instaDisc_addSubscription($username, $password, $central, $uri, $title, $category, $key = '', $enc = '') { global $instaDisc_subCount, $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI, $idusSubscriptionTitle, $idusSubscriptionCategory, $idusActivationKey, $idusEncryptionKey; $idusUsername[$instaDisc_subCount] = $username; $idusPassword[$instaDisc_subCount] = $password; $idusCentralServer[$instaDisc_subCount] = $central; $idusSubscriptionURI[$instaDisc_subCount] = $uri; $idusSubscriptionTitle[$instaDisc_subCount] = $title; $idusSubscriptionCategory[$instaDisc_subCount] = $category; $idusActivationKey[$instaDisc_subCount] = $key; $idusEncryptionKey[$instaDisc_subCount] = $enc; $instaDisc_subCount++; } ?>