function processDocument($url, $headers, $document) { list($mimetype) = explode(';', $headers['Content-Type']); echo "Found " . $mimetype . "\n"; switch ($mimetype) { case 'application/atomserv+xml': $actions = parseIndexDocument($document, $url); break; case 'application/atom+xml': if (strpos($document, '<feed') !== FALSE) { // feed $actions = parseAtomFeed($document, $url, $headers); } elseif (strpos($document, '<entry') !== FALSE) { // entry $actions = parseAtomEntry($document, $url, $headers); } break; default: echo "Unknown format: " . $mimetype . "\n"; echo substr($document, 0, 1000) . "\n"; exit; } if (!$actions) { echo "Nothing found to do\n"; exit; } echo "Available actions:\n"; $items = array_keys($actions); $choice = doMenu($items); $chosenUrl = $actions[$items[$choice - 1]]; list($code, $document, $headers) = $chosenUrl->exec(); if (substr($code, 0, 1) == '2') { echo "Success: " . $code . "\n"; if ($document) { processDocument($chosenUrl, $headers, $document); } } else { echo "Error: " . $code . "\n"; } }
return false; } */ </script> </head> <!--<body onload="register()" onunload="deregister()">--> <body> <?php if (isset($_POST['sinatuta'])) { signDocument(); } else { processDocument(); print firm_form(); } ?> </body> </html> <?php /* * XML dokumentuan sinaduraren atala txertatzen du, sinatu beharreko hash-a eratuz. */ function processDocument() { global $src_file, $target_file, $user_pubkey_file_path, $user_cert_file_path; require dirname(__FILE__) . '/xmlseclibs.php';