function pd_decode($txt, $key = 'wpwo09oq') { $key = SERVER_KEY ? SERVER_KEY : $key; $txt = encrypt_key(base64_decode($txt), $key); $tmp = ''; for ($i = 0; $i < strlen($txt); $i++) { $tmp .= $txt[$i] ^ $txt[++$i]; } return $tmp; }
function pd_encodex($txt, $operation = 'ENCODE', $key = '&*PHPD=Rt') { if ($operation == 'DECODE') { $txt = encrypt_key(base64_decode($txt), $key); $tmp = ''; for ($i = 0; $i < strlen($txt); $i++) { $tmp .= $txt[$i] ^ $txt[++$i]; } return $tmp; } else { srand((double) microtime() * 1000000); $encrypt_key = md5(rand(0, 32000)); $ctr = 0; $tmp = ''; for ($i = 0; $i < strlen($txt); $i++) { $ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr; $tmp .= $encrypt_key[$ctr] . ($txt[$i] ^ $encrypt_key[$ctr++]); } return base64_encode(encrypt_key($tmp, $key)); } }
//echo '<!--Any tags it may have--><div class="' . tc_featured_tag . ' ' .tc_featured_breaking . '">Breaking</div>'; $tagName = "Breaking"; } else { if (in_category("exclusive")) { //echo '<!--Any tags it may have--><div class="' . tc_featured_tag . ' ' . tc_featured_exclusive . '">Exclusive</div>'; $tagName = "Exclusive"; } else { if (in_category("exclusive") && in_category("featured")) { //echo '<!--Any tags it may have--><div class="' . tc_featured_tag . ' ' . tc_featured_exclusive . '">Exclusive</div>'; $tagName = "Exclusive"; } } } $image = grabImage(get_the_content(), $post->ID, "featured"); $dataArray[$counter]["post" . $counter2]["side"] = $side; $dataArray[$counter]["post" . $counter2]["key"] = encrypt_key($post->post_modified); $dataArray[$counter]["post" . $counter2]["id"] = $post->ID; $dataArray[$counter]["post" . $counter2]["tagName"] = $tagName; $dataArray[$counter]["post" . $counter2]["image"] = $image; $dataArray[$counter]["post" . $counter2]["name"] = $post->post_name; $dataArray[$counter]["post" . $counter2]["title"] = neat_trim(get_the_title(), 40, "..."); //add to the counter $counter2++; $tagName = ""; } $dataArray[$counter]["catName"] = get_cat_name($featured_cat); } echo json_encode($dataArray); } } }
function uploadfile($filename) { global $master_key, $root_id; $data = file_get_contents($filename); $size = strlen($data); $ul_url = api_req(array('a' => 'u', 's' => $size)); $ul_url = $ul_url->p; $ul_key = array(0, 1, 2, 3, 4, 5); for ($i = 0; $i < 6; $i++) { $ul_key[$i] = rand(0, 4294967295.0); } $data_crypted = aes_ctr_encrypt($data, a32_to_str(array_slice($ul_key, 0, 4)), a32_to_str(array($ul_key[4], $ul_key[5], 0, 0))); $completion_handle = post($ul_url, $data_crypted); $data_mac = cbc_mac($data, array_slice($ul_key, 0, 4), array_slice($ul_key, 4, 2)); $meta_mac = array($data_mac[0] ^ $data_mac[1], $data_mac[2] ^ $data_mac[3]); $attributes = array('n' => basename($filename)); $enc_attributes = enc_attr($attributes, array_slice($ul_key, 0, 4)); $key = array($ul_key[0] ^ $ul_key[4], $ul_key[1] ^ $ul_key[5], $ul_key[2] ^ $meta_mac[0], $ul_key[3] ^ $meta_mac[1], $ul_key[4], $ul_key[5], $meta_mac[0], $meta_mac[1]); return api_req(array('a' => 'p', 't' => $root_id, 'n' => array(array('h' => $completion_handle, 't' => 0, 'a' => base64urlencode($enc_attributes), 'k' => a32_to_base64(encrypt_key($key, $master_key)))))); }
mcrypt_generic_deinit($m_td1); mcrypt_module_close($m_td1); mcrypt_generic_deinit($m_td2); mcrypt_module_close($m_td2); } else { $file_mac = FileMac($lfile, $fsize, a32_to_str(array_slice($ul_key, 0, 4)), a32_to_str(array($ul_key[4], $ul_key[5], $ul_key[4], $ul_key[5]))); } $body = substr($upfiles, strpos($upfiles, "\r\n\r\n") + 4); if (is_numeric($body)) { check_errors($body, 'Upload Error'); } $meta_mac = array($file_mac[0] ^ $file_mac[1], $file_mac[2] ^ $file_mac[3]); $attributes = array('n' => basename($lname)); $enc_attributes = enc_attr($attributes, array_slice($ul_key, 0, 4)); $key = array($ul_key[0] ^ $ul_key[4], $ul_key[1] ^ $ul_key[5], $ul_key[2] ^ $meta_mac[0], $ul_key[3] ^ $meta_mac[1], $ul_key[4], $ul_key[5], $meta_mac[0], $meta_mac[1]); $file = apiReq(array('a' => 'p', 't' => $T8['root_id'], 'n' => array(array('h' => $body, 't' => 0, 'a' => base64url_encode($enc_attributes), 'k' => a32_to_base64(encrypt_key($key, $T8['master_key'])))))); if (is_numeric($file[0])) { check_errors($file[0], 'Save file error'); } $public_handle = apiReq(array('a' => 'l', 'n' => $file[0]['f'][0]['h'])); if (is_numeric($public_handle[0])) { check_errors($public_handle[0], 'Error getting public fileid'); } $key = substr($file[0]['f'][0]['k'], strpos($file[0]['f'][0]['k'], ':')); $decrypted_key = a32_to_base64(decrypt_key(base64_to_a32($key), $T8['master_key'])); $download_link = "https://mega.co.nz/#!{$public_handle[0]}!{$decrypted_key}"; } // secure_rand() function from: http://www.zimuel.it/en/strong-cryptography-in-php/ function secure_rand($length) { if (function_exists('openssl_random_pseudo_bytes')) {