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; } $_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 = ? and ?'", $app->db->quote($_POST['zone']), $app->tform->getAuthSQL('r')); $sql=$app->db->queryOneRecord("SELECT dkim_public, dkim_selector FROM mail_domain WHERE domain = ? AND dkim = 'Y' AND ?", substr_replace($soa['origin'],'',-1), $app->tform->getAuthSQL('r')); $public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$sql['dkim_public']); echo "\n"; echo "\n"; echo "".$public_key."\n"; echo "".$soa['origin']."\n"; echo "".$sql['dkim_selector']."\n"; echo "\n"; } ?>