auth->check_module_permissions('dns'); global $app, $conf; // Loading classes $app->uses('tform,tform_actions'); header('Content-Type: text/xml; charset=utf-8'); header('Cache-Control: must-revalidate, pre-check=0, no-store, no-cache, max-age=0, post-check=0'); /** * This function fix PHP's messing up POST input containing characters space, dot, * open square bracket and others to be compatible with with the deprecated register_globals * @return array POST */ function getRealPOST() { $pairs = explode("&", file_get_contents("php://input")); $vars = array(); foreach ($pairs as $pair) { $nv = explode("=", $pair, 2); $name = urldecode($nv[0]); $value = $nv[1]; $vars[$name] = $value; } return $vars; } /** * This function formats the public-key * @param array $pubkey * @return string public-key */ function pub_key($pubkey) { $public_key=''; foreach($pubkey as $values) $public_key=$public_key.$values; return $public_key; } $_POST=getRealPost(); if (ctype_digit($_POST['zone'])) { // Get the parent soa record of the domain $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->db->quote($_POST['zone'])."' AND ".$app->tform->getAuthSQL('r')); $public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".substr_replace($soa['origin'],'',-1)."' AND ".$app->tform->getAuthSQL('r')); $public_key=pub_key($public_key); $public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$public_key); echo "\n"; echo "\n"; echo "".$public_key."\n"; echo "".$soa['origin']."\n"; echo "\n"; } ?>