public function getXML() { $xml = new DomDocument(); $xml->encoding = "UTF-8"; // cr?ation de la racine avec id du tu $root = $this->createNoeud($xml, $xml, "tu"); $root->setAttribute("id", TBIDSITE); $root_key = $this->createNoeud($xml, $root, "key"); $root_key->appendChild($xml->createTextNode(TBKEYSITE)); // noeud id serveur veille $root_veille = $this->createNoeud($xml, $root, "idVeille"); $root_veille->appendChild($xml->createTextNode($this->encode($a))); $root_date = $this->createNoeud($xml, $root, "date"); $root_date->appendChild($xml->createTextNode(date("c"))); // noeud version $root_version = $this->createNoeud($xml, $root, "version"); $root_version->appendChild($xml->createTextNode($this->encode($this->getVersion()))); // noeud nombre de patients $root_nb_patients = $this->createNoeud($xml, $root, "nbPatients"); $root_nb_patients->appendChild($xml->createTextNode($this->encode($this->getNbPatients()))); // noeud nombre de m?decins pr?sents $root_nb_medecins = $this->createNoeud($xml, $root, "nbMedecins"); $root_nb_medecins->appendChild($xml->createTextNode($this->encode($this->getNbMedecins()))); // ENQUETES $root_enq = $this->createNoeud($xml, $root, "enquetes"); $tab_enq = $this->getEnquetes(); foreach ($tab_enq as $enq) { $node_enq = $this->createNoeud($xml, $root_enq, "enquete"); $node_enq->setAttribute("id", $this->encode($enq['id'])); $enq_name = $this->createNoeud($xml, $node_enq, "name"); $enq_name->appendChild($xml->createTextNode($this->encode($enq['nom']))); $enq_valeur = $this->createNoeud($xml, $node_enq, "value"); $enq_valeur->appendChild($xml->createTextNode($this->encode($enq['is_active']))); } // OPTIONS $root_option = $this->createNoeud($xml, $root, "options"); $opt_categs = $this->getOptCateg(); foreach ($opt_categs as $categ) { $node_categ = $this->createNoeud($xml, $root_option, "categ"); $node_categ->setAttribute("nom", $this->encode($categ['categorie'])); $opts = $this->getTabOptions($categ['categorie']); // noeuds options foreach ($opts as $opt) { $node_opt = $this->createNoeud($xml, $node_categ, "option"); $node_opt->setAttribute("id", $this->encode($opt['idoption'])); $opt_name = $this->createNoeud($xml, $node_opt, "name"); $opt_name->appendChild($xml->createTextNode($this->encode($opt['libelle']))); $opt_valeur = $this->createNoeud($xml, $node_opt, "value"); $opt_valeur->appendChild($xml->createTextNode($this->encode($opt['valeur']))); } } // ajout des tests du index.test.php $root_tests = $xml->createElement("tests"); $root->appendChild($root_tests); $tests_categ1 = $this->createCategTest($xml, $root_tests, "Configuration php basique"); $this->createNoeudTest($xml, $tests_categ1, "Test version de PHP > 5.1.0", clUpdater::checkPHPVersion('5.1.0')); $this->createNoeudTest($xml, $tests_categ1, "Safe mode non activ?", clUpdater::testSafeMode()); $this->createNoeudTest($xml, $tests_categ1, "Test de la desactivation de la limite temporelle d'execution du script", clUpdater::testLimiteTempo()); $this->createNoeudTest($xml, $tests_categ1, "Test de l'augmentation de la memoire allouee a 512M", clUpdater::testNoNoNoNoNoNoThereIsNoLimit("512M")); $tests_categ2 = $this->createCategTest($xml, $root_tests, "Modules php necessaires"); $modules = array("soap", "xsl", "xml", "ftp", "mysql", "calendar", "gd", "zlib", "mbstring", "sockets"); foreach ($modules as $module) { $this->createNoeudTest($xml, $tests_categ2, "Test de la presence du module PHP " . $module, clUpdater::testModule($module)); } $tests_categ3 = $this->createCategTest($xml, $root_tests, "Modules php pour fonctionalites etendues"); $modules = array("curl", "openssl"); foreach ($modules as $module) { $this->createNoeudTest($xml, $tests_categ3, "Test de la presence du module PHP " . $module, clUpdater::testModule($module)); } $tests_categ4 = $this->createCategTest($xml, $root_tests, "Verification des repertoires"); $dirs = array(URLCACHE, URLDOCS, URLLOCAL . 'hprim/', URLLOCAL . 'hprim/ok/', URLLOCAL . 'hprim/xml/', URLLOCAL . 'rpu/', URLLOCAL . 'rpu/ok/', URLLOCAL . 'rpu/logs/', URLLOCAL . 'var/', URLLOCAL . 'var/maj/', URLLOCAL . 'temp/', URLLOCAL . 'var/dist/'); foreach ($dirs as $dir) { $this->createNoeudTest($xml, $tests_categ4, "Test du droit d'ecriture sur le dossier " . $dir, clUpdater::testEcritureDossier($dir), true); } $tests_categ5 = $this->createCategTest($xml, $root_tests, "Connexions aux bases"); $this->createNoeudTest($xml, $tests_categ5, "Connexion au serveur MySQL '" . MYSQL_USER . "@" . MYSQL_HOST . " (using password: "******")'", mysql_pconnect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS)); $bases = array(BASEXHAM, BDD, CCAM_BDD); $bbases = array("xham", "tuv2", "ccam"); foreach ($bases as $i => $base) { $this->createNoeudTest($xml, $tests_categ5, "Connexion ? la base " . $bbases[$i] . " '" . $base . "'", mysql_select_db($base)); $this->createNoeudTest($xml, $tests_categ5, "Test des privileges " . $bbases[$i] . " : CREATE ALTER DROP base '" . $base . "'", clUpdater::testGrantOnBase(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, $base)); } $tests_categ6 = $this->createCategTest($xml, $root_tests, "Communication"); ob_flush(); flush(); $ftp_server = 'www.veille-arh-paca.com'; $ftp_user_name = 'importsrv'; $ftp_user_pass = '******'; $this->createNoeudTest($xml, $tests_categ6, "Test de connexion FTP vers serveur de veille (ftp://www.veille-arh-paca.com)", clUpdater::testDepotFTP($ftp_server, $ftp_user_name, $ftp_user_pass), true); $this->createNoeudTest($xml, $tests_categ6, "Test de cryptage avec la clef publique ARH", clUpdater::clefARH(), true); return $xml; }
$modules = array("soap", "xsl", "xml", "ftp", "mysql", "calendar", "gd", "zlib", "ftp", "mbstring", "sockets"); foreach ($modules as $module) { affichage("Test de la présence du module PHP " . $module, clUpdater::testModule($module), false, false, false); } echo "<h4>Modules php pour fonctionalités étendues</h4>"; $modules = array("curl", "openssl"); foreach ($modules as $module) { affichage("Test de la présence du module PHP " . $module, clUpdater::testModule($module), false, true, false); } /* * TESTS SUR LES REPERTOIRES */ echo "<br /><hr/><h4>Vérification des répertoires</h4>"; $dirs = array(URLCACHE, URLDOCS, URLLOCAL . 'hprim/', URLLOCAL . 'hprim/ok/', URLLOCAL . 'hprim/xml/', URLLOCAL . 'rpu/', URLLOCAL . 'rpu/ok/', URLLOCAL . 'rpu/logs/', URLLOCAL . 'var/', URLLOCAL . 'var/maj/', URLLOCAL . 'temp/', URLLOCAL . 'var/dist/'); foreach ($dirs as $dir) { affichage("Test du droit d'écriture sur le dossier " . $dir, clUpdater::testEcritureDossier($dir), true, false, true); } /* * TESTS DES FICHIERS .cfg */ echo "<br /><hr/><h4>Création des fichiers de configuration MySQL</h4>"; affichage("Creation du fichier " . URLLOCAL . "queries_int/config_xham.cfg", clUpdater::genResultQueryConfigFile(URLLOCAL . "queries_int/config_xham.cfg", MYSQL_HOST, BASEXHAM, MYSQL_USER, MYSQL_PASS)); affichage("Creation du fichier " . URLLOCAL . "queries_int/config_ccam.cfg", clUpdater::genResultQueryConfigFile(URLLOCAL . "queries_int/config_ccam.cfg", MYSQL_HOST, CCAM_BDD, MYSQL_USER, MYSQL_PASS)); affichage("Creation du fichier " . URLLOCAL . "queries_int/config_terminal.cfg", clUpdater::genResultQueryConfigFile(URLLOCAL . "queries_int/config_terminal.cfg", MYSQL_HOST, BDD, MYSQL_USER, MYSQL_PASS)); affichage("Creation du fichier " . URLLOCAL . "queries_int/config_formx.cfg", clUpdater::genResultQueryConfigFile(URLLOCAL . "queries_int/config_formx.cfg", MYSQL_HOST, defined('FX_BDD') ? FX_BDD : BDD, MYSQL_USER, MYSQL_PASS)); /* * TEST DE CONNEXION AUX BASES */ echo "<br /><hr /><h4>Connexions aux bases</h4>"; affichage("Connexion au serveur MySQL '" . MYSQL_USER . "@" . MYSQL_HOST . " (using password: "******")'", mysql_pconnect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS), false, false, true); $bases = array(BASEXHAM, BDD, CCAM_BDD);