ERREUR !
'.$str; echo '
Page précédente
'; echo '
revenir a la page de login
'; echo '
'; die(); } function service_allowed_check($service) { if ($_SESSION['userid']!=$GLOBALS['CONFIG_ROOTID']) { if (!$_SESSION['service']) citydie('L\'utilisateur n\'est pas administrateur et n\'a aucun service spécifié'); elseif ($_SESSION['service']!=$service) citydie('Vous n\'êtes pas autorisé a ouvrir des documents de ce service'); } } // Escape characters in/out of php function html2php($str) { return $str; } function php2html($str) { return htmlspecialchars($str); } // Escape characters in/out of the db function db2php($str) { return $str; } function php2db($str) { return mysql_real_escape_string($str); } // Run a mysql querry and go to error page if it fail function mysql_query_checked($str, $dblink) { if ( ($ret=mysql_query($str, $dblink)) === false ) citydie("Erreur de communication avec la base de donnée :
requete: $str
message: " . mysql_error($dblink)); return $ret; } // Return an 2d array with all the result row in an array // array { // row1(fieldname1 => value1, fieldname2 => value3,..., fieldnameN => valueN) // row2(fieldname1 => value1, fieldname2 => value3,..., fieldnameN => valueN) // ... // } function mysql_fetch_all($str, $dblink) { $a=array(); $result = mysql_query_checked($str, $dblink); while ($row = mysql_fetch_assoc($result)) $a[]=$row; return $a; } // check if the session is valid, if not : errormessage function session_check() { if (!$_SESSION || !array_key_exists('userid',$_SESSION)) citydie("Vous n'êtes pas connecté correctement"); } function session_logout() { $_SESSION = array(); session_destroy(); } // check a datetime validity from splited up datetime // true if valid, false if not function checkdatetime($dated, $datem, $datey, $timeh, $timem) { // contain non-digit characters foreach (array($dated,$datem, $datey, $timeh, $timem) as $dateitem) if (!ctype_digit((string)$dateitem)) return false; // hour or minutes overflow if ((int)$timem >=60 || (int) $timeh >= 24) return false; // checktime will tell if the date part is in the calendar return checkdate((int)$datem, (int)$dated, (int)$datey); } //////////////////// // XML functions class DOMArrete { private $xpath; private $doc; // create the internal DOM object / xpath object public function __construct($file) { $this->doc = new DOMDocument; $this->doc->preserveWhiteSpace = false; $this->doc->load($file); $this->xpath = new DOMXPath($this->doc); $this->xpath->registerNamespace("sc","http://www.utc.fr/ics/scenari/v3/core"); $this->xpath->registerNamespace("sp","http://www.utc.fr/ics/scenari/v3/primitive"); $this->xpath->registerNamespace("ct","utc.fr/city"); } // return the "Objet" document field content public function getObjet() { $query = '/sc:item/ct:arrete/sp:objet/ct:sTxt'; $entries = $this->xpath->query($query, $this->doc); return $entries->item(0)->nodeValue."\n"; } // set the document metadata public function setMeta($metaarray) { $query = '/sc:item/ct:arrete/ct:arreteMeta'; $entries = $this->xpath->query($query, $this->doc); $node=$entries->item(0); $element = $this->doc->createElementNS('http://www.utc.fr/ics/scenari/v3/primitive',"sp:validation"); $node=$node->appendChild($element); $element = $this->doc->createElement("ct:validation"); $node=$node->appendChild($element); $element = $this->doc->createElement("ct:validationMeta"); $node = $node->appendChild($element); foreach($metaarray as $metaname => $metavalue) { if ($metavalue) { $element = $this->doc->createElement("sp:$metaname", php2html("$metavalue")); $node->appendChild($element); } } } public function save($dest) { $this->doc->formatOutput=true; $this->doc->save($dest); } } // extract SCENARI userlist from auto-generated SCENARIserver xml access files function get_userlist() { global $_user_name, $_user_code, $_user_pw, $CONFIG_WSPS_PATH; $filelist=glob($CONFIG_WSPS_PATH."/../users/ac/*/acdef.xml"); $_user_name=array(); $_user_code=array(); $_user_pw=array(); foreach ($filelist as $file) { $doc = new DOMDocument; $doc->preserveWhiteSpace = false; $doc->load($file); $xpath = new DOMXPath($doc); $entries = $xpath->query('/acteur', $doc); $current_user=$entries->item(0)->getAttribute('compte'); $entries = $xpath->query('/acteur/identite/nom', $doc); $_user_name[$current_user]=$entries->item(0)->nodeValue; $entries = $xpath->query('/acteur/identite/prenom', $doc); $_user_code[$current_user]=$entries->item(0)->nodeValue; $entries = $xpath->query('/acteur/acces/password', $doc); $_user_pw[$current_user]=$entries->item(0)->nodeValue; } } if (function_exists('date_default_timezone_set') && $CONFIG_TIMEZONE) date_default_timezone_set($CONFIG_TIMEZONE); // Connect to the database $dblink=null; $dblink=mysql_pconnect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWD); if (!$dblink) citydie("Erreur de serveur de base de donnée (connexion)"); if (!mysql_select_db($MYSQL_BASE,$dblink)) citydie("Erreur de serveur de base de donnée (selection de la base)"); mysql_query("SET NAMES 'utf8'"); get_userlist(); session_start(); ?>