dom); default_login($econf); require_once 'process_document.php'; process_document($econf, $doc->dom, $out_doc); if ($doc->need_save()) { save_document($doc); } serve_document($doc, $out_doc); } function default_login($econf) { $w2mllog = get_http_parameter('w2mllog'); if ($w2mllog === 'out') { $econf->log_default_user('w2mllogout'); setcookie('w2mlusr', '', 1); setcookie('w2mlpwd', '', 1); } else { $w2mlusr = get_http_parameter('w2mlusr'); if ($w2mlusr === NULL) { $econf->log_default_user('w2mlanon'); } else { if ($econf->registered_users[$w2mlusr] !== NULL) { $econf->log_default_user('w2mlwrong'); } else { $econf->log_default_user('w2mlnolog'); setcookie('w2mlusr', $w2mlusr); $w2mlpwd = get_http_parameter('w2mlpwd'); if ($w2mlpwd !== NULL) { setcookie('w2mlpwd', $w2mlpwd); } } } } } function create_out_document($w2ml_doc) { $impl = new DOMImplementation; $doctype = clone_doctype($impl, $w2ml_doc); if ($doctype === NULL) { $out_doc = $impl->createDocument(NULL, NULL); } else { $out_doc = $impl->createDocument(NULL, NULL, $doctype); } $out_doc->encoding = 'UTF-8'; return $out_doc; } function serve_document($doc, $document) { $serialize_options = Serializer::NO_W2ML_NS_DECL; if (!$doc->has_xml_decl()) { $serialize_options |= Serializer::NO_XML_DECL; } if ($doc->req->meta_content_type_element() === NULL) { $serialize_options |= Serializer::NO_META_CONTENT_TYPE; } if ($_SERVER['REQUEST_METHOD'] === 'HEAD') { $serializer = new StringSerializer($serialize_options, $doc->replaced_doctype_system_id()); serialize_document($serializer, $document); header('Content-Length: '.strlen($serializer->str)); header('Content-Type: text/html; charset=utf-8'); } else { header('Content-Type: text/html; charset=utf-8'); $serializer = new SendSerializer($serialize_options, $doc->replaced_doctype_system_id()); serialize_document($serializer, $document); } } function save_document($doc) { $serialize_options = 0; if (!$doc->has_xml_decl()) { $serialize_options |= Serializer::NO_XML_DECL; } if ($doc->req->meta_content_type_element() === NULL) { $serialize_options |= Serializer::NO_META_CONTENT_TYPE; } $serializer = new SaveSerializer($doc, $serialize_options); serialize_document_in_xml($serializer, $doc->dom); } ?>