/** * Export object config * * @return CMbXMLDocument */ function exportXMLConfigValues() { $doc = new CMbXMLDocument(); $root = $doc->addElement($doc, $this->_class); foreach ($this->getConfigValues() as $key => $value) { $node = $doc->addElement($root, "entry"); $node->setAttribute("config", $key); $node->setAttribute("value", $value); } return $doc; }
/** * Export XML * * @return CMbXMLDocument */ function exportXML() { $doc = new CMbXMLDocument(); $root = $doc->addElement($doc, $this->_class); foreach ($this->getConfigFields() as $field) { $node = $doc->addElement($root, "entry"); $node->setAttribute("config", $field); $node->setAttribute("value", $this->{$field}); } return $doc; }
/** * @see parent::getHPrimXMLEvenements */ static function getHPrimXMLEvenements($messageServeurActivitePmsi) { $hprimxmldoc = new CMbXMLDocument(); $hprimxmldoc->loadXML($messageServeurActivitePmsi); $xpath = new CMbXPath($hprimxmldoc); $event = $xpath->queryUniqueNode("/*/*[2]"); $dom_evt = new CHPrimXMLEvenementsServeurActivitePmsi(); if ($nodeName = $event->nodeName) { $dom_evt = new CHPrimXMLEventServeurActivitePmsi::$evenements[$nodeName](); } $dom_evt->loadXML($messageServeurActivitePmsi); return $dom_evt; }
/** * Export to DOM * * @return CMbXMLDocument */ function toDOM() { $this->doc = new CMbXMLDocument("utf-8"); $this->doc->formatOutput = true; $root = $this->doc->createElement("mediboard-export"); $root->setAttribute("date", CMbDT::dateTime()); $root->setAttribute("root", $this->object->_guid); $this->doc->appendChild($root); $this->_toDOM($this->object, $this->depth); return $this->doc; }
function load($file, $options = null) { parent::load($file); $root = $this->documentElement; list($this->object_class, $this->object_id) = explode("-", $root->nodeName); $objectNodes = $root->childNodes; $objects = array(); foreach ($objectNodes as $node) { $values = $this->getFields($node); $refs = $this->getRefs($node); $objects[$node->getAttribute("id")] = new CMbObjectImport($node->nodeName, $values, $refs); } $this->objects_values = $objects; }
/** * @see parent::getAcknowledgment */ function getAcknowledgment() { $dom = new CMbXMLDocument("UTF-8"); $dom->loadXMLSafe($this->ack_data); $xpath = new CMbXPath($dom); $xpath->registerNamespace("rs", "urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"); $xpath->registerNamespace("rim", "urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"); $status = $xpath->queryAttributNode(".", null, "status"); if ($status === "urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure") { $nodes = $xpath->query("//rs:RegistryErrorList/rs:RegistryError"); $ack = array(); foreach ($nodes as $_node) { $ack[] = array("status" => $xpath->queryAttributNode(".", $_node, "codeContext"), "context" => $xpath->queryAttributNode(".", $_node, "errorCode")); } } else { $nodes = $xpath->query("//rim:RegistryObjectList/rim:ObjectRef"); $ack = array(); foreach ($nodes as $_node) { $ack[] = array("status" => $xpath->queryAttributNode(".", $_node, "id"), "context" => ""); } } return $ack; }
/** * Add element * * @param string $elParent Parent element * @param string $elName Name * @param string $elValue Value * @param string $elNS Namespace * * @return mixed */ function addElement($elParent, $elName, $elValue = null, $elNS = "urn:hl7-org:v2xml") { return parent::addElement($elParent, $elName, $elValue, $elNS); }
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $actor_guid = CValue::request("actor_guid"); $format_config_guid = CValue::request("format_config_guid"); $file = isset($_FILES['import']) ? $_FILES['import'] : null; if (!empty($file) && ($contents = file_get_contents($file['tmp_name']))) { $actor = CMbObject::loadFromGuid($actor_guid); $format_config = CMbObject::loadFromGuid($format_config_guid); if (!$format_config->sender_class || !$format_config->sender_id) { $format_config->sender_class = $actor->_class; $format_config->sender_id = $actor->_id; } $dom = new CMbXMLDocument(); $dom->loadXML($contents); $root_name = $dom->documentElement->nodeName; $fields = $format_config->getPlainFields(); unset($fields[$format_config->_spec->key]); unset($fields["sender_id"]); unset($fields["sender_class"]); if ($root_name == $format_config->_class) { $xpath = new CMbXPath($dom); $nodeList = $xpath->query("//{$root_name}/*"); $array_configs = array(); foreach ($nodeList as $_node) { $config = $xpath->getValueAttributNode($_node, "config"); $value = $xpath->getValueAttributNode($_node, "value"); $array_configs[$config] = $value; }
/** * Retourne une entrée dans un jeux de valeur * * @param String $name Nom du jeux de valeur * @param String $code Identifiant de la valeur voulut * * @return array */ static function loadEntryJV($name, $code) { $path = "modules/xds/resources/jeux_de_valeurs/{$name}"; $dom = new CMbXMLDocument(); $dom->load($path); $xpath = new CMbXPath($dom); $node = $xpath->queryUniqueNode("//line[@id='{$code}']"); $valeur = array("id" => $xpath->queryAttributNode(".", $node, "id"), "oid" => $xpath->queryAttributNode(".", $node, "oid"), "name" => $xpath->queryAttributNode(".", $node, "name")); return $valeur; }
/** * Création d'un noeud pour lcm * * @param DOMNode $nodeParent Noeud parent * @param String $name Nom du noeud * @param String $value Valeur du noeud * * @return DOMElement */ function createLcmElement($nodeParent, $name, $value = null) { return parent::addElement($nodeParent, "lcm:{$name}", $value, "urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"); }
/** * @see parent::__construct() */ function __construct() { parent::__construct("UTF-8"); $this->formatOutput = true; $this->addElement($this, "jeuxValeurs"); }
function __construct($encoding = "iso-8859-1") { parent::__construct($encoding); $this->msg_version = self::VERSION; $this->hostname = $this->guessHostname(); $this->app_name = self::APPNAME; $this->procid = ($procid = getmypid()) ? $procid : self::PROCID; $this->setTimestamp(CMbDT::dateTime()); }
/** * fonction permettant de créér la structure principal des classes d'un XSD * * @return bool */ static function createClassFromXSD() { $pathXSD = "modules/cda/resources/POCD_MT000040.xsd"; $pathDir = "modules/cda/classes/classesCDA/classesGenerate/"; $dom = new CMbXMLDocument("UTF-8"); $dom->load($pathXSD); $xpath = new CMbXPath($dom); $xpath->registerNamespace("xs", "http://www.w3.org/2001/XMLSchema"); $nodeList = $xpath->query("//xs:complexType[@name] | //xs:simpleType[@name]"); foreach ($nodeList as $_node) { $tabVariable = array(); $tabProps = array(); /** @var DOMElement $_node */ $elements = $_node->getElementsByTagName("element"); $nodeAttributes = $_node->getElementsByTagName("attribute"); $nameNode = $xpath->queryAttributNode(".", $_node, "name"); $nameNode = str_replace(".", "_", $nameNode); list($tabVariable, $tabProps) = self::createPropsForElement($elements, $tabVariable, $tabProps); list($tabVariable, $tabProps) = self::createPropsForElement($nodeAttributes, $tabVariable, $tabProps); $smarty = new CSmartyDP(); $smarty->assign("name", $nameNode); $smarty->assign("variables", $tabVariable); $smarty->assign("props", $tabProps); $data = $smarty->fetch("defaultClassCDA.tpl"); file_put_contents($pathDir . "CCDA" . $nameNode . ".class.php", $data); } return true; }
// fin du foreach CAppUI::stepAjax("Analyses Importées: " . $compteur["analyses"] . ", Chapitres Importés: " . $compteur["chapitres"] . ", Sous chapitres Importés: " . $compteur["sousChapitre"], UI_MSG_OK); } // Check import configuration $clCconfig = CAppUI::conf("{$m} CCatalogueLabo"); if (null == ($remote_name = $clCconfig["remote_name"])) { CAppUI::stepAjax("Remote name not configured", UI_MSG_ERROR); } if (null == ($remote_url = $clCconfig["remote_url"])) { CAppUI::stepAjax("Remote URL not configured", UI_MSG_ERROR); } if (false === ($content = file_get_contents($remote_url))) { CAppUI::stepAjax("Couldn't connect to remote url", UI_MSG_ERROR); } // Check imported catalogue document $doc = new CMbXMLDocument(); if (!$doc->loadXML($content)) { CAppUI::stepAjax("Document is not well formed", UI_MSG_ERROR); } $tmpPath = "tmp/dPlabo/import_catalogue.xml"; CMbPath::forceDir(dirname($tmpPath)); $doc->save($tmpPath); $doc->load($tmpPath); if (!$doc->schemaValidate("modules/{$m}/remote/catalogue.xsd")) { CAppUI::stepAjax("Document is not valid", UI_MSG_ERROR); } CAppUI::stepAjax("Document is valid", UI_MSG_OK); // Check access to idSante400 $canSante400 = CModule::getCanDo("dPsante400"); if (!$canSante400->edit) { CAppUI::stepAjax("No permission for module 'dPsante400' or module not installed", UI_MSG_ERROR);
/** * @see parent::isWellFormed() */ function isWellFormed($data) { $dom = new CMbXMLDocument(); if ($dom->loadXML($data, LIBXML_NOWARNING | LIBXML_NOERROR) !== false) { return $dom; } return null; }
$where = array(); CApp::setTimeLimit(300); $loops = CValue::get("loops", 100); $trunk = CValue::get("trunk", 100); mbTrace($loops, "loops"); mbTrace($trunk, "trunk"); $problems = array(); for ($loop = 0; $loop < $loops; $loop++) { $starting = $loop * $trunk; $ds = $doc->_spec->ds; $query = "SELECT `compte_rendu`.`compte_rendu_id`, `contenthtml`.`content` \r\n FROM compte_rendu, contenthtml\r\n WHERE compte_rendu.content_id = contenthtml.content_id\r\n ORDER BY compte_rendu_id DESC\r\n LIMIT {$starting}, {$trunk}"; $docs = $ds->loadHashList($query); foreach ($docs as $doc_id => $doc_source) { // Root node surrounding $source = utf8_encode("<div>{$doc_source}</div>"); // Entity purge $source = preg_replace("/&\\w+;/i", "", $source); // Escape warnings, returns false if really invalid $doc = new CMbXMLDocument(); if (false == ($validation = $doc->loadXML($source))) { $doc = new CCompteRendu(); $doc->load($doc_id); $problems[$doc_id] = $doc; } } } mbTrace(count($problems), "Problems count"); // Création du template $smarty = new CSmartyDP(); $smarty->assign("problems", $problems); $smarty->display("check_document.tpl");
* $Id$ * * @package Mediboard * @subpackage Labo * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ if (!class_exists("DOMDocument")) { trigger_error("sorry, DOMDocument is needed"); return; } CCanDo::checkRead(); $mbPrescription = new CPrescriptionLabo(); $doc = new CMbXMLDocument(); $docReference = new CMbXMLDocument(); $docReference->load("modules/dPlabo/remote/prescription.xml"); $docReference->setSchema("modules/dPlabo/remote/prescription.xsd"); $doc->setSchema("modules/dPlabo/remote/prescription.xsd"); if (!$doc->checkSchema()) { return; } // Chargement de la prescription $mb_prescription_id = CValue::post("mb_prescription_id", 2); if ($mbPrescription->load($mb_prescription_id)) { $mbPrescription->loadRefs(); } $doc->setDocument("tmp/Prescription-" . $mbPrescription->_id . ".xml"); $prescription = $doc->addElement($doc, "prescription"); $doc->addAttribute($prescription, "id", $mbPrescription->_id); $doc->addAttribute($prescription, "date", CMbDT::date());
* @link http://www.mediboard.org */ CPasswordKeeper::checkHTTPS(); CCanDo::checkAdmin(); $password_keeper_id = CValue::postOrSession("password_keeper_id"); $oldPassphrase = CValue::post("oldPassphrase"); $newPassphrase = CValue::post("newPassphrase"); $passphrase = CValue::sessionAbs("passphrase"); if ($passphrase != $oldPassphrase) { $msg = "Phrase de passe incorrecte."; CAppUI::stepAjax($msg, UI_MSG_ERROR); } $user = CMediusers::get(); $keeper = new CPasswordKeeper(); $keeper->load($password_keeper_id); if ($keeper->_id && $keeper->user_id == $user->_id) { $dom = new CMbXMLDocument("ISO-8859-1"); $keeperNode = $dom->addElement($dom, "keeper"); $dom->addAttribute($keeperNode, "name", $keeper->keeper_name); $categoriesNode = $dom->addElement($keeperNode, "categories"); foreach ($keeper->loadRefsCategories() as $_category) { $categoryNode = $dom->addElement($categoriesNode, "category"); $dom->addAttribute($categoryNode, "name", $_category->category_name); $passwordsNode = $dom->addElement($categoryNode, "passwords"); foreach ($_category->loadRefsPasswords() as $_password) { // Déchiffrement du mot de passe $_password->password = $_password->getPassword(); // Génération d'un nouveau vecteur d'inistalisation $_password->generateIV(); // Chiffrement avec la nouvelle phrase de passe saisie $newPass = $_password->encrypt($newPassphrase); $passwordNode = $dom->addElement($passwordsNode, "password");
$root = $doc->createElement("modeles"); $doc->appendChild($root); $where = array("compte_rendu_id" => CSQLDataSource::prepareIn($modeles_ids)); // Récupération des header_id, footer_id, preface_id et ending_id $ds = CSQLDataSource::get("std"); $request = new CRequest(); $request->addTable("compte_rendu"); $request->addWhere($where); $components_ids = array(); foreach (array("header_id", "footer_id", "preface_id", "ending_id") as $_component) { $request->select = array(); $request->addSelect($_component); $components_ids = array_merge($components_ids, $ds->loadColumn($request->makeSelect())); } $modeles_ids = array_unique(array_merge($components_ids, $modeles_ids)); CMbArray::removeValue("", $modeles_ids); foreach ($modeles_ids as $_modele_id) { $modele = CApp::fetch("dPcompteRendu", "ajax_export_modele", array("modele_id" => $_modele_id)); $doc_modele = new CMbXMLDocument(null); @$doc_modele->loadXML($modele); // Importation du noeud CPrescription $modele_importe = $doc->importNode($doc_modele->firstChild, true); // Ajout de ce noeud comme fils de protocoles $doc->documentElement->appendChild($modele_importe); } $filename = 'Modèles ' . ($owner ? " - {$owner}" : '') . ($object_class ? " - " . CAppUI::tr($object_class) : '') . '.xml'; $content = $doc->saveXML(); header('Content-Type: text/xml'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Content-Length: ' . strlen($content) . ';'); echo $content;
/** * @see parent::saveFinalFile */ function saveFinalFile() { $this->documentfinalfilename = "{$this->finalpath}/{$this->documentfinalprefix}-{$this->now}.xml"; CMbPath::forceDir(dirname($this->documentfinalfilename)); parent::save($this->documentfinalfilename); }
/** * Dumps the internal XML tree back into a string * * @return void */ function saveFileXML() { parent::saveXML(); }
* * @category Password Keeper * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @link http://www.mediboard.org */ CApp::setTimeLimit(360); // Récupération du fichier $file = CValue::files('datafile'); $passphrase = CValue::post('passphrase'); if (!$passphrase || !$file) { $msg = "Le fichier et la phrase de passe doivent être saisis."; CAppUI::stepAjax($msg, UI_MSG_ERROR); } $user = CMediusers::get(); $dom = new CMbXMLDocument(); if (!$dom->load($file['tmp_name'])) { CAppUI::redirect('m=passwordKeeper&a=vw_import_keeper&dialog=1'); } $xpath = new CMbXPath($dom); $keeperNode = $xpath->queryUniqueNode("/keeper"); $keeperName = $keeperNode->getAttribute("name"); if ($keeperNode->nodeName != "keeper") { CAppUI::redirect('m=passwordKeeper&a=vw_import_keeper&dialog=1'); } $keeper = new CPasswordKeeper(); $keeper->keeper_name = $keeperName; $keeper->_passphrase = $passphrase; $keeper->user_id = $user->_id; $keeper->store(); $categoryNodes = $xpath->query("//category");
public function setEVAttributes(DOMElement $dom_node, $csd_code, $original_text, $code_system_name) { $this->msg_xml->addAttribute($dom_node, 'csd-code', $csd_code); $this->msg_xml->addAttribute($dom_node, 'originalText', $original_text); $this->msg_xml->addAttribute($dom_node, 'codeSystemName', $code_system_name); }
/** * Check service availability * * @throws CMbException * * @return void */ public function checkServiceAvailability() { $url = $this->wsdl_url; if ($this->wsdl_original) { $url = $this->wsdl_original; } $xml = file_get_contents($url); $dom = new CMbXMLDocument(); $dom->loadXML($xml); $xpath = new CMbXPath($dom); $xpath->registerNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/"); $xpath->registerNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/"); $xpath->registerNamespace("soap12", "http://schemas.xmlsoap.org/wsdl/soap12"); $login = CMbArray::get($this->options, "login"); $password = CMbArray::get($this->options, "password"); $service_nodes = $xpath->query("//wsdl:service"); foreach ($service_nodes as $_service_node) { $service_name = $_service_node->getAttribute("name"); $port_nodes = $xpath->query("wsdl:port", $_service_node); foreach ($port_nodes as $_port_node) { $address = $xpath->queryAttributNode("soap:address|soap12:address", $_port_node, "location"); if (!$address) { continue; } if ($login && $password) { $address = str_replace("://", "://{$login}:{$password}@", $address); } // Url exist $url_exist = CHTTPClient::checkUrl($address, $this->check_option); if (!$url_exist) { throw new CMbException("Service '{$service_name}' injoignable à l'adresse : <em>{$address}</em>"); } } } }
/** * Lecture du fichier XML associé au rejet * * @param string $content_file contenu du fichier * @param bool $details enregistrement des informations * * @return null */ function readXML($content_file = null, $details = false) { if (!$content_file) { $file = $this->loadRefFile(); $file->updateFormFields(); $content_file = file_get_contents($file->_file_path); } $doc = new CMbXMLDocument("UTF-8"); $doc->loadXMLSafe($content_file); $xpath = new CMbXPath($doc); $xpath->registerNamespace("invoice", "http://www.forum-datenaustausch.ch/invoice"); $payload = $xpath->queryUniqueNode("//invoice:payload"); $timestamp = $xpath->getValueAttributNode($payload, "response_timestamp"); $this->date = strftime('%Y-%m-%d', $timestamp); $invoice = $xpath->queryUniqueNode("//invoice:invoice"); $this->num_facture = $xpath->getValueAttributNode($invoice, "request_id"); $this->_date_facture = $xpath->getValueAttributNode($invoice, "request_date"); $insurance = $xpath->queryUniqueNode("//invoice:insurance"); $ean_party = $xpath->getValueAttributNode($insurance, "ean_party"); $corr = new CCorrespondantPatient(); $corr->ean = $ean_party; $corr->loadMatchingObject(); $this->name_assurance = $corr->nom; $patient = $xpath->queryUniqueNode("//invoice:patient"); $this->_avs = $xpath->getValueAttributNode($patient, "ssn"); if ($company = $xpath->queryUniqueNode("//invoice:contact/invoice:company")) { $this->_contact[] = $xpath->queryTextNode("invoice:companyname", $company); $this->_contact[] = $xpath->queryTextNode("invoice:department", $company); $this->_contact[] = $xpath->queryTextNode("invoice:subaddressing", $company); $postal = $xpath->queryUniqueNode("invoice:postal", $company); $this->_contact[] = $xpath->queryTextNode("invoice:pobox", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:street", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:zip", $postal) . " " . $xpath->queryTextNode("invoice:city", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:telecom", $company)); $this->_contact[] = $xpath->queryTextNode("invoice:email", $xpath->queryUniqueNode("invoice:online", $company)); } if ($employee = $xpath->queryUniqueNode("//invoice:contact/invoice:employee")) { $this->_contact[] = $xpath->getValueAttributNode($employee, "salutation") . " " . $xpath->queryTextNode("invoice:givenname", $employee) . " " . $xpath->queryTextNode("invoice:familyname", $employee); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:telecom", $employee)); $this->_contact[] = $xpath->queryTextNode("invoice:email", $xpath->queryUniqueNode("invoice:online", $employee)); } if ($person = $xpath->queryUniqueNode("//invoice:contact/invoice:person")) { $this->_contact[] = $xpath->getValueAttributNode($person, "salutation") . " " . $xpath->queryTextNode("invoice:givenname", $person) . " " . $xpath->queryTextNode("invoice:familyname", $person); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:subaddressing", $person)); $postal = $xpath->queryUniqueNode("invoice:postal", $person); $this->_contact[] = $xpath->queryTextNode("invoice:pobox", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:street", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:zip", $postal) . " " . $xpath->queryTextNode("invoice:city", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:telecom", $person)); $this->_contact[] = $xpath->queryTextNode("invoice:email", $xpath->queryUniqueNode("invoice:online", $person)); } $this->_contact = array_filter($this->_contact); $pending = $xpath->query("//invoice:pending"); foreach ($pending as $_pending) { $explanation = $xpath->queryTextNode("invoice:explanation", $_pending); $this->motif_rejet = "{$explanation} \r\n"; $this->_commentaire = $explanation; $this->_status_in = $xpath->getValueAttributNode($_pending, "status_in"); $this->_status_out = $xpath->getValueAttributNode($_pending, "status_out"); $nb_message = 0; $messages = $xpath->query("//invoice:message"); foreach ($messages as $_message) { $code = $xpath->getValueAttributNode($_message, "code"); $text = $xpath->getValueAttributNode($_message, "text"); if (!$details) { $this->motif_rejet .= "{$code}: {$text} \r\n"; } else { $this->_erreurs[$nb_message]['code'] = $code; $this->_erreurs[$nb_message]['text'] = $text; } $nb_message++; } $this->_pending = 1; } $rejected = $xpath->query("//invoice:rejected"); foreach ($rejected as $_rejected) { $explanation = $xpath->queryTextNode("invoice:explanation", $_rejected); $this->motif_rejet = "{$explanation} \r\n"; $this->_commentaire = $explanation; $this->_status_in = $xpath->getValueAttributNode($_rejected, "status_in"); $this->_status_out = $xpath->getValueAttributNode($_rejected, "status_out"); $nb_message = 0; $messages = $xpath->query("//invoice:error"); foreach ($messages as $_message) { $code = $xpath->getValueAttributNode($_message, "code"); $text = $xpath->getValueAttributNode($_message, "text"); if (!$details) { $this->motif_rejet .= "{$code}: {$text} \r\n"; } else { $this->_erreurs[$nb_message]['code'] = $code; $this->_erreurs[$nb_message]['text'] = $text; } if ($error_value = $xpath->getValueAttributNode($_message, "error_value")) { $valid_value = $xpath->getValueAttributNode($_message, "valid_value"); if (!$details) { $this->motif_rejet .= "({$error_value}/{$valid_value})"; } else { $this->_erreurs[$nb_message]['error_value'] = $error_value; $this->_erreurs[$nb_message]['valid_value'] = $valid_value; $this->_erreurs[$nb_message]['record_id'] = $xpath->getValueAttributNode($_message, "record_id"); } } $nb_message++; } } if (!$details) { if ($msg = $this->store()) { mbTrace($msg); } } }
/** * Création du xml en UTF-8 */ function __construct() { parent::__construct("UTF-8"); $this->preserveWhiteSpace = true; $this->formatOutput = false; }
/** * Nettoie du code HTML * * @param string $html the html string * * @return string the cleaned html */ static function sanitizeHTML($html) { //check if html is present if (!preg_match("/<html/", $html)) { $html = '<html><head><title>E-mail</title></head><body>' . $html . '</body></html>'; } //=>XML $html = CMbString::convertHTMLToXMLEntities($html); //load & repair dom $document = new CMbXMLDocument(); $document->preserveWhiteSpace = false; @$document->loadHTML($html); //remove scripts tag $xpath = new DOMXpath($document); $filter = array("//script", "//meta", "//applet", "//iframe"); //some dangerous foreach ($filter as $_filter) { $elements = $xpath->query($_filter); foreach ($elements as $_element) { $_element->parentNode->removeChild($_element); } } $html = $document->saveHTML(); //Cleanup after save $html = preg_replace("/<!DOCTYPE(.*?)>/", '', $html); $html = preg_replace("/\\/\\/>/mu", "/>", $html); $html = preg_replace("/nowrap/", '', $html); $html = preg_replace("/<[b|h]r([^>]*)>/", "<br \$1/>", $html); $html = preg_replace("/<img([^>]+)>/", "<img\$1/>", $html); return $html; }
* @subpackage Labo * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 19460 $ */ function redirect() { echo CAppUI::getMsg(); CApp::rip(); } if (!class_exists("DOMDocument")) { trigger_error("sorry, DOMDocument is needed"); return; } CCanDo::checkRead(); $doc = new CMbXMLDocument(); $doc->setSchema("modules/dPlabo/remote/prescription.xsd"); if (!$doc->checkSchema()) { CAppUI::setMsg("Schema manquant", UI_MSG_ERROR); redirect(); } $mbPrescription = new CPrescriptionLabo(); // Chargement de la prescription $mb_prescription_id = CValue::post("prescription_labo_id", null); if (!$mb_prescription_id) { CAppUI::setMsg("Veuillez spécifier une prescription", UI_MSG_ERROR); redirect(); } if ($mbPrescription->load($mb_prescription_id)) { $mbPrescription->loadRefs(); }
default: $user_id = $owner->_id; break; case "CFunctions": $function_id = $owner->_id; break; case "CGroups": $group_id = $owner->_id; } $file = $_FILES['datafile']; if (strtolower(pathinfo($file['name'], PATHINFO_EXTENSION) !== "xml")) { CAppUI::stepAjax("Fichier non reconnu", UI_MSG_ERROR); CApp::rip(); } $doc = file_get_contents($file['tmp_name']); $xml = new CMbXMLDocument(null); $xml->loadXML($doc); $root = $xml->firstChild; if ($root->nodeName == "modeles") { $root = $root->childNodes; } else { $root = array($xml->firstChild); } $modeles_ids_xml = array(); $components = array("header_id", "footer_id", "preface_id", "ending_id"); foreach ($root as $_modele) { $modele = new CCompteRendu(); $modele->user_id = $user_id; $modele->function_id = $function_id; $modele->group_id = $group_id; // Mappings des champs principaux
/** * Try to validate the document against a schema will trigger errors when not validating * * @param bool $returnErrors Return errors * @param bool $display_errors Display errors * * @return boolean */ function schemaValidate($returnErrors = false, $display_errors = true) { $this->patharchiveschema = "modules/hl7/resources/hl7v3_{$this->hl7v3_version}"; $this->schemafilename = "{$this->patharchiveschema}/{$this->dirschemaname}.xsd"; return parent::schemaValidate($this->schemafilename, $returnErrors, $display_errors); }