Ajout des fichiers /framework/default/_includes

Modification des chemins complet
Attention à tester
This commit is contained in:
Michael RICOIS 2009-02-20 09:40:39 +00:00
parent c2130298ff
commit bbc355f57b
38 changed files with 6534 additions and 80 deletions

View File

@ -9,11 +9,11 @@ define ('ACTES_IGNUM_FTP_PASS', 'passmpc78');
require_once realpath(dirname(__FILE__) . '/../framework/fwk.php');
//define ('INCLUDE_PATH', '/var/www/site_extranet/includes/');
define ( 'INCLUDE_PATH' , realpath(dirname(__FILE__) . '/../includes/') );
define ('INCLUDE_PATH', realpath(dirname(__FILE__) . '/../includes/'));
require_once realpath(dirname(__FILE__) . '/mysql.php');
//include '/var/www/default/_includes/curl.php';
include_once(FWK_PATH.'common/ftp.php');
include_once(FWK_PATH.'/common/ftp.php');
$tempsMinEntreRequetes=5;
$tempsMaxEntreRequetes=30;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
<?
$tabINDREP=array('B'=>'bis',
'T'=>'ter',
'Q'=>'quater',
'C'=>'quinquies',
' '=>'',
''=>'');
switch($_SESSION['user']) {
case 'MHZ': $myEmail='mheitz@scores-decisions.com'; break;
case 'JMY': $myEmail='jmartory@scores-decisions.com'; break;
case 'YLN': $myEmail='buzuk@scores-decisions.com'; break;
}
?>

View File

@ -0,0 +1,177 @@
<?
include_once('/var/www/default/_includes/timer.php');
/** Parse une page Html et retourne son contenu dans un tableau :
** "code" => Code réponse Serveur
** "header" => Headers du serveur
** "body" => Page HTML
**/
function parse_response($this_response, $err_num, $err_msg) {
// Split response into header and body sections
list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
$response_header_lines = explode("\r\n", $response_headers);
// First line of headers is the HTTP response code
$http_response_line = array_shift($response_header_lines);
if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
if ($response_code==100) {
list($response_headers, $response_body) = explode("\r\n\r\n", $response_body, 2);
$response_header_lines = explode("\r\n", $response_headers);
$http_response_line = array_shift($response_header_lines);
if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
}
// put the rest of the headers in an array
$response_header_array = array();
$nbRMID=0;
foreach($response_header_lines as $header_line)
{
list($header,$value) = explode(': ', $header_line, 2);
if ($header=='Set-cookie' && substr($value,0,5)=='RMID=' && $nbRMID<5)//{
$nbRMID++;
// echo ("Je gicle le RMID n°$nbRMID\r\n");}
else
$response_header_array[$header] .= $value."\n";
}
/* if ($response_code==100) {
print_r($response_headers);
// print_r($response_header_lines);
}*/
return array('code' => $response_code, 'header' => $response_header_array, 'body' => $response_body, 'err_num'=>$err_num, 'err_msg'=>$err_msg);
}
/** Récupère une page HTML en fonction des paramètres :
** $url Url distante de la page à récupérer
** $strCookies Chaine de caractère contenant les cookies
** $postData Tableau des données à passer en POST uniquement
** $referer Referer à indiquer lors de l'appel de la page
** $debug Activer le débogage (True/False)
**
** ... et retourne son contenu dans un tableau :
** "code" => Code réponse Serveur
** "header" => Headers du serveur
** "body" => Page HTML
**/
function getUrl($url, $strCookies='', $postData='', $referer='', $debug=false, $host='', $proxy='', $timeout=0) {
$ch = curl_init();
if ($host=='')
$this_header = array('Host: '. HOST_INSEE);
else
$this_header = array('Host: '. $host);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
if ($proxy<>'') curl_setopt($ch, CURLOPT_PROXY, $proxy);
if (((int)$timeout)<>0) curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password'); // Pas nécessaire en authentification NT
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
// Add each cookie that has been returned in the response
// If cookies need to be added/deleted or value changed, then add code here
if ($strCookies!='') {
//die('"'.$strCookies.'"');
//echo $strCookies."\r\n";
$cookies = explode("\n", $strCookies);
// Create the basic header
foreach($cookies as $this_cookie) {
if (trim($this_cookie)<>'')
array_push($this_header, 'Cookie: '.$this_cookie);
}
}
if ($postData!='') {
if (is_array($postData))
$post_data=$postData;
$o="";
foreach ($post_data as $k=>$v)
{
// $o.= "$k=".utf8_encode($v)."&";
$o.= "$k=".$v."&";
}
$post_data=substr($o,0,-1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
//if in_array('',$this_header
// array_push($this_header, "Content-type: application/x-www-form-urlencoded");
// array_push($this_header, "Content-Length: ".strlen($post_data));
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
//print_r($this_header);
$page=curl_exec($ch);
$response = parse_response($page, curl_errno($ch), curl_error($ch));
if ($debug){
$url2=str_replace('http://', '', $url);
$url2=str_replace('/', '_', $url2);
$url2=str_replace('?', '(param)', $url2);
$url2=str_replace('&', '(et)', $url2);
$fp=fopen('insee/'. date('Ymd-His') .'-'. microtime_float(true) .'-'. $url2 . '.html', 'a');
fwrite($fp, $url."\r\n");
fwrite($fp, $page);
fclose($fp);
//echo strip_tags(html_entity_decode($response['body']), '<td>');
}
//print_r(curl_getinfo($ch));
curl_close($ch);
return $response;
}
/** Recherche un texte dans une page HTML
**
**/
function getTextInHtml($pageHtml, $strToFind, $strDeb, $strEnd, $include_strDeb=false, $include_strEnd=false, $ltrim=true, $rtrim=true, &$fin, $nbOcc=1) {
$tabRet=array();
$deb=$nbOccTrouve=0;
while( is_int(($deb=strpos($pageHtml,$strToFind,$fin))) ) {
$deb++;
$deb2 = strpos($pageHtml,$strDeb, $deb);
$fin = strpos($pageHtml,$strEnd, $deb2);
if (!$include_strDeb)
$deb2+=strlen($strDeb);
$s_temp = substr($pageHtml, $deb2, ($fin-$deb2));
if ($ltrim) $s_temp=ltrim($s_temp);
if ($rtrim) $s_temp=rtrim($s_temp);
if ($nbOcc==1) return $s_temp;
//echo $s_temp."\r\n";
//$a_temp = explode('" class="basic">', $s_temp);
$tabUrl[$nbOccTrouve]=$s_temp;
$nbOccTrouve++;
if ($nbOcc==$nbOccTrouve) {
// echo "j'ai trouvé le nb demandé, je sort\r\n";
break;
};
}
return $tabUrl;
/*<span class="mongrasvert">
<li>Le type de voie a été modifié<br>
<li>L'orthographe du mot directeur a été modifiée<br>
<li>Le code postal a été forcé à partir du département et de la localité<br> </span>
*/
}
?>

View File

@ -0,0 +1,820 @@
<?php
/***********************************************************************************************************/
/* CLASSE D'AFFICHAGE ET D'ENVOI D'UN FORMULAIRE */
/* */
/* Auteur : Bernard Martin-Rabaud */
/* Email : bernard@ediweb.org */
/* */
/* Cette classe permet de : */
/* - créer un formulaire */
/* - le contrôler et l'afficher pour confirmation */
/* - et retourner son contenu */
/***********************************************************************************************************/
define("_SEPA_AFFICHE_MULTIPLE", ", ");
define("_SEPA_VALEUR_MULTIPLE", "###");
$erreur_message = array("min" => "caractères minimum",
"max" => "caractères maximum",
"texte" => "texte non valide",
"alphanum" => "texte alphanumérique non valide",
"num" => "valeur numérique non valide",
"num-strict" => "valeur numérique non valide",
"tel" => "numéro de téléphone non valide",
"email" => "e-mail non valide",
"url" => "url non valide",
"date" => "date non valide",
"datej" => "jour non valide",
"datem" => "mois non valide",
"datem" => "année non valide",
"option" => "aucune option n'a été sélectionnée",
"vide" => "champ obligatoire");
class ClasseForm {
var $titre;
var $montrer_titre;
var $champs;
var $taille_std;
var $pivot_siecle;
var $mode_retour;
var $confirme;
var $mode;
var $champ_cour;
var $log;
var $name;
var $closeButton;
function ClasseForm($titre=null, $confirme=false, $autocomplete="on", $nom='formulaire', $closeButton=false) {
$this->titre = $titre;
$this->montrer_titre = true;
$this->champs = array();
$this->taille_std = null;
$this->pivot_siecle = 20;
$this->mode_retour = "noms & valeurs";
$this->confirme = $confirme;
if ($autocomplete==false || $autocomplete=="off" || $autocomplete==null)
$this->autocomplete = 'off';
else
$this->autocomplete = 'on';
$this->name=$nom;
$this->mode = null;
$this->champ_cour = 0;
$this->log = null;
$this->closeButton=$closeButton;
}
function afficher() {
$resultat = null;
echo $this->javascriptSubmit();
if (!isset($_POST) || !$_POST || ($_POST["classeform_acces"] == "annuler")) $this->mode = null;
else {
$this->affecterValeursChamps($_POST);
$succes = $this->controler();
if ($succes) $this->mode = $_POST["classeform_acces"];
else $this->mode = "erreur";
}
switch ($this->mode) {
case "confirme" :
echo $this->afficherTexte();
echo $this->afficherForm(true);
break;
case "modif" :
echo $this->afficherForm();
break;
case "envoi" :
$resultat = $this->retournerTableauValeurs($this->mode_retour);
//print_r($resultat);
if ($this->log) $this->enregistrerLog($this->retournerTableauValeurs("valeurs", $resultat));
break;
default :
echo $this->afficherForm();
}
return $resultat;
}
function ajoutChamp($label, $nom, $type, $format=null, $oblig=true, $min=null, $max=null, $defVal='') {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, $type, $format, $oblig, $min, $max, $defVal);
}
function ajoutChampText($label, $nom, $format=null, $oblig=true, $min=null, $max=null, $defVal='', $ajaxQuery='') {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "text", $format, $oblig, $min, $max, $defVal, $ajaxQuery);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
}
function ajoutChampHidden($nom) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp('', $nom, "hidden");
}
function ajoutChampPassword($label, $nom, $min=null, $max=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "password", "", true, $min, $max);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 100);
}
function ajoutChampTextarea($label, $nom, $format=null, $oblig=true, $min=null, $max=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "textarea", $format, $oblig, $min, $max);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 3);
}
function ajoutChampFile($label, $nom, $oblig=true, $min=null, $max=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "file", "fichier", $oblig, $min, $max);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
}
function ajoutChampSelect($label, $nom, $oblig=true, $taille=null, $multiple=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "select", "", $oblig, null, null);
if ($taille) $this->champs[$this->champ_cour]->valCtlLimites($taille, null);
if ($multiple) $this->champs[$this->champ_cour]->valMultiple();
}
function ajoutChampRadio($label, $nom, $oblig=true, $fin_ligne=null) {
$this->champ_cour = sizeof($this->champs);
$args = func_get_args();
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "radio", "", $oblig);
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
}
function ajoutChampCheckbox($label, $nom, $oblig=true, $fin_ligne=null) {
$this->champ_cour = sizeof($this->champs);
$args = func_get_args();
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "checkbox", "", $oblig);
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
}
function ajoutTexte($texte) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($texte, "", "", "", false);
}
function cacherTitre() {
$this->montrer_titre = false;
}
function valTailleStd($taille) {
$this->taille_std = $taille;
}
function valPivotSiecle($pivot) {
$this->pivot_siecle = $pivot;
}
function valModeRetour($mode) {
$this->mode_retour = $mode;
}
function valLog($log) {
$this->log = $log;
}
function valChampFormat($format, $min=null, $max=null) {
$this->champs[$this->champ_cour]->valFormat($format, $min, $max);
}
function valChampLimites($min, $max=null) {
$this->champs[$this->champ_cour]->valLimites($min, $max);
}
function valChampCtlLimites($min, $max=null) {
$this->champs[$this->champ_cour]->valCtlLimites($min, $max);
}
function valChampMultiple() {
$this->champs[$this->champ_cour]->valMultiple();
}
function valChampOptions() {
if ((func_num_args() == 1) && is_array(func_get_arg(0))) $args = func_get_arg(0);
else $args = func_get_args();
$this->champs[$this->champ_cour]->valOptions($args);
}
function valChampDescro($descro) {
$this->champs[$this->champ_cour]->valDescro($descro);
}
function valChampFinLigne($fin_ligne) {
$this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
}
function valChampOption1Vide($option_vide) {
$this->champs[$this->champ_cour]->valOption1Vide($option_vide);
}
function afficherForm($cache=false) {
$html = "<form method='post' action='javascript:location.href' name='$this->name' 'id='$this->name' autocomplete='$this->autocomplete'>\n";
$html .= "<fieldset>\n";
$html .= "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
if ($this->titre && $this->montrer_titre && !$cache)
$html .= "<caption class='form-caption'>$this->titre" . (($this->mode == "erreur") ? " <span class='erreur'>(erreurs)</span>" : "") . "</caption>\n";
else if (($this->mode == "erreur"))
$html .= "<caption class='form-caption'><span class='erreur'>(erreurs)</span></caption>\n";
for ($i=0;$i<sizeof($this->champs);$i++) {
if ($cache) $html .= $this->champs[$i]->afficherFormCache();
else $html .= $this->champs[$i]->afficherForm();
}
if ($valeurs) $html .= $this->afficherBoutonsForm();
else $html .= $this->afficherBoutonsForm();
if ($this->existeChampFacultatif())
$html .= "<tr><td class='form-info-obligatoire' colspan='2'>&nbsp;</td></tr>";
$html .= "</fieldset></table></form>\n";
return $html;
}
function afficherBoutonsForm() {
if (($this->mode == null) || ($this->mode == "erreur")) {
if ($this->confirme)
$html = "<tr><td><input type='hidden' name='classeform_acces' value='confirme' /></td>";
else $html = "<tr><td><input type='hidden' name='classeform_acces' value='envoi' /></td>";
}
else $html = "<tr><td><input type='hidden' name='classeform_acces' /></td>";
$html .= "<td><input class='form-bouton' type='button' value='Envoyer' onClick='soumettre(\"envoi\")'/>";
if ($this->confirme) {
if ($this->mode == "confirme") {
$html .= " <input class='form-bouton' type='button' value='Modifier'";
$html .= " onClick='soumettre(\"modif\")'; />";
}
else {
$html .= " <input class='form-bouton' type='button' value='Voir avant envoi'";
$html .= " onClick='soumettre(\"confirme\")'; />";
}
}
$html .= " <input class='form-bouton' type='reset' value='Rétablir' onClick='soumettre(\"annuler\")' />\n";
if ($this->closeButton)
$html .= " <input class='form-bouton' type='button' value='Annuler & Fermer' onClick='soumettre(\"fermer\")' />\n";
$html .= "</td></tr>";
return $html;
}
function afficherTexte() {
$html = "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
if ($this->titre) $html .= "<caption class='form-caption'>$this->titre</caption>\n";
for ($i=0;$i<sizeof($this->champs);$i++)
$html .= $this->champs[$i]->afficherTexte();
$html .= "</table>\n";
return $html;
}
function javascriptSubmit() {
$html = "<script language='JavaScript'>\n";
$html .= "<!-- \n";
$html .= "function soumettre(acces) {\n";
$html .= " if (acces=='fermer') self.close();\n";
$html .= " else {\n";
$html .= " with (document.forms[0]) {\n";
$html .= " classeform_acces.value=acces; action=location.href; submit();\n";
$html .= " }\n";
$html .= " }\n";
$html .= "}\n";
$html .= "// -->\n";
$html .= "</script>\n";
return $html;
}
function controler() {
$succes = true;
for ($i=0;$i<sizeof($this->champs);$i++) {
$this->champs[$i]->valeur_db=$this->champs[$i]->valeur;
if ( $this->champs[$i]->aControler() && ($this->champs[$i]->controler($this->pivot_siecle) == false) ) {
$succes = false;
}
}
return $succes;
}
function affecterValeursChamps($valeurs) {
$valeurs = convertirPost($valeurs);
for ($i=0;$i<sizeof($this->champs);$i++)
$this->champs[$i]->affecterValeur($valeurs);
}
function retournerTableauValeurs($mode_retour) {
$retour = array();
for ($i=0;$i<sizeof($this->champs);$i++)
{// echo "------------------------------------\r\n$i : \r\n";
//print_r($this->champs);
//print_r($this->champs[$i]);
//echo "\r\n\r\n";
$this->champs[$i]->retournerTableauValeurs(&$retour, $mode_retour);}
return $retour;
}
function envoyerMail() {
$mail = new ClasseMail($this->titre);
$mail->contenu = $this->champs;
return $mail->envoyer($this->cible);
}
function existeChampFacultatif() {
$ok = false;
for ($i=0;$i<sizeof($this->champs);$i++) {
if ($this->champs[$i]->type && !$this->champs[$i]->valObligatoire()) {
$ok = true;
break;
}
}
return $ok;
}
function enregistrerLog($valeurs, $resultat) {
if ($f = fopen($this->log, "a")) {
$texte = ($resultat ? "" : "ECHEC ") . "[ " . date("d/mY H:i:s") . " ] - ";
$texte .= $this->titre ? "$this->titre - " : "";
$texte .= $valeurs;
fputs($f, $texte);
fclose($f);
}
}
}
class ClasseFormChamp {
var $label;
var $nom;
var $type;
var $format;
var $oblig;
var $taille_max;
var $taille_min;
var $valeur;
var $options;
var $descro;
var $multiple;
var $fonction;
var $ctl_taille1;
var $ctl_taille2;
var $fin_ligne;
var $erreur;
var $valeur_defaut;
var $valeur_db;
var $ajaxQuey;
function ClasseFormChamp($label, $nom, $type=null, $format=null, $oblig=true, $min=null, $max=null, $valDef='', $ajaxQuery='') {
$this->label = $label;
$this->nom = $nom;
$this->type = $type;
$this->format = $format;
$this->taille_min = $min;
$this->taille_max = $max;
$this->oblig = $oblig;
if (($type == "select") || ($type == "checkbox") || ($type == "radio")) {
$this->valeur = array();
$this->options = array();
}
else {
$this->valeur = null;
$this->options = null;
}
$this->descro = null;
if ($type == "checkbox") $this->multiple = true;
else $this->multiple = false;
$this->fonction = null;
$this->ctl_taille1 = null;
$this->ctl_taille2 = null;
$this->fin_ligne = null;
$this->erreur = null;
$this->valeur_defaut = $valDef;
$this->ajaxQuey = $ajaxQuery;
// $this->valeur_db=$this->valeur;
}
function valObligatoire() {
if ($this->oblig) return true;
else return false;
}
function valFormat($format, $long_min=null, $long_max=null) {
if ($this->type == "text") {
$this->format = $format;
if ($long_min) $this->taille_min = $long_min;
if ($long_max) $this->taille_max = $long_max;
}
}
function valLimites($min, $max) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
$this->taille_min = $min;
$this->taille_max = $max;
}
}
function valCtlLimites($taille1, $taille2) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "select") || ($this->type == "file")) {
$this->ctl_taille1 = $taille1;
if ($taille2 && ($this->type != "select")) $this->ctl_taille2 = $taille2;
}
}
function valFonction($fonction) {
$this->fonction = $fonction;
}
function valDescro($descro) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
$this->descro = $descro;
}
}
function valMultiple() {
if ($this->type == "select") $this->multiple = true;
}
function valFinLigne($fin_ligne) {
if (($this->type == "radio") || ($this->type == "checkbox")) $this->fin_ligne = $fin_ligne;
}
function valOptions($options) {
if ($this->champAOptions()) {
if (is_array($options)) {
foreach ($options as $option) {
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $option, $regs))
$this->options[] = new ClasseFormOption($regs[1], true);
else $this->options[] = new ClasseFormOption($option);
}
}
else {
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $options, $regs))
$this->options[] = new ClasseFormOption($regs[1], true);
else $this->options[] = new ClasseFormOption($options);
}
}
}
function ValOption1Vide($option_vide) {
if ($this->type == "select") $this->fin_ligne = $option_vide;
}
function afficherForm() {
if (!$this->type) $html = "<tr><td class='form-label' colspan='2'>$this->label</td></tr>";
else {
if (!is_null($this->erreur))
$html = "<tr><td class='form-label-erreur'> > $this->label (<font size='-2'>$this->erreur</font>)</td>";
else if ($this->oblig) $html = "<tr><td class='form-label-obligatoire'>$this->label</td>";
else $html .= "<tr><td class='form-label-facultatif'>$this->label</td>";
$html .= "<td class='form-td'>";
switch ($this->type) {
case "text" : $html .= $this->afficherFormTexte();
break;
case "password" : $html .= $this->afficherFormPassword();
break;
case "textarea" : $html .= $this->afficherFormTextarea();
break;
case "select" : $html .= $this->afficherFormSelect();
break;
case "radio" : $html .= $this->afficherFormRadio();
break;
case "checkbox" : $html .= $this->afficherFormCheckbox();
break;
case "file" : $html .= $this->afficherFormFile();
break;
case "hidden" : $html .= $this->afficherFormCache();
break;
}
$html .= "</td></tr>\n";
}
return $html;
}
function afficherFormCache() {
$html = "<input type='hidden' name='$this->nom' id='$this->nom'";
if (is_array($this->valeur)) {
$chaine = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
$html .= " value=\"" . $chaine . "\" />\n";
}
else $html .= " value=\"" . $this->valeur . "\" />\n";
return $html;
}
function afficherTexte() {
$html = "<tr><td class='form-label'>$this->label</td><td class='form-td'>";
if (is_array($this->valeur)) {
$chaine = implode(_SEPA_AFFICHE_MULTIPLE, $this->valeur);
$html .= $chaine;
}
else $html .= $this->valeur;
$html .= "</td></tr>\n";
return $html;
}
function champAOptions() {
if (($this->type == "select") || ($this->type == "checkbox") || ($this->type == "radio")) return true;
else return false;
}
function controler($pivot=null) {
global $erreur_message;
//$this->valeur_db=$this->valeur;
if ($this->type) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
$this->controlerChampTexte($pivot);
if (is_null($this->erreur)) return true;
else return false;
}
else if (($this->type == "select") || ($this->type == "radio")) {
if (!$this->valeur || (sizeof($this->valeur) == 0)) {
$this->erreur = $erreur_message["option"];
return false;
}
else return true;
}
else return true;
}
else return true;
}
function aControler() {
if ($this->type && $this->oblig) return true;
else return false;
//return true;
}
function retournerTableauValeurs(&$tableau, $mode_retour) {
if (is_array($this->valeur)) {$valeur = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
print_r($this->valeur);
die('Cas non géré dans inc_classeform.php');
}
else $valeur = $this->valeur_db;
switch ($mode_retour) {
case "noms & valeurs" :
$tableau[$this->nom] = $valeur;
break;
case "labels & valeurs" :
$tableau[$this->label] = $valeur;
break;
case "valeurs" :
$tableau[] = $valeur;
}
//echo '$this->nom='.$this->nom.', $valeur='.$valeur."\r\n";
}
function affecterValeur($valeurs) {
$valeur = $valeurs[$this->nom];
if ($this->champAOptions()) {
if (strpos($valeur, _SEPA_VALEUR_MULTIPLE) !== false)
$this->valeur = explode(_SEPA_VALEUR_MULTIPLE, $valeur);
else $this->valeur = $valeur;
for ($i=0;$i<sizeof($this->options);$i++)
$this->options[$i]->selectionnerSiValeur($this->valeur);
}
else $this->valeur = $valeur;
}
function controlerChampTexte($pivot) {
global $erreur_message;
if (trim($this->valeur) == "") $this->erreur = $erreur_message["vide"];
else {
$this->erreur = champTexteConforme($this->valeur, $this->taille_min, $this->taille_max);
if (is_null($this->erreur) && $this->format) {
switch ($this->format) {
case "alphanum" :
if (!controlerAlphanum($this->valeur)) $this->erreur = $erreur_message["alphanum"];
break;
case "num" :
if (!controlerNum($this->valeur)) $this->erreur = $erreur_message["num"];
break;
case "num-strict" :
if (!controlerNum($this->valeur, true)) $this->erreur = $erreur_message["num"];
break;
case "tel" :
if (!controlerTel($this->valeur)) $this->erreur = $erreur_message["tel"];
break;
case "email" :
if (!controlerEmail($this->valeur)) $this->erreur = $erreur_message["email"];
break;
case "date" :
if (!controlerDate($this->valeur, $pivot)) $this->erreur = $erreur_message["date"];
$tmp=explode('/', $this->valeur);
if ($tmp[0]*1<10) $date_j='0'.$tmp[0]*1; else $date_j=''.$tmp[0]*1;
if ($date_j*1 < 1 || $date_j>31) $this->erreur = $erreur_message["datej"];
if ($tmp[1]*1<10) $date_m='0'.$tmp[1]*1; else $date_m=''.$tmp[1]*1;
if ($date_m*1 < 1 || $date_m>12) $this->erreur = $erreur_message["datem"];
$date_a=''.$tmp[2]*1;
if ($date_a*1 < 1890 || $date_a>date('Y')) $this->erreur = $erreur_message["datea"];
$this->valeur_db=$date_a.'-'.$date_m.'-'.$date_j;
break;
case "url" :
if (!controlerUrl($this->valeur)) $this->erreur = $erreur_message["url"];
break;
}
}
}
}
function afficherFormTexte() {
$html .= "<input class='form-input' type='text' name='$this->nom' size='$this->ctl_taille1' ";
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
if ($this->valeur) $html .= ' value="' . $this->valeur . '" />';
else if ($this->valeur_defaut) $html .= ' value="' . $this->valeur_defaut . '" />';
else if ($this->descro) { $html .= ' value="' . htmlentities(stripslashes($this->descro), ENT_QUOTES) . '"';
$html .= " onFocus='this.value=\"\"' />";
}
elseif ($this->ajaxQuey) $html .= " id='$this->nom' onkeyup=\"loadData('$this->nom');\" />
<ul id='zoneResultats_$this->nom' style='visibility: hidden;'></ul>";
else $html .= ' value="" />';
return $html;
}
function afficherFormPassword() {
$html .= "<input class='form-input' type='password' name='$this->nom' size='$this->ctl_taille1'";
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
if ($this->valeur) $html .= ' value="' . $this->valeur . '" />';
else if ($this->descro) {
$html .= ' value="' . htmlentities(stripslashes($this->descro), ENT_QUOTES) . '"';
$html .= " onFocus='this.value=\"\"' />";
}
else $html .= " value='' />";
return $html;
}
function afficherFormTextarea() {
$html .= "<textarea class='form-input' name='$this->nom' cols='$this->ctl_taille1'";
if ($this->ctl_taille2) $html .= " rows='$this->ctl_taille2'";
else if ($this->taille_max) {
$rows = ceil($this->taille_max / $taille_std);
$html .= " rows='$rows'";
}
else $html .= " rows='3'";
if ((trim($this->valeur) == "") || $this->descro) $html .= " onFocus='this.value=\"\"'>";
else $html .= ">";
if (trim($this->valeur)) $html .= $this->valeur;
else if ($this->descro) $html .= htmlentities(stripslashes($this->descro), ENT_QUOTES);
$html .= "</textarea>";
return $html;
}
function afficherFormSelect() {
$html = "<select name='$this->nom" . ($this->multiple ? "[]'" : "'");
if ($this->fin_ligne && $this->multiple)
$html .= " size='" . (($this->ctl_taille1 >= 2) ? $this->ctl_taille1 : 2 ) . "'";
else $html .= " size='" . ($this->ctl_taille1 ? $this->ctl_taille1 : 1) . "'";
$html .= $this->multiple ? " multiple>\n" : ">\n";
if ($this->fin_ligne) {
$html .= "<option class='form-option-entete' value=''>$this->fin_ligne</option>\n";
}
for ($i=0;$i<sizeof($this->options);$i++)
$html .= $this->options[$i]->afficherFormSelect();
$html .= "</select>\n";
return $html;
}
function afficherFormRadio() {
for ($i=0;$i<sizeof($this->options);$i++) {
$html .= $this->options[$i]->afficherFormCase("radio", $this->nom, $this->oblig);
$html .= $this->fin_ligne ? "<br />" : "&nbsp;";
}
return $html;
}
function afficherFormCheckbox() {
for ($i=0;$i<sizeof($this->options);$i++) {
$html .= $this->options[$i]->afficherFormCase("checkbox", "$this->nom[]", $this->oblig);
$html .= $this->fin_ligne ? "<br />" : "&nbsp;";
}
return $html;
}
function afficherFormFile() {
$html .= "<input class='form-input' type='file' name='$this->nom' size='$this->ctl_taille1'";
if ($this->taille_max) $html .= " maxlength='$this->ctl_taille2'";
if ($this->descro) $html .= " value='$this->descro' onChange='this.value=\"\"' />";
else $html .= " value='' />";
return $html;
}
}
class ClasseFormOption {
var $valeur;
var $selection;
function ClasseFormOption($val, $selec=false) {
$this->valeur = htmlspecialchars(stripslashes($val), ENT_QUOTES);
$this->selection = $selec;
}
function afficherFormSelect() {
echo "<!--Valeur du select='$this->valeur'-->";
if (strpos($this->valeur,':')>0) {
$tab=explode(':', $this->valeur);
$html = '<option value="'.$tab[0] .'"' . ($this->selection ? ' selected>' : '>');
$html .= $tab[1]."</option>\n";
}
else {
$html = '<option value="'. $this->valeur .'"' . ($this->selection ? ' selected>' : '>');
$html .= "$this->valeur</option>\n";
}
return $html;
}
function afficherFormCase($type, $nom, $oblig) {
$html = "<input type='$type' name='$nom' value=\"$this->valeur\"";
$html .= ($this->selection) ? " checked />" : " />";
if ($oblig) $html .= "<span class='form-input-obligatoire'>" . $this->valeur . "<span>";
else $html .= "<span class='form-input-facultatif'>" . $this->valeur . "<span>";
return $html;
}
function selectionnerSiValeur($valeurs) {
if (is_array($valeurs)) {
if (in_array($this->valeur, $valeurs)) $this->selection = true;
else $this->selection = false;
}
else if ($this->valeur == $valeurs) $this->selection = true;
else $this->selection = false;
}
}
function controlerEmail($valeur) {
if (preg_match("/^[\w|-]+(\.[\w|-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/", $valeur)) return true;
else return false;
}
function controlerDate($valeur, $pivot) {
if (preg_match("/^(\d{1,2})[\/|\-|\.](\d{1,2})[\/|\-|\.](\d\d)(\d\d)?$/", $valeur, $regs)) {
$jour = ($regs[1] < 10) ? "0".$regs[1] : $regs[1];
$mois = ($regs[2] < 10) ? "0".$regs[2] : $regs[2];
if ($regs[4]) $an = $regs[3] . $regs[4];
else {
if ($pivot) {
if ($regs[3] <= $pivot) $an = $regs[3] + 2000;
else $an = $regs[3] + 1900;
}
else $an = $regs[3] + 2000;
}
if (checkdate($mois, $jour, $an)) return true;
else return false;
}
else return false;
}
function controlerUrl($valeur) {
if (ereg("^((http|ftp):\/\/)?([0-9a-z_]+[\.\-])+[0-9a-z]+(\/[0-9a-z_]+)*(\/[0-9a-z_]+\.[0-9a-z]+)?$", $valeur)) return true;
else return false;
}
function controlerAlphanum($valeur) {
//if (preg_match("/^[\w|\d|\s|'|\"|\\|,|\.|\-|&|#|;]+$/", $valeur)) return true;
//else return false;
return true;
}
function controlerNum($valeur, $strict=false) {
if ($strict) {
if (ereg("^[0-9]+$", $valeur)) return true;
else return false;
}
else if (preg_match("/^[\d|\s|\-|\+|E|e|,|\.]+$/", $valeur)) return true;
else return false;
}
function controlerTel($valeur) {
if (preg_match("/^[\d|\s|\-|\.|\(|\)]+$/", $valeur)) return true;
else return false;
}
function champTexteConforme($valeur, $min, $max) {
global $erreur_message;
if ($min && (strlen($valeur) < $min)) return $min . " " . $erreur_message["min"];
else if ($max && (strlen($valeur) > $max)) return $max . " " . $erreur_message["max"];
else if (preg_match('/(.)\1{4,}/', $valeur)) return $erreur_message["texte"];
else return null;
}
function convertirPost($post) {
$result = array();
foreach ($post as $cle => $valeur) {
if (is_array($valeur)) {
for ($i=0;$i<sizeof($valeur);$i++)
$result[$cle][] = stripslashes($valeur[$i]);//htmlspecialchars(, ENT_QUOTES);
}
else $result[$cle] =stripslashes($valeur);// htmlspecialchars(stripslashes(), ENT_QUOTES);
}
return $result;
}
?>

View File

@ -0,0 +1,764 @@
<?php
/***********************************************************************************************************/
/* CLASSE D'AFFICHAGE ET D'ENVOI D'UN FORMULAIRE */
/* */
/* Auteur : Bernard Martin-Rabaud */
/* Email : bernard@ediweb.org */
/* */
/* Cette classe permet de : */
/* - créer un formulaire */
/* - le contrôler et l'afficher pour confirmation */
/* - et retourner son contenu */
/***********************************************************************************************************/
define("_SEPA_AFFICHE_MULTIPLE", ", ");
define("_SEPA_VALEUR_MULTIPLE", "###");
$erreur_message = array("min" => "caractères minimum",
"max" => "caractères maximum",
"texte" => "texte non valide",
"alphanum" => "texte alphanumérique non valide",
"num" => "valeur numérique non valide",
"num-strict" => "valeur numérique non valide",
"tel" => "numéro de téléphone non valide",
"email" => "e-mail non valide",
"url" => "url non valide",
"date" => "date non valide",
"option" => "aucune option n'a été sélectionnée",
"vide" => "champ obligatoire");
class ClasseForm {
var $titre;
var $montrer_titre;
var $champs;
var $taille_std;
var $pivot_siecle;
var $mode_retour;
var $confirme;
var $mode;
var $champ_cour;
var $log;
function ClasseForm($titre=null, $confirme=false) {
$this->titre = $titre;
$this->montrer_titre = true;
$this->champs = array();
$this->taille_std = null;
$this->pivot_siecle = 20;
$this->mode_retour = "noms & valeurs";
$this->confirme = $confirme;
$this->mode = null;
$this->champ_cour = 0;
$this->log = null;
}
function afficher() {
$resultat = null;
echo $this->javascriptSubmit();
if (!isset($_POST) || !$_POST || ($_POST["classeform_acces"] == "annuler")) $this->mode = null;
else {
$this->affecterValeursChamps($_POST);
$succes = $this->controler();
if ($succes) $this->mode = $_POST["classeform_acces"];
else $this->mode = "erreur";
}
switch ($this->mode) {
case "confirme" :
echo $this->afficherTexte();
echo $this->afficherForm(true);
break;
case "modif" :
echo $this->afficherForm();
break;
case "envoi" :
$resultat = $this->retournerTableauValeurs($this->mode_retour);
if ($this->log) $this->enregistrerLog($this->retournerTableauValeurs("valeurs", $resultat));
break;
default :
echo $this->afficherForm();
}
return $resultat;
}
function ajoutChamp($label, $nom, $type, $format=null, $oblig=true, $min=null, $max=null, $defVal='') {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, $type, $format, $oblig, $min, $max, $defVal);
}
function ajoutChampText($label, $nom, $format=null, $oblig=true, $min=null, $max=null, $defVal='') {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "text", $format, $oblig, $min, $max, $defVal);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
}
function ajoutChampPassword($label, $nom, $min=null, $max=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "password", "", true, $min, $max);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 100);
}
function ajoutChampTextarea($label, $nom, $format=null, $oblig=true, $min=null, $max=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "textarea", $format, $oblig, $min, $max);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 3);
}
function ajoutChampFile($label, $nom, $oblig=true, $min=null, $max=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "file", "fichier", $oblig, $min, $max);
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
}
function ajoutChampSelect($label, $nom, $oblig=true, $taille=null, $multiple=null) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "select", "", $oblig, null, null);
if ($taille) $this->champs[$this->champ_cour]->valCtlLimites($taille, null);
if ($multiple) $this->champs[$this->champ_cour]->valMultiple();
}
function ajoutChampRadio($label, $nom, $oblig=true, $fin_ligne=null) {
$this->champ_cour = sizeof($this->champs);
$args = func_get_args();
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "radio", "", $oblig);
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
}
function ajoutChampCheckbox($label, $nom, $oblig=true, $fin_ligne=null) {
$this->champ_cour = sizeof($this->champs);
$args = func_get_args();
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "checkbox", "", $oblig);
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
}
function ajoutTexte($texte) {
$this->champ_cour = sizeof($this->champs);
$this->champs[$this->champ_cour] = new ClasseFormChamp($texte, "", "", "", false);
}
function cacherTitre() {
$this->montrer_titre = false;
}
function valTailleStd($taille) {
$this->taille_std = $taille;
}
function valPivotSiecle($pivot) {
$this->pivot_siecle = $pivot;
}
function valModeRetour($mode) {
$this->mode_retour = $mode;
}
function valLog($log) {
$this->log = $log;
}
function valChampFormat($format, $min=null, $max=null) {
$this->champs[$this->champ_cour]->valFormat($format, $min, $max);
}
function valChampLimites($min, $max=null) {
$this->champs[$this->champ_cour]->valLimites($min, $max);
}
function valChampCtlLimites($min, $max=null) {
$this->champs[$this->champ_cour]->valCtlLimites($min, $max);
}
function valChampMultiple() {
$this->champs[$this->champ_cour]->valMultiple();
}
function valChampOptions() {
if ((func_num_args() == 1) && is_array(func_get_arg(0))) $args = func_get_arg(0);
else $args = func_get_args();
$this->champs[$this->champ_cour]->valOptions($args);
}
function valChampDescro($descro) {
$this->champs[$this->champ_cour]->valDescro($descro);
}
function valChampFinLigne($fin_ligne) {
$this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
}
function valChampOption1Vide($option_vide) {
$this->champs[$this->champ_cour]->valOption1Vide($option_vide);
}
function afficherForm($cache=false) {
$html = "<form method='post' action='javascript:location.href'>\n";
$html .= "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
if ($this->titre && $this->montrer_titre && !$cache)
$html .= "<caption class='form-caption'>$this->titre" . (($this->mode == "erreur") ? " <span class='erreur'>(erreurs)</span>" : "") . "</caption>\n";
else if (($this->mode == "erreur"))
$html .= "<caption class='form-caption'><span class='erreur'>(erreurs)</span></caption>\n";
for ($i=0;$i<sizeof($this->champs);$i++) {
if ($cache) $html .= $this->champs[$i]->afficherFormCache();
else $html .= $this->champs[$i]->afficherForm();
}
if ($valeurs) $html .= $this->afficherBoutonsForm();
else $html .= $this->afficherBoutonsForm();
if ($this->existeChampFacultatif())
$html .= "<tr><td class='form-info-obligatoire' colspan='2'>&nbsp;</td></tr>";
$html .= "</table></form>\n";
return $html;
}
function afficherBoutonsForm() {
if (($this->mode == null) || ($this->mode == "erreur")) {
if ($this->confirme)
$html = "<tr><td><input type='hidden' name='classeform_acces' value='confirme' /></td>";
else $html = "<tr><td><input type='hidden' name='classeform_acces' value='envoi' /></td>";
}
else $html = "<tr><td><input type='hidden' name='classeform_acces' /></td>";
$html .= "<td><input class='form-bouton' type='button' value='Envoyer' onClick='soumettre(\"envoi\")'/>";
if ($this->confirme) {
if ($this->mode == "confirme") {
$html .= " <input class='form-bouton' type='button' value='Modifier'";
$html .= " onClick='soumettre(\"modif\")'; />";
}
else {
$html .= " <input class='form-bouton' type='button' value='Voir avant envoi'";
$html .= " onClick='soumettre(\"confirme\")'; />";
}
}
$html .= " <input class='form-bouton' type='reset' value='Annuler' onClick='soumettre(\"annuler\")' /></td></tr>\n";
return $html;
}
function afficherTexte() {
$html = "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
if ($this->titre) $html .= "<caption class='form-caption'>$this->titre</caption>\n";
for ($i=0;$i<sizeof($this->champs);$i++)
$html .= $this->champs[$i]->afficherTexte();
$html .= "</table>\n";
return $html;
}
function javascriptSubmit() {
$html = "<script language='JavaScript'>\n";
$html .= "<!-- \n";
$html .= "function soumettre(acces) { with (document.forms[0]) {";
$html .= "classeform_acces.value=acces; action=location.href; submit();";
$html .= "} }\n";
$html .= "// -->\n";
$html .= "</script>\n";
return $html;
}
function controler() {
$succes = true;
for ($i=0;$i<sizeof($this->champs);$i++) {
if ($this->champs[$i]->aControler() && ($this->champs[$i]->controler($this->pivot_siecle) == false)) {
$succes = false;
}
}
return $succes;
}
function affecterValeursChamps($valeurs) {
$valeurs = convertirPost($valeurs);
for ($i=0;$i<sizeof($this->champs);$i++)
$this->champs[$i]->affecterValeur($valeurs);
}
function retournerTableauValeurs($mode_retour) {
$retour = array();
for ($i=0;$i<sizeof($this->champs);$i++)
{ //echo "------------------------------------\r\n$i : \r\n";
//print_r($this->champs);
// print_r($this->champs[$i]);
//echo "\r\n\r\n";
$this->champs[$i]->retournerTableauValeurs(&$retour, $mode_retour);}
return $retour;
}
function envoyerMail() {
$mail = new ClasseMail($this->titre);
$mail->contenu = $this->champs;
return $mail->envoyer($this->cible);
}
function existeChampFacultatif() {
$ok = false;
for ($i=0;$i<sizeof($this->champs);$i++) {
if ($this->champs[$i]->type && !$this->champs[$i]->valObligatoire()) {
$ok = true;
break;
}
}
return $ok;
}
function enregistrerLog($valeurs, $resultat) {
if ($f = fopen($this->log, "a")) {
$texte = ($resultat ? "" : "ECHEC ") . "[ " . date("d/mY H:i:s") . " ] - ";
$texte .= $this->titre ? "$this->titre - " : "";
$texte .= $valeurs;
fputs($f, $texte);
fclose($f);
}
}
}
class ClasseFormChamp {
var $label;
var $nom;
var $type;
var $format;
var $oblig;
var $taille_max;
var $taille_min;
var $valeur;
var $options;
var $descro;
var $multiple;
var $fonction;
var $ctl_taille1;
var $ctl_taille2;
var $fin_ligne;
var $erreur;
var $valeur_defaut;
var $valeur_db;
function ClasseFormChamp($label, $nom, $type=null, $format=null, $oblig=true, $min=null, $max=null, $valDef='') {
$this->label = $label;
$this->nom = $nom;
$this->type = $type;
$this->format = $format;
$this->taille_min = $min;
$this->taille_max = $max;
$this->oblig = $oblig;
if (($type == "select") || ($type == "checkbox") || ($type == "radio")) {
$this->valeur = array();
$this->options = array();
}
else {
$this->valeur = null;
$this->options = null;
}
$this->descro = null;
if ($type == "checkbox") $this->multiple = true;
else $this->multiple = false;
$this->fonction = null;
$this->ctl_taille1 = null;
$this->ctl_taille2 = null;
$this->fin_ligne = null;
$this->erreur = null;
$this->valeur_defaut = $valDef;
}
function valObligatoire() {
if ($this->oblig) return true;
else return false;
}
function valFormat($format, $long_min=null, $long_max=null) {
if ($this->type == "text") {
$this->format = $format;
if ($long_min) $this->taille_min = $long_min;
if ($long_max) $this->taille_max = $long_max;
}
}
function valLimites($min, $max) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
$this->taille_min = $min;
$this->taille_max = $max;
}
}
function valCtlLimites($taille1, $taille2) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "select") || ($this->type == "file")) {
$this->ctl_taille1 = $taille1;
if ($taille2 && ($this->type != "select")) $this->ctl_taille2 = $taille2;
}
}
function valFonction($fonction) {
$this->fonction = $fonction;
}
function valDescro($descro) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
$this->descro = $descro;
}
}
function valMultiple() {
if ($this->type == "select") $this->multiple = true;
}
function valFinLigne($fin_ligne) {
if (($this->type == "radio") || ($this->type == "checkbox")) $this->fin_ligne = $fin_ligne;
}
function valOptions($options) {
if ($this->champAOptions()) {
if (is_array($options)) {
foreach ($options as $option) {
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $option, $regs))
$this->options[] = new ClasseFormOption($regs[1], true);
else $this->options[] = new ClasseFormOption($option);
}
}
else {
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $options, $regs))
$this->options[] = new ClasseFormOption($regs[1], true);
else $this->options[] = new ClasseFormOption($options);
}
}
}
function ValOption1Vide($option_vide) {
if ($this->type == "select") $this->fin_ligne = $option_vide;
}
function afficherForm() {
if (!$this->type) $html = "<tr><td class='form-label' colspan='2'>$this->label</td></tr>";
else {
if (!is_null($this->erreur))
$html = "<tr><td class='form-label-erreur'> > $this->label (<font size='-2'>$this->erreur</font>)</td>";
else if ($this->oblig) $html = "<tr><td class='form-label-obligatoire'>$this->label</td>";
else $html .= "<tr><td class='form-label-facultatif'>$this->label</td>";
$html .= "<td class='form-td'>";
switch ($this->type) {
case "text" : $html .= $this->afficherFormTexte();
break;
case "password" : $html .= $this->afficherFormPassword();
break;
case "textarea" : $html .= $this->afficherFormTextarea();
break;
case "select" : $html .= $this->afficherFormSelect();
break;
case "radio" : $html .= $this->afficherFormRadio();
break;
case "checkbox" : $html .= $this->afficherFormCheckbox();
break;
case "file" : $html .= $this->afficherFormFile();
}
$html .= "</td></tr>\n";
}
return $html;
}
function afficherFormCache() {
$html = "<input type='hidden' name='$this->nom'";
if (is_array($this->valeur)) {
$chaine = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
$html .= " value='" . $chaine . "' />\n";
}
else $html .= " value='" . $this->valeur . "' />\n";
return $html;
}
function afficherTexte() {
$html = "<tr><td class='form-label'>$this->label</td><td class='form-td'>";
if (is_array($this->valeur)) {
$chaine = implode(_SEPA_AFFICHE_MULTIPLE, $this->valeur);
$html .= $chaine;
}
else $html .= $this->valeur;
$html .= "</td></tr>\n";
return $html;
}
function champAOptions() {
if (($this->type == "select") || ($this->type == "checkbox") || ($this->type == "radio")) return true;
else return false;
}
function controler($pivot=null) {
global $erreur_message;
$this->valeur_db=$this->valeur;
if ($this->type) {
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
$this->controlerChampTexte($pivot);
if (is_null($this->erreur)) return true;
else return false;
}
else if (($this->type == "select") || ($this->type == "radio")) {
if (!$this->valeur || (sizeof($this->valeur) == 0)) {
$this->erreur = $erreur_message["option"];
return false;
}
else return true;
}
else return true;
}
else return true;
}
function aControler() {
if ($this->type && $this->oblig) return true;
else return false;
}
function retournerTableauValeurs(&$tableau, $mode_retour) {
if (is_array($this->valeur)) {$valeur = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
print_r($this->valeur);
die('Cas non géré dans inc_classeform.php');
}
else $valeur = $this->valeur_db;
switch ($mode_retour) {
case "noms & valeurs" :
$tableau[$this->nom] = $valeur;
break;
case "labels & valeurs" :
$tableau[$this->label] = $valeur;
break;
case "valeurs" :
$tableau[] = $valeur;
}
}
function affecterValeur($valeurs) {
$valeur = $valeurs[$this->nom];
if ($this->champAOptions()) {
if (strpos($valeur, _SEPA_VALEUR_MULTIPLE) !== false)
$this->valeur = explode(_SEPA_VALEUR_MULTIPLE, $valeur);
else $this->valeur = $valeur;
for ($i=0;$i<sizeof($this->options);$i++)
$this->options[$i]->selectionnerSiValeur($this->valeur);
}
else $this->valeur = $valeur;
}
function controlerChampTexte($pivot) {
global $erreur_message;
if (trim($this->valeur) == "") $this->erreur = $erreur_message["vide"];
else {
$this->erreur = champTexteConforme($this->valeur, $this->taille_min, $this->taille_max);
if (is_null($this->erreur) && $this->format) {
switch ($this->format) {
case "alphanum" :
if (!controlerAlphanum($this->valeur)) $this->erreur = $erreur_message["alphanum"];
break;
case "num" :
if (!controlerNum($this->valeur)) $this->erreur = $erreur_message["num"];
break;
case "num-strict" :
if (!controlerNum($this->valeur, true)) $this->erreur = $erreur_message["num"];
break;
case "tel" :
if (!controlerTel($this->valeur)) $this->erreur = $erreur_message["tel"];
break;
case "email" :
if (!controlerEmail($this->valeur)) $this->erreur = $erreur_message["email"];
break;
case "date" :
if (!controlerDate($this->valeur, $pivot)) $this->erreur = $erreur_message["date"];
else $this->valeur_db=substr($this->valeur,6,4).'-'.substr($this->valeur,3,2).'-'.substr($this->valeur,0,2);
break;
case "url" :
if (!controlerUrl($this->valeur)) $this->erreur = $erreur_message["url"];
break;
}
}
}
}
function afficherFormTexte() {
$html .= "<input class='form-input' type='text' name='$this->nom' size='$this->ctl_taille1' ";
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
if ($this->valeur) $html .= " value='" . $this->valeur . "' />";
else if ($this->valeur_defaut) $html .= " value='" . $this->valeur_defaut . "' />";
else if ($this->descro) { $html .= " value='" . htmlentities(stripslashes($this->descro), ENT_QUOTES) . "'";
$html .= " onFocus='this.value=\"\"' />";
}
else $html .= " value='' />";
return $html;
}
function afficherFormPassword() {
$html .= "<input class='form-input' type='password' name='$this->nom' size='$this->ctl_taille1'";
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
if ($this->valeur) $html .= " value='" . $this->valeur . "' />";
else if ($this->descro) {
$html .= " value='" . htmlentities(stripslashes($this->descro), ENT_QUOTES) . "'";
$html .= " onFocus='this.value=\"\"' />";
}
else $html .= " value='' />";
return $html;
}
function afficherFormTextarea() {
$html .= "<textarea class='form-input' name='$this->nom' cols='$this->ctl_taille1'";
if ($this->ctl_taille2) $html .= " rows='$this->ctl_taille2'";
else if ($this->taille_max) {
$rows = ceil($this->taille_max / $taille_std);
$html .= " rows='$rows'";
}
else $html .= " rows='3'";
if ((trim($this->valeur) == "") || $this->descro) $html .= " onFocus='this.value=\"\"'>";
else $html .= ">";
if (trim($this->valeur)) $html .= $this->valeur;
else if ($this->descro) $html .= htmlentities(stripslashes($this->descro), ENT_QUOTES);
$html .= "</textarea>";
return $html;
}
function afficherFormSelect() {
$html = "<select name='$this->nom" . ($this->multiple ? "[]'" : "'");
if ($this->fin_ligne && $this->multiple)
$html .= " size='" . (($this->ctl_taille1 >= 2) ? $this->ctl_taille1 : 2 ) . "'";
else $html .= " size='" . ($this->ctl_taille1 ? $this->ctl_taille1 : 1) . "'";
$html .= $this->multiple ? " multiple>\n" : ">\n";
if ($this->fin_ligne) {
$html .= "<option class='form-option-entete' value=''>$this->fin_ligne</option>\n";
}
for ($i=0;$i<sizeof($this->options);$i++)
$html .= $this->options[$i]->afficherFormSelect();
$html .= "</select>\n";
return $html;
}
function afficherFormRadio() {
for ($i=0;$i<sizeof($this->options);$i++) {
$html .= $this->options[$i]->afficherFormCase("radio", $this->nom, $this->oblig);
$html .= $this->fin_ligne ? "<br />" : "&nbsp;";
}
return $html;
}
function afficherFormCheckbox() {
for ($i=0;$i<sizeof($this->options);$i++) {
$html .= $this->options[$i]->afficherFormCase("checkbox", "$this->nom[]", $this->oblig);
$html .= $this->fin_ligne ? "<br />" : "&nbsp;";
}
return $html;
}
function afficherFormFile() {
$html .= "<input class='form-input' type='file' name='$this->nom' size='$this->ctl_taille1'";
if ($this->taille_max) $html .= " maxlength='$this->ctl_taille2'";
if ($this->descro) $html .= " value='$this->descro' onChange='this.value=\"\"' />";
else $html .= " value='' />";
return $html;
}
}
class ClasseFormOption {
var $valeur;
var $selection;
function ClasseFormOption($val, $selec=false) {
$this->valeur = htmlspecialchars(stripslashes($val), ENT_QUOTES);
$this->selection = $selec;
}
function afficherFormSelect() {
$html = "<option value='$this->valeur'" . ($this->selection ? " selected>" : ">");
$html .= "$this->valeur</option>\n";
return $html;
}
function afficherFormCase($type, $nom, $oblig) {
$html = "<input type='$type' name='$nom' value='$this->valeur'";
$html .= ($this->selection) ? " checked />" : " />";
if ($oblig) $html .= "<span class='form-input-obligatoire'>" . $this->valeur . "<span>";
else $html .= "<span class='form-input-facultatif'>" . $this->valeur . "<span>";
return $html;
}
function selectionnerSiValeur($valeurs) {
if (is_array($valeurs)) {
if (in_array($this->valeur, $valeurs)) $this->selection = true;
else $this->selection = false;
}
else if ($this->valeur == $valeurs) $this->selection = true;
else $this->selection = false;
}
}
function controlerEmail($valeur) {
if (preg_match("/^[\w|-]+(\.[\w|-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/", $valeur)) return true;
else return false;
}
function controlerDate($valeur, $pivot) {
if (preg_match("/^(\d{1,2})[\/|\-|\.](\d{1,2})[\/|\-|\.](\d\d)(\d\d)?$/", $valeur, $regs)) {
$jour = ($regs[1] < 10) ? "0".$regs[1] : $regs[1];
$mois = ($regs[2] < 10) ? "0".$regs[2] : $regs[2];
if ($regs[4]) $an = $regs[3] . $regs[4];
else {
if ($pivot) {
if ($regs[3] <= $pivot) $an = $regs[3] + 2000;
else $an = $regs[3] + 1900;
}
else $an = $regs[3] + 2000;
}
if (checkdate($mois, $jour, $an)) return true;
else return false;
}
else return false;
}
function controlerUrl($valeur) {
if (ereg("^((http|ftp):\/\/)?([0-9a-z_]+[\.\-])+[0-9a-z]+(\/[0-9a-z_]+)*(\/[0-9a-z_]+\.[0-9a-z]+)?$", $valeur)) return true;
else return false;
}
function controlerAlphanum($valeur) {
if (preg_match("/^[\w|\d|\s|'|\"|\\|,|\.|\-|&|#|;]+$/", $valeur)) return true;
else return false;
}
function controlerNum($valeur, $strict=false) {
if ($strict) {
if (ereg("^[0-9]+$", $valeur)) return true;
else return false;
}
else if (preg_match("/^[\d|\s|\-|\+|E|e|,|\.]+$/", $valeur)) return true;
else return false;
}
function controlerTel($valeur) {
if (preg_match("/^[\d|\s|\-|\.|\(|\)]+$/", $valeur)) return true;
else return false;
}
function champTexteConforme($valeur, $min, $max) {
global $erreur_message;
if ($min && (strlen($valeur) < $min)) return $min . " " . $erreur_message["min"];
else if ($max && (strlen($valeur) > $max)) return $max . " " . $erreur_message["max"];
else if (preg_match('/(.)\1{4,}/', $valeur)) return $erreur_message["texte"];
else return null;
}
function convertirPost($post) {
$result = array();
foreach ($post as $cle => $valeur) {
if (is_array($valeur)) {
for ($i=0;$i<sizeof($valeur);$i++)
$result[$cle][] = htmlspecialchars(stripslashes($valeur[$i]), ENT_QUOTES);
}
else $result[$cle] = htmlspecialchars(stripslashes($valeur), ENT_QUOTES);
}
return $result;
}
?>

View File

@ -0,0 +1,302 @@
<?php
class ICotation {
var $reTrtAuto;
var $tabBilan;
var $tabNotation;
var $tabLibActivite;
var $tabActivite;
var $tabR;
function ICotation ($tabBilan, $retraitementAutomatique=true) {
$this->reTrtAuto = $retraitementAutomatique;
$this->tabBilan = $tabBilan;
include ('paramCotation.inc');
}
function calculProvisionsPourRisque () {
if ( !$this->reTrtAuto )
return $this->tabBilan['DP'] + $this->tabBilan['DQ'] - $this->tabBilan['X04'];
else
return (1/2*$this->tabBilan['DP'])+(1/2*$this->tabBilan['DQ']);
}
function calculEBE () {
return $this->tabBilan['FC'] + $this->tabBilan['FF'] + $this->tabBilan['FI'] + $this->tabBilan['FOB']
+ $this->tabBilan['FM'] + $this->tabBilan['FN'] - $this->tabBilan['FC'] + $this->tabBilan['FC']
- ( $this->tabBilan['FS'] + $this->tabBilan['FT'] + $this->tabBilan['FU'] + $this->tabBilan['FV'] )
- ( $this->tabBilan['FW'] - $this->tabBilan['HP'] - $this->tabBilan['HQ'] - $this->tabBilan['HP2'] - $this->tabBilan['HQ2'] )
- $this->tabBilan['FX'] - ( $this->tabBilan['FY'] + $this->tabBilan['FZ'] ) + ( $this->tabBilan['FO'] - $this->tabBilan['FOB'] ) ;
}
function calculChiffreAffaires () {
return $this->tabBilan['FC']
+ $this->tabBilan['FF']
+ $this->tabBilan['FI']
+ $this->tabBilan['FO']
- $this->tabBilan['FOB'] ;
}
function calculMargeCommerciale () {
return $this->tabBilan['FC'] - ( $this->tabBilan['FS'] + $this->tabBilan['FT'] ) ;
}
function calculProduction () {
return $this->tabBilan['FF'] + $this->tabBilan['FI'] + $this->tabBilan['FM'] + $this->tabBilan['FN'] ;
}
function calculValeurAjoutee () {
return $this->calculMargeCommerciale() + $this->calculProduction()
- ( $this->tabBilan['FU'] + $this->tabBilan['FV'] + $this->tabBilan['FW'] ) ;
}
function calculEBEnonCASA () {
return $this->calculValeurAjoutee() + $this->tabBilan['FO'] - $this->tabBilan['FX'] - ( $this->tabBilan['FY'] + $this->tabBilan['FZ'] ) ;
}
function calculFondsPropresNetsCorriges() {
return $this->tabBilan['DA'] + $this->tabBilan['DC'] + $this->tabBilan['DB'] + $this->tabBilan['DD'] + $this->tabBilan['DE'] + $this->tabBilan['DF'] + $this->tabBilan['DG'] + $this->tabBilan['DK'] - (1/3*$this->tabBilan['X01'])
+ $this->tabBilan['DH'] + $this->tabBilan['DI'] + $this->tabBilan['DJ']
- $this->tabBilan['CL'] - $this->tabBilan['AB'] + $this->tabBilan['AC'] - $this->tabBilan['AA'] - $this->tabBilan['CB'] + $this->tabBilan['CC'] - $this->tabBilan['X02'] - $this->tabBilan['CM'] - $this->tabBilan['CN']
+ $this->tabBilan['DM'] + $this->tabBilan['DN']
- $this->tabBilan['X03'] + $this->calculProvisionsPourRisque() - $this->tabBilan['RAD'] ;
}
function calculDettesFinancieresBancairesBrutes () {
return $this->tabBilan['DS'] - $this->tabBilan['CM1'] + $this->tabBilan['EI'] - $this->tabBilan['CM2']
+ $this->tabBilan['DT'] - $this->tabBilan['CM3'] + $this->tabBilan['DU'] - $this->tabBilan['EH']
+ (3/4*$this->tabBilan['YQ']) + (2/3*$this->tabBilan['YR'])
+ (3/4*$this->tabBilan['YQ2']) + (2/3*$this->tabBilan['YR2'])
+ $this->tabBilan['DV'] - $this->tabBilan['EI'] - $this->tabBilan['DVI1'] - $this->tabBilan['CM2']
+ $this->tabBilan['YS'] + $this->tabBilan['X08']
+ $this->tabBilan['EH'] + $this->tabBilan['VI1'] - ( $this->tabBilan['X20'] + $this->tabBilan['X21'] ) ;
}
function noteCapitalisation () {
if ( !$this->reTrtAuto ) {
$autresDettesExploit = $this->tabBilan['EA'] - $this->tabBilan['EAVI1'] - $this->tabBilan['EAB'] + $this->tabBilan['EB'] + $this->tabBilan['X01'] + $this->tabBilan['X04'] ;
$dettesFiscalesSociales = $this->tabBilan['DY'] - $this->tabBilan['DYA'];
} else {
$autresDettesExploit = $this->tabBilan['EA'] - $this->tabBilan['EAVI1'] - $this->tabBilan['EAB'] + $this->tabBilan['EB'] + $this->tabBilan['X01'] + 2/3*((1/2*$this->tabBilan['DP'])+(1/2*$this->tabBilan['DQ']));
$dettesFiscalesSociales = $this->tabBilan['DY'] + 1/3*((1/2*$this->tabBilan['DP'])+(1/2*$this->tabBilan['DQ'])) - $this->tabBilan['DYA'] ;
}
$numerateur = $this->calculFondsPropresNetsCorriges();
$denominateur = $numerateur + $this->tabBilan['DS'] - $this->tabBilan['CM1'] + $this->tabBilan['EI'] - $this->tabBilan['CM2'] + $this->tabBilan['DU'] - $this->tabBilan['EH']
+ $this->tabBilan['DV'] - $this->tabBilan['DVI1'] - $this->tabBilan['EI'] + $this->tabBilan['DT'] - $this->tabBilan['CM3'] + 3/4*$this->tabBilan['YQ'] + 2/3*$this->tabBilan['YR']
+ 3/4*$this->tabBilan['YQ2'] + 2/3*$this->tabBilan['YR2']
+ $this->tabBilan['DW'] + $this->tabBilan['DX'] + $dettesFiscalesSociales
+ $autresDettesExploit + $this->tabBilan['DZ'] + $this->tabBilan['DIA'] + $this->tabBilan['ED'] + $this->tabBilan['EAB'] + $this->tabBilan['DYA']
+ $this->tabBilan['EH'] + $this->tabBilan['YS'] + $this->tabBilan['VI1'];
// + $this->tabBilan['X08']
// - $this->tabBilan['X20'] + $this->tabBilan['YS'] - $this->tabBilan['X08'];
if ($denominateur==0)
return array('NUMERATEUR'=>$numerateur*100,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
return array('NUMERATEUR'=>$numerateur* 100,'DENOMINATEUR'=>$denominateur,'NOTE'=>($numerateur* 100)/$denominateur);
}
function noteLevierEndettement () {
$numerateur = $this->calculDettesFinancieresBancairesBrutes();
$denominateur = $this->calculFondsPropresNetsCorriges();
if ($denominateur==0)
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur/$denominateur);
}
function noteCapaciteRemboursement () {
$numerateur = $this->calculDettesFinancieresBancairesBrutes();
$denominateur = $this->calculEBE();
if ($denominateur==0)
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur/$denominateur);
}
function noteCouvChargesFi () {
$numerateur = $this->calculEBE();
$denominateur = $this->tabBilan['GR'] + ( 1/4*$this->tabBilan['HP'] + 1/3*$this->tabBilan['HQ'] )
+ ( 1/4*$this->tabBilan['HP2'] + 1/3*$this->tabBilan['HQ2'] )
+ $this->tabBilan['GS']
+ $this->tabBilan['GT']
- $this->tabBilan['GJ']
- $this->tabBilan['GK']
- $this->tabBilan['GL']
- $this->tabBilan['GN']
- $this->tabBilan['GO']
- $this->tabBilan['GH']
+ $this->tabBilan['GI'] ;
if ($denominateur==0)
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur/$denominateur);
}
function noteTresorerie () {
$numerateur = $this->tabBilan['CD'] - $this->tabBilan['CE'] + $this->tabBilan['CF'] - $this->tabBilan['CG']
- $this->tabBilan['EH'] - ( $this->tabBilan['YS'] + $this->tabBilan['X08'] ) ;
$denominateur = $this->calculChiffreAffaires();
if ($denominateur==0)
return array('NUMERATEUR'=>$numerateur*360,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
return array('NUMERATEUR'=>$numerateur*360,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur*360/$denominateur);
}
function noteMargeExploitation () {
$numerateur = $this->calculEBE();
$denominateur = $this->calculChiffreAffaires();
if ($denominateur==0)
return array('NUMERATEUR'=>$numerateur*100,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
return array('NUMERATEUR'=>$numerateur*100,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur*100/$denominateur);
}
function getSecteurActivite($naf) {
$nbSecteurs=count($this->tabActivite);
while (strlen($naf) > 1)
{
for ($i=1; $i<$nbSecteurs; $i++)
{
for ($j=0; isset($this->tabActivite[$i][$j]); $j++)
{
if ($this->tabActivite[$i][$j]==$naf)
// echo 'NAF '.$naf.' TROUVÉ !<br>';
return $i;
}
}
// echo 'NAF '.$naf.' non trouvé !<br>';
$naf=substr($naf,0,strlen($naf)-1);
}
return 17; // Secteur d'activité par défaut si non trouvé
}
function getBorne($note, $borne, $secteur) {
// print_array($this->tabR[$borne][$secteur],0);
for ($j=0; $j<10; $j++)
{
$tabMinMax=explode(':',$this->tabR[$borne][$secteur][$j]);
if ($tabMinMax[0]!='') $min=$tabMinMax[0];
else $min=-1E99;
if ($tabMinMax[1]!='') $max=$tabMinMax[1];
else $max=1E99;
if ( ( $note>$min && $note<=$max ) )
{
// echo "TROUVE ++++ $note > ".$tabMinMax[0]." et $note <= ". $tabMinMax[1].'<br/>';
if ($j==0) return 3;
elseif ($j<4) return $j+4;
else return $j*2+1;
}
// echo "NOK $note < ".$tabMinMax[0]." ou $note > ". $tabMinMax[1].'<br/>';
}
return 3; // On retourne la plus basse note par défaut
}
function getNoteBorne($note, $borne, $secteur, $numerateur, $denominateur) {
$noteBorneBrute=$this->getBorne($note, $borne, $secteur);
switch($borne)
{
case 1:
if ($numerateur<0) return 3;
else return $noteBorneBrute;
break;
case 2:
if ($numerateur==0) return 19;
else return $noteBorneBrute;
break;
case 3:
if ($numerateur==0 && $denominateur>0) return 19;
elseif ($denominateur<0) return 3;
else return $noteBorneBrute;
break;
case 4:
if ($note<0) return 19;
else return $noteBorneBrute;
break;
default:
return $noteBorneBrute;
break;
}
}
function getNotationFin ($coteMoy) {
if( $coteMoy > 18.5 )
return 'A';
elseif( $coteMoy > 16 )
return 'B+';
elseif( $coteMoy > 14 )
return 'B';
elseif( $coteMoy > 12.5 )
return 'C+';
elseif( $coteMoy > 11 )
return 'C';
elseif( $coteMoy > 10 )
return 'C-';
elseif( $coteMoy > 9 )
return 'D+';
elseif( $coteMoy > 8 )
return 'D';
elseif( $coteMoy > 7 )
return 'D-';
elseif( $coteMoy > 6 )
return 'E+';
elseif( $coteMoy > 4.5 )
return 'E';
elseif( $coteMoy > 3 )
return 'E-';
else
return 'E--';
}
function getInfosNotation ($notation, $csv=false) {
if ($csv) {
$str =$this->tabNotation[$notation][1].';'.
$this->tabNotation[$notation][2].';'.
$this->tabNotation[$notation][3].';'.
$this->tabNotation[$notation][4].';';
return $str;
} else {
$str ='Notation : '. $this->tabNotation[$notation][0]."\r\n";
$str.='Equivalence BDF : '. $this->tabNotation[$notation][1]."\r\n";
$str.='Grades Moody\'s : '. $this->tabNotation[$notation][2]."\r\n";
$str.='Grades S&P : '. $this->tabNotation[$notation][3]."\r\n";
$str.='Probabilité de défaillance : '. $this->tabNotation[$notation][4]." %\r\n";
return $str;
}
}
}

View File

@ -0,0 +1,418 @@
<?
/** Parse une page Html et retourne son contenu dans un tableau :
** "code" => Code réponse Serveur
** "header" => Headers du serveur
** "body" => Page HTML
**/
function parse_response($this_response) {
// Split response into header and body sections
list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
$response_header_lines = explode("\r\n", $response_headers);
// First line of headers is the HTTP response code
$http_response_line = array_shift($response_header_lines);
if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
// put the rest of the headers in an array
$response_header_array = array();
$nbRMID=0;
foreach($response_header_lines as $header_line)
{
list($header,$value) = explode(': ', $header_line, 2);
if ($header=='Set-cookie' && substr($value,0,5)=='RMID=' && $nbRMID<5)//{
$nbRMID++;
// echo ("Je gicle le RMID n°$nbRMID\r\n");}
else
$response_header_array[$header] .= $value."\n";
}
return array('code' => $response_code, 'header' => $response_header_array, 'body' => $response_body);
}
/** Récupère une page HTML en fonction des paramètres :
** $url Url distante de la page à récupérer
** $strCookies Chaine de caractère contenant les cookies
** $postData Tableau des données à passer en POST uniquement
** $referer Referer à indiquer lors de l'appel de la page
** $debug Activer le débogage (True/False)
**
** ... et retourne son contenu dans un tableau :
** "code" => Code réponse Serveur
** "header" => Headers du serveur
** "body" => Page HTML
**/
function getUrl($url, $strCookies='', $postData='', $referer='', $debug=false, $host='') {
$ch = curl_init();
if ($host=='')
$this_header = array('Host: '. HOST_INSEE);
else
$this_header = array('Host: '. $host);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
//curl_setopt($ch, CURLOPT_PROXY, '10.142.10.254:80');
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password'); // Pas nécessaire en authentification NT
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
// Add each cookie that has been returned in the response
// If cookies need to be added/deleted or value changed, then add code here
if ($strCookies!='') {
//die('"'.$strCookies.'"');
//echo $strCookies."\r\n";
$cookies = explode("\n", $strCookies);
// Create the basic header
foreach($cookies as $this_cookie) {
if (trim($this_cookie)<>'')
array_push($this_header, 'Cookie: '.$this_cookie);
}
}
if ($postData!='') {
if (is_array($postData))
$post_data=$postData;
$o="";
foreach ($post_data as $k=>$v)
{
$o.= "$k=".utf8_encode($v)."&";
}
$post_data=substr($o,0,-1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
//if in_array('',$this_header
/*array_push($this_header, "Content-type: application/x-www-form-urlencoded");
array_push($this_header, "Content-Length: 44");*/
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
//print_r($this_header);
$page=curl_exec($ch);
$response = parse_response($page);
if ($debug){
$url2=str_replace('http://', '', $url);
$url2=str_replace('/', '_', $url2);
$url2=str_replace('?', '(param)', $url2);
$url2=str_replace('&', '(et)', $url2);
$fp=fopen('/var/www/_includes/partenaires/insee/'. date('Ymd-His') .'-'. microtime_float(true) .'-'. $url2 . '.html', 'a');
fwrite($fp, $url."\r\n");
fwrite($fp, $page);
fclose($fp);
//echo strip_tags(html_entity_decode($response['body']), '<td>');
}
//print_r(curl_getinfo($ch));
curl_close($ch);
return $response;
}
/**Verification de la validité des données pour la demande*/
function valideData($variable, $taille_min, $taille_max, $type_variable, $erreur=false){
if ( strlen((string)$variable) < $taille_min )
return $erreur;
if ( strlen((string)$variable) > $taille_max )
return $erreur;
if ( $type_variable == 'A' )
if ( is_string($variable) == true )
return true;
else
return $erreur;
elseif ( $type_variable == 'N')
{
for ($i=0; $i < strlen((string)$variable); $i++)
{
$car = substr((string)$variable,$i,1);
if ($car<'0' || $car>'9')
return $erreur;
}
return true;
}
return $erreur;
}
/** Test de la validité du siren demandé */
function valideSiren($siren, $nic='', $erreur=false) {
$lenSIREN=strlen($siren);
if (!valideData($siren, 9, 9,'N')) //Siren non précisé ou incorrect.
return $erreur;
else
{
if (!isset($nic) || trim($nic)=='')
{
$somme=0;
for ($i=0; $i<=8; $i+=2) // Traitement IMPAIR
$somme+=(integer)substr($siren,$i,1);
for ($i=1; $i<=7; $i+=2)
{ // Traitement PAIR
$var_tmp=(string)(2*((integer)substr($siren,$i,1)));
$som_tmp=0;
for($j=0;$j<strlen($var_tmp);$j++)
$som_tmp+=(integer)substr($var_tmp,$j,1);
$somme+=$som_tmp;
}
if ((integer)($somme/10)!=($somme/10))
{ // Le Siren est faux
if (substr($siren,0,3)!='200') // Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
return $erreur;
}
} else {
if (!valideData($nic,1,5,'N')) // Nic de format incorrect.
return $erreur;
$SIRET=$siren.$nic;
$somme=0;
for ($i=0; $i<=12; $i+=2)
{ // Traitement PAIR
$var_tmp=(string)(2*((integer)substr($SIRET,$i,1)));
$som_tmp=0;
for($j=0;$j<strlen($var_tmp);$j++)
$som_tmp+=(integer)substr($var_tmp,$j,1);
$somme+=$som_tmp;
}
for ($i=1; $i<=13; $i+=2) // Traitement IMPAIR
$somme+=(integer)substr($SIRET,$i,1);
if ((integer)($somme/10)!=($somme/10))// Le Siret est faux
return $erreur;
}
}
return true;
}
function rechercheTelephone($raisonSociale='', $adresse='', $localite='', $departement='', $activite='') {
$response1=getUrl(SITE_PJ.'pj.cgi?', '', '', '', true, HOST_PJ);
//print_r($response1['header']['Set-cookie']);
$pageHtml=$response1['body'];
$SESSION_ID=getTextInHtml($pageHtml, '<input type="hidden" name="SESSION_ID" value="', ' value="', '">');
$VID=getTextInHtml($pageHtml, '<input type="hidden" name="VID" value="', ' value="', '">');
$e_cookie=getTextInHtml($pageHtml, '<noscript><img ALT="" src="http://e.pagesjaunes.fr/m/web/', 'src="', '" BORDER=0 width=1 height=1></noscript>');
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/pji.css', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/pji_PJ.css', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_open.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/alerte.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_VED.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl(SITE_PJ.'sitecrm/popup.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/AUTOPROMO_PJ_banniere_activite/hotel_pj.swf?clickTAG=http://sbx.pagesjaunes.fr/RealMedia/ads/click_lx.ads/www.pagesjaunes.fr/GENERAL/GENERAL/PJ/1238513556/Top/OasDefault/AUTOPROMO_PJ_banniere_activite/hotel_pj.html/61633130323433353434346339306330?', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_VED.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/anim_HP_v2-04-2006.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_webcam.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_photo.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_trafic.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/Edito_webcams/new_04-2006.jpg', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response=getUrl('http://e.pagesjaunes.fr/js/m.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
$response2=getUrl($e_cookie, $response1['header']['Set-cookie'], '', SITE_PJ, true, HOST_PJ);
$cookies=$response1['header']['Set-cookie'] . $response2['header']['Set-Cookie'];
$input_image=$VALID_ARR=$NUM_RUE=$NEW_DEPARTEMENT=$OBJ_GEO='';
// Requête d'interrogation
$postData=array(
'ACTIVITE_VALIDATED_ASCII'=>'',
'ID_THEME_SDE'=>'',
'LISTE_RUB_AVEC_THEME'=>'',
'input_image'=>$input_image,
'FRM_ACTIVITE'=>$activite,
'FRM_NOM'=>$raisonSociale,
'FRM_ADRESSE'=>$adresse,
'FRM_LOCALITE'=>$localite,
'FRM_DEPARTEMENT'=>$departement,
'JF_INSCRIPTIONS_REQ.x'=>'25',
'JF_INSCRIPTIONS_REQ.y'=>'4',
'faire'=>'decode_input_image',
'DEFAULT_ACTION'=>'jf_inscriptions_req',
'SESSION_ID'=>$SESSION_ID,
'VID'=>$VID,
'INFO_VILLE'=>'non',
'CODE_LOC_INFO_VILLE'=>'00000000',
'IV_ACTIVATION'=>'oui',
'lang'=>'FR',
'pays'=>'FR',
'srv'=>'PJ',
'TYPE_RECHERCHE'=>'ZZZ');
//print_r($postData);//die();
sleep(1);
$response=getUrl(SITE_PJ, $cookies, $postData, SITE_PJ, true, HOST_PJ);
$pageHtml=$response['body'];
if (count($tabNT=getTabListeNonTrouve($pageHtml))>0)
{
// Pas de réponses pour ces critères
// Il faut élargir la recherche !
$tabNTk=array_keys($tabNT);
$input_image=$tabNT[0];
$DEFAULT_ACTION='inscriptions_req';
$NEW_DEPARTEMENT=getTextInHtml($pageHtml, '<input type="hidden" name="NEW_DEPARTEMENT" value="', 'value="', '">');
$OBJ_GEO=getTextInHtml($pageHtml, '<input type=hidden name=OBJ_GEO value="', 'value="', '">');
}
elseif (count($tabGU=getTabListeGU($pageHtml))>0)
{
// Plusieurs Adresses possibles pour l'adresse donnée
// print_r($tabGU);
$input_image=getBonneAdresse($adresse, $tabGU);
$DEFAULT_ACTION='jf_inscriptions_req';
$VALID_ARR=getTextInHtml($pageHtml, '<input type=hidden name=VALID_ARR value="', 'value="', '">');
$NUM_RUE=getTextInHtml($pageHtml, '<input type=hidden name=NUM_RUE value="', 'value="', '">');
}
if ($input_image<>'') {
$CODE_LOC_INFO_VILLE=getTextInHtml($pageHtml, '<input type="hidden" name="CODE_LOC_INFO_VILLE" value="', 'value="', '">');
$postData=array(
'GEO_DEP'=>'', // New
'faire'=>'decode_input_image',
'DEFAULT_ACTION'=>$DEFAULT_ACTION,
'input_image'=>$input_image,// diff
'SESSION_ID'=>$SESSION_ID,
'VID'=>$VID,
'INFO_VILLE'=>'oui', // non dans la recherche préc.
'CODE_LOC_INFO_VILLE'=>$CODE_LOC_INFO_VILLE, // diff
'IV_ACTIVATION'=>'oui',
'lang'=>'FR',
'pays'=>'FR',
'srv'=>'PJ',
'TYPE_RECHERCHE'=>'CLOC', // ZZZ
'SAV_ADRESSE'=>$adresse, //
'SAV_LOCALITE'=>$localite, // New
'SAV_DEPARTEMENT'=>$departement, //
'FRM_NOM'=>$raisonSociale,
'FRM_ADRESSE'=>$adresse,
'FRM_LOCALITE'=>$localite,
'FRM_DEPARTEMENT'=>$departement,
'FRM_TYPE_PUB'=>'TOUS',
'RP_FORM'=>'',
'VALID_LOC'=>$CODE_LOC_INFO_VILLE,
'VALID_ARR'=>$VALID_ARR,
'NUM_RUE'=>$NUM_RUE,
'test_flash'=>'',
'ESPLUS'=>'',
'NEW_DEPARTEMENT'=>$NEW_DEPARTEMENT,
'OBJ_GEO'=>$OBJ_GEO,
);
print_r($postData);
sleep(1);
$response=getUrl(SITE_PJ, $cookies, $postData, SITE_PJ, true, HOST_PJ);
$pageHtml=$response['body'];
}
$nbReponses=trim(getTextInHtml($pageHtml, '<tr><td align="left" class=txtrequetetotal valign=middle nowrap><b>', '<b>', 'r&eacute;ponse(s)</b></td>'));
$tabRep=getTabResponses($pageHtml);
if (count($tabRep)==$nbReponses)
return $tabRep;
else
return false;
}
function getTabResponses($pageHtml) {
$tabRepTmp=explode ('class=fdinscr', $pageHtml);
$tabRep=array();
foreach($tabRepTmp as $key => $value)
{
if ($key>0) {
$raisonSociale=getTextInHtml($value, 'class=fdrsinscr', '<b>', '</b>');
$ligneAdresse=html_entity_decode(getTextInHtml($value, '<td align="left" class=txtinscr ><b>', '<b>', '|'));
$tabligneAdresse=explode('<br>', $ligneAdresse);
$ligneAdresse1=strip_tags($tabligneAdresse[0]);
$ligneAdresse2=strip_tags($tabligneAdresse[1]);
$dispoPlan =(bool)(strpos($value, '<b>Plan</b>'));
$dispoIti =(bool)(strpos($value, '<b>Itin&eacute;raire</b>'));
$dispoPhoto =(bool)(strpos($value, '<b>Photo</b>'));
$dispoWeb =(bool)(strpos($value, '<b>Site</b></a>&nbsp;&nbsp;&nbsp;'));
$lienWeb=getTextInHtml($value, '<a target="_blank" href="http://www.pagesjaunes.fr/CGI/MOD?', 'href="', '" ');
$page=getUrl($lienWeb, '', '', '', true);
$lienWeb=$page['header']['Location'];
/*echo "Enreg n°$key : RS='$raisonSociale'\r\n";
echo "Enreg n°$key : Adresse1='$ligneAdresse1'\r\n";
echo "Enreg n°$key : Adresse2='$ligneAdresse2'\r\n";
echo "Enreg n°$key : Plan ?='$dispoPlan'\r\n";
echo "Enreg n°$key : Itineraire ?='$dispoIti'\r\n";
echo "Enreg n°$key : Photo ?='$dispoPhoto'\r\n";
echo "Enreg n°$key : Web ?='$dispoWeb'\r\n";
echo "Enreg n°$key : Site WEB='$lienWeb'\r\n\r\n";*/
array_push($tabRep, array( 'raisonSociale' =>$raisonSociale,
'AdresseLigne1' =>$ligneAdresse1,
'AdresseLigne2' =>$ligneAdresse2,
'Dispo_Plan' =>$dispoPlan,
'Dispo_Iti' =>$dispoIti,
'Dispo_Photo' =>$dispoPhoto,
'Dispo_Web' =>$dispoWeb,
'LienWeb' =>$lienWeb));
}
}
return $tabRep;
}
function getBonneAdresse($adresse, $tabGU) {
// tableau de mots à vérifier
$words = array_keys($tabGU);
// aucune distance de trouvée pour le moment
$shortest = -1;
// boucle sur les des mots pour trouver le plus près
foreach ($words as $word) {
// calcule la distance avec le mot mis en entrée,
// et le mot courant
$lev = levenshtein($adresse, $word);
// cherche une correspondance exacte
if ($lev == 0) {
// le mot le plus près est celui-ci (correspondance exacte)
$closest = $word;
$shortest = 0;
// on sort de la boucle ; nous avons trouvé une correspondance exacte
break;
}
// Si la distance est plus petite que la prochaine distance trouvée
// OU, si le prochain mot le plus près n'a pas encore été trouvé
if ($lev <= $shortest || $shortest < 0) {
// définission du mot le plus près ainsi que la distance
$closest = $word;
$shortest = $lev;
}
}
/*
echo "Mot entré : $adresse\n";
if ($shortest == 0) {
echo "Correspondance exacte trouvée : $closest\n";
} else {
echo "Vous voulez dire : $closest ?\n";
}*/
return $tabGU[$closest];
}
?>

View File

@ -0,0 +1,548 @@
<?
class Insee {
}
function getDataEtablissement($pageHtml)
{
global $libelleErreur;
$responseSiege=$pageHtml;
$tabRet=array();
// On recherche si on est sur un établissement siège ou secondaire
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
if ($pos>0)
$tabRet['typeEtablissement']='secondaire';
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
if ($pos>0)
$tabRet['typeEtablissement']='siège';
// Recherche Dernière MAJ / Activité
$pos=strpos($responseSiege, '<font face="Arial" size="2">(dernière mise à jour :');
if ($pos>0) {
$tabRet['dateMAJ']=substr($responseSiege, $pos+51, 10);
$tabRet['dateAbsActivite']='';
$tabRet['active']='O';
} else {
$tabRet['active']='N';
$tabRet['dateMAJ']='';
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence&nbsp;d\'activité notée&nbsp;le&nbsp;:&nbsp;');
if ($pos>0) $tabRet['dateAbsActivite']=substr($responseSiege, $pos+78, 10);
else {
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence&nbsp;d\'activité');
if ($pos>0) $tabRet['dateAbsActivite']='';
}
}
$pos=strpos($responseSiege, ' size="-1"> <B>n°&nbsp;SIRET&nbsp;:</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
$tabRet['siret']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+97, 32)));
$pos=strpos($responseSiege, 'size="-1"> <B>Date&nbsp;de&nbsp;création&nbsp;:</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
if ($pos>0) {
$posFin=strpos($responseSiege, '</font>', $pos+109);
$tabRet['dateCreation']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+109, $posFin-($pos+109))));
}
else $tabRet['dateCreation']='';
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$len=127;
if ($pos==0){
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$len=122;
if ($pos==0){
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$len=126;
$libelleErreur='Informations INSEE non diffusables';
}
}
if ($libelleErreur=='') {
//LARGE*DOMINIQUE MICHEL/ <BR>GERANT SARL BIMAGIQUE &nbsp;</font>
$posFin=strpos($responseSiege, '</font>', $pos+$len);
$raisonSocialeStr=trim(substr($responseSiege, $pos+$len, $posFin-($pos+$len)));
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
$tabRet['raisonSociale']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
$tabRet['Enseigne']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[1])));
$pos=strpos($responseSiege, ' size="-1"> <B>Activité&nbsp;principale&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$tabRet['NafCode']=substr($responseSiege, $pos+120, 4);
$tabRet['NafLib']=trim(substr($responseSiege, $pos+137, 70));
$pos=strpos($responseSiege, ' size="-1"> <B>Adresse&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$posFin=strpos($responseSiege, '</font>', $pos+103);
$AdresseStr=substr($responseSiege, $pos+103, $posFin-($pos+103));
$AdresseTabLigne=explode('<BR>', $AdresseStr);//'
$tabRet['AdresseLigne1']=str_replace('&nbsp;', '/', $AdresseTabLigne[0]);
$tabRet['AdresseLigne2']=str_replace('&nbsp;', '/', $AdresseTabLigne[1]);
$tabRet['AdresseLigne3']=str_replace('&nbsp;', '/', $AdresseTabLigne[2]);
/*
$AdresseNum=$AdresseTabLigne1[0];
$AdresseVoi=$AdresseTabLigne1[1];
$AdresseRue=$AdresseTabLigne1[2];
$AdresseCP=$AdresseTabLigne2[0];
$AdresseVille=$AdresseTabLigne2[1];
*/
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise&nbsp;est&nbsp;connue&nbsp;au&nbsp;répertoire&nbsp;comme&nbsp;');
if ($pos>0) {
$posFin=strpos($responseSiege, '</b>', $pos+106);
$tabRet['etatJuridique']=html_entity_decode(substr($responseSiege, $pos+106, $posFin-($pos+106)));
$tabRet['dateEtatJuridique']='';
} else {
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise&nbsp;est&nbsp;cessée&nbsp;le&nbsp;:&nbsp;');
$tabRet['dateEtatJuridique']=substr($responseSiege, $pos+86, 10);
$tabRet['etatJuridique']='cessée';
}
//echo 'GetDataEtab="'.$libelleErreur."\"\r\n";
return $tabRet;
}
}
function getDataEntreprise($pageHtml)
{
global $libelleErreur;
$responseEntreprise=$pageHtml;
$tabRet=array();
if ($libelleErreur=='') {
$pos=strpos($responseEntreprise, 'size="-1"> <B>Date&nbsp;de&nbsp;création&nbsp;:</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
if ($pos>0)
$tabRet['dateCreationEntrep']=substr($responseEntreprise, $pos+109, 10);
else
$tabRet['dateCreationEntrep']='';
// Raison sociale et Sigle
$pos=strpos($responseEntreprise, ' size="-1"> <B>Raison sociale et Sigle&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$posFin=strpos($responseEntreprise, '</font>', $pos+123);
$raisonSocialeStr=trim(substr($responseEntreprise, $pos+123, $posFin-($pos+123)));
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
$tabRet['raisonSocialeEntrep']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
$tabRet['sigle']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[1])));
// Activité prinicpale Entrep
$pos=strpos($responseEntreprise, ' size="-1"> <B>Activité&nbsp;principale&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$tabRet['NafCodeEntrep']=substr($responseEntreprise, $pos+120, 4);
$tabRet['NafLibEntrep']=trim(substr($responseEntreprise, $pos+137, 70));
// Forme Juridique
$pos=strpos($responseEntreprise, ' size="-1"> <B>Forme&nbsp;juridique&nbsp;:</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
$tabRet['FJCodeEntrep']=substr($responseEntreprise, $pos+116, 4);
$tabRet['FJLibEntrep']=trim(substr($responseEntreprise, $pos+133, 70));
// Nb Etab Actifs
$pos=strpos($responseEntreprise, ' size="-1"> <B>Nb&nbsp;établissements&nbsp;actifs&nbsp;:</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
$posFin=strpos($responseEntreprise, '</font>', $pos+118);
$tabRet['nbEtabActifs']=trim(str_replace(' ', '', html_entity_decode(substr($responseEntreprise, $pos+118, $posFin-($pos+118)))));
}
return $tabRet;
}
/*
* parseHtml.php
* Author: Carlos Costa Jordao
* Email: carlosjordao@yahoo.com
*
* My notation of variables:
* i_ = integer, ex: i_count
* a_ = array, a_html
* b_ = boolean,
* s_ = string
*
* What it does:
* - parses a html string and get the tags
* - exceptions: html tags like <br> <hr> </a>, etc
* - At the end, the array will look like this:
* ["IMG"][0]["SRC"] = "xxx"
* ["IMG"][1]["SRC"] = "xxx"
* ["IMG"][1]["ALT"] = "xxx"
* ["A"][0]["HREF"] = "xxx"
*
*/
function parseHtml( $s_str )
{
$i_indicatorL = 0;
$i_indicatorR = 0;
$s_tagOption = '';
$i_arrayCounter = 0;
$a_html = array();
// Search for a tag in string
while( is_int(($i_indicatorL=strpos($s_str,'<',$i_indicatorR))) ) {
// Get everything into tag...
$i_indicatorL++;
$i_indicatorR = strpos($s_str,'>', $i_indicatorL);
$s_temp = substr($s_str, $i_indicatorL, ($i_indicatorR-$i_indicatorL) );
$a_tag = explode( ' ', $s_temp );
// Here we get the tag's name
list( ,$s_tagName,, ) = each($a_tag);
$s_tagName = strtoupper($s_tagName);
// Well, I am not interesting in <br>, </font> or anything else like that...
// So, this is false for tags without options.
$b_boolOptions = is_array(($s_tagOption=each($a_tag))) && $s_tagOption[1];
if( $b_boolOptions ) {
// Without this, we will mess up the array
$i_arrayCounter = (int)count($a_html[$s_tagName]);
// get the tag options, like src="htt://". Here, s_tagTokOption is 'src' and s_tagTokValue is '"http://"'
do {
$s_tagTokOption = strtoupper(strtok($s_tagOption[1], "="));
$s_tagTokValue = trim(strtok("="));
$a_html[$s_tagName][$i_arrayCounter][$s_tagTokOption] =
$s_tagTokValue;
$b_boolOptions = is_array(($s_tagOption=each($a_tag))) &&
$s_tagOption[1];
} while( $b_boolOptions );
}
}
return $a_html;
}
function getDataEntrepriseRNCS($pageHtml) {
global $libelleErreur;
$tabRet=array();
// Liste et liens vers les Bilans
$tabRet['tabListeBilans']=getTabListeBilans($pageHtml);
$tabRet['raisonSociale']=getTextInHtml($pageHtml, '<td align="left" valign="top"><span class="boldred"><br>', '<br>', '</span>');
$tabRet['RCS']=getTextInHtml($pageHtml, '<span class="textarial">RCS ', 'RCS ', '</span>', true);
$tabRet['activite']=getTextInHtml($pageHtml, '<td width="185" align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Activit&eacute;</td>', 'class="basictext">', '</td>');
$tabRet['adresseSiege']=getTextInHtml($pageHtml, '<td align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Si&egrave;ge
social</td>', 'class="basictext">', '</td>');
print_r($tabRet);
die();
// Capital social
// Chiffre d'affaires
// Date CA
// Effectif
// Forme Juridique
// Nationalité
// Activité
// Siège social
/*
<tr>
<td bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Si&egrave;ge
social</td>
<td bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td align="left" valign="top" bgcolor="#EBF0F5" class="basictext">75 Avenue la Grande Armee<br>
75116 PARIS 16 </td>
</tr>
</table>
<div align="center"><img src="../images/degrade580grey.jpg" width="580" height="12"><br>
<br>
</div>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><img src="../images/arrowsmallblue.gif" width="9" height="10"><span class="boldtextarialblue15">Renseignements
juridiques</span></td>
<td>&nbsp;</td>
</tr>
</table>
<table width="580" border="0" align="center" cellpadding="1" cellspacing="2">
<tr align="left" valign="top">
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="185" bgcolor="#FFFFFF" class="boldtextarial">Forme
juridique</td>
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="385" bgcolor="#EBF0F5" class="basictext">SA à conseil d'administration</td>
</tr>
<tr align="left" valign="top">
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="185" bgcolor="#FFFFFF" class="boldtextarial">Capital social</td>
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="385" bgcolor="#EBF0F5" class="basictext">171.285.000,00
EURO</td>
</tr>
<tr align="left" valign="top">
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="185" bgcolor="#FFFFFF" class="boldtextarial">Nationalit&eacute;</td>
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td bgcolor="#EBF0F5" class="basictext">France</td>
</tr>
</table>
<div align="center"><img src="../images/degrade580grey.jpg" width="580" height="12"><br>
<br>
</div>
<div align="center">
<table width="588" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="210" align="left" valign="top"><img src="../images/arrowsmallblue.gif" width="9" height="10"><span class="boldtextarialblue15">Chiffres
cl&eacute;s</span></td>
<td width="378" align="left" valign="top" class="smalltext">au 31-12-2004</td>
</tr>
</table>
<table width="580" border="0" align="center" cellpadding="1" cellspacing="2">
<tr>
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="185" align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Chiffre
d'affaires</td>
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="385" align="left" valign="top" bgcolor="#EBF0F5" class="basictext">18.049.000.000
EU</td>
</tr>
<tr>
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="185" align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Effectif</td>
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
<td width="385" align="left" valign="top" bgcolor="#EBF0F5" class="basictext">De 5150 à 5720</td>
</tr>
</table>
<div align="center"><img src="../images/degrade580grey.jpg" width="580" height="12"><br>
<br>
<br>
</div>
</div>
<table width="600" border="0" cellspacing="2" cellpadding="0">*/
return $tabRet;
}
function getDataEcoCoface($pageHtml) {
global $libelleErreur;
$tabRet=array();
// SIREN
$pos=strpos($pageHtml, '<b><font class="nota">La forme juridique ou la date de création trop récente de l\'entreprise ne nous permettant pas d\'obtenir suffisamment d\'informations, nous vous offrons ce produit.</font></b>');
if ($pos>0) {
$tabRet['infoEco']='OUI';
$tabRet['societeInactive']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Société inactive</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
$strCapital=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Capital &nbsp (', '(', '</tr><tr>');
$tabTmp=explode('</td>', $strCapital);
$tabRet['capital_source']=str_replace(')', '', $tabTmp[0]);
$tabTmp=explode('&nbsp', $tabTmp[1]);
$tabRet['capital_montant']=str_replace(chr(160), '', trim(strip_tags($tabTmp[0])));
$tabRet['capital_devise']=trim(strip_tags($tabTmp[1]));
$tabRet['dateCreation']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Date de création</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
$tabRet['formeJuridique']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Forme juridique</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
$tabRet['cotationBourse']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Cotation en bourse</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
$tabRet['effectifSociete']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Effectif société</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
$tabRet['activite']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Activité</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
$tabRet['sigle']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Sigle</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
$tabRet['enseigne']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Enseigne</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
// Dirigeants
$strDir=@getTextInHtml($pageHtml, '<td class="tabtot">IDENTITE</td>', '<td>&nbsp;</td>', '</table>');
$tabDir=explode('</tr>', $strDir);
$nbDir=1;
foreach ($tabDir as $key => $dir)
{
$tabTmp=explode('<td bgcolor="#FFF3DE" class="tabval" > ', $dir);
$typeDir=trim(strip_tags($tabTmp[0]));
$nomDir=trim(strip_tags($tabTmp[1]));
if ($typeDir<>'' && $typeDir<>'Date de création' && $typeDir<>'Forme juridique' && $typeDir<>'Cotation en bourse'
&& $typeDir<>'Effectif société' && $typeDir<>'Société inactive' && $typeDir<>'Activité'
&& $typeDir<>'Sigle' && $typeDir<>'Enseigne'
&& substr($typeDir, 0, 8) <>'Capital ' )
{
//$tabDir['Produits'].=$produit.'/';
//$produit=str_replace(' ','_',$produit);
$tabRet['Dirigeant'.$nbDir.'Type']=trim($typeDir);
$tabTmp=explode('&nbsp', $nomDir);
$tabRet['Dirigeant'.$nbDir.'Genre']=trim($tabTmp[0]);
$tabRet['Dirigeant'.$nbDir.'Prenom']=trim($tabTmp[1]);
$tabRet['Dirigeant'.$nbDir.'Nom']=trim($tabTmp[2]);
$nbDir++;
}
}
$tabRet['NbDirigeants']=$nbDir-1;
// Liens Financiers
$strTmp=@getTextInHtml($pageHtml, '<td class="tabtot">LIENS FINANCIERS</td>', '<td>&nbsp;</td>', '</table>');
if (strpos($strTmp, 'Néant')>0)
$tabRet['LiensFinanciers']='Néant';
else
$tabRet['LiensFinanciers']='Présence liens';
// ELEMENTS FINANCIERS
$strTmp=@getTextInHtml($pageHtml, '<td class="tabtot">ELEMENTS FINANCIERS</td>', '<td>&nbsp;</td>', '</table>');
if (strpos($strTmp, 'Néant')>0)
$tabRet['ElementsFinanciers']='Néant';
else
$tabRet['ElementsFinanciers']='Présence El.Fi.';
}
else
$tabRet['infoEco']='NON';
//echo $pageHtml;
//print_r($tabRet);
//die();
return $tabRet;
}
function getDataEntrepriseCoface($pageHtml) {
global $libelleErreur;
$tabRet=array();
// SIREN
$tabRet['siren']=@getTextInHtml($pageHtml, 'portail/entreprise_identite/identite.asp?nsiren=', '?nsiren=', '&IMPRESSION=OUI');
//$tabRet['siren']=@getTextInHtml($pageHtml, '<a href="http://www.coface.fr" target="_blank">&nbsp;Qui sommes nous&nbsp;</a>-<a href="javascript:;" onClick="MM_openBrWindow(\'../mod_cofacescrl/part_recherche.asp?nscrl=18452&metier=ALL&geo=ALL&idnav=168d25840396c5f38f4
$tabRet['nscrl']=@getTextInHtml($pageHtml, 'Plan du site&nbsp;</a>-<a href="http://www.coface.fr" target="_blank">&nbsp;Qui sommes nous&nbsp;</a>-<a href="javascript:;" onClick="MM_openBrWindow(\'../mod_cofacescrl/part_recherche.asp?nscrl=', '?nscrl=', '&metier=ALL&geo=ALL&idnav=');
// Raison Sociale, Adresse et lien vers Géoloc
$strRS_Adr=@getTextInHtml($pageHtml, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne"> <b> Raison sociale<br>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><b>', '</b></td>');
$tabRS_Adr=explode('<br>', $strRS_Adr);
$tabRet['raisonSociale']=trim($tabRS_Adr[0]);
$tabRS_Adr1=explode('&nbsp;', $tabRS_Adr[1]);
$tabRet['AdresseLigne1']=trim($tabRS_Adr1[0]);
$tabRet['AdresseLigne2']=trim($tabRS_Adr1[1]);
$tabRS_Adr1=explode('&nbsp;', $tabRS_Adr[2]);
$tabRet['codePostal']=trim($tabRS_Adr1[0]);
$tabRet['ville']=trim($tabRS_Adr1[1]);
$tabRet['UrlGeoLoc']=@getTextInHtml($pageHtml, '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><a href="javascript:;" onClick="MM_openBrWindow(\'', 'onClick="MM_openBrWindow(\'', '\',\'Planfax');
// Téléphone / Fax
$strTelFax=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne"><b>Téléphone<br>', '<td bgcolor="#FFF3DE" class="tabval" valign="top">', '</td>');
$tabTelFax=explode('<br>', $strTelFax);
$tabRet['tel']=trim($tabTelFax[0]);
$tabRet['fax']=trim($tabTelFax[1]);
// Adresse Internet / Email
$strInet=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne"><b>Adresse internet <br>', '<td bgcolor="#FFF3DE" class="tabval"><a class="tabval" HREF="', '</a></td>');
$tabInet=explode('<br>', $strInet);
$tabRet['web']=trim( @getTextInHtml($tabInet[0], ' target="_new">', '>', '</a>') );
$tabRet['mail']=trim( @getTextInHtml($tabInet[1], ' href="mailto:', ':', '">') );
// Bourse
$strBourse=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne"> <b>'."\r\n".' Code Sicovam<br>', '<td bgcolor="#FFF3DE" class="tabval">', '</td>');
$tabBourse=explode('<br>', $strBourse);
$tabRet['bourse_isin']=trim($tabBourse[0]);
$tabRet['bourse_marche']=trim($tabBourse[1]);
$tabRet['bourse_ville']=trim($tabBourse[2]);
// Activité
$tabRet['activite']=trim(str_replace('&nbsp;', ' ', @getTextInHtml($pageHtml, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne" valign="top"><b>Libellé code activité </b></td>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval">', '</td>')));
// Produits disponibles
$strDispos=@getTextInHtml($pageHtml, '<table border="0" cellpadding="0" cellspacing="0" width="98%"><tr><td class="normal"><b>Produits disponibles</b></td></tr><tr><td bgcolor="#E1D0B6"><img src="../images/vide.gif" border="0" height="1"><br></td></tr><tr><td><img src="../images/vide.gif" border="0" height="5"><br></td></tr></table>', '<table border="0" cellpadding="5" cellspacing="0" width="100%">', '</table>');
$tabDispos=explode('<td align="left" width="25%"', $strDispos);
$tabRet['Produits']='';
foreach ($tabDispos as $key => $produit)
{
$produit=trim(str_replace('>', '', str_replace('nowrap>', '', strip_tags($produit))));
if ($produit<>'' && $produit<>'&nbsp;') {
$tabRet['Produits'].=$produit.'/';
$produit=str_replace(' ','_',$produit);
$tabRet['Produit_'.$produit]='Oui';
}
}
// print_r($tabRet);
// die();
return $tabRet;
}
function getTabListeBilans($pageHtml) {
$tabUrl=array();
$deb=$fin=0;
while( is_int(($deb=strpos($pageHtml,'<a href="http://www.societe.com/cgi-bin/bilan?bil=',$fin))) ) {
$deb=$deb+9;
$fin = strpos($pageHtml,'</a>', $deb);
$s_temp = substr($pageHtml, $deb, ($fin-$deb));
//echo $s_temp."\r\n";
$a_temp = explode('" class="basic">', $s_temp);
$tabUrl[$a_temp[1]]=$a_temp[0];
}
return $tabUrl;
}
function getTabListeGU($pageHtml) {
$tabGU=array();
$deb=$fin=0;
/* <tr><td><img alt="" src="b.gi onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_PDR_SUP_LOC_REQ')">Lancer la recherche dans toute la localit&eacute;</td></tr>
<tr><td><img src="b.gif" alt="" border=0></td><td align="left" onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_INSCRIPTIONS_REQ')">Lancer la recherche sans l&#39;adresse</td></tr>
*/
while( is_int(($deb=strpos($pageHtml,'<td onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class="txt9px" href="javascript:ChoixGeo(\'',$fin))) ) {
$deb=$deb+122;
$fin = strpos($pageHtml,'</td></tr>', $deb);
$s_temp = substr($pageHtml, $deb, ($fin-$deb));
//echo $s_temp."\r\n";
$a_temp = explode('\')">', $s_temp);
$tabGU[$a_temp[1]]=$a_temp[0];
}
return $tabGU;
}
function getTabListeNonTrouve($pageHtml) {
$tabGU=array();
$deb=$fin=0;
/* onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_PDR_SUP_LOC_REQ')">Lancer la recherche dans toute la localit&eacute;</td></tr>
onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_INSCRIPTIONS_REQ')">Lancer la recherche sans l&#39;adresse</td></tr>
*/
while( is_int(($deb=strpos($pageHtml,'onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo(\'',$fin))) ) {
$deb=$deb+116;
$fin = strpos($pageHtml,'</td></tr>', $deb);
$s_temp = substr($pageHtml, $deb, ($fin-$deb));
//echo $s_temp."\r\n";
$a_temp = explode('\')">', $s_temp);
$tabGU[$a_temp[1]]=$a_temp[0];
}
return $tabGU;
}
/** Recherche un texte dans une page HTML
**
**/
function getTextInHtml($pageHtml, $strToFind, $strDeb, $strEnd, $include_strDeb=false, $include_strEnd=false, $ltrim=true, $rtrim=true, &$fin, $nbOcc=1) {
$tabRet=array();
$deb=$nbOccTrouve=0;
while( is_int(($deb=strpos($pageHtml,$strToFind,$fin))) ) {
$deb++;
$deb2 = strpos($pageHtml,$strDeb, $deb);
$fin = strpos($pageHtml,$strEnd, $deb2);
if (!$include_strDeb)
$deb2+=strlen($strDeb);
$s_temp = substr($pageHtml, $deb2, ($fin-$deb2));
if ($ltrim) $s_temp=ltrim($s_temp);
if ($rtrim) $s_temp=rtrim($s_temp);
if ($nbOcc==1) return $s_temp;
//echo $s_temp."\r\n";
//$a_temp = explode('" class="basic">', $s_temp);
$tabUrl[$nbOccTrouve]=$s_temp;
$nbOccTrouve++;
if ($nbOcc==$nbOccTrouve) {
// echo "j'ai trouvé le nb demandé, je sort\r\n";
break;
};
}
return $tabUrl;
/*<span class="mongrasvert">
<li>Le type de voie a été modifié<br>
<li>L'orthographe du mot directeur a été modifiée<br>
<li>Le code postal a été forcé à partir du département et de la localité<br> </span>
*/
}
?>

View File

@ -0,0 +1,89 @@
<?
//include('fonctions.php');
//include('insee.class.php');
define('HOST_NORMAD', 'www.normad.fr');
define('SITE_NORMAD', 'http://'. HOST_NORMAD .'/');
//$normad2=new Normad('SCI BRYGE', 'Kervegant', '', '', '', '29', 'SCAER');
class Normad {
/** Normalise l'adresse postale donnée en paramètre. Seule la ligne 1 qui devrait comporter la Raison Sociale ou le nom de l'expéditeur reste inchangée !
** @param $adrL1 Obligatoirement le Nom ou la Raison Sociale du destinataire
** @param $adrL2 Normalisation = Appart.,Bâtiment...
** @param $adrL3 Normalisation = Résidence,Cité...
** @param $adrL4 Normalisation = Num./Bis/Type voie/Nom voie
** @param $adrL5 Normalisation = BP,TSA,Lieu-dit...
** @param $codPos Code Postal (ou département)
** @param $ville Ville (orthographe correcte si possible si pas de CP)
** @return array
**/
function Normad ($adrL1, $adrL2, $adrL3, $adrL4, $adrL5, $codPos, $ville) {
$adrL1 =substr(trim($adrL1) , 0, 40);
$adrL2 =substr(trim($adrL2) , 0, 40);
$adrL3 =substr(trim($adrL3) , 0, 40);
$adrL4 =substr(trim($adrL4) , 0, 40);
$adrL5 =substr(trim($adrL5) , 0, 40);
$codPos=substr(trim($codPos), 0, 5);
$ville =substr(trim($ville) , 0, 33);
$postData=array( 'ad1'=>$adrL2, //htmlentities($adrL2),
'ad2'=>$adrL3, //htmlentities($adrL3),
'ad3'=>$adrL4, //htmlentities($adrL4),
'ad4'=>$adrL5, //htmlentities($adrL5),
'cod'=>$codPos,
'loc'=>htmlentities($ville),
'hiddenField'=>'GEN',);
$tabHtml=getUrl(SITE_NORMAD.'traiter_adresse.php', '', $postData, SITE_NORMAD.'validez.php', true, HOST_NORMAD);
$page=$tabHtml['body'];
$posInHtml=0;
$tabRet=array();
$retour=trim(str_replace(chr(173), '', getTextInHtml($page, '<td colspan=2><font face="Arial" size="2" color="#3F5A80"><b>', '<b>', '</b></font>', false, true, true, true, $posInHtml)));
$retour=explode('[*', $retour);
$tabRet['retour_code']=str_replace(']','',$retour[1]);
$tabRet['retour_libelle']=trim($retour[0]);
$tabRet['retour_messages']=getTextInHtml($page, '<li>', 'i>', '<br>', false, false, true, true, $posInHtml, 0);
// Récupération des Lignes d'adresse
$tabRet['ligne1']=$adrL1;
$tabRet['ligne2']=getTextInHtml($page, '<td class="gris2"><span class=grasnoir>Adresse en sortie :</span>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
$tabRet['ligne3']=getTextInHtml($page, '<td class=pet align=right nowrap> Volet 2 : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
$tabRet['ligne4']=getTextInHtml($page, '<td class=pet align=right nowrap> Volet ', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
$tabRet['ligne5']=getTextInHtml($page, '<td class=pet align=right nowrap> Volet 4 : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
$tabRet['CP']=getTextInHtml($page, '<td class=pet align=right nowrap> CP : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
$tabRet['ville']=getTextInHtml($page, '<td class=pet align=right nowrap> Localité : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
$tabRet['ligne6']=$tabRet['CP'] .' '. $tabRet['ville'];
// Découpage de la rue
$tabRet['voie_num']=getTextInHtml($page, '<span class=pet>Numéro ', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
$tabRet['voie_btq']=getTextInHtml($page, '<span class=pet>Bis/Ter/Quater/...', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
$tabRet['voie_type']=getTextInHtml($page, '<span class=pet>Type', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
$tabRet['voie_denom']=getTextInHtml($page, '<span class=pet>Dénomination', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
$tabRet['voie_motDir']=getTextInHtml($page, 'directeur :</span> ', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
$tabRet['voie_matric']=getTextInHtml($page, '<span class=pet>Matricule voie :</span>', '</span>', '<br>', false, true, true, true, $posInHtml);
$tabRet['code_insee_commune']=getTextInHtml($page, '<span class=pet>Code INSEE commune :</span>', '</span>', '<br>', false, true, true, true, $posInHtml);
print_r($tabRet);
//echo "$voie_num\r\n$voie_btq\r\n$voie_type\r\n$voie_denom\r\n$voie_motDir\r\n$voie_matric\r\n$code_insee_commune\r\n";
}
/*
<td class="gris2" valign=top><span class=grasnoir>Détails :</span><br>
00441644 <br>
28074 <br>
<br>
<br>
</td>
</tr>
</table>
<hr size=1>
</td>
</tr>
<tr>
<td colspan=3><p class="gris2" align="justify">&nbsp; </p>
<p class="mongrasvert" align="right"> R&eacute;f&eacute;rentiels
d'avril 2006 </p>
*/
} ?>

View File

@ -0,0 +1,170 @@
<?PHP
$this->tabNotation['A+']=array('Exceptionnel', 'A3++', 'Aaa' ,'AAA' ,'0.001');
$this->tabNotation['A'] =array('Excellent', 'A3+', 'Aa1 Aa2 Aa3' ,'AA+ AA AA-' ,'0.01');
$this->tabNotation['B+']=array('Très bon', '3++', 'A1' ,'A+' ,'0.02');
$this->tabNotation['B'] =array('Bon', '3+', 'A2 A3' ,'A A-' ,'0.04');
$this->tabNotation['C+']=array('Assez bon', '3', 'Baa1' ,'BBB+' ,'0.15');
$this->tabNotation['C'] =array('Acceptable', '3', 'Baa2' ,'BBB' ,'0.30');
$this->tabNotation['C-']=array('Moyen', '3', 'Baa3' ,'BBB-' ,'0.60');
$this->tabNotation['D+']=array('Passable', '4+', 'Ba1' ,'BB+' ,'0.90');
$this->tabNotation['D'] =array('Médiocre', '4', 'Ba2' ,'BB' ,'1.25');
$this->tabNotation['D-']=array('Très médiocre', '4', 'Ba3' ,'BB-' ,'1.60');
$this->tabNotation['E+']=array('Mauvais (sous surveillance)', '5', 'B1 B2 B3', 'B+ B B-', '5.00');
$this->tabNotation['E'] =array('Très mauvais (sensible, sans incident)', '6', 'Caa', 'CCC', '14.00');
$this->tabNotation['E-']=array('Très mauvais (sensible avec incidents)', '8', 'Ca C', 'CC C', '17.00');
$this->tabNotation['F'] =array('En défaut, hors procédures judiciaires (douteux)', '8 9', 'D', 'D', 'Défaut');
$this->tabNotation['Z'] =array('En défaut, avec procédures judiciaires ou contentieuses (douteux)', 'P', '', '', 'Défaut');
$this->tabLibActivite[0]='';
$this->tabLibActivite[15]='Industries Alimentaires : Collecte Appro';
$this->tabLibActivite[3]='Industries Alimentaires : Collecte et 1ère transformation';
$this->tabLibActivite[5]='Industries Alimentaires : Eaux de vie et Champagne';
$this->tabLibActivite[2]='Industries Alimentaires : Autres activités';
$this->tabLibActivite[6]='Industries extractives / Production Distribution : Énergie Eau';
$this->tabLibActivite[7]='Construction - BTP';
$this->tabLibActivite[1]='Industries Manufacturières';
$this->tabLibActivite[8]='Négoce';
$this->tabLibActivite[4]='Commerce de Gros';
$this->tabLibActivite[9]='Commerce Distribution';
$this->tabLibActivite[10]='Grande Distribution';
$this->tabLibActivite[12]='Transports';
$this->tabLibActivite[13]='Media Technologie de l\'information';
$this->tabLibActivite[14]='Services';
$this->tabLibActivite[11]='Hôtellerie et Loisirs / Activités immobilières';
$this->tabLibActivite[16]='Banques. Assurances. Activités financières';
$this->tabLibActivite[17]='Agriculture. Sylviculture. Pêche. Aquaculture';
$this->tabActivite[15]=array('512A');
$this->tabActivite[3]=array('151A','151C','152','153E','155','157','159G','159J','159N','159Q');
$this->tabActivite[5]=array('159A','159F');
$this->tabActivite[2]=array('151E','151F','153A','153C','153F','154','156','158','159B','159D','159L','159S','159T');
$this->tabActivite[6]=array('11','10','12','13','14','401','402','403','410');
$this->tabActivite[7]=array('451','452','453','454','455');
$this->tabActivite[1]=array('251','252','241','242','243','245','246','247','261','262','263','264','265','266','267','268','244','297','300','311','312','313','314','315','316','321','322','323','17','18','19','20','21','271','272','273','274','275','281','282','283','284','285','286','287','291','292','293','294','295','296','341','342','343','353','351','352','354','355','223','331','332','333','334','335','361','362','363','364','365','366','231','232','233','222','371','372');
$this->tabActivite[8]=array();
$this->tabActivite[4]=array('511A','511N','511P','512C','512E','512G','512J','513','511C','515A','515C','511E','511G','511J','511L','511R','511T','511U','514','515E','515F','515H','515J','515L','515N','515Q','516','517');
$this->tabActivite[9]=array('501','502','503','504','505','521A','521B','521C','521J','522','523','524A','524C','524E','524F','524H','524J','524L','524N','524R','524T','524U','524V','524W','524X','524Y','524Z','525','526');
$this->tabActivite[10]=array('521D','521E','521F','521H','524P');
$this->tabActivite[12]=array('621','622','623','611','612','602','603','631','632','634','634B','634C','634A','641');
$this->tabActivite[13]=array('221','722','721','723','724','725','726','924','642','922','921');
$this->tabActivite[14]=array('703','712E','711','712A','713','714','712C','741A','741C','741E','741G','742','743','741J','744','745','746','747','748','900','633','801','802','803','804','851','852','853','930','911','912','913','527','950');
$this->tabActivite[11]=array('923','925','926','927','551','552','553','554','555','702');
$this->tabActivite[16]=array('651','660','672','652E','652A','652C','652F','671');
$this->tabActivite[17]=array('751','990','752','990','701');
$this->tabR[1][0]=array();
$this->tabR[1][1]=array('0:15.5','15.5:21.7','21.7:25','25:29.1','29.1:33.4','33.4:37','37:40','40:42.6','42.6:44.9','44.9:100');
$this->tabR[1][2]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
$this->tabR[1][3]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
$this->tabR[1][4]=array('0:8.7','8.7:12.8','12.8:15','15:17.7','17.7:20.6','20.6:23','23:25','25:26.7','26.7:28.3','28.3:100');
$this->tabR[1][5]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
$this->tabR[1][6]=array('0:20.5','20.5:26.7','26.7:30','30:34.1','34.1:38.4','38.4:42','42:45','45:47.6','47.6:49.9','49.9:100');
$this->tabR[1][7]=array('0:13.7','13.7:17.8','17.8:20','20:22.7','22.7:25.6','25.6:28','28:30','30:31.7','31.7:33.3','33.3:100');
$this->tabR[1][8]=array('0:3.7','3.7:7.8','7.8:10','10:12.7','12.7:15.6','15.6:18','18:20','20:21.7','21.7:23.3','23.3:100');
$this->tabR[1][9]=array('0:13.7','13.7:17.8','17.8:20','20:22.7','22.7:25.6','25.6:28','28:30','30:31.7','31.7:33.3','33.3:100');
$this->tabR[1][10]=array('0:5.7','5.7:9.8','9.8:12','12:14.7','14.7:17.6','17.6:20','20:22','22:23.7','23.7:25.3','25.3:100');
$this->tabR[1][11]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
$this->tabR[1][12]=array('0:13.7','13.7:17.8','17.8:20','20:22.7','22.7:25.6','25.6:28','28:30','30:31.7','31.7:33.3','33.3:100');
$this->tabR[1][13]=array('0:23.7','23.7:27.8','27.8:30','30:32.7','32.7:35.6','35.6:38','38:40','40:41.7','41.7:43.3','43.3:100');
$this->tabR[1][14]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
$this->tabR[1][15]=array('0:15.5','15.5:21.7','21.7:25','25:29.1','29.1:33.4','33.4:37','37:40','40:42.6','42.6:44.9','44.9:100');
$this->tabR[1][16]=array('0:6.8','6.8:8.9','8.9:10','10:11.4','11.4:12.8','12.8:14','14:15','15:15.9','15.9:16.6','16.6:100');
$this->tabR[1][17]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
$this->tabR[2][0]=array();
$this->tabR[2][1]=array('1.8:','1.6:1.8','1.5:1.6','1.4:1,5','1.2:1.4','1.0:1.2','0.9:1.0','0.8:0,9','0.7:0,8','0:0.7');
$this->tabR[2][2]=array('2.2:','1.9:2.2','1.8:1.9','1.6:1.8','1.4:1.6','1.2:1.4','1.0:1.2','0.9:1.0','0.7:0.9','0:0.7');
$this->tabR[2][3]=array('2.2:','1.9:2.2','1.8:1.9','1.6:1.8','1.4:1.6','1.2:1.4','1.0:1.2','0.9:1.0','0.7:0.9','0:0.7');
$this->tabR[2][4]=array('3.0:','2.7:3.0','2.5:2.7','2.3:2.5','2.0:2.3','1.7:2.0','1.5:1.7','1.3:1.5','1.1:1.3','0:1.1');
$this->tabR[2][5]=array('2.6:','2.4:2.6','2.2:2.4','2.0:2.2','1.7:2.0','1.5:1.7','1.3:1.5','1.1:1.3','1.0:1.1','0:1');
$this->tabR[2][6]=array('1.7:','1.6:1.7','1.5:1.6','1.4:1.5','1.2:1.4','1.1:1.2','1.0:1.1','0.9:1.0','0.8:0.9','0:0.8');
$this->tabR[2][7]=array('1.5:','1.4:1.5','1.3:1.4','1.1:1.3','1.0:1.2','0.9:1.0','0.8:0.9','0.7:0.8','0.6:0.7','0:0.6');
$this->tabR[2][8]=array('10.1:','8.8:10.1','8:8.8','7:8','5.8:7','4.8:5.8','4:4.8','3.3:4','2.8:3.3','0:2.8');
$this->tabR[2][9]=array('3:','2.7:3','2.5:2.7','2.3:2.5','2:2.3','1.7:2','1.5:1.7','1.3:1.5','1.1:1.3','0:1.1');
$this->tabR[2][10]=array('3.8:','3.3:3.8','3.0:3.3','2.6:3.0','2.2:2.6','1.8:2.2','1.5:1.8','1.2:1.5','1.0:1.2','0:1');
$this->tabR[2][11]=array('2.3:','2.1:2.3','2:2.1','1.8:2','1.6:1.8','1.5:1.6','1.3:1.5','1.2:1.3','1:1.2','0:1');
$this->tabR[2][12]=array('2.3:','2.1:2.3','2:2.1','1.8:2','1.6:1.8','1.5:1.6','1.3:1.5','1.2:1.3','1:1.2','0:1');
$this->tabR[2][13]=array('1.8:','1.6:1.8','1.5:1.6','1.4:1.5','1.2:1.4','1:1.2','0.9:1','0.8:0.9','0.7:0.8','0:0.7');
$this->tabR[2][14]=array('1.8:','1.6:1.8','1.5:1.6','1.4:1.5','1.2:1.4','1:1.2','0.9:1','0.8:0.9','0.7:0.8','0:0.7');
$this->tabR[2][15]=array('2.2:','1.9:2.2','1.7:1.9','1.5:1.7','1.2:1.5','1.0:1.2','0.8:1.0','0.7:0.8','0.5:0.7','0:0.5');
$this->tabR[2][16]=array('10.1:','8.8:10.1','8:8.8','7:8','5.8:7','4.8:5.8','4:4.8','3.3:4','2.8:3.3','0:2.8');
$this->tabR[2][17]=array('2.2:','1.9:2.2','1.8:1.9','1.6:1.8','1.4:1.6','1.2:1.4','1:1.2','0.9:1','0.7:0.9','0:0.7');
$this->tabR[3][0]=array();
$this->tabR[3][1]=array('4.4:','4:4.4','3.8:4','3.5:3.8','3.1:3.5','2.8:3.1','2.5:2.8','2.2:2.5','2:2.2','0:2');
$this->tabR[3][2]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
$this->tabR[3][3]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
$this->tabR[3][4]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
$this->tabR[3][5]=array('8.6:','7.9:8.6','7.5:7.9','6.9:7.5','6.2:6.9','5.6:6.2','5:5.6','4.5:5','4:4.5','0:4');
$this->tabR[3][6]=array('4.4:','4:4.4','3.8:4','3.5:3.8','3.1:3.5','2.8:3.1','2.5:2.8','2.2:2.5','2:2.2','0:2');
$this->tabR[3][7]=array('4.4:','4:4.4','3.8:4','3.5:3.8','3.1:3.5','2.8:3.1','2.5:2.8','2.2:2.5','2:2.2','0:2');
$this->tabR[3][8]=array('10.9:','9.7:10.9','9:9.7','8:9','6.8:8','5.8:6.8','5:5.8','4.3:5','3.7:4.3','0:3.7');
$this->tabR[3][9]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
$this->tabR[3][10]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
$this->tabR[3][11]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
$this->tabR[3][12]=array('5.9:','5.4:5.9','5:5.4','4.5:5','3.9:4.5','3.4:3.9','3:3.4','2.6:3','2.3:2.6','0:2.3');
$this->tabR[3][13]=array('4.2:','3.8:4.2','3.5:3.8','3.1:3.5','2.7:3.1','2.3:2.7','2:2.3','1.7:2','1.5:1.7','0:1.5');
$this->tabR[3][14]=array('4.2:','3.8:4.2','3.5:3.8','3.1:3.5','2.7:3.1','2.3:2.7','2:2.3','1.7:2','1.5:1.7','0:1.5');
$this->tabR[3][15]=array('6.9:','6.3:6.9','6.0:6.3','5.5:6.0','5.0:5.5','4.5:5.0','4.0:4.5','3.6:4.0','3.2:3.6','0:3.2');
$this->tabR[3][16]=array('10.9:','9.7:10.9','9:9.7','8:9','6.8:8','5.8:6.8','5:5.8','4.3:5','3.7:4.3','0:3.7');
$this->tabR[3][17]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
$this->tabR[4][0]=array();
$this->tabR[4][1]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][2]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][3]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][4]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][5]=array('0:1.36','1.36:1.44','1.44:1.5','1.5:1.58','1.58:1.71','1.71:1.85','1.85:2','2:2.16','2.16:2.33','2.33:');
$this->tabR[4][6]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][7]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][8]=array('0:1.1','1.1:1.2','1.2:1.3','1.3:1.4','1.4:1.6','1.6:1.8','1.8:2','2:2.2','2.2:2.5','2.5:');
$this->tabR[4][9]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][10]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][11]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][12]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[4][13]=array('0:2.4','2.4:2.7','2.7:3','3:3.4','3.4:4.1','4.1:5','5:6','6:7.2','7.2:8.7','8.7:');
$this->tabR[4][14]=array('0:2.4','2.4:2.7','2.7:3','3:3.4','3.4:4.1','4.1:5','5:6','6:7.2','7.2:8.7','8.7:');
$this->tabR[4][15]=array('0:2.9','2.9:3.4','3.4:3.7','3.7:4.3','4.3:5.2','5.2:6.2','6.2:7.5','7.5:9.1','9.1:10.9','10.9:');
$this->tabR[4][16]=array('0:1.1','1.1:1.2','1.2:1.3','1.3:1.4','1.4:1.6','1.6:1.8','1.8:2','2:2.2','2.2:2.5','2.5:');
$this->tabR[4][17]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
$this->tabR[5][0]=array();
$this->tabR[5][1]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
$this->tabR[5][2]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
$this->tabR[5][3]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
$this->tabR[5][4]=array('-99:-16.7','-16.7:-12.7','-12.7:-10','-10:-6','-6:-0.7','-0.7:4.7','4.7:10','10:15.3','15.3:20.7','20.7:');
$this->tabR[5][5]=array('-999:-420','-420:-384','-384:-360','-360:-324','-324:-276','-276:-228','-228:-180','-180:-132','-132:-84','-84:');
$this->tabR[5][6]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
$this->tabR[5][7]=array('-99:-30','-30:-24','-24:-20','-20:-14','-14:-6','-6:2','2:10','10:18','18:26','26:');
$this->tabR[5][8]=array('-99:-41.7','-41.7:-34.7','-34.7:-30','-30:-23','-23:-13.7','-13.7:-4.3','-4.3:5','5:14.3','14.3:23.7','23.7:');
$this->tabR[5][9]=array('-99:-16.7','-16.7:-12.7','-12.7:-10','-10:-6','-6:-0.7','-0.7:4.7','4.7:10','10:15.3','15.3:20.7','20.7:');
$this->tabR[5][10]=array('-99:-5','-5:-2','-2:0','0:3','3:7','7:11','11:15','15:19','19:23','23:');
$this->tabR[5][11]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
$this->tabR[5][12]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
$this->tabR[5][13]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
$this->tabR[5][14]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
$this->tabR[5][15]=array('-99:-38.3','-38.3:-36.3','-36.3:-35.0','-35:-33','-33.0:-30','-30:-27.7','-27.7:-25.0','-25.0:-22.3','-22.3:-19.7','-19.7:');
$this->tabR[5][16]=array('-99:-41.7','-41.7:-34.7','-34.7:-30','-30:-23','-23:-13.7','-13.7:-4.3','-4.3:5','5:14.3','14.3:23.7','23.7:');
$this->tabR[5][17]=array(':-58.3','-58.3:53.3','-53.3:-50','-50:-45','-45:-38.3','-38.3:-31.7','-31.7:-25','-25:-18.3','-18.3:-11.7','-11.7:');
$this->tabR[6][0]=array();
$this->tabR[6][1]=array('0:6','6:6.6','6.6:7','7:7.6','7.6:8.4','8.4:9.2','9.2:10','10:10.8','10.8:11.6','11.6:');
$this->tabR[6][2]=array('0:6','6:6.6','6.6:7','7:7.6','7.6:8.4','8.4:9.2','9.2:10','10:10.8','10.8:11.6','11.6:');
$this->tabR[6][3]=array('0:1.5','1.5:2.1','2.1:2.5','2.5:3.1','3.1:3.9','3.9:4.7','4.7:5.5','5.5:6.3','6.3:7.1','7.1:');
$this->tabR[6][4]=array('0:1.8','1.8:2.2','2.2:2.5','2.5:2.9','2.9:3.4','3.4:4','4:4.5','4.5:5','5:5.6','5.6:');
$this->tabR[6][5]=array('0:6.7','6.7:7.5','7.5:8','8:8.8','8.8:9.9','9.9:10.9','10.9:12','12:13.1','13.1:14.1','14.1:');
$this->tabR[6][6]=array('0:7.7','7.7:8.5','8.5:9','9:9.8','9.8:10.9','10.9:11.9','11.9:13','13:14.1','14.1:15.1','15.1:');
$this->tabR[6][7]=array('0:3','3:3.6','3.6:4','4:4.6','4.6:5.4','5.4:6.2','6.2:7','7:7.8','7.8:8.6','8.6:');
$this->tabR[6][8]=array('0:1.3','1.3:1.7','1.7:2','2:2.4','2.4:2.9','2.9:3.5','3.5:4','4:4.5','4.5:5.1','5.1:');
$this->tabR[6][9]=array('0:1.8','1.8:2.2','2.2:2.5','2.5:2.9','2.9:3.4','3.4:4','4:4.5','4.5:5','5:5.6','5.6:');
$this->tabR[6][10]=array('0:1.3','1.3:1.7','1.7:2','2:2.4','2.4:2.9','2.9:3.5','3.5:4','4:4.5','4.5:5.1','5.1:');
$this->tabR[6][11]=array('0:8.3','8.3:9.3','9.3:10','10:11','11:12.3','12.3:13.7','13.7:15','15:16.3','16.3:17.7','17.7:');
$this->tabR[6][12]=array('0:4.7','4.7:5.5','5.5:6','6:6.8','6.8:7.9','7.9:8.9','8.9:10','10:11.1','11.1:12.1','12.1:');
$this->tabR[6][13]=array('0:3','3:4.8','4.8:6','6:7.8','7.8:10.2','10.2:12.6','12.6:15','15:17.4','17.4:19.8','19.8:');
$this->tabR[6][14]=array('0:3','3:4.8','4.8:6','6:7.8','7.8:10.2','10.2:12.6','12.6:15','15:17.4','17.4:19.8','19.8:');
$this->tabR[6][15]=array('0:2','2:2.3','2.3:2.5','2.5:2.8','2.8:3.2','3.2:3.6','3.6:4.0','4.0:4.4','4.4:4.8','4.8:');
$this->tabR[6][16]=array('0:1.7','1.7:1.9','1.9:2','2:2.2','2.2:2.5','2.5:2.7','2.7:3','3:3.3','3.3:3.5','3.5:');
$this->tabR[6][17]=array('0:4.7','4.7:5.5','5.5:6','6:6.8','6.8:7.9','7.9:8.9','8.9:10','10:11.1','11.1:12.1','12.1:');
?>

View File

@ -0,0 +1,9 @@
<?
class Rncs {
function Rncs () {}
}
?>

View File

View File

@ -0,0 +1,195 @@
<?php
//script will fetch an email identified by $msgid, and parse the its parts into an
//array $partsarray
//structure of array:
//$partsarray[<name of part>][<attachment/text>]
//if attachment- subarray is [filename][binary data]
//if text- subarray is [type of text(HTML/PLAIN)][text string]
//i.e.
//$partsarray[3.1][attachment][filename]=filename of attachment in part 3.1
//$partsarray[3.1][attachment][binary]=binary data of attachment in part 3.1
//$partsarray[2][text][type]=type of text in part 2
//$partsarray[2][text][string]=decoded text string in part 2
//$partsarray[not multipart][text][string]=decoded text string in message that isn't multipart
function parsepart($p,$i){
global $link,$msgid,$partsarray;
//where to write file attachments to:
$filestore = '[full/path/to/attachment/store/(chmod777)]';
//fetch part
$part=imap_fetchbody($link,$msgid,$i);
//if type is not text
if ($p->type!=0){
//DECODE PART
//decode if base64
if ($p->encoding==3)$part=base64_decode($part);
//decode if quoted printable
if ($p->encoding==4)$part=quoted_printable_decode($part);
//no need to decode binary or 8bit!
//get filename of attachment if present
$filename='';
// if there are any dparameters present in this part
if (count($p->dparameters)>0){
foreach ($p->dparameters as $dparam){
if ((strtoupper($dparam->attribute)=='NAME') ||(strtoupper($dparam->attribute)=='FILENAME')) $filename=$dparam->value;
}
}
//if no filename found
if ($filename==''){
// if there are any parameters present in this part
if (count($p->parameters)>0){
foreach ($p->parameters as $param){
if ((strtoupper($param->attribute)=='NAME') ||(strtoupper($param->attribute)=='FILENAME')) $filename=$param->value;
}
}
}
//write to disk and set partsarray variable
if ($filename!=''){
$partsarray[$i][attachment] = array('filename'=>$filename,'binary'=>$part);
$fp=fopen($filestore.$filename,"w+");
fwrite($fp,$part);
fclose($fp);
}
//end if type!=0
}
//if part is text
else if($p->type==0){
//decode text
//if QUOTED-PRINTABLE
if ($p->encoding==4) $part=quoted_printable_decode($part);
//if base 64
if ($p->encoding==3) $part=base64_decode($part);
//OPTIONAL PROCESSING e.g. nl2br for plain text
//if plain text
if (strtoupper($p->subtype)=='PLAIN')1;
//if HTML
else if (strtoupper($p->subtype)=='HTML')1;
$partsarray[$i][text] = array('type'=>$p->subtype,'string'=>$part);
}
//if subparts... recurse into function and parse them too!
if (count($p->parts)>0){
foreach ($p->parts as $pno=>$parr){
parsepart($parr,($i.'.'.($pno+1)));
}
}
return;
}
//require('./constantes.php');
$imap_server='{imap.online.net}';
$imap_account='buzuk@lenaour.org';//'scores-decisions.com';
$imap_password='bzh4231*';//catsysyo92';
if (!$mbox = imap_open($imap_server, $imap_account, $imap_password)) die("Connexion IMAP impossible : ". imap_last_error());
$list = imap_list($mbox, $imap_server, "*");
if(is_array($list)) {
reset($list);
foreach ($list as $val) {
echo imap_utf7_decode($val) . "<br />\n";
}
} else {
echo "imap_list a échoué : " . imap_last_error() . "\n";
}
echo "<p><h1>Entetes de mail dans INBOX</h1>\n";
$headers = imap_headers ($mbox);
if ($headers == false) {
echo "Erreur !\n";
} else {
while (list ($key,$val) = each ($headers)) {
echo $val."<br>\n";
}
}
$check = imap_mailboxmsginfo($mbox);
if($check) {
echo "Date: " . $check->Date ."<br />\n" ;
echo "Pilote: " . $check->Driver ."<br />\n" ;
echo "Mailbox: " . $check->Mailbox ."<br />\n" ;
echo "Messages: ". $check->Nmsgs ."<br />\n" ;
echo "Récent: " . $check->Recent ."<br />\n" ;
echo "Non lus: " . $check->Unread ."<br />\n" ;
echo "Effacés: " . $check->Deleted ."<br />\n" ;
echo "Taille: " . $check->Size ."<br />\n" ;
} else {
echo "imap_check() a échoué: ".imap_last_error(). "<br />\n";
}
$imap_obj = imap_check($mbox);
$imap_sorted = imap_sort($mbox, SORTARRIVAL, 0);
$MN=$imap_obj->Nmsgs;
echo '<br>Nombre de messages '.$MN.'<br/>';
$overview = imap_fetch_overview($mbox,"1:$MN",0);
$k=0;
$partsarray=array();
while( list($key,$val) = each($overview))
{
if (strpos($val->from, 'rapports@neoveille.fr')!==false) {
$unsorted[$k]=$val;//->uid;
/*$unsorted[$k]["subject"]=imap_utf8($val->subject); // Le sujet du message
$unsorted[$k]['from']=$val->from;
$unsorted[$k]['to']=$val->to;
$unsorted[$k]['date']=$val->date;// Date d'expédition
$unsorted[$k]['message_id - Identification du message
references - est une référence sur l'id de ce message
in_reply_to - est une réponse à cet identifiant de message
size - taille en octets
uid - UID du message dans la boîte aux lettres
msgno - numéro de séquence du message dans la boîte
recent - Ce message est récent
flagged - Ce message est marqué
answered - Ce message a donné lieu à une réponse
deleted - Ce message est marqué pour l'effacement
seen - Ce message est déjà lu
draft - Ce message est un brouillon
*/
$s=imap_fetchstructure($mbox,$val->message_id);
/*if (count($s->parts)>0){
foreach ($s->parts as $partno=>$partarr){
//parse parts of email
parsepart($partarr,$partno+1);
}
}
else { //for not multipart messages
//get body of message
//decode if quoted-printable
if ($s->encoding==4) $text=quoted_printable_decode($text);
//OPTIONAL PROCESSING
if (strtoupper($s->subtype)=='PLAIN') $text=$text;
if (strtoupper($s->subtype)=='HTML') $text=$text;
$partsarray['not multipart'][text]=array('type'=>$s->subtype,'string'=>$text);
}*/
$full_bodacc=imap_body($mbox,$val->msgno).'[FIN]';
$k++;
}
}
//usort ($unsorted, create_function('$a,$b','setlocale(LC_ALL,$locale);return strcoll($a["subject"],$b["subject"]);'));
$Bodacc=explode("-------------------------------------------------- \r\n--------------------------------------------------", $full_bodacc);
echo '<pre>';
/*var_dump($imap_obj);
print_r($imap_obj);
print_r($imap_sorted);
print_r($unsorted);
print_r($partsarray);*/
print_r($Bodacc);
echo '</pre>';
imap_close($mbox);
?>

View File

@ -0,0 +1,76 @@
<?
//error_reporting(E_ALL);
function mysql_trace($query, $res='') {
if (!$fp=fopen('mysql_insert.log', 'a'))
return false;
if (!fwrite($fp, date('Y/m/d - H:i:s') ." - $res : $query\n"))
return false;
if (!fclose($fp))
return false;
return true;
}
/** Retourne la dernière valeur de l'auto-incrément ou 0 si pas d'auto-incrément
** Penser à bien tester la valeur !== false
**/
function mysql_insert($table, $toAdd, $debug=false){
$fields = implode(array_keys($toAdd), '`,`');
foreach (array_values($toAdd) as $key=>$array_values)
$tmp[$key]=addslashes($array_values);
$values = "'".implode(array_values($tmp), "','")."'"; # better
$values = str_replace("'NULL'", 'NULL', $values);
$query = 'INSERT INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
$res = mysql_query($query);// OR die(mysql_error());
if ($res!==false)
{
if (mysql_insert_id()>0)
$res=mysql_insert_id();
else
$res=true;
}
if ($debug) mysql_trace($query, $res);
return $res;
//-- Example of usage
//$tToAdd = array('id'=>3, 'name'=>'Yo', 'salary' => 5000);
//insertIntoDB('myTable', $tToAdd)
}
function mysql_update($table, $update, $where, $debug=false){
$fields = array_keys($update);
$values = array_values($update);
$i=0;
$query='UPDATE `'.$table.'` SET ';
while($fields[$i]){
if($i>0){$query.=', ';}
$query.=' `'.$fields[$i]."`='".addslashes($values[$i])."'";
$i++;
}
$query = str_replace("'NULL'", 'NULL', $query);
$query.=' WHERE '.$where.' LIMIT 1;';
if ($debug) mysql_trace($query, mysql_errno());
mysql_query($query);// or die(mysql_error());
return true;
//Example
// mysql_update('myTable', $anarray, "type = 'main'")
}
function mysql_select($table, $fields, $where, $debug=false, $assoc=MYSQL_BOTH) {
$query="SELECT $fields FROM $table WHERE $where;";
// if ($debug) mysql_trace($query, count($tab));
$result=mysql_query($query) or die(mysql_error());
$tab=array();
while ($ligne = mysql_fetch_array($result, $assoc))
$tab[]=$ligne;
mysql_free_result($result);
if ($debug) mysql_trace($query, count($tab));
// echo $query;
return $tab;
}
?>

View File

@ -0,0 +1,404 @@
<?
define('HOST_INSEE', 'avis-situation-sirene.insee.fr');
define('SITE_INSEE', 'http://'. HOST_INSEE .'/');
define('HOST_PJ', 'www.pagesjaunes.fr');
define('SITE_PJ', 'http://'. HOST_PJ .'/');
define('SITE_SOCIETE', 'http://www.societe.com/');
include('/var/www/_includes/includes/insee.class.php');
//include('includes/normad.class.php');
include('/var/www/_includes/includes/fonctions.php');
/* v0.1 Extraction d'informations INSEE en ligne de commande.
Usage: <?=$argv[0]?> <extract type> <fileIn> <fileInFmt> <fileOut> <fileOutFmt>
Where <extract type> is :
id siren.tm.fr : Fiche d'identite INSEE (établissement+entreprise)
lst siren.tm.fr : Liste des etablissements du SIREN (+infos entreprise)
rncs societe.com : Informations du RNCS
pj pagesjaunes.fr : Données des pages jaunes
coface cofacerating.fr : Coface
Where <fileInFmt> is :
csv Fichier IN au format CSV (; ou ,) SIREN;NIC;REF
plat Fichier IN au format plat (blancs significatifs) SIREN_____NIC__REF______________
Where <fileOutFmt> is : csv / todo
Le fichier en entrée doit être au format <fileInFmt> et contenir le SIREN en première colonne.
*/
$insee=&new Insee();
function getInfosSirene($sirenLu, $nicLu='') {
$tabRet=array();
$invalide=false;
if (valideSiren($sirenLu)==false) {
$libelleErreur='SIREN invalide';
$invalide=true;
}
if ( $nicLu<>'' && valideSiren($sirenLu, $nicLu)==false) {
$libelleErreur='SIRET invalide';
$invalide=true;
}
if ($invalide==true)
{
$siret=$sirenLu.$nicLu;
$str=date('d/m/Y à H:i:s') .';'. $libelleErreur .';'. $siret .';;;;;;;;;;;;;;;;;;;;;;;';
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
fwrite($fp, $str."\r\n");
fclose($fp);
$num=$key+1;
flush();
} else { // La demande est valide on va à l'INSEE
/** Paramètre de requête "option" à l'insee :
** 1: Fiche du siège + Données entreprises
** 2: Tous les établissements de l'entreprise
** 3: Un établissement particulier
** 4: Département
**/
if ($nicLu<>'') $option=3;
else $option=1;
$libelleErreur='Erreur SCRIPT Inconnue';
$tabInfoEtab=array();
$tabInfoEntrep=array();
/** Etape de connexion au site de l'INSEE pour simuler correctement un utilisateur WEB
**/
$response1=getUrl(SITE_INSEE);
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'SIRENET_Script/Accueil/script_page_accueil.asp');
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
if ($nicLu=='') //Faire une boucle de recherche de tous les établissement et y inclure le reste du traitement
{
// Requête d'interrogation
$postData=array(
'siren'=>$sirenLu,
'option'=>2,
'nic'=>'',
'dep'=>'',
'listeDep'=>'');
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
$action='nouveau';
$referer=SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false';
$nbRepTot=$pageCour=$nbTotPage=$nbRepParPage=$numEtab=0;
$tabInfoEtab=array();
while(true)
{
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action='.$action, $response1["header"]["Set-Cookie"], '', $referer);
if ($responseQ['code']==302)
{
//$libelleErreur='Erreur INSEE inconnue 1';
// Siren Invalide ou autre erreur non répertoriée !
$header=$responseQ['header'];
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
{
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',true);
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
if ($pos>0){
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
} else
$libelleErreur='Erreur INSEE inconnue';
}
// On déroule les URLs d'appels liste des établissements
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
//sleep(1);
// Frames réponse niveau Etab
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
$responseListe=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', true);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_bas.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
$responseListe=$responseListe['body'];
$pos=strpos($responseListe, 'Nombre total de réponses&nbsp;:&nbsp;'."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
if ($pos>0) {
$posFin=strpos($responseListe, '</b></font>', $pos+73);
$nbRepTot=trim(substr($responseListe, $pos+73, $posFin-($pos+73)));
}
$pos=strpos($responseListe, '&nbsp;-&nbsp;Affichage de la page&nbsp;'."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
if ($pos>0) {
$posFin=strpos($responseListe, '&nbsp;-&nbsp;</b></font>', $pos+75);
$strPages=trim(substr($responseListe, $pos+75, $posFin-($pos+75)));
$tabPages=explode('&nbsp;/&nbsp;', $strPages);
$pageCour=$tabPages[0];
$nbTotPage=$tabPages[1];
}
$pos=strpos($responseListe, '&nbsp;-&nbsp;</b></font>'."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
if ($pos>0) {
$posFin=strpos($responseListe, '</b></font>', $pos+60);
$nbRepParPage=trim(substr($responseListe, $pos+60, $posFin-($pos+60)));
}
/* TODO = Récupérer les infos étab + entrep pour chaque ligne du tableau !!!*
*/
if ($libelleErreur=='Erreur SCRIPT Inconnue')
$libelleErreur='';
for ($i=1;$i<11; $i++)
{
if ($numEtab==$nbRepTot)
break; // Il n'y a pas plus d'établissement à récupérer ! On sort...
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=detail&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp');
if ($responseQ['code']==302)
{
// Siren Invalide ou autre erreur non répertoriée !
$header=$responseQ['header'];
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i)
{
// On déroule les URLs d'appels fiche siège
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
//sleep(1);
// Frames réponse niveau Etab
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i, true);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i);
$responseEtab=$responseEtab['body'];
// Récupération de la fiche entreprise INSEE
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, true);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
$responseEntreprise=$responseEntreprise['body'];
$tabInfoEntrep=getDataEntreprise($responseEntreprise);
}
elseif (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i)
{
// On déroule les URLs d'appels établissement
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
//sleep(1);
// Frames réponse niveau Etab
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i, true);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i);
$responseEtab=$responseEtab['body'];
}
$tabInfoEtab=getDataEtablissement($responseEtab);
$tabRet[]=array_merge($tabInfoEtab, $tabInfoEntrep);
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
else $siret=$tabInfoEtab['siret'];
$str= date('d/m/Y à H:i:s') .';'.
$libelleErreur .';'.
// Siège
$siret .';'.
$tabInfoEtab['active'] .';'.
$tabInfoEtab['dateAbsActivite'] .';'.
$tabInfoEtab['typeEtablissement'] .';'.
$tabInfoEtab['dateMAJ'] .';'.
$tabInfoEtab['dateCreation'] .';'.
$tabInfoEtab['raisonSociale'] .';'.
$tabInfoEtab['Enseigne'] .';'.
$tabInfoEtab['NafCode'] .';'.
$tabInfoEtab['NafLib'] .';'.
$tabInfoEtab['AdresseLigne1'] .';'.
$tabInfoEtab['AdresseLigne2'] .';'.
$tabInfoEtab['AdresseLigne3'] .';'.
$tabInfoEtab['etatJuridique'] .';'.
$tabInfoEtab['dateEtatJuridique'] .';'.
// Entreprise
$tabInfoEntrep['dateCreationEntrep'] .';'.
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
$tabInfoEntrep['sigle'] .';'.
$tabInfoEntrep['NafCodeEntrep'] .';'.
$tabInfoEntrep['NafLibEntrep'] .';'.
$tabInfoEntrep['FJCodeEntrep'] .';'.
$tabInfoEntrep['FJLibEntrep'] .';'.
$tabInfoEntrep['nbEtabActifs'] .';';
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
fwrite($fp, $str."\r\n");
fclose($fp);
$numEtab++;
$num=$key+1;
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
// echo "Question $num/$nbLignes : Demande=$sirenLu$nicLu Etablissement $numEtab/$nbRepTot $typeEtablissement=$siret $libelleErreur\r\n";
flush();
sleep(1);
}//end for
}//end if
if ($pageCour==$nbTotPage) {
// On sort de la boucle de passage à la page de liste suivante car il n'y a plus d'autres pages
break;
} else {
$action='listeplus';
$referer=SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp';
}
}
} //Fin While
// die('Boucle');
} /* Fin de la boucle option 'lst' */ else
{
// Requête d'interrogation
$postData=array('siren'=>$sirenLu,
'option'=>$option,
'nic'=>$nicLu,
'dep'=>'',
'listeDep'=>'');
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=nouveau', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
if ($responseQ['code']==302)
{
//$libelleErreur='Erreur INSEE inconnue 1';
// Siren Invalide ou autre erreur non répertoriée !
$header=$responseQ['header'];
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
{
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',true);
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
if ($pos>0){
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
} else
$libelleErreur='Erreur INSEE inconnue';
}
else
{ if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege')
// L'établissement demandé est un siège !
$option=1;
if ($option==3)
{
// On déroule les URLs d'appels établissement
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
//sleep(1);
// Frames réponse niveau Etab
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', true);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
$responseEtab=$responseEtab['body'];
// On recherche si on est bien sur un fiche établissement
$pos=strpos($responseEtab, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
if ($pos<1)
$libelleErreur='Erreur SCRIPT Fiche Etablissement non trouvée';
else
$libelleErreur='';
$responseSiege=$responseEtab;
}
else
{
// On déroule les URLs d'appels Sièges
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
//sleep(1);
// Frames réponse niveau sièges
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
$responseSiege=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', true);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
$responseSiege=$responseSiege['body'];//strip_tags(html_entity_decode(), '<td>');
// On recherche si on est bien sur un fiche siège
$pos=strpos($responseSiege, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
if ($pos<1)
$libelleErreur='Erreur SCRIPT Fiche Siège non trouvée';
else
$libelleErreur='';
}
// Niveau entreprise
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=entreprise');
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', true);
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
$responseEntreprise=$responseEntreprise['body'];
$pos=strpos($responseEntreprise, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Entreprise</B>');
if ($pos<1) {
$libelleErreur='Erreur SCRIPT Fiche Entreprise non trouvée';
}
/** Recherche des données établissement
**/
$tabInfoEtab=getDataEtablissement($responseSiege);
/** Recherche des données entreprise
**/
$tabInfoEntrep=getDataEntreprise($responseEntreprise);
}
}
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
else $siret=$tabInfoEtab['siret'];
$str= date('d/m/Y à H:i:s') .';'.
$libelleErreur .';'.
// Siège
$siret .';'.
$tabInfoEtab['active'] .';'.
$tabInfoEtab['dateAbsActivite'] .';'.
$tabInfoEtab['typeEtablissement'] .';'.
$tabInfoEtab['dateMAJ'] .';'.
$tabInfoEtab['dateCreation'] .';'.
$tabInfoEtab['raisonSociale'] .';'.
$tabInfoEtab['Enseigne'] .';'.
$tabInfoEtab['NafCode'] .';'.
$tabInfoEtab['NafLib'] .';'.
$tabInfoEtab['AdresseLigne1'] .';'.
$tabInfoEtab['AdresseLigne2'] .';'.
$tabInfoEtab['AdresseLigne3'] .';'.
$tabInfoEtab['etatJuridique'] .';'.
$tabInfoEtab['dateEtatJuridique'] .';'.
// Entreprise
$tabInfoEntrep['dateCreationEntrep'] .';'.
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
$tabInfoEntrep['sigle'] .';'.
$tabInfoEntrep['NafCodeEntrep'] .';'.
$tabInfoEntrep['NafLibEntrep'] .';'.
$tabInfoEntrep['FJCodeEntrep'] .';'.
$tabInfoEntrep['FJLibEntrep'] .';'.
$tabInfoEntrep['nbEtabActifs'] .';'.
//echo $str.'<br/>';
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
fwrite($fp, $str."\r\n");
fclose($fp);
$num=$key+1;
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
// echo "Ligne $num/$nbLignes : Question=$sirenLu$nicLu Retour $typeEtablissement=$siret $libelleErreur (PJ=$nbPJ)\r\n";
//echo $str."<br/>";
flush();
$tabRet=array(0=>array_merge($tabInfoEntrep, $tabInfoEtab));
}
}
return $tabRet;
}
?>

View File

@ -0,0 +1,54 @@
http://avis-situation-sirene.insee.fr/REPERTOIRE/Reponse/Liste_principal.asp
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Fri, 03 Nov 2006 00:40:09 GMT
Content-Length: 1173
Content-Type: text/html
Expires: Thu, 02 Nov 2006 00:40:09 GMT
Cache-control: private
<HTML>
<HEAD>
<TITLE>Le répertoire SIRENE</TITLE>
<STYLE>
A { text-decoration: none;}
</STYLE>
</HEAD>
<BODY vlink="#0000FF" alink="#0000FF" >
<table valign="top">
<tr>
<td valign="top">
<font face="Arial" size="2">&nbsp;Nombre total de réponses&nbsp;:&nbsp;
<font face="Arial" size="2"><b></b></font>
<font face="Arial" size="2">&nbsp;-&nbsp;Affichage de la page&nbsp;
<font face="Arial" size="2"><b>&nbsp;/&nbsp;&nbsp;-&nbsp;</b></font>
<font face="Arial" size="2"><b></b></font>
<font face="Arial" size="2">&nbsp;réponses affichées dans cette page&nbsp;
</td>
</tr>
</table>
<table cols=2 width="100%">
<tr>
<td>&nbsp;</td>
<td align=right>
Page précédente/suivante :<a href="/REPERTOIRE/Reponse/question.asp?action=listemoins" target="_top"><img src="/IMAGES/reponse/fleche_precedent.gif" width="20" height="20" border="0" alt="Page précédente"></a>&nbsp;&nbsp;<a href="/REPERTOIRE/Reponse/question.asp?action=listeplus" target="_top"><img src="/IMAGES/reponse/fleche_suivant.gif" width="20" height="20" border="0" alt="Page suivante"></a>
</td>
</tr>
</table>
</BODY>
</HTML>

View File

@ -0,0 +1,174 @@
<?
define ('BEFORE', 0);
define ('AFTER', 1);
define ('BOTH', 2);
function trimAccent ($strWithAccent) {
$strWithAccent = htmlentities(strtolower($strWithAccent ));
$strWithAccent = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $strWithAccent );
$strWithAccent = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($strWithAccent ));
$strWithAccent = trim($strWithAccent , "-");
return $strWithAccent;
}
//function SRSaufVoyelle ($strIn, $mot1, $mot2) {
function str_replace_except_voy($mot1, $mot2, $strIn, $rule=0) {
$Voyelle=array('a','e','i','o','u','y', '1', '2', '3', '4');
if ($mot1==$mot2) return $strIn;
if (strpos($mot2,$mot1)===false)
{
//foreach ($Voyelle as $k => $voy)
$posMot1=strpos($strIn, $mot1);
while ($posMot1!==false) {
$lettreAV=$strIn[$posMot1-1];
$lettreAP=$strIn[$posMot1+strlen($mot1)];
//echo "Lettre AV=$lettreAV<br/>";
//echo "Lettre AP=$lettreAP<br/>";
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
( $rule==1 && !in_array($lettreAP, $Voyelle) ) ||
( $rule==2 && !in_array($lettreAV, $Voyelle) && !in_array($lettreAP, $Voyelle) ))
$strIn=substr($strIn,0,$posMot1) . $mot2 . substr($strIn,$posMot1+strlen($mot1),strlen($strIn));
//echo "Le Mot devient : $strIn<br/>";
$posMot1=@strpos($strIn, $mot1, $posMot1+strlen($mot1));
}
return $strIn;
}
//echo "Erreur : $mot2 contient $mot1 !<br>";
return $strIn;
}
/** Retourne le phonex d'un mot
**/
function phonex($strIn) {
if ($strIn=='') return 0.0;
$tabSonAIA=array('aina', 'eina', 'aima', 'eima');
$tabSonAIE=array('ainr', 'eine', 'aime', 'eime');
$tabSonAII=array('aini', 'eini', 'aimi', 'eimi');
$tabSonAIO=array('aino', 'eino', 'aimo', 'eimo');
$tabSonAIU=array('ainu', 'einu', 'aimu', 'eimu');
$tabCarPhon=array('1', '2', '3', '4', '5', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z');
/** On traite tout en minuscule **/
$strIn=strtolower($strIn);
/** On remplace les 'Y' par des 'I' **/
$strIn=str_replace('y', 'i', $strIn);
/** On supprime les accents **/
$strIn=trimAccent($strIn);
/** On retire les 'H' muets sauf ceux précédés par 'C' ou 'S' **/
$strIn = preg_replace ('/(?<![CS])H/', '', $strIn);
/** On remplace les 'PH' par des 'F' **/
$strIn=str_replace('ph', 'f', $strIn);
/** On remplace les 'G' par des 'K' devant AN AM AIN AIM **/
$strIn=str_replace('gan', 'kan', $strIn);
$strIn=str_replace('gain', 'kain', $strIn);
$strIn=str_replace('gam', 'kam4', $strIn);
$strIn=str_replace('gaim', 'kaim', $strIn);
/** On remplace le son AI **/
for ($i=0; $i>4; $i++) {
$strIn=str_replace($tabSonAIA[$i], 'yna', $strIn);
$strIn=str_replace($tabSonAIE[$i], 'yne', $strIn);
$strIn=str_replace($tabSonAII[$i], 'yni', $strIn);
$strIn=str_replace($tabSonAIO[$i], 'yno', $strIn);
$strIn=str_replace($tabSonAIU[$i], 'ynu', $strIn);
}
/** Remplacement des groupes de 3 lettres **/
$strIn=str_replace('eau', 'o', $strIn);
$strIn=str_replace('oua', '2', $strIn);
$strIn=str_replace('ein', '4', $strIn);
$strIn=str_replace('ain', '4', $strIn);
/** Remplacement du son 'é' **/
$strIn=str_replace('ai', 'y', $strIn);
$strIn=str_replace('ei', 'y', $strIn);
$strIn=str_replace('er', 'yr', $strIn);
$strIn=str_replace('ess', 'yss', $strIn);
$strIn=str_replace('et', 'yt', $strIn);
$strIn=str_replace('ez', 'yz', $strIn);
/** Remplacement des groupes de 2 lettres sauf si voyelle ou son (1 à 4) AVANT **/
$strIn=str_replace_except_voy('an', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('am', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('en', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('em', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('in', '4', $strIn, BEFORE);
/** Remplacement du son 'SCH' **/
$strIn=str_replace('sch', '5', $strIn);
/** Remplacement du 'S' sauf si voyelle ou son (1 à 4) avant ou après **/
$strIn=str_replace_except_voy('in', '4', $strIn, BOTH);
/** Remplacement de groupe de 2 lettres diverses **/
$strIn=str_replace('oe', 'e', $strIn);
$strIn=str_replace('eu', 'e', $strIn);
$strIn=str_replace('au', 'o', $strIn);
$strIn=str_replace('oi', '2', $strIn);
$strIn=str_replace('oy', '2', $strIn);
$strIn=str_replace('ou', '3', $strIn);
$strIn=str_replace('ch', '5', $strIn);
$strIn=str_replace('sh', '5', $strIn);
$strIn=str_replace('ss', 's', $strIn);
$strIn=str_replace('sc', 's', $strIn);
/** Remplacement du 'C' par 'S' s'il est suivi d'un 'E' ou d'un 'I' **/
$strIn=str_replace('ce', 'se', $strIn);
$strIn=str_replace('ci', 'si', $strIn);
/** Remplacement divers **/
$strIn=str_replace('c', 'k', $strIn);
$strIn=str_replace('q', 'k', $strIn);
$strIn=str_replace('qu', 'k', $strIn);
$strIn=str_replace('ga', 'ka', $strIn);
$strIn=str_replace('go', 'ko', $strIn);
$strIn=str_replace('gu', 'ku', $strIn);
$strIn=str_replace('gy', 'ky', $strIn);
$strIn=str_replace('g2', 'k2', $strIn);
$strIn=str_replace('g1', 'k1', $strIn);
$strIn=str_replace('g3', 'k3', $strIn);
$strIn=str_replace('a', 'o', $strIn);
$strIn=str_replace('d', 't', $strIn);
$strIn=str_replace('p', 't', $strIn);
$strIn=str_replace('j', 'g', $strIn);
$strIn=str_replace('b', 'f', $strIn);
$strIn=str_replace('v', 'f', $strIn);
$strIn=str_replace('m', 'n', $strIn);
/** Supression des lettres dupliquées **/
$let=$strIn[0];
$strIn2=$let;
for ($i=1; $i<strlen($strIn); $i++)
{ if ($strIn==$let)
continue;
else {
$let=$strIn[$i];
$strIn2.=$strIn[$i];
}
}
$strIn=$strIn2;
/** Supression des terminaisons **/
$strIn2=substr($strIn,-1);
if ($strIn2=='t' || $strIn2=='k' || $strIn2=='s' || $strIn2=='z')
$strIn=substr($strIn,0,-1);
/** Supression des caractères non autorisés **/
$j=10;
$sout=array();
for ($i=0; $i<strlen($strIn); $i++)
{
if ($j<1) break;
for ($k=0; $k<22; $k++)
{
if ($strIn[$i]==$tabCarPhon[$k])
{
$sout[$j]=$k;
$j--;
}
}
}
//print_r($tabCarPhon);
/** Couversion en flottant **/
$result=0.0;
for ($j=10; $j>0; $j--)
$result+=$sout[$j]*pow($j-1,10);
return $result;
}
?>

View File

@ -0,0 +1,527 @@
codeZone;valeur;NBEntreprises;NbProCol;Pourcentage;Risque;Points
GLOBALE;TOTAL;6447249;43572;0.006758231;0.006758231;0
insAPEN31;DB;18973;612;0.032256364;4.729218896;-3.729218896
insAPEN31;FA;367665;9644;0.0262304;3.845731092;-2.845731092
insAPEN31;DJ;32346;786;0.024299759;3.562673018;-2.562673018
insAPEN31;DM;5682;132;0.023231257;3.406016148;-2.406016148
insAPEN31;DC;2430;55;0.022633745;3.318412852;-2.318412852
insAPEN31;DE;36701;740;0.020162938;2.956159228;-1.956159228
insAPEN31;DH;5546;111;0.020014425;2.934385137;-1.934385137
insAPEN31;DD;11292;225;0.019925611;2.92136384;-1.92136384
insAPEN31;DK;17243;334;0.019370179;2.839930026;-1.839930026
insAPEN31;HA;242687;4586;0.018896768;2.770521585;-1.770521585
insAPEN31;IA;111075;1916;0.017249606;2.529025356;-1.529025356
insAPEN31;DL;20515;323;0.015744577;2.308367769;-1.308367769
insAPEN31;GA;693458;10740;0.0154876;2.270691423;-1.270691423
insAPEN31;DI;9391;138;0.014694921;2.154473946;-1.154473946
insAPEN31;DA;69613;995;0.014293307;2.095591997;-1.095591997
insAPEN31;DG;4389;61;0.013898382;2.037690661;-1.037690661
insAPEN31;DN;33557;435;0.012963018;1.900553633;-0.900553633
insAPEN31;ZZ;16576;119;0.007179054;1.052546337;-0.052546337
insAPEN31;CB;2833;17;0.006000706;0.879784584;0.120215416
insAPEN31;GG;9721;52;0.005349244;0.784271442;0.215728558
insAPEN31;MA;70612;373;0.005282388;0.774469502;0.225530498
insAPEN31;FF;4750;25;0.005263158;0.77165007;0.22834993
insAPEN31;CA;195;1;0.005128205;0.751864171;0.248135829
insAPEN31;HH;3757;16;0.004258717;0.62438547;0.37561453
insAPEN31;JA;72234;289;0.004000886;0.586583954;0.413416046
insAPEN31;OA;611504;2075;0.003393273;0.497499673;0.502500327
insAPEN31;KA;2657556;7102;0.00267238;0.391807048;0.608192952
insAPEN31;BA;14187;37;0.002608021;0.382371184;0.617628816
insAPEN31;OO;2450;6;0.00244898;0.359053502;0.640946498
insAPEN31;II;1476;3;0.00203252;0.297994946;0.702005054
insAPEN31;KK;22395;40;0.001786113;0.261868298;0.738131702
insAPEN31;AA;777002;1339;0.00172329;0.252657643;0.747342357
insAPEN31;EA;5687;7;0.001230877;0.180463266;0.819536734
insAPEN31;NA;432746;238;0.000549976;0.080633943;0.919366057
insAPEN31;BB;81;;0;0;1
insAPEN31;DF;149;;0;0;1
insAPEN31;EE;79;;0;0;1
insAPEN31;JJ;596;;0;0;1
insAPEN31;LA;56364;;0;0;1
insAPEN31;LL;79;;0;0;1
insAPEN31;MM;343;;0;0;1
insAPEN31;NN;772;;0;0;1
insAPEN31;PA;32;;0;0;1
insAPEN31;QA;510;;0;0;1
insMONOACT;1;57315;535;0.00933438;1.368546272;-0.368546272
insMONOACT;2;6175850;41794;0.006767328;0.992181671;0.007818329
insMONOACT;0;214084;1243;0.005806132;0.851257436;0.148742564
insSAISONAT;0;6422146;43477;0.006769855;0.99255229;0.00744771
insSAISONAT;1;25103;95;0.003784408;0.554845387;0.445154613
insDEPET;93;99100;1332;0.013440969;1.988829034;-0.988829034
insDEPET;77;87496;937;0.010709061;1.58459497;-0.58459497
insDEPET;94;94293;975;0.01034011;1.530002158;-0.530002158
insDEPET;57;67886;694;0.010223021;1.51267675;-0.51267675
insDEPET;95;72827;735;0.010092411;1.493350666;-0.493350666
insDEPET;13;198603;1935;0.009743055;1.441657335;-0.441657335
insDEPET;59;165430;1504;0.009091459;1.345242092;-0.345242092
insDEPET;91;75252;675;0.008969861;1.327249612;-0.327249612
insDEPET;06;158986;1366;0.008591951;1.271331178;-0.271331178
insDEPET;62;87566;730;0.008336569;1.23354282;-0.23354282
insDEPET;54;50761;411;0.008096767;1.198059904;-0.198059904
insDEPET;90;9792;79;0.00806781;1.193775242;-0.193775242
insDEPET;42;68973;550;0.007974135;1.179914273;-0.179914273
insDEPET;60;52888;420;0.00794131;1.175057253;-0.175057253
insDEPET;92;147353;1169;0.00793333;1.173876504;-0.173876504
insDEPET;68;61653;481;0.007801729;1.154403789;-0.154403789
insDEPET;72;43306;332;0.007666374;1.134375644;-0.134375644
insDEPET;31;116009;868;0.007482178;1.107120578;-0.107120578
insDEPET;02;39818;295;0.00740871;1.096249618;-0.096249618
insDEPET;78;101841;754;0.007403698;1.095508047;-0.095508047
insDEPET;67;93946;692;0.007365934;1.089920151;-0.089920151
insDEPET;28;34301;252;0.007346725;1.087077834;-0.087077834
insDEPET;33;152528;1107;0.007257684;1.07390268;-0.07390268
insDEPET;84;67613;488;0.007217547;1.067963714;-0.067963714
insDEPET;83;126540;909;0.007183499;1.062925765;-0.062925765
insDEPET;66;58946;419;0.007108201;1.051784011;-0.051784011
insDEPET;18;27790;193;0.006944944;1.027627324;-0.027627324
insDEPET;69;174961;1214;0.006938689;1.026701782;-0.026701782
insDEPET;88;34443;238;0.006909967;1.022451853;-0.022451853
insDEPET;30;76395;525;0.006872177;1.0168602;-0.0168602
insDEPET;08;23202;157;0.006766658;1.001246731;-0.001246731
insDEPET;87;34338;231;0.006727241;0.995414275;0.004585725
insDEPET;76;86118;579;0.006723333;0.994836039;0.005163961
insDEPET;26;53631;358;0.006675244;0.987720376;0.012279624
insDEPET;34;133650;876;0.006554433;0.969844315;0.030155685
insDEPET;2A;17005;111;0.006527492;0.965857872;0.034142128
insDEPET;25;44175;286;0.00647425;0.95797981;0.04202019
insDEPET;38;119307;770;0.006453938;0.954974293;0.045025707
insDEPET;41;28978;186;0.006418662;0.949754625;0.050245375
insDEPET;45;49561;318;0.006416335;0.949410303;0.050589697
insDEPET;2B;19519;124;0.006352784;0.940006815;0.059993185
insDEPET;70;21399;132;0.006168513;0.912740526;0.087259474
insDEPET;37;49723;305;0.006133982;0.907631159;0.092368841
insDEPET;55;17276;105;0.006077796;0.899317376;0.100682624
insDEPET;27;45311;273;0.006025027;0.891509307;0.108490693
insDEPET;39;26947;162;0.006011801;0.889552272;0.110447728
insDEPET;80;42871;257;0.005994728;0.887026083;0.112973917
insDEPET;47;40592;242;0.005961766;0.882148698;0.117851302
insDEPET;82;27230;159;0.005839148;0.864005216;0.135994784
insDEPET;36;23734;137;0.00577231;0.854115317;0.145884683
insDEPET;63;65589;373;0.005686929;0.841481754;0.158518246
insDEPET;89;33216;188;0.005659923;0.837485697;0.162514303
insDEPET;52;16860;94;0.005575326;0.824968117;0.175031883
insDEPET;24;51134;284;0.005554034;0.821817631;0.178182369
insDEPET;58;22345;123;0.005504587;0.814501022;0.185498978
insDEPET;17;75422;415;0.005502373;0.814173445;0.185826555
insDEPET;71;55680;306;0.00549569;0.813184479;0.186815521
insDEPET;03;34938;192;0.005495449;0.813148882;0.186851118
insDEPET;21;53379;290;0.005432848;0.803885963;0.196114037
insDEPET;49;68055;368;0.005407391;0.800119144;0.199880856
insDEPET;11;55513;300;0.00540414;0.799638025;0.200361975
insDEPET;86;38412;205;0.005336874;0.789684879;0.210315121
insDEPET;51;65810;346;0.00525756;0.777948932;0.222051068
insDEPET;56;72609;378;0.005205966;0.770314771;0.229685229
insDEPET;07;33636;169;0.005024379;0.74344568;0.25655432
insDEPET;44;106703;532;0.004985802;0.73773754;0.26226246
insDEPET;01;51685;255;0.004933733;0.730033082;0.269966918
insDEPET;10;30663;149;0.004859277;0.71901592;0.28098408
insDEPET;14;64428;310;0.004811573;0.711957263;0.288042737
insDEPET;19;30160;144;0.004774536;0.706477014;0.293522986
insDEPET;16;39889;190;0.004763218;0.704802333;0.295197667
insDEPET;73;71454;339;0.004744311;0.702004723;0.297995277
insDEPET;81;40986;194;0.004733324;0.700378935;0.299621065
insDEPET;35;90680;422;0.004653727;0.688601272;0.311398728
insDEPET;29;86330;400;0.004633384;0.685591038;0.314408962
insDEPET;61;32758;149;0.004548507;0.673032089;0.326967911
insDEPET;74;93707;423;0.00451407;0.667936558;0.332063442
insDEPET;09;17626;79;0.004482015;0.663193417;0.336806583
insDEPET;79;37656;162;0.004302103;0.636572261;0.363427739
insDEPET;64;83756;359;0.00428626;0.634227986;0.365772014
insDEPET;23;16174;68;0.004204278;0.622097355;0.377902645
insDEPET;50;52775;219;0.004149692;0.614020335;0.385979665
insDEPET;04;22787;90;0.00394962;0.58441619;0.41558381
insDEPET;40;49541;192;0.003875578;0.573460278;0.426539722
insDEPET;43;27370;105;0.003836317;0.567650968;0.432349032
insDEPET;22;64491;244;0.003783474;0.559831842;0.440168158
insDEPET;85;64417;243;0.003772296;0.558177928;0.441822072
insDEPET;46;26030;95;0.003649635;0.54002805;0.45997195
insDEPET;53;32932;120;0.003643872;0.539175339;0.460824661
insDEPET;99;40894;134;0.003276764;0.484855233;0.515144767
insDEPET;65;34146;104;0.003045745;0.450671801;0.549328199
insDEPET;32;32543;96;0.002949943;0.436496261;0.563503739
insDEPET;15;22199;62;0.002792919;0.413261701;0.586738299
insDEPET;05;25212;70;0.002776456;0.410825718;0.589174282
insDEPET;48;12747;34;0.002667294;0.394673359;0.605326641
insDEPET;98;775;2;0.002580645;0.381852092;0.618147908
insDEPET;12;41281;104;0.002519319;0.372777775;0.627222225
insDEPCOMEN;75120;23391;422;0.018041127;2.669503799;-1.669503799
insDEPCOMEN;75110;28336;491;0.017327781;2.56395164;-1.56395164
insDEPCOMEN;75102;19124;292;0.015268772;2.259284889;-1.259284889
insDEPCOMEN;75103;14002;144;0.010284245;1.521735947;-0.521735947
insDEPCOMEN;75112;23538;238;0.010111309;1.496147047;-0.496147047
insDEPCOMEN;75119;18558;185;0.009968747;1.475052368;-0.475052368
insDEPCOMEN;75109;30187;288;0.009540531;1.411690247;-0.411690247
insDEPCOMEN;75111;32950;296;0.008983308;1.329239301;-0.329239301
insDEPCOMEN;75101;16952;132;0.007786692;1.15217877;-0.15217877
insDEPCOMEN;75118;26179;197;0.007525116;1.113473932;-0.113473932
insDEPCOMEN;75114;21520;154;0.007156134;1.058876561;-0.058876561
insDEPCOMEN;75108;66310;446;0.006725984;0.995228288;0.004771712
insDEPCOMEN;75117;41679;278;0.006670026;0.986948262;0.013051738
insDEPCOMEN;75115;36833;223;0.006054353;0.895848666;0.104151334
insDEPCOMEN;75113;19497;113;0.005795763;0.857585705;0.142414295
insDEPCOMEN;75104;10380;51;0.004913295;0.72700886;0.27299114
insDEPCOMEN;75105;14528;71;0.004887115;0.723135028;0.276864972
insDEPCOMEN;75116;48424;220;0.004543202;0.672247044;0.327752956
insDEPCOMEN;75106;16345;72;0.004405017;0.651800145;0.348199855
insDEPCOMEN;75107;18645;59;0.003164387;0.468227056;0.531772944
insDEPCOMEN,3;974;61141;402;0.006574966;0.972882512;0.027117488
insDEPCOMEN,3;972;42850;261;0.006091015;0.901273418;0.098726582
insDEPCOMEN,3;971;63190;307;0.004858364;0.718880828;0.281119172
insDEPCOMEN,3;973;13285;63;0.00474219;0.701690944;0.298309056
insCJ,2;54;1046180;26431;0.025264295;3.738299821;-2.738299821
insCJ,2;55;116455;1676;0.014391825;2.129525393;-1.129525393
insCJ,2;13;332350;4569;0.013747555;2.034194255;-1.034194255
insCJ,2;56;6079;81;0.01332456;1.971604606;-0.971604606
insCJ,2;57;68076;864;0.012691698;1.8779614;-0.8779614
insCJ,2;12;437093;5064;0.011585635;1.714299878;-0.714299878
insCJ,2;11;197912;2096;0.010590566;1.567061711;-0.567061711
insCJ,2;82;5102;51;0.00999608;1.479097048;-0.479097048
insCJ,2;31;11814;115;0.009734214;1.440349288;-0.440349288
insCJ,2;53;1525;13;0.00852459;1.261364073;-0.261364073
insCJ,2;52;38818;186;0.004791592;0.709000819;0.290999181
insCJ,2;51;517;1;0.001934236;0.286204465;0.713795535
insCJ,2;92;417094;658;0.001577582;0.233431198;0.766568802
insCJ,2;62;10141;12;0.001183315;0.175092447;0.824907553
insCJ,2;17;40919;39;0.000953102;0.141028389;0.858971611
insCJ,2;16;558658;471;0.000843092;0.124750367;0.875249633
insCJ,2;65;1134849;828;0.000729612;0.107959088;0.892040912
insCJ,2;32;26976;19;0.00070433;0.104218063;0.895781937
insCJ,2;29;24080;14;0.000581395;0.086027738;0.913972262
insCJ,2;84;8634;5;0.000579106;0.085688967;0.914311033
insCJ,2;63;20101;6;0.000298493;0.044167268;0.955832732
insCJ,2;19;511880;129;0.000252012;0.037289666;0.962710334
insCJ,2;15;577704;133;0.000230222;0.034065378;0.965934622
insCJ,2;18;497265;107;0.000215177;0.03183925;0.96816075
insCJ,2;22;29402;3;0.000102034;0.015097719;0.984902281
insCJ,2;21;24477;1;4.08547E-05;0.006045173;0.993954827
insCJ,2;10;1;0;0;0;1
insCJ,2;14;6117;0;0;0;1
insCJ,2;23;7434;0;0;0;1
insCJ,2;27;527;0;0;0;1
insCJ,2;41;874;0;0;0;1
insCJ,2;61;17;0;0;0;1
insCJ,2;64;178;0;0;0;1
insCJ,2;69;2;0;0;0;1
insCJ,2;71;2984;0;0;0;1
insCJ,2;72;36821;0;0;0;1
insCJ,2;73;91862;0;0;0;1
insCJ,2;74;2566;0;0;0;1
insCJ,2;81;1202;0;0;0;1
insCJ,2;83;4849;0;0;0;1
insCJ,2;91;145682;0;0;0;1
insCJ,2;93;461;0;0;0;1
insCJ,2;99;1571;0;0;0;1
ageDirigeant;0;4092989;11244;0.002747137;0.406487512;0.593512488
ageDirigeant;1;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;2;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;3;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;4;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;5;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;6;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;7;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;8;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;9;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;10;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;11;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;12;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;13;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;14;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;15;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;16;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;17;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;18;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;19;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;20;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;21;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;22;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;23;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;24;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;25;7915;339;0.042830069;6.337467242;-5.337467242
ageDirigeant;26;51311;1744;0.033988813;5.029246825;-4.029246825
ageDirigeant;27;51311;1744;0.033988813;5.029246825;-4.029246825
ageDirigeant;28;51311;1744;0.033988813;5.029246825;-4.029246825
ageDirigeant;29;51311;1744;0.033988813;5.029246825;-4.029246825
ageDirigeant;30;132700;3421;0.025779955;3.814600838;-2.814600838
ageDirigeant;31;132700;3421;0.025779955;3.814600838;-2.814600838
ageDirigeant;32;132700;3421;0.025779955;3.814600838;-2.814600838
ageDirigeant;33;132700;3421;0.025779955;3.814600838;-2.814600838
ageDirigeant;34;132700;3421;0.025779955;3.814600838;-2.814600838
ageDirigeant;35;246272;4538;0.01842678;2.726568435;-1.726568435
ageDirigeant;36;246272;4538;0.01842678;2.726568435;-1.726568435
ageDirigeant;37;246272;4538;0.01842678;2.726568435;-1.726568435
ageDirigeant;38;246272;4538;0.01842678;2.726568435;-1.726568435
ageDirigeant;39;246272;4538;0.01842678;2.726568435;-1.726568435
ageDirigeant;40;339245;5421;0.015979602;2.364465057;-1.364465057
ageDirigeant;41;339245;5421;0.015979602;2.364465057;-1.364465057
ageDirigeant;42;339245;5421;0.015979602;2.364465057;-1.364465057
ageDirigeant;43;339245;5421;0.015979602;2.364465057;-1.364465057
ageDirigeant;44;339245;5421;0.015979602;2.364465057;-1.364465057
ageDirigeant;45;367968;5217;0.014177863;2.097865945;-1.097865945
ageDirigeant;46;367968;5217;0.014177863;2.097865945;-1.097865945
ageDirigeant;47;367968;5217;0.014177863;2.097865945;-1.097865945
ageDirigeant;48;367968;5217;0.014177863;2.097865945;-1.097865945
ageDirigeant;49;367968;5217;0.014177863;2.097865945;-1.097865945
ageDirigeant;50;375026;4591;0.012241818;1.811393744;-0.811393744
ageDirigeant;51;375026;4591;0.012241818;1.811393744;-0.811393744
ageDirigeant;52;375026;4591;0.012241818;1.811393744;-0.811393744
ageDirigeant;53;375026;4591;0.012241818;1.811393744;-0.811393744
ageDirigeant;54;375026;4591;0.012241818;1.811393744;-0.811393744
ageDirigeant;55;377653;3778;0.010003892;1.480253045;-0.480253045
ageDirigeant;56;377653;3778;0.010003892;1.480253045;-0.480253045
ageDirigeant;57;377653;3778;0.010003892;1.480253045;-0.480253045
ageDirigeant;58;377653;3778;0.010003892;1.480253045;-0.480253045
ageDirigeant;59;377653;3778;0.010003892;1.480253045;-0.480253045
ageDirigeant;60;232451;2003;0.00861687;1.275018479;-0.275018479
ageDirigeant;61;232451;2003;0.00861687;1.275018479;-0.275018479
ageDirigeant;62;232451;2003;0.00861687;1.275018479;-0.275018479
ageDirigeant;63;232451;2003;0.00861687;1.275018479;-0.275018479
ageDirigeant;64;232451;2003;0.00861687;1.275018479;-0.275018479
ageDirigeant;65;100941;680;0.006736609;0.996800526;0.003199474
ageDirigeant;66;100941;680;0.006736609;0.996800526;0.003199474
ageDirigeant;67;100941;680;0.006736609;0.996800526;0.003199474
ageDirigeant;68;100941;680;0.006736609;0.996800526;0.003199474
ageDirigeant;69;100941;680;0.006736609;0.996800526;0.003199474
ageDirigeant;70;55612;320;0.005754154;0.85142895;0.14857105
ageDirigeant;71;55612;320;0.005754154;0.85142895;0.14857105
ageDirigeant;72;55612;320;0.005754154;0.85142895;0.14857105
ageDirigeant;73;55612;320;0.005754154;0.85142895;0.14857105
ageDirigeant;74;55612;320;0.005754154;0.85142895;0.14857105
ageDirigeant;75;33744;164;0.004860123;0.719141306;0.280858694
ageDirigeant;76;33744;164;0.004860123;0.719141306;0.280858694
ageDirigeant;77;33744;164;0.004860123;0.719141306;0.280858694
ageDirigeant;78;33744;164;0.004860123;0.719141306;0.280858694
ageDirigeant;79;33744;164;0.004860123;0.719141306;0.280858694
ageDirigeant;80;19900;73;0.003668342;0.542796117;0.457203883
ageDirigeant;81;19900;73;0.003668342;0.542796117;0.457203883
ageDirigeant;82;19900;73;0.003668342;0.542796117;0.457203883
ageDirigeant;83;19900;73;0.003668342;0.542796117;0.457203883
ageDirigeant;84;19900;73;0.003668342;0.542796117;0.457203883
ageDirigeant;*;13522;39;0.002884189;0.426766798;0.573233202
ageEntreprise;0;398545;3931;0,009863378;1,45812286;-0.45812286
ageEntreprise;1;363230;5849;0.016102745;2.380500904;-1.380500904
ageEntreprise;2;336945;5474;0.016245975;2.401674887;-1.401674887
ageEntreprise;3;320242;4323;0.013499166;1.995608689;-0.995608689
ageEntreprise;4;311256;3186;0.010235947;1.513200512;-0.513200512
ageEntreprise;5;286481;2597;0.009065174;1.340122706;-0.340122706
ageEntreprise;6;271422;2131;0.007851243;1.16066488;-0.16066488
ageEntreprise;7;249689;1696;0.00679245;1.004141411;-0.004141411
ageEntreprise;8;299828;1471;0.004906146;0.725285383;0.274714617
ageEntreprise;9;251098;1368;0.005448072;0.805399367;0.194600633
ageEntreprise;10;224326;1088;0.004850084;0.716997635;0.283002365
ageEntreprise;11;225543;1016;0.004504684;0.665936463;0.334063537
ageEntreprise;12;219141;911;0.004157141;0.614558427;0.385441573
ageEntreprise;13;227433;890;0.00391324;0.578502136;0.421497864
ageEntreprise;14;228796;849;0.003710729;0.548564505;0.451435495
ageEntreprise;15;203213;738;0.003631657;0.536875165;0.463124835
ageEntreprise;16;195413;723;0.003699856;0.546957126;0.453042874
ageEntreprise;17;156467;621;0.003968888;0.586728635;0.413271365
ageEntreprise;18;136150;578;0.004245318;0.627593783;0.372406217
ageEntreprise;19;120966;421;0.003480317;0.514502176;0.485497824
ageEntreprise;20;110350;344;0.003117354;0.460844645;0.539155355
ageEntreprise;21;108829;314;0.00288526;0.426533798;0.573466202
ageEntreprise;22;92057;306;0.003324028;0.49139762;0.50860238
ageEntreprise;23;94394;225;0.002383626;0.3523762;0.6476238
ageEntreprise;24;61811;133;0.002151721;0.318093146;0.681906854
ageEntreprise;25;86450;215;0.002486987;0.367656207;0.632343793
ageEntreprise;26;79203;222;0.002802924;0.414361868;0.585638132
ageEntreprise;27;41020;131;0.003193564;0.472110957;0.527889043
ageEntreprise;28;37137;119;0.003204351;0.473705671;0.526294329
ageEntreprise;29;30627;110;0.003591602;0.530953718;0.469046282
ageEntreprise;30;27785;106;0.003815008;0.563980261;0.436019739
ageEntreprise;31;27100;87;0.003210332;0.474589802;0.525410198
ageEntreprise;32;26851;86;0.00320286;0.47348522;0.52651478
ageEntreprise;33;21279;48;0.002255745;0.3334713;0.6665287
ageEntreprise;34;17287;42;0.002429571;0.359168382;0.640831618
ageEntreprise;35;20082;45;0.002240813;0.331263809;0.668736191
ageEntreprise;36;24005;33;0.001374714;0.203226655;0.796773345
ageEntreprise;37;10981;36;0.00327839;0.484650929;0.515349071
ageEntreprise;38;14152;43;0.00303844;0.449178619;0.550821381
ageEntreprise;39;17017;67;0.003937239;0.582049933;0.417950067
ageEntreprise;40;31055;102;0.003284495;0.485553488;0.514446512
ageEntreprise;41;15175;43;0.002833608;0.418897912;0.581102088
ageEntreprise;42;6992;15;0.002145309;0.3171453;0.6828547
ageEntreprise;43;6310;14;0.0022187;0.327994919;0.672005081
ageEntreprise;44;7244;15;0.002070679;0.306112636;0.693887364
ageEntreprise;45;5863;13;0.002217295;0.32778713;0.67221287
ageEntreprise;46;7647;52;0.006800052;1.005265304;-0.005265304
ageEntreprise;47;9466;55;0.005810268;0.858943563;0.141056437
ageEntreprise;48;6119;35;0.005719889;0.845582587;0.154417413
ageEntreprise;49;6031;41;0.006798209;1.004992841;-0.004992841
ageEntreprise;50;4954;22;0.004440856;0.656500587;0.343499413
ageEntreprise;51;12623;11;0.000871425;0.128824523;0.871175477
ageEntreprise;*;353169;621;0.001758365;0.259942604;0.740057396
insTEFEN;11;122483;2586;0.021113134;3.12406207;-2.12406207
insTEFEN;2;348140;6830;0.019618544;2.902911041;-1.902911041
insTEFEN;3;178988;3509;0.019604666;2.900857541;-1.900857541
insTEFEN;12;77324;1239;0.016023486;2.370958447;-1.370958447
insTEFEN;1;946071;14717;0.015555915;2.301773089;-1.301773089
insTEFEN;21;22652;290;0.012802402;1.894342023;-0.894342023
insTEFEN;22;11018;103;0.009348339;1.383252313;-0.383252313
insTEFEN;31;2325;13;0.005591398;0.827346328;0.172653672
insTEFEN;0;4729670;14264;0.003015855;0.446249188;0.553750812
insTEFEN;32;4541;13;0.002862806;0.423602777;0.576397223
insTEFEN;41;2251;6;0.002665482;0.394405265;0.605594735
insTEFEN;51;492;1;0.00203252;0.300747375;0.699252625
insTEFEN;42;1121;1;0.000892061;0.131996172;0.868003828
insTEFEN;52;172;0;0;0;1
insTEFEN;53;1;0;0;0;1
insNBTOA;13;445;8;0.017977528;2.660093638;-1.660093638
insNBTOA;2;199031;2816;0.01414855;2.093528483;-1.093528483
insNBTOA;3;38973;413;0.01059708;1.56802565;-0.56802565
insNBTOA;1;3755472;38870;0.01035023;1.531499858;-0.531499858
insNBTOA;8;1595;15;0.009404389;1.391545849;-0.391545849
insNBTOA;11;743;6;0.00807537;1.194894013;-0.194894013
insNBTOA;4;14851;119;0.008012928;1.185654658;-0.185654658
insNBTOA;7;2443;19;0.007777323;1.150792658;-0.150792658
insNBTOA;20-25;949;7;0.007376185;1.091437261;-0.091437261
insNBTOA;10;869;6;0.006904488;1.021641256;-0.021641256
insNBTOA;5;7090;46;0.006488011;0.960016163;0.039983837
insNBTOA;6;3905;24;0.006145967;0.909404611;0.090595389
insNBTOA;9;1144;6;0.005244755;0.776054416;0.223945584
insNBTOA;14;412;2;0.004854369;0.718289848;0.281710152
insNBTOA;75-99;225;1;0.004444444;0.657634261;0.342365739
insNBTOA;35-49;639;2;0.00312989;0.463122719;0.536877281
insNBTOA;50-74;424;1;0.002358491;0.348980445;0.651019555
insNBTOA;15-19;1445;3;0.002076125;0.307199395;0.692800605
insNBTOA;12;626;1;0.001597444;0.236370142;0.763629858
insNBTOA;26-34;793;1;0.001261034;0.186592319;0.813407681
insNBTOA;0;2414681;1206;0.000499445;0.073901711;0.926098289
insNBTOA;100-;494;0;0;0;1
insTCA;2;21622;409;0.018915919;2.798369096;-1.798369096
insTCA;3;28973;507;0.017499051;2.588761516;-1.588761516
insTCA;1;20023;348;0.017380013;2.571151383;-1.571151383
insTCA;4;15955;207;0.012973989;1.919336348;-0.919336348
insTCA;5;10403;89;0.008555224;1.265636407;-0.265636407
insTCA;6;7600;51;0.006710526;0.992736831;0.007263169
insTCA;0;6337365;41952;0.006619786;0.979312956;0.020687044
insTCA;7;2667;7;0.002624672;0.388286754;0.611713246
insTCA;9;1314;2;0.00152207;0.225170857;0.774829143
insTCA;8;1327;0;0;0;1
insTCAEXPOR;3;5258;109;0.020730316;3.066785966;-2.066785966
insTCAEXPOR;2;12013;215;0.017897278;2.647674141;-1.647674141
insTCAEXPOR;1;10029;173;0.017249975;2.551913931;-1.551913931
insTCAEXPOR;4;5589;88;0.015745214;2.329303684;-1.329303684
insTCAEXPOR;0;6414360;42987;0.006701682;0.991428405;0.008571595
insSEXE;M;2233981;9893;0.004428417;0.655262754;0.344737246
insSEXE;F;923849;2714;0.002937710;0.434686146;0.565313854
insSEXE;*;3289419;30965;0.009413516;1.392896465;-0.392896465
insRECME;0;6445782;43572;0.006759769;1.000227591;-0.000227591
insRECME;1;1467;0;0.000000000;0;1
insMONOREG;1;78856;935;0.011857056;1.754461392;-0.754461392
insMONOREG;2;6170828;41393;0.006707852;0.992545468;0.007454532
insMONOREG;0;197565;1244;0.006296662;0.931702627;0.068297373
insRPET;11;1205539;10949;0.009082245;1.343874119;-0.343874119
insRPET;31;252996;2234;0.008830179;1.306576712;-0.306576712
insRPET;41;170366;1448;0.008499348;1.25762463;-0.25762463
insRPET;93;599741;4858;0.008100163;1.198558318;-0.198558318
insRPET;42;155599;1173;0.007538609;1.1154667;-0.1154667
insRPET;22;135577;972;0.007169358;1.060829637;-0.060829637
insRPET;4;60943;402;0.006596328;0.976040016;0.023959984
insRPET;24;214087;1391;0.006497359;0.961395827;0.038604173
insRPET;23;131429;852;0.006482588;0.959210205;0.040789795
insRPET;43;102313;659;0.006441019;0.953059456;0.046940544
insRPET;94;36450;234;0.006419753;0.949912765;0.050087235
insRPET;91;337251;2154;0.006386934;0.945056671;0.054943329
insRPET;82;667354;4078;0.0061107;0.904183032;0.095816968
insRPET;2;42948;261;0.006077117;0.899213798;0.100786202
insRPET;72;377551;2184;0.005784649;0.855938198;0.144061802
insRPET;26;164649;907;0.005508688;0.81510506;0.18489494
insRPET;74;80672;443;0.005491372;0.812542903;0.187457097
insRPET;21;136535;746;0.0054638;0.808463155;0.191536845
insRPET;54;191379;972;0.005078927;0.751514532;0.248485468
insRPET;73;335852;1699;0.005058776;0.748532806;0.251467194
insRPET;52;315413;1595;0.005056862;0.748249607;0.251750393
insRPET;83;150096;732;0.004876879;0.721618007;0.278381993
insRPET;1;63134;307;0.004862673;0.719516021;0.280483979
insRPET;3;13275;63;0.004745763;0.702217129;0.297782871
insRPET;53;314133;1445;0.004599962;0.680643473;0.319356527
insRPET;25;149961;678;0.004521176;0.668985593;0.331014407
insRPET;99;41208;134;0.003251796;0.481159052;0.518840948
insRPET;98;775;2;0.002580645;0.381850789;0.618149211
insSINGT;43;23550;425;0.018046709;2.670330198;-1.670330198
insSINGT;2;76142;1237;0.016245961;2.403877696;-1.403877696
insSINGT;1;3885595;40481;0.010418224;1.541560768;-0.541560768
insSINGT;40;13737;119;0.008662736;1.281805149;-0.281805149
insSINGT;31;35843;96;0.002678347;0.396308903;0.603691097
insSINGT;33;3315;8;0.002413273;0.357086476;0.642913524
insSINGT;52;6565;10;0.001523229;0.225388741;0.774611259
insSINGT;10;96382;127;0.001317673;0.194973117;0.805026883
insSINGT;60;216663;228;0.001052326;0.155710193;0.844289807
insSINGT;90;577496;260;0.00045022;0.066617958;0.933382042
insSINGT;70;1298907;576;0.00044345;0.065616245;0.934383755
insSINGT;34;24032;1;4.16112E-05;0.006157112;0.993842888
insSINGT;80;149852;4;2.6693E-05;0.003949703;0.996050297
insSINGT;0;1;;0;0;1
insSINGT;30;5741;0;0;0;1
insSINGT;42;33428;0;0;0;1
insORDIN;1;3412206;41477;0.012155479;1.798618445;-0.798618445
insORDIN;0;3035043;2095;0.00069027;0.102137713;0.897862287
insMODET;3;2787;130;0.046645138;6.901974209;-5.901974209
insMODET;1;991;19;0.019172553;2.836918732;-1.836918732
insMODET;2;3347;45;0.013444876;1.989407496;-0.989407496
insMODET;0;6440124;43378;0.006735585;0.996649019;0.003350981
insAUXILT;1;26364;474;0.017979062;2.66032066;-1.66032066
insAUXILT;0;6420872;43098;0.006712172;0.993184774;0.006815226
insAUXILT;*;13;0;0;0;1
insTCD;73;83653;867;0.010364243;1.533573253;-0.533573253
insTCD;44;207816;2036;0.009797128;1.449658615;-0.449658615
insTCD;52;189137;1814;0.009590931;1.419148149;-0.419148149
insTCD;43;241634;2262;0.009361265;1.385164989;-0.385164989
insTCD;62;114691;1056;0.009207348;1.362390251;-0.362390251
insTCD;41;193192;1687;0.008732246;1.292090379;-0.292090379
insTCD;51;286358;2499;0.008726838;1.291290286;-0.291290286
insTCD;72;161502;1371;0.008489059;1.256106603;-0.256106603
insTCD;80;520175;4329;0.008322199;1.231416755;-0.231416755
insTCD;42;173427;1427;0.008228246;1.21751469;-0.21751469
insTCD;61;258193;2063;0.007990147;1.182283729;-0.182283729
insTCD;31;307323;2413;0.007851674;1.161794206;-0.161794206
insTCD;32;256048;1919;0.007494688;1.108971884;-0.108971884
insTCD;71;137763;984;0.007142702;1.056889189;-0.056889189
insTCD;22;291665;2073;0.007107469;1.051675929;-0.051675929
insTCD;21;317427;2113;0.006656649;0.984969043;0.015030957
insTCD;18;197044;1301;0.006602586;0.976969555;0.023030445
insTCD;17;257376;1549;0.006018432;0.890533619;0.109466381
insTCD;15;199766;1128;0.005646607;0.83551543;0.16448457
insTCD;16;172805;968;0.00560169;0.828869199;0.171130801
insTCD;14;249738;1244;0.00498122;0.737059757;0.262940243
insTCD;0;120431;578;0.004799429;0.71016047;0.28983953
insTCD;13;342501;1623;0.004738672;0.701170482;0.298829518
insTCD;12;272656;1158;0.00424711;0.628435122;0.371564878
insTCD;11;245321;1022;0.00416597;0.616429079;0.383570921
insTCD;8;125432;481;0.003834747;0.567418744;0.432581256
insTCD;7;149718;535;0.003573385;0.528745536;0.471254464
insTCD;6;81869;265;0.003236878;0.478953484;0.521046516
insTCD;4;81356;256;0.003146664;0.465604668;0.534395332
insTCD;5;84330;243;0.002881537;0.426374401;0.573625599
insTCD;3;74476;200;0.002685429;0.397356756;0.602643244
insTCD;2;43091;94;0.00218143;0.322781198;0.677218802
insTCD;1;9335;14;0.001499732;0.221911936;0.778088064
insNATURE;91;238972;6564;0.027467653;4.064325692;-3.064325692
insNATURE;20;144873;3353;0.023144409;3.424625203;-2.424625203
insNATURE;22;10828;119;0.010990026;1.626168944;-0.626168944
insNATURE;93;160570;1367;0.008513421;1.259711389;-0.259711389
insNATURE;21;185819;1501;0.008077753;1.195246614;-0.195246614
insNATURE;92;83924;635;0.00756637;1.119578368;-0.119578368
insNATURE;99;5621113;30028;0.005342003;0.790443877;0.209556123
insNATURE;23;1135;5;0.004405286;0.651840126;0.348159874
insNATURE;*;15;0;0;0;1
insORIGINE;3;296615;3962;0.013357382;1.976461277;-0.976461277
insORIGINE;7;112298;1480;0.01317922;1.950098922;-0.950098922
insORIGINE;2;907819;9870;0.010872211;1.608736195;-0.608736195
insORIGINE;5;54475;462;0.008480955;1.254907414;-0.254907414
insORIGINE;6;1914;11;0.005747126;0.85038913;0.14961087
insORIGINE;1;4776418;27127;0.005679361;0.840361968;0.159638032
insORIGINE;8;90133;230;0.002551785;0.377581718;0.622418282
insORIGINE;0;173492;370;0.002132663;0.315565284;0.684434716
insORIGINE;4;34085;60;0.001760305;0.260468315;0.739531685
insTU;8;1084479;9960;0.009184134;1.358955201;-0.358955201
insTU;7;1259040;10827;0.008599409;1.272434856;-0.272434856
insTU;5;399066;3189;0.007991159;1.182433539;-0.182433539
insTU;6;378843;2890;0.00762849;1.128770171;-0.128770171
insTU;4;410877;2959;0.007201669;1.065614405;-0.065614405
insTU;3;331773;2090;0.006299488;0.93212079;0.06787921
insTU;2;343704;2076;0.006040081;0.893736945;0.106263055
insTU;1;375638;2186;0.005819433;0.861088098;0.138911902
insTU;0;1863829;7395;0.003967639;0.587082401;0.412917599
1 codeZone valeur NBEntreprises NbProCol Pourcentage Risque Points
2 GLOBALE TOTAL 6447249 43572 0.006758231 0.006758231 0
3 insAPEN31 DB 18973 612 0.032256364 4.729218896 -3.729218896
4 insAPEN31 FA 367665 9644 0.0262304 3.845731092 -2.845731092
5 insAPEN31 DJ 32346 786 0.024299759 3.562673018 -2.562673018
6 insAPEN31 DM 5682 132 0.023231257 3.406016148 -2.406016148
7 insAPEN31 DC 2430 55 0.022633745 3.318412852 -2.318412852
8 insAPEN31 DE 36701 740 0.020162938 2.956159228 -1.956159228
9 insAPEN31 DH 5546 111 0.020014425 2.934385137 -1.934385137
10 insAPEN31 DD 11292 225 0.019925611 2.92136384 -1.92136384
11 insAPEN31 DK 17243 334 0.019370179 2.839930026 -1.839930026
12 insAPEN31 HA 242687 4586 0.018896768 2.770521585 -1.770521585
13 insAPEN31 IA 111075 1916 0.017249606 2.529025356 -1.529025356
14 insAPEN31 DL 20515 323 0.015744577 2.308367769 -1.308367769
15 insAPEN31 GA 693458 10740 0.0154876 2.270691423 -1.270691423
16 insAPEN31 DI 9391 138 0.014694921 2.154473946 -1.154473946
17 insAPEN31 DA 69613 995 0.014293307 2.095591997 -1.095591997
18 insAPEN31 DG 4389 61 0.013898382 2.037690661 -1.037690661
19 insAPEN31 DN 33557 435 0.012963018 1.900553633 -0.900553633
20 insAPEN31 ZZ 16576 119 0.007179054 1.052546337 -0.052546337
21 insAPEN31 CB 2833 17 0.006000706 0.879784584 0.120215416
22 insAPEN31 GG 9721 52 0.005349244 0.784271442 0.215728558
23 insAPEN31 MA 70612 373 0.005282388 0.774469502 0.225530498
24 insAPEN31 FF 4750 25 0.005263158 0.77165007 0.22834993
25 insAPEN31 CA 195 1 0.005128205 0.751864171 0.248135829
26 insAPEN31 HH 3757 16 0.004258717 0.62438547 0.37561453
27 insAPEN31 JA 72234 289 0.004000886 0.586583954 0.413416046
28 insAPEN31 OA 611504 2075 0.003393273 0.497499673 0.502500327
29 insAPEN31 KA 2657556 7102 0.00267238 0.391807048 0.608192952
30 insAPEN31 BA 14187 37 0.002608021 0.382371184 0.617628816
31 insAPEN31 OO 2450 6 0.00244898 0.359053502 0.640946498
32 insAPEN31 II 1476 3 0.00203252 0.297994946 0.702005054
33 insAPEN31 KK 22395 40 0.001786113 0.261868298 0.738131702
34 insAPEN31 AA 777002 1339 0.00172329 0.252657643 0.747342357
35 insAPEN31 EA 5687 7 0.001230877 0.180463266 0.819536734
36 insAPEN31 NA 432746 238 0.000549976 0.080633943 0.919366057
37 insAPEN31 BB 81 0 0 1
38 insAPEN31 DF 149 0 0 1
39 insAPEN31 EE 79 0 0 1
40 insAPEN31 JJ 596 0 0 1
41 insAPEN31 LA 56364 0 0 1
42 insAPEN31 LL 79 0 0 1
43 insAPEN31 MM 343 0 0 1
44 insAPEN31 NN 772 0 0 1
45 insAPEN31 PA 32 0 0 1
46 insAPEN31 QA 510 0 0 1
47 insMONOACT 1 57315 535 0.00933438 1.368546272 -0.368546272
48 insMONOACT 2 6175850 41794 0.006767328 0.992181671 0.007818329
49 insMONOACT 0 214084 1243 0.005806132 0.851257436 0.148742564
50 insSAISONAT 0 6422146 43477 0.006769855 0.99255229 0.00744771
51 insSAISONAT 1 25103 95 0.003784408 0.554845387 0.445154613
52 insDEPET 93 99100 1332 0.013440969 1.988829034 -0.988829034
53 insDEPET 77 87496 937 0.010709061 1.58459497 -0.58459497
54 insDEPET 94 94293 975 0.01034011 1.530002158 -0.530002158
55 insDEPET 57 67886 694 0.010223021 1.51267675 -0.51267675
56 insDEPET 95 72827 735 0.010092411 1.493350666 -0.493350666
57 insDEPET 13 198603 1935 0.009743055 1.441657335 -0.441657335
58 insDEPET 59 165430 1504 0.009091459 1.345242092 -0.345242092
59 insDEPET 91 75252 675 0.008969861 1.327249612 -0.327249612
60 insDEPET 06 158986 1366 0.008591951 1.271331178 -0.271331178
61 insDEPET 62 87566 730 0.008336569 1.23354282 -0.23354282
62 insDEPET 54 50761 411 0.008096767 1.198059904 -0.198059904
63 insDEPET 90 9792 79 0.00806781 1.193775242 -0.193775242
64 insDEPET 42 68973 550 0.007974135 1.179914273 -0.179914273
65 insDEPET 60 52888 420 0.00794131 1.175057253 -0.175057253
66 insDEPET 92 147353 1169 0.00793333 1.173876504 -0.173876504
67 insDEPET 68 61653 481 0.007801729 1.154403789 -0.154403789
68 insDEPET 72 43306 332 0.007666374 1.134375644 -0.134375644
69 insDEPET 31 116009 868 0.007482178 1.107120578 -0.107120578
70 insDEPET 02 39818 295 0.00740871 1.096249618 -0.096249618
71 insDEPET 78 101841 754 0.007403698 1.095508047 -0.095508047
72 insDEPET 67 93946 692 0.007365934 1.089920151 -0.089920151
73 insDEPET 28 34301 252 0.007346725 1.087077834 -0.087077834
74 insDEPET 33 152528 1107 0.007257684 1.07390268 -0.07390268
75 insDEPET 84 67613 488 0.007217547 1.067963714 -0.067963714
76 insDEPET 83 126540 909 0.007183499 1.062925765 -0.062925765
77 insDEPET 66 58946 419 0.007108201 1.051784011 -0.051784011
78 insDEPET 18 27790 193 0.006944944 1.027627324 -0.027627324
79 insDEPET 69 174961 1214 0.006938689 1.026701782 -0.026701782
80 insDEPET 88 34443 238 0.006909967 1.022451853 -0.022451853
81 insDEPET 30 76395 525 0.006872177 1.0168602 -0.0168602
82 insDEPET 08 23202 157 0.006766658 1.001246731 -0.001246731
83 insDEPET 87 34338 231 0.006727241 0.995414275 0.004585725
84 insDEPET 76 86118 579 0.006723333 0.994836039 0.005163961
85 insDEPET 26 53631 358 0.006675244 0.987720376 0.012279624
86 insDEPET 34 133650 876 0.006554433 0.969844315 0.030155685
87 insDEPET 2A 17005 111 0.006527492 0.965857872 0.034142128
88 insDEPET 25 44175 286 0.00647425 0.95797981 0.04202019
89 insDEPET 38 119307 770 0.006453938 0.954974293 0.045025707
90 insDEPET 41 28978 186 0.006418662 0.949754625 0.050245375
91 insDEPET 45 49561 318 0.006416335 0.949410303 0.050589697
92 insDEPET 2B 19519 124 0.006352784 0.940006815 0.059993185
93 insDEPET 70 21399 132 0.006168513 0.912740526 0.087259474
94 insDEPET 37 49723 305 0.006133982 0.907631159 0.092368841
95 insDEPET 55 17276 105 0.006077796 0.899317376 0.100682624
96 insDEPET 27 45311 273 0.006025027 0.891509307 0.108490693
97 insDEPET 39 26947 162 0.006011801 0.889552272 0.110447728
98 insDEPET 80 42871 257 0.005994728 0.887026083 0.112973917
99 insDEPET 47 40592 242 0.005961766 0.882148698 0.117851302
100 insDEPET 82 27230 159 0.005839148 0.864005216 0.135994784
101 insDEPET 36 23734 137 0.00577231 0.854115317 0.145884683
102 insDEPET 63 65589 373 0.005686929 0.841481754 0.158518246
103 insDEPET 89 33216 188 0.005659923 0.837485697 0.162514303
104 insDEPET 52 16860 94 0.005575326 0.824968117 0.175031883
105 insDEPET 24 51134 284 0.005554034 0.821817631 0.178182369
106 insDEPET 58 22345 123 0.005504587 0.814501022 0.185498978
107 insDEPET 17 75422 415 0.005502373 0.814173445 0.185826555
108 insDEPET 71 55680 306 0.00549569 0.813184479 0.186815521
109 insDEPET 03 34938 192 0.005495449 0.813148882 0.186851118
110 insDEPET 21 53379 290 0.005432848 0.803885963 0.196114037
111 insDEPET 49 68055 368 0.005407391 0.800119144 0.199880856
112 insDEPET 11 55513 300 0.00540414 0.799638025 0.200361975
113 insDEPET 86 38412 205 0.005336874 0.789684879 0.210315121
114 insDEPET 51 65810 346 0.00525756 0.777948932 0.222051068
115 insDEPET 56 72609 378 0.005205966 0.770314771 0.229685229
116 insDEPET 07 33636 169 0.005024379 0.74344568 0.25655432
117 insDEPET 44 106703 532 0.004985802 0.73773754 0.26226246
118 insDEPET 01 51685 255 0.004933733 0.730033082 0.269966918
119 insDEPET 10 30663 149 0.004859277 0.71901592 0.28098408
120 insDEPET 14 64428 310 0.004811573 0.711957263 0.288042737
121 insDEPET 19 30160 144 0.004774536 0.706477014 0.293522986
122 insDEPET 16 39889 190 0.004763218 0.704802333 0.295197667
123 insDEPET 73 71454 339 0.004744311 0.702004723 0.297995277
124 insDEPET 81 40986 194 0.004733324 0.700378935 0.299621065
125 insDEPET 35 90680 422 0.004653727 0.688601272 0.311398728
126 insDEPET 29 86330 400 0.004633384 0.685591038 0.314408962
127 insDEPET 61 32758 149 0.004548507 0.673032089 0.326967911
128 insDEPET 74 93707 423 0.00451407 0.667936558 0.332063442
129 insDEPET 09 17626 79 0.004482015 0.663193417 0.336806583
130 insDEPET 79 37656 162 0.004302103 0.636572261 0.363427739
131 insDEPET 64 83756 359 0.00428626 0.634227986 0.365772014
132 insDEPET 23 16174 68 0.004204278 0.622097355 0.377902645
133 insDEPET 50 52775 219 0.004149692 0.614020335 0.385979665
134 insDEPET 04 22787 90 0.00394962 0.58441619 0.41558381
135 insDEPET 40 49541 192 0.003875578 0.573460278 0.426539722
136 insDEPET 43 27370 105 0.003836317 0.567650968 0.432349032
137 insDEPET 22 64491 244 0.003783474 0.559831842 0.440168158
138 insDEPET 85 64417 243 0.003772296 0.558177928 0.441822072
139 insDEPET 46 26030 95 0.003649635 0.54002805 0.45997195
140 insDEPET 53 32932 120 0.003643872 0.539175339 0.460824661
141 insDEPET 99 40894 134 0.003276764 0.484855233 0.515144767
142 insDEPET 65 34146 104 0.003045745 0.450671801 0.549328199
143 insDEPET 32 32543 96 0.002949943 0.436496261 0.563503739
144 insDEPET 15 22199 62 0.002792919 0.413261701 0.586738299
145 insDEPET 05 25212 70 0.002776456 0.410825718 0.589174282
146 insDEPET 48 12747 34 0.002667294 0.394673359 0.605326641
147 insDEPET 98 775 2 0.002580645 0.381852092 0.618147908
148 insDEPET 12 41281 104 0.002519319 0.372777775 0.627222225
149 insDEPCOMEN 75120 23391 422 0.018041127 2.669503799 -1.669503799
150 insDEPCOMEN 75110 28336 491 0.017327781 2.56395164 -1.56395164
151 insDEPCOMEN 75102 19124 292 0.015268772 2.259284889 -1.259284889
152 insDEPCOMEN 75103 14002 144 0.010284245 1.521735947 -0.521735947
153 insDEPCOMEN 75112 23538 238 0.010111309 1.496147047 -0.496147047
154 insDEPCOMEN 75119 18558 185 0.009968747 1.475052368 -0.475052368
155 insDEPCOMEN 75109 30187 288 0.009540531 1.411690247 -0.411690247
156 insDEPCOMEN 75111 32950 296 0.008983308 1.329239301 -0.329239301
157 insDEPCOMEN 75101 16952 132 0.007786692 1.15217877 -0.15217877
158 insDEPCOMEN 75118 26179 197 0.007525116 1.113473932 -0.113473932
159 insDEPCOMEN 75114 21520 154 0.007156134 1.058876561 -0.058876561
160 insDEPCOMEN 75108 66310 446 0.006725984 0.995228288 0.004771712
161 insDEPCOMEN 75117 41679 278 0.006670026 0.986948262 0.013051738
162 insDEPCOMEN 75115 36833 223 0.006054353 0.895848666 0.104151334
163 insDEPCOMEN 75113 19497 113 0.005795763 0.857585705 0.142414295
164 insDEPCOMEN 75104 10380 51 0.004913295 0.72700886 0.27299114
165 insDEPCOMEN 75105 14528 71 0.004887115 0.723135028 0.276864972
166 insDEPCOMEN 75116 48424 220 0.004543202 0.672247044 0.327752956
167 insDEPCOMEN 75106 16345 72 0.004405017 0.651800145 0.348199855
168 insDEPCOMEN 75107 18645 59 0.003164387 0.468227056 0.531772944
169 insDEPCOMEN,3 974 61141 402 0.006574966 0.972882512 0.027117488
170 insDEPCOMEN,3 972 42850 261 0.006091015 0.901273418 0.098726582
171 insDEPCOMEN,3 971 63190 307 0.004858364 0.718880828 0.281119172
172 insDEPCOMEN,3 973 13285 63 0.00474219 0.701690944 0.298309056
173 insCJ,2 54 1046180 26431 0.025264295 3.738299821 -2.738299821
174 insCJ,2 55 116455 1676 0.014391825 2.129525393 -1.129525393
175 insCJ,2 13 332350 4569 0.013747555 2.034194255 -1.034194255
176 insCJ,2 56 6079 81 0.01332456 1.971604606 -0.971604606
177 insCJ,2 57 68076 864 0.012691698 1.8779614 -0.8779614
178 insCJ,2 12 437093 5064 0.011585635 1.714299878 -0.714299878
179 insCJ,2 11 197912 2096 0.010590566 1.567061711 -0.567061711
180 insCJ,2 82 5102 51 0.00999608 1.479097048 -0.479097048
181 insCJ,2 31 11814 115 0.009734214 1.440349288 -0.440349288
182 insCJ,2 53 1525 13 0.00852459 1.261364073 -0.261364073
183 insCJ,2 52 38818 186 0.004791592 0.709000819 0.290999181
184 insCJ,2 51 517 1 0.001934236 0.286204465 0.713795535
185 insCJ,2 92 417094 658 0.001577582 0.233431198 0.766568802
186 insCJ,2 62 10141 12 0.001183315 0.175092447 0.824907553
187 insCJ,2 17 40919 39 0.000953102 0.141028389 0.858971611
188 insCJ,2 16 558658 471 0.000843092 0.124750367 0.875249633
189 insCJ,2 65 1134849 828 0.000729612 0.107959088 0.892040912
190 insCJ,2 32 26976 19 0.00070433 0.104218063 0.895781937
191 insCJ,2 29 24080 14 0.000581395 0.086027738 0.913972262
192 insCJ,2 84 8634 5 0.000579106 0.085688967 0.914311033
193 insCJ,2 63 20101 6 0.000298493 0.044167268 0.955832732
194 insCJ,2 19 511880 129 0.000252012 0.037289666 0.962710334
195 insCJ,2 15 577704 133 0.000230222 0.034065378 0.965934622
196 insCJ,2 18 497265 107 0.000215177 0.03183925 0.96816075
197 insCJ,2 22 29402 3 0.000102034 0.015097719 0.984902281
198 insCJ,2 21 24477 1 4.08547E-05 0.006045173 0.993954827
199 insCJ,2 10 1 0 0 0 1
200 insCJ,2 14 6117 0 0 0 1
201 insCJ,2 23 7434 0 0 0 1
202 insCJ,2 27 527 0 0 0 1
203 insCJ,2 41 874 0 0 0 1
204 insCJ,2 61 17 0 0 0 1
205 insCJ,2 64 178 0 0 0 1
206 insCJ,2 69 2 0 0 0 1
207 insCJ,2 71 2984 0 0 0 1
208 insCJ,2 72 36821 0 0 0 1
209 insCJ,2 73 91862 0 0 0 1
210 insCJ,2 74 2566 0 0 0 1
211 insCJ,2 81 1202 0 0 0 1
212 insCJ,2 83 4849 0 0 0 1
213 insCJ,2 91 145682 0 0 0 1
214 insCJ,2 93 461 0 0 0 1
215 insCJ,2 99 1571 0 0 0 1
216 ageDirigeant 0 4092989 11244 0.002747137 0.406487512 0.593512488
217 ageDirigeant 1 7915 339 0.042830069 6.337467242 -5.337467242
218 ageDirigeant 2 7915 339 0.042830069 6.337467242 -5.337467242
219 ageDirigeant 3 7915 339 0.042830069 6.337467242 -5.337467242
220 ageDirigeant 4 7915 339 0.042830069 6.337467242 -5.337467242
221 ageDirigeant 5 7915 339 0.042830069 6.337467242 -5.337467242
222 ageDirigeant 6 7915 339 0.042830069 6.337467242 -5.337467242
223 ageDirigeant 7 7915 339 0.042830069 6.337467242 -5.337467242
224 ageDirigeant 8 7915 339 0.042830069 6.337467242 -5.337467242
225 ageDirigeant 9 7915 339 0.042830069 6.337467242 -5.337467242
226 ageDirigeant 10 7915 339 0.042830069 6.337467242 -5.337467242
227 ageDirigeant 11 7915 339 0.042830069 6.337467242 -5.337467242
228 ageDirigeant 12 7915 339 0.042830069 6.337467242 -5.337467242
229 ageDirigeant 13 7915 339 0.042830069 6.337467242 -5.337467242
230 ageDirigeant 14 7915 339 0.042830069 6.337467242 -5.337467242
231 ageDirigeant 15 7915 339 0.042830069 6.337467242 -5.337467242
232 ageDirigeant 16 7915 339 0.042830069 6.337467242 -5.337467242
233 ageDirigeant 17 7915 339 0.042830069 6.337467242 -5.337467242
234 ageDirigeant 18 7915 339 0.042830069 6.337467242 -5.337467242
235 ageDirigeant 19 7915 339 0.042830069 6.337467242 -5.337467242
236 ageDirigeant 20 7915 339 0.042830069 6.337467242 -5.337467242
237 ageDirigeant 21 7915 339 0.042830069 6.337467242 -5.337467242
238 ageDirigeant 22 7915 339 0.042830069 6.337467242 -5.337467242
239 ageDirigeant 23 7915 339 0.042830069 6.337467242 -5.337467242
240 ageDirigeant 24 7915 339 0.042830069 6.337467242 -5.337467242
241 ageDirigeant 25 7915 339 0.042830069 6.337467242 -5.337467242
242 ageDirigeant 26 51311 1744 0.033988813 5.029246825 -4.029246825
243 ageDirigeant 27 51311 1744 0.033988813 5.029246825 -4.029246825
244 ageDirigeant 28 51311 1744 0.033988813 5.029246825 -4.029246825
245 ageDirigeant 29 51311 1744 0.033988813 5.029246825 -4.029246825
246 ageDirigeant 30 132700 3421 0.025779955 3.814600838 -2.814600838
247 ageDirigeant 31 132700 3421 0.025779955 3.814600838 -2.814600838
248 ageDirigeant 32 132700 3421 0.025779955 3.814600838 -2.814600838
249 ageDirigeant 33 132700 3421 0.025779955 3.814600838 -2.814600838
250 ageDirigeant 34 132700 3421 0.025779955 3.814600838 -2.814600838
251 ageDirigeant 35 246272 4538 0.01842678 2.726568435 -1.726568435
252 ageDirigeant 36 246272 4538 0.01842678 2.726568435 -1.726568435
253 ageDirigeant 37 246272 4538 0.01842678 2.726568435 -1.726568435
254 ageDirigeant 38 246272 4538 0.01842678 2.726568435 -1.726568435
255 ageDirigeant 39 246272 4538 0.01842678 2.726568435 -1.726568435
256 ageDirigeant 40 339245 5421 0.015979602 2.364465057 -1.364465057
257 ageDirigeant 41 339245 5421 0.015979602 2.364465057 -1.364465057
258 ageDirigeant 42 339245 5421 0.015979602 2.364465057 -1.364465057
259 ageDirigeant 43 339245 5421 0.015979602 2.364465057 -1.364465057
260 ageDirigeant 44 339245 5421 0.015979602 2.364465057 -1.364465057
261 ageDirigeant 45 367968 5217 0.014177863 2.097865945 -1.097865945
262 ageDirigeant 46 367968 5217 0.014177863 2.097865945 -1.097865945
263 ageDirigeant 47 367968 5217 0.014177863 2.097865945 -1.097865945
264 ageDirigeant 48 367968 5217 0.014177863 2.097865945 -1.097865945
265 ageDirigeant 49 367968 5217 0.014177863 2.097865945 -1.097865945
266 ageDirigeant 50 375026 4591 0.012241818 1.811393744 -0.811393744
267 ageDirigeant 51 375026 4591 0.012241818 1.811393744 -0.811393744
268 ageDirigeant 52 375026 4591 0.012241818 1.811393744 -0.811393744
269 ageDirigeant 53 375026 4591 0.012241818 1.811393744 -0.811393744
270 ageDirigeant 54 375026 4591 0.012241818 1.811393744 -0.811393744
271 ageDirigeant 55 377653 3778 0.010003892 1.480253045 -0.480253045
272 ageDirigeant 56 377653 3778 0.010003892 1.480253045 -0.480253045
273 ageDirigeant 57 377653 3778 0.010003892 1.480253045 -0.480253045
274 ageDirigeant 58 377653 3778 0.010003892 1.480253045 -0.480253045
275 ageDirigeant 59 377653 3778 0.010003892 1.480253045 -0.480253045
276 ageDirigeant 60 232451 2003 0.00861687 1.275018479 -0.275018479
277 ageDirigeant 61 232451 2003 0.00861687 1.275018479 -0.275018479
278 ageDirigeant 62 232451 2003 0.00861687 1.275018479 -0.275018479
279 ageDirigeant 63 232451 2003 0.00861687 1.275018479 -0.275018479
280 ageDirigeant 64 232451 2003 0.00861687 1.275018479 -0.275018479
281 ageDirigeant 65 100941 680 0.006736609 0.996800526 0.003199474
282 ageDirigeant 66 100941 680 0.006736609 0.996800526 0.003199474
283 ageDirigeant 67 100941 680 0.006736609 0.996800526 0.003199474
284 ageDirigeant 68 100941 680 0.006736609 0.996800526 0.003199474
285 ageDirigeant 69 100941 680 0.006736609 0.996800526 0.003199474
286 ageDirigeant 70 55612 320 0.005754154 0.85142895 0.14857105
287 ageDirigeant 71 55612 320 0.005754154 0.85142895 0.14857105
288 ageDirigeant 72 55612 320 0.005754154 0.85142895 0.14857105
289 ageDirigeant 73 55612 320 0.005754154 0.85142895 0.14857105
290 ageDirigeant 74 55612 320 0.005754154 0.85142895 0.14857105
291 ageDirigeant 75 33744 164 0.004860123 0.719141306 0.280858694
292 ageDirigeant 76 33744 164 0.004860123 0.719141306 0.280858694
293 ageDirigeant 77 33744 164 0.004860123 0.719141306 0.280858694
294 ageDirigeant 78 33744 164 0.004860123 0.719141306 0.280858694
295 ageDirigeant 79 33744 164 0.004860123 0.719141306 0.280858694
296 ageDirigeant 80 19900 73 0.003668342 0.542796117 0.457203883
297 ageDirigeant 81 19900 73 0.003668342 0.542796117 0.457203883
298 ageDirigeant 82 19900 73 0.003668342 0.542796117 0.457203883
299 ageDirigeant 83 19900 73 0.003668342 0.542796117 0.457203883
300 ageDirigeant 84 19900 73 0.003668342 0.542796117 0.457203883
301 ageDirigeant * 13522 39 0.002884189 0.426766798 0.573233202
302 ageEntreprise 0 398545 3931 0,009863378 1,45812286 -0.45812286
303 ageEntreprise 1 363230 5849 0.016102745 2.380500904 -1.380500904
304 ageEntreprise 2 336945 5474 0.016245975 2.401674887 -1.401674887
305 ageEntreprise 3 320242 4323 0.013499166 1.995608689 -0.995608689
306 ageEntreprise 4 311256 3186 0.010235947 1.513200512 -0.513200512
307 ageEntreprise 5 286481 2597 0.009065174 1.340122706 -0.340122706
308 ageEntreprise 6 271422 2131 0.007851243 1.16066488 -0.16066488
309 ageEntreprise 7 249689 1696 0.00679245 1.004141411 -0.004141411
310 ageEntreprise 8 299828 1471 0.004906146 0.725285383 0.274714617
311 ageEntreprise 9 251098 1368 0.005448072 0.805399367 0.194600633
312 ageEntreprise 10 224326 1088 0.004850084 0.716997635 0.283002365
313 ageEntreprise 11 225543 1016 0.004504684 0.665936463 0.334063537
314 ageEntreprise 12 219141 911 0.004157141 0.614558427 0.385441573
315 ageEntreprise 13 227433 890 0.00391324 0.578502136 0.421497864
316 ageEntreprise 14 228796 849 0.003710729 0.548564505 0.451435495
317 ageEntreprise 15 203213 738 0.003631657 0.536875165 0.463124835
318 ageEntreprise 16 195413 723 0.003699856 0.546957126 0.453042874
319 ageEntreprise 17 156467 621 0.003968888 0.586728635 0.413271365
320 ageEntreprise 18 136150 578 0.004245318 0.627593783 0.372406217
321 ageEntreprise 19 120966 421 0.003480317 0.514502176 0.485497824
322 ageEntreprise 20 110350 344 0.003117354 0.460844645 0.539155355
323 ageEntreprise 21 108829 314 0.00288526 0.426533798 0.573466202
324 ageEntreprise 22 92057 306 0.003324028 0.49139762 0.50860238
325 ageEntreprise 23 94394 225 0.002383626 0.3523762 0.6476238
326 ageEntreprise 24 61811 133 0.002151721 0.318093146 0.681906854
327 ageEntreprise 25 86450 215 0.002486987 0.367656207 0.632343793
328 ageEntreprise 26 79203 222 0.002802924 0.414361868 0.585638132
329 ageEntreprise 27 41020 131 0.003193564 0.472110957 0.527889043
330 ageEntreprise 28 37137 119 0.003204351 0.473705671 0.526294329
331 ageEntreprise 29 30627 110 0.003591602 0.530953718 0.469046282
332 ageEntreprise 30 27785 106 0.003815008 0.563980261 0.436019739
333 ageEntreprise 31 27100 87 0.003210332 0.474589802 0.525410198
334 ageEntreprise 32 26851 86 0.00320286 0.47348522 0.52651478
335 ageEntreprise 33 21279 48 0.002255745 0.3334713 0.6665287
336 ageEntreprise 34 17287 42 0.002429571 0.359168382 0.640831618
337 ageEntreprise 35 20082 45 0.002240813 0.331263809 0.668736191
338 ageEntreprise 36 24005 33 0.001374714 0.203226655 0.796773345
339 ageEntreprise 37 10981 36 0.00327839 0.484650929 0.515349071
340 ageEntreprise 38 14152 43 0.00303844 0.449178619 0.550821381
341 ageEntreprise 39 17017 67 0.003937239 0.582049933 0.417950067
342 ageEntreprise 40 31055 102 0.003284495 0.485553488 0.514446512
343 ageEntreprise 41 15175 43 0.002833608 0.418897912 0.581102088
344 ageEntreprise 42 6992 15 0.002145309 0.3171453 0.6828547
345 ageEntreprise 43 6310 14 0.0022187 0.327994919 0.672005081
346 ageEntreprise 44 7244 15 0.002070679 0.306112636 0.693887364
347 ageEntreprise 45 5863 13 0.002217295 0.32778713 0.67221287
348 ageEntreprise 46 7647 52 0.006800052 1.005265304 -0.005265304
349 ageEntreprise 47 9466 55 0.005810268 0.858943563 0.141056437
350 ageEntreprise 48 6119 35 0.005719889 0.845582587 0.154417413
351 ageEntreprise 49 6031 41 0.006798209 1.004992841 -0.004992841
352 ageEntreprise 50 4954 22 0.004440856 0.656500587 0.343499413
353 ageEntreprise 51 12623 11 0.000871425 0.128824523 0.871175477
354 ageEntreprise * 353169 621 0.001758365 0.259942604 0.740057396
355 insTEFEN 11 122483 2586 0.021113134 3.12406207 -2.12406207
356 insTEFEN 2 348140 6830 0.019618544 2.902911041 -1.902911041
357 insTEFEN 3 178988 3509 0.019604666 2.900857541 -1.900857541
358 insTEFEN 12 77324 1239 0.016023486 2.370958447 -1.370958447
359 insTEFEN 1 946071 14717 0.015555915 2.301773089 -1.301773089
360 insTEFEN 21 22652 290 0.012802402 1.894342023 -0.894342023
361 insTEFEN 22 11018 103 0.009348339 1.383252313 -0.383252313
362 insTEFEN 31 2325 13 0.005591398 0.827346328 0.172653672
363 insTEFEN 0 4729670 14264 0.003015855 0.446249188 0.553750812
364 insTEFEN 32 4541 13 0.002862806 0.423602777 0.576397223
365 insTEFEN 41 2251 6 0.002665482 0.394405265 0.605594735
366 insTEFEN 51 492 1 0.00203252 0.300747375 0.699252625
367 insTEFEN 42 1121 1 0.000892061 0.131996172 0.868003828
368 insTEFEN 52 172 0 0 0 1
369 insTEFEN 53 1 0 0 0 1
370 insNBTOA 13 445 8 0.017977528 2.660093638 -1.660093638
371 insNBTOA 2 199031 2816 0.01414855 2.093528483 -1.093528483
372 insNBTOA 3 38973 413 0.01059708 1.56802565 -0.56802565
373 insNBTOA 1 3755472 38870 0.01035023 1.531499858 -0.531499858
374 insNBTOA 8 1595 15 0.009404389 1.391545849 -0.391545849
375 insNBTOA 11 743 6 0.00807537 1.194894013 -0.194894013
376 insNBTOA 4 14851 119 0.008012928 1.185654658 -0.185654658
377 insNBTOA 7 2443 19 0.007777323 1.150792658 -0.150792658
378 insNBTOA 20-25 949 7 0.007376185 1.091437261 -0.091437261
379 insNBTOA 10 869 6 0.006904488 1.021641256 -0.021641256
380 insNBTOA 5 7090 46 0.006488011 0.960016163 0.039983837
381 insNBTOA 6 3905 24 0.006145967 0.909404611 0.090595389
382 insNBTOA 9 1144 6 0.005244755 0.776054416 0.223945584
383 insNBTOA 14 412 2 0.004854369 0.718289848 0.281710152
384 insNBTOA 75-99 225 1 0.004444444 0.657634261 0.342365739
385 insNBTOA 35-49 639 2 0.00312989 0.463122719 0.536877281
386 insNBTOA 50-74 424 1 0.002358491 0.348980445 0.651019555
387 insNBTOA 15-19 1445 3 0.002076125 0.307199395 0.692800605
388 insNBTOA 12 626 1 0.001597444 0.236370142 0.763629858
389 insNBTOA 26-34 793 1 0.001261034 0.186592319 0.813407681
390 insNBTOA 0 2414681 1206 0.000499445 0.073901711 0.926098289
391 insNBTOA 100- 494 0 0 0 1
392 insTCA 2 21622 409 0.018915919 2.798369096 -1.798369096
393 insTCA 3 28973 507 0.017499051 2.588761516 -1.588761516
394 insTCA 1 20023 348 0.017380013 2.571151383 -1.571151383
395 insTCA 4 15955 207 0.012973989 1.919336348 -0.919336348
396 insTCA 5 10403 89 0.008555224 1.265636407 -0.265636407
397 insTCA 6 7600 51 0.006710526 0.992736831 0.007263169
398 insTCA 0 6337365 41952 0.006619786 0.979312956 0.020687044
399 insTCA 7 2667 7 0.002624672 0.388286754 0.611713246
400 insTCA 9 1314 2 0.00152207 0.225170857 0.774829143
401 insTCA 8 1327 0 0 0 1
402 insTCAEXPOR 3 5258 109 0.020730316 3.066785966 -2.066785966
403 insTCAEXPOR 2 12013 215 0.017897278 2.647674141 -1.647674141
404 insTCAEXPOR 1 10029 173 0.017249975 2.551913931 -1.551913931
405 insTCAEXPOR 4 5589 88 0.015745214 2.329303684 -1.329303684
406 insTCAEXPOR 0 6414360 42987 0.006701682 0.991428405 0.008571595
407 insSEXE M 2233981 9893 0.004428417 0.655262754 0.344737246
408 insSEXE F 923849 2714 0.002937710 0.434686146 0.565313854
409 insSEXE * 3289419 30965 0.009413516 1.392896465 -0.392896465
410 insRECME 0 6445782 43572 0.006759769 1.000227591 -0.000227591
411 insRECME 1 1467 0 0.000000000 0 1
412 insMONOREG 1 78856 935 0.011857056 1.754461392 -0.754461392
413 insMONOREG 2 6170828 41393 0.006707852 0.992545468 0.007454532
414 insMONOREG 0 197565 1244 0.006296662 0.931702627 0.068297373
415 insRPET 11 1205539 10949 0.009082245 1.343874119 -0.343874119
416 insRPET 31 252996 2234 0.008830179 1.306576712 -0.306576712
417 insRPET 41 170366 1448 0.008499348 1.25762463 -0.25762463
418 insRPET 93 599741 4858 0.008100163 1.198558318 -0.198558318
419 insRPET 42 155599 1173 0.007538609 1.1154667 -0.1154667
420 insRPET 22 135577 972 0.007169358 1.060829637 -0.060829637
421 insRPET 4 60943 402 0.006596328 0.976040016 0.023959984
422 insRPET 24 214087 1391 0.006497359 0.961395827 0.038604173
423 insRPET 23 131429 852 0.006482588 0.959210205 0.040789795
424 insRPET 43 102313 659 0.006441019 0.953059456 0.046940544
425 insRPET 94 36450 234 0.006419753 0.949912765 0.050087235
426 insRPET 91 337251 2154 0.006386934 0.945056671 0.054943329
427 insRPET 82 667354 4078 0.0061107 0.904183032 0.095816968
428 insRPET 2 42948 261 0.006077117 0.899213798 0.100786202
429 insRPET 72 377551 2184 0.005784649 0.855938198 0.144061802
430 insRPET 26 164649 907 0.005508688 0.81510506 0.18489494
431 insRPET 74 80672 443 0.005491372 0.812542903 0.187457097
432 insRPET 21 136535 746 0.0054638 0.808463155 0.191536845
433 insRPET 54 191379 972 0.005078927 0.751514532 0.248485468
434 insRPET 73 335852 1699 0.005058776 0.748532806 0.251467194
435 insRPET 52 315413 1595 0.005056862 0.748249607 0.251750393
436 insRPET 83 150096 732 0.004876879 0.721618007 0.278381993
437 insRPET 1 63134 307 0.004862673 0.719516021 0.280483979
438 insRPET 3 13275 63 0.004745763 0.702217129 0.297782871
439 insRPET 53 314133 1445 0.004599962 0.680643473 0.319356527
440 insRPET 25 149961 678 0.004521176 0.668985593 0.331014407
441 insRPET 99 41208 134 0.003251796 0.481159052 0.518840948
442 insRPET 98 775 2 0.002580645 0.381850789 0.618149211
443 insSINGT 43 23550 425 0.018046709 2.670330198 -1.670330198
444 insSINGT 2 76142 1237 0.016245961 2.403877696 -1.403877696
445 insSINGT 1 3885595 40481 0.010418224 1.541560768 -0.541560768
446 insSINGT 40 13737 119 0.008662736 1.281805149 -0.281805149
447 insSINGT 31 35843 96 0.002678347 0.396308903 0.603691097
448 insSINGT 33 3315 8 0.002413273 0.357086476 0.642913524
449 insSINGT 52 6565 10 0.001523229 0.225388741 0.774611259
450 insSINGT 10 96382 127 0.001317673 0.194973117 0.805026883
451 insSINGT 60 216663 228 0.001052326 0.155710193 0.844289807
452 insSINGT 90 577496 260 0.00045022 0.066617958 0.933382042
453 insSINGT 70 1298907 576 0.00044345 0.065616245 0.934383755
454 insSINGT 34 24032 1 4.16112E-05 0.006157112 0.993842888
455 insSINGT 80 149852 4 2.6693E-05 0.003949703 0.996050297
456 insSINGT 0 1 0 0 1
457 insSINGT 30 5741 0 0 0 1
458 insSINGT 42 33428 0 0 0 1
459 insORDIN 1 3412206 41477 0.012155479 1.798618445 -0.798618445
460 insORDIN 0 3035043 2095 0.00069027 0.102137713 0.897862287
461 insMODET 3 2787 130 0.046645138 6.901974209 -5.901974209
462 insMODET 1 991 19 0.019172553 2.836918732 -1.836918732
463 insMODET 2 3347 45 0.013444876 1.989407496 -0.989407496
464 insMODET 0 6440124 43378 0.006735585 0.996649019 0.003350981
465 insAUXILT 1 26364 474 0.017979062 2.66032066 -1.66032066
466 insAUXILT 0 6420872 43098 0.006712172 0.993184774 0.006815226
467 insAUXILT * 13 0 0 0 1
468 insTCD 73 83653 867 0.010364243 1.533573253 -0.533573253
469 insTCD 44 207816 2036 0.009797128 1.449658615 -0.449658615
470 insTCD 52 189137 1814 0.009590931 1.419148149 -0.419148149
471 insTCD 43 241634 2262 0.009361265 1.385164989 -0.385164989
472 insTCD 62 114691 1056 0.009207348 1.362390251 -0.362390251
473 insTCD 41 193192 1687 0.008732246 1.292090379 -0.292090379
474 insTCD 51 286358 2499 0.008726838 1.291290286 -0.291290286
475 insTCD 72 161502 1371 0.008489059 1.256106603 -0.256106603
476 insTCD 80 520175 4329 0.008322199 1.231416755 -0.231416755
477 insTCD 42 173427 1427 0.008228246 1.21751469 -0.21751469
478 insTCD 61 258193 2063 0.007990147 1.182283729 -0.182283729
479 insTCD 31 307323 2413 0.007851674 1.161794206 -0.161794206
480 insTCD 32 256048 1919 0.007494688 1.108971884 -0.108971884
481 insTCD 71 137763 984 0.007142702 1.056889189 -0.056889189
482 insTCD 22 291665 2073 0.007107469 1.051675929 -0.051675929
483 insTCD 21 317427 2113 0.006656649 0.984969043 0.015030957
484 insTCD 18 197044 1301 0.006602586 0.976969555 0.023030445
485 insTCD 17 257376 1549 0.006018432 0.890533619 0.109466381
486 insTCD 15 199766 1128 0.005646607 0.83551543 0.16448457
487 insTCD 16 172805 968 0.00560169 0.828869199 0.171130801
488 insTCD 14 249738 1244 0.00498122 0.737059757 0.262940243
489 insTCD 0 120431 578 0.004799429 0.71016047 0.28983953
490 insTCD 13 342501 1623 0.004738672 0.701170482 0.298829518
491 insTCD 12 272656 1158 0.00424711 0.628435122 0.371564878
492 insTCD 11 245321 1022 0.00416597 0.616429079 0.383570921
493 insTCD 8 125432 481 0.003834747 0.567418744 0.432581256
494 insTCD 7 149718 535 0.003573385 0.528745536 0.471254464
495 insTCD 6 81869 265 0.003236878 0.478953484 0.521046516
496 insTCD 4 81356 256 0.003146664 0.465604668 0.534395332
497 insTCD 5 84330 243 0.002881537 0.426374401 0.573625599
498 insTCD 3 74476 200 0.002685429 0.397356756 0.602643244
499 insTCD 2 43091 94 0.00218143 0.322781198 0.677218802
500 insTCD 1 9335 14 0.001499732 0.221911936 0.778088064
501 insNATURE 91 238972 6564 0.027467653 4.064325692 -3.064325692
502 insNATURE 20 144873 3353 0.023144409 3.424625203 -2.424625203
503 insNATURE 22 10828 119 0.010990026 1.626168944 -0.626168944
504 insNATURE 93 160570 1367 0.008513421 1.259711389 -0.259711389
505 insNATURE 21 185819 1501 0.008077753 1.195246614 -0.195246614
506 insNATURE 92 83924 635 0.00756637 1.119578368 -0.119578368
507 insNATURE 99 5621113 30028 0.005342003 0.790443877 0.209556123
508 insNATURE 23 1135 5 0.004405286 0.651840126 0.348159874
509 insNATURE * 15 0 0 0 1
510 insORIGINE 3 296615 3962 0.013357382 1.976461277 -0.976461277
511 insORIGINE 7 112298 1480 0.01317922 1.950098922 -0.950098922
512 insORIGINE 2 907819 9870 0.010872211 1.608736195 -0.608736195
513 insORIGINE 5 54475 462 0.008480955 1.254907414 -0.254907414
514 insORIGINE 6 1914 11 0.005747126 0.85038913 0.14961087
515 insORIGINE 1 4776418 27127 0.005679361 0.840361968 0.159638032
516 insORIGINE 8 90133 230 0.002551785 0.377581718 0.622418282
517 insORIGINE 0 173492 370 0.002132663 0.315565284 0.684434716
518 insORIGINE 4 34085 60 0.001760305 0.260468315 0.739531685
519 insTU 8 1084479 9960 0.009184134 1.358955201 -0.358955201
520 insTU 7 1259040 10827 0.008599409 1.272434856 -0.272434856
521 insTU 5 399066 3189 0.007991159 1.182433539 -0.182433539
522 insTU 6 378843 2890 0.00762849 1.128770171 -0.128770171
523 insTU 4 410877 2959 0.007201669 1.065614405 -0.065614405
524 insTU 3 331773 2090 0.006299488 0.93212079 0.06787921
525 insTU 2 343704 2076 0.006040081 0.893736945 0.106263055
526 insTU 1 375638 2186 0.005819433 0.861088098 0.138911902
527 insTU 0 1863829 7395 0.003967639 0.587082401 0.412917599

View File

@ -0,0 +1,194 @@
<?php
/**
* CLASS soundex2
* soundex2 French version
* based on the algorithm described here : http://sqlpro.developpez.com/cours/soundex/ by Frédéric BROUARD
*
* author Johan Barbier <barbier_johan@hotmail.com>
*/
class soundex2 {
/**
* public sString
* main string we work on
*/
var $sString = '';
/**
* vowels replacement array
*/
var $aReplaceVoy1 = array (
'E' => 'A',
'I' => 'A',
'O' => 'A',
'U' => 'A'
);
/**
* consonnants replacement array
*/
var $aReplaceGrp1 = array (
'GUI' => 'KI',
'GUE' => 'KE',
'GA' => 'KA',
'GO' => 'KO',
'GU' => 'K',
'CA' => 'KA',
'CO' => 'KO',
'CU' => 'KU',
'Q' => 'K',
'CC' => 'K',
'CK' => 'K'
);
/**
* other replacement array
*/
var $aReplaceGrp2 = array (
'ASA' => 'AZA',
'KN' => 'NN',
'PF' => 'FF',
'PH' => 'FF',
'SCH' => 'SSS'
);
/**
* endings replacement array
*/
var $aEnd = array (
'A',
'T',
'D',
'S'
);
/**
* public function build
* core function of the class, go through the whole process
* @Param string sString : the string we want to check
*/
function build ($sString) {
/**
* let's check it's a real string...
*/
if (is_string ($sString) && !empty ($sString)) {
$this -> sString = $sString;
} else {
$this -> sString = '';
//trigger_error ('Parameter string must not be empty', E_USER_ERROR);
}
/**
* remove starting and ending spaces
*/
$this -> sString = trim ($this -> sString);
/**
* remove special french characters
*/
$this -> trimAccent ();
/**
* string to upper case
*/
$this -> sString = strtoupper ($this -> sString );
/**
* let's remove every space in the string
*/
$this -> sString = str_replace (' ', '', $this -> sString);
/**
* let's remove every '-' in the string
*/
$this -> sString = str_replace ('-', '', $this -> sString);
/**
* let's process through the first replacement array
*/
$this -> arrReplace ($this -> aReplaceGrp1);
/**
* let's process through th vowels replacement
*/
$sChar = substr ($this -> sString, 0, 1);
$this -> sString = substr ($this -> sString, 1, strlen ($this -> sString) - 1);
$this -> arrReplace ($this -> aReplaceVoy1);
$this -> sString = $sChar.$this -> sString;
/**
* let's process through the second replacement array
*/
$this -> arrReplace ($this -> aReplaceGrp2, true);
/**
* let's remove every 'H' but those prededed by a 'C' or an 'S'
*/
$this -> sString = preg_replace ('/(?<![CS])H/', '', $this -> sString);
/**
* let's remove every 'Y' but those preceded by an 'A'
*/
$this -> sString = preg_replace ('/(?<!A)Y/', '', $this -> sString);
/**
* remove endings in aEnd
*/
$length = strlen ($this -> sString) - 1;
if (in_array ($this -> sString{$length}, $this -> aEnd)) {
$this -> sString = substr ($this -> sString, 0, $length);
}
/**
* let's remove every 'A', but the one at the beginning of the string, if any.
*/
$sChar = '';
if ($this -> sString{0} === 'A') {
$sChar = 'A';
}
$this -> sString = str_replace ('A', '', $this -> sString);
$this -> sString = $sChar.$this -> sString;
/**
* let's have only 1 occurence of each letter
*/
$this -> sString = preg_replace( '/(.)\1/', '$1', $this -> sString );
/**
* let's have the final code : a 4 letters string
*/
$this -> getFinal ();
}
/**
* private function getFinal
* gets the first 4 letters, pads the string with white space if the string length < 4
*/
function getFinal () {
if (strlen ($this -> sString) < 4) {
$this -> sString = str_pad ($this -> sString, 4, ' ', STR_PAD_RIGHT);
} else {
$this -> sString = substr ($this -> sString, 0, 4);
}
}
/**
* private function trimAccent
* remove every special French letters
*/
function trimAccent () {
$this -> sString = htmlentities(strtolower($this -> sString ));
$this -> sString = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $this -> sString );
$this -> sString = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($this -> sString ));
$this -> sString = trim($this -> sString , "-");
}
/**
* private function arrReplace
* replacement method, given an array
* @Param array tab : the replacement array to be used
* @Param bool pref : if false, just replace keys by values; if true, do the same but only with prefix
*/
function arrReplace ($tab, $pref = false) {
$fromRep = array_keys ($tab);
$toRep = array_values ($tab);
if (false === $pref) {
$this -> sString = str_replace ($fromRep, $toRep, $this -> sString);
} else {
foreach ($fromRep as $clef => $val) {
$length = strlen ($val);
if (substr ($this -> sString, 0, $length) === $val) {
$this -> sString = substr_replace ($this -> sString, $toRep[$clef], 0, $length);
}
}
}
}
}
?>

View File

@ -0,0 +1,374 @@
<?
define ('BEFORE', 0);
define ('AFTER', 1);
define ('BOTH', 2);
function trimAccent ($strWithAccent) {
$strWithAccent = htmlentities(strtolower($strWithAccent ));
$strWithAccent = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $strWithAccent );
$strWithAccent = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($strWithAccent ));
$strWithAccent = trim($strWithAccent , "-");
return $strWithAccent;
}
//function SRSaufVoyelle ($strIn, $mot1, $mot2) {
function str_replace_except_voy($mot1, $mot2, $strIn, $rule=0) {
$Voyelle=array('a','e','i','o','u','y', '1', '2', '3', '4');
if ($mot1==$mot2) return $strIn;
if (strpos($mot2,$mot1)===false)
{
//foreach ($Voyelle as $k => $voy)
$posMot1=strpos($strIn, $mot1);
while ($posMot1!==false) {
$lettreAV=$strIn[$posMot1-1];
$lettreAP=$strIn[$posMot1+strlen($mot1)];
//echo "Lettre AV=$lettreAV<br/>";
//echo "Lettre AP=$lettreAP<br/>";
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
( $rule==1 && !in_array($lettreAP, $Voyelle) ) ||
( $rule==2 && !in_array($lettreAV, $Voyelle) && !in_array($lettreAP, $Voyelle) ))
$strIn=substr($strIn,0,$posMot1) . $mot2 . substr($strIn,$posMot1+strlen($mot1),strlen($strIn));
//echo "Le Mot devient : $strIn<br/>";
$posMot1=strpos($strIn, $mot1, $posMot1+strlen($mot1));
}
return $strIn;
}
//echo "Erreur : $mot2 contient $mot1 !<br>";
return $strIn;
}
/** Retourne le phonex d'un mot
**/
function phonex($strIn) {
if ($strIn=='') return 0.0;
$tabSonAIA=array('aina', 'eina', 'aima', 'eima');
$tabSonAIE=array('ainr', 'eine', 'aime', 'eime');
$tabSonAII=array('aini', 'eini', 'aimi', 'eimi');
$tabSonAIO=array('aino', 'eino', 'aimo', 'eimo');
$tabSonAIU=array('ainu', 'einu', 'aimu', 'eimu');
$tabCarPhon=array('1', '2', '3', '4', '5', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z');
/** On traite tout en minuscule **/
$strIn=strtolower($strIn);
/** On remplace les 'Y' par des 'I' **/
$strIn=str_replace('y', 'i', $strIn);
/** On supprime les accents **/
$strIn=trimAccent($strIn);
/** On retire les 'H' muets sauf ceux précédés par 'C' ou 'S' **/
$strIn = preg_replace ('/(?<![CS])H/', '', $strIn);
/** On remplace les 'PH' par des 'F' **/
$strIn=str_replace('ph', 'f', $strIn);
/** On remplace les 'G' par des 'K' devant AN AM AIN AIM **/
$strIn=str_replace('gan', 'kan', $strIn);
$strIn=str_replace('gain', 'kain', $strIn);
$strIn=str_replace('gam', 'kam4', $strIn);
$strIn=str_replace('gaim', 'kaim', $strIn);
/** On remplace le son AI **/
for ($i=0; $i>4; $i++) {
$strIn=str_replace($tabSonAIA[$i], 'yna', $strIn);
$strIn=str_replace($tabSonAIE[$i], 'yne', $strIn);
$strIn=str_replace($tabSonAII[$i], 'yni', $strIn);
$strIn=str_replace($tabSonAIO[$i], 'yno', $strIn);
$strIn=str_replace($tabSonAIU[$i], 'ynu', $strIn);
}
/** Remplacement des groupes de 3 lettres **/
$strIn=str_replace('eau', 'o', $strIn);
$strIn=str_replace('oua', '2', $strIn);
$strIn=str_replace('ein', '4', $strIn);
$strIn=str_replace('ain', '4', $strIn);
/** Remplacement du son 'é' **/
$strIn=str_replace('ai', 'y', $strIn);
$strIn=str_replace('ei', 'y', $strIn);
$strIn=str_replace('er', 'yr', $strIn);
$strIn=str_replace('ess', 'yss', $strIn);
$strIn=str_replace('et', 'yt', $strIn);
$strIn=str_replace('ez', 'yz', $strIn);
/** Remplacement des groupes de 2 lettres sauf si voyelle ou son (1 à 4) AVANT **/
$strIn=str_replace_except_voy('an', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('am', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('en', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('em', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('in', '4', $strIn, BEFORE);
/** Remplacement du son 'SCH' **/
$strIn=str_replace('sch', '5', $strIn);
/** Remplacement du 'S' sauf si voyelle ou son (1 à 4) avant ou après **/
$strIn=str_replace_except_voy('in', '4', $strIn, BOTH);
/** Remplacement de groupe de 2 lettres diverses **/
$strIn=str_replace('oe', 'e', $strIn);
$strIn=str_replace('eu', 'e', $strIn);
$strIn=str_replace('au', 'o', $strIn);
$strIn=str_replace('oi', '2', $strIn);
$strIn=str_replace('oy', '2', $strIn);
$strIn=str_replace('ou', '3', $strIn);
$strIn=str_replace('ch', '5', $strIn);
$strIn=str_replace('sh', '5', $strIn);
$strIn=str_replace('ss', 's', $strIn);
$strIn=str_replace('sc', 's', $strIn);
/** Remplacement du 'C' par 'S' s'il est suivi d'un 'E' ou d'un 'I' **/
$strIn=str_replace('ce', 'se', $strIn);
$strIn=str_replace('ci', 'si', $strIn);
/** Remplacement divers **/
$strIn=str_replace('c', 'k', $strIn);
$strIn=str_replace('q', 'k', $strIn);
$strIn=str_replace('qu', 'k', $strIn);
$strIn=str_replace('ga', 'ka', $strIn);
$strIn=str_replace('go', 'ko', $strIn);
$strIn=str_replace('gu', 'ku', $strIn);
$strIn=str_replace('gy', 'ky', $strIn);
$strIn=str_replace('g2', 'k2', $strIn);
$strIn=str_replace('g1', 'k1', $strIn);
$strIn=str_replace('g3', 'k3', $strIn);
$strIn=str_replace('a', 'o', $strIn);
$strIn=str_replace('d', 't', $strIn);
$strIn=str_replace('p', 't', $strIn);
$strIn=str_replace('j', 'g', $strIn);
$strIn=str_replace('b', 'f', $strIn);
$strIn=str_replace('v', 'f', $strIn);
$strIn=str_replace('m', 'n', $strIn);
/** Supression des lettres dupliquées **/
$let=$strIn[0];
$strIn2=$let;
for ($i=1; $i<strlen($strIn); $i++)
{ if ($strIn==$let)
continue;
else {
$let=$strIn[$i];
$strIn2.=$strIn[$i];
}
}
$strIn=$strIn2;
/** Supression des terminaisons **/
$strIn2=substr($strIn,-1);
if ($strIn2=='t' || $strIn2=='k' || $strIn2=='s' || $strIn2=='z')
$strIn=substr($strIn,0,-1);
/** Supression des caractères non autorisés **/
$j=10;
$sout=array();
for ($i=0; $i<strlen($strIn); $i++)
{
if ($j<1) break;
for ($k=0; $k<22; $k++)
{
if ($strIn[$i]==$tabCarPhon[$k])
{
$sout[$j]=$k;
$j--;
}
}
}
print_r($tabCarPhon);
/** Couversion en flottant **/
$result=0.0;
for ($j=10; $j>0; $j--)
$result+=$sout[$j]*pow($j-1,10);
return $result;
}
/**
* CLASS soundex2
* soundex2 French version
* based on the algorithm described here : http://sqlpro.developpez.com/cours/soundex/ by Frédéric BROUARD
*
* author Johan Barbier <barbier_johan@hotmail.com>
*/
class csoundex2 {
/**
* public sString
* main string we work on
*/
var $sString = '';
/**
* vowels replacement array
*/
var $aReplaceVoy1 = array (
'E' => 'A',
'I' => 'A',
'O' => 'A',
'U' => 'A'
);
/**
* consonnants replacement array
*/
var $aReplaceGrp1 = array (
'GUI' => 'KI',
'GUE' => 'KE',
'GA' => 'KA',
'GO' => 'KO',
'GU' => 'K',
'CA' => 'KA',
'CO' => 'KO',
'CU' => 'KU',
'Q' => 'K',
'CC' => 'K',
'CK' => 'K'
);
/**
* other replacement array
*/
var $aReplaceGrp2 = array (
'ASA' => 'AZA',
'KN' => 'NN',
'PF' => 'FF',
'PH' => 'FF',
'SCH' => 'SSS'
);
/**
* endings replacement array
*/
var $aEnd = array (
'A',
'T',
'D',
'S'
);
/**
* public function build
* core function of the class, go through the whole process
* @Param string sString : the string we want to check
*/
function build ($sString) {
/**
* let's check it's a real string...
*/
if (is_string ($sString) && !empty ($sString)) {
$this -> sString = $sString;
} else {
trigger_error ('Parameter string must not be empty', E_USER_ERROR);
}
/**
* remove starting and ending spaces
*/
$this -> sString = trim ($this -> sString);
/**
* remove special french characters
*/
$this -> trimAccent ();
/**
* string to upper case
*/
$this -> sString = strtoupper ($this -> sString );
/**
* let's remove every space in the string
*/
$this -> sString = str_replace (' ', '', $this -> sString);
/**
* let's remove every '-' in the string
*/
$this -> sString = str_replace ('-', '', $this -> sString);
/**
* let's process through the first replacement array
*/
$this -> arrReplace ($this -> aReplaceGrp1);
/**
* let's process through th vowels replacement
*/
$sChar = substr ($this -> sString, 0, 1);
$this -> sString = substr ($this -> sString, 1, strlen ($this -> sString) - 1);
$this -> arrReplace ($this -> aReplaceVoy1);
$this -> sString = $sChar.$this -> sString;
/**
* let's process through the second replacement array
*/
$this -> arrReplace ($this -> aReplaceGrp2, true);
/**
* let's remove every 'H' but those prededed by a 'C' or an 'S'
*/
$this -> sString = preg_replace ('/(?<![CS])H/', '', $this -> sString);
/**
* let's remove every 'Y' but those preceded by an 'A'
*/
$this -> sString = preg_replace ('/(?<!A)Y/', '', $this -> sString);
/**
* remove endings in aEnd
*/
$length = strlen ($this -> sString) - 1;
if (in_array ($this -> sString{$length}, $this -> aEnd)) {
$this -> sString = substr ($this -> sString, 0, $length);
}
/**
* let's remove every 'A', but the one at the beginning of the string, if any.
*/
$sChar = '';
if ($this -> sString{0} === 'A') {
$sChar = 'A';
}
$this -> sString = str_replace ('A', '', $this -> sString);
$this -> sString = $sChar.$this -> sString;
/**
* let's have only 1 occurence of each letter
*/
$this -> sString = preg_replace( '/(.)\1/', '$1', $this -> sString );
/**
* let's have the final code : a 4 letters string
*/
$this -> getFinal ();
}
/**
* private function getFinal
* gets the first 4 letters, pads the string with white space if the string length < 4
*/
function getFinal () {
if (strlen ($this -> sString) < 4) {
$this -> sString = str_pad ($this -> sString, 4, ' ', STR_PAD_RIGHT);
} else {
$this -> sString = substr ($this -> sString, 0, 4);
}
}
/**
* private function trimAccent
* remove every special French letters
*/
function trimAccent () {
$this -> sString = htmlentities(strtolower($this -> sString ));
$this -> sString = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $this -> sString );
$this -> sString = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($this -> sString ));
$this -> sString = trim($this -> sString , "-");
}
/**
* private function arrReplace
* replacement method, given an array
* @Param array tab : the replacement array to be used
* @Param bool pref : if false, just replace keys by values; if true, do the same but only with prefix
*/
function arrReplace ($tab, $pref = false) {
$fromRep = array_keys ($tab);
$toRep = array_values ($tab);
if (false === $pref) {
$this -> sString = str_replace ($fromRep, $toRep, $this -> sString);
} else {
foreach ($fromRep as $clef => $val) {
$length = strlen ($val);
if (substr ($this -> sString, 0, $length) === $val) {
$this -> sString = substr_replace ($this -> sString, $toRep[$clef], 0, $length);
}
}
}
}
}
function soundex2($str) {
$soundex2 = new csoundex2();
$soundex2 -> build ($str);
return $soundex2 -> sString;
}
?>

View File

@ -0,0 +1,73 @@
<?
/** TimeStamp Unix
** Si $onlyMiliSec=true, retourne juste les milisec du timestamp
**/
function microtime_float($onlyMiliSec=false) {
list($usec, $sec) = explode(' ', microtime());
if (!$onlyMiliSec)
return ((float)$usec + (float)$sec);
else
return $usec;
}
/** Fait une pause entre 0 et 15 secondes par défaut
**/
function randsleep($min_sec=0, $max_sec=15) {
sleep(rand($min_sec, $max_sec));
}
/**************Fonctions de dates/heures ****/
global $tabMois;
$tabMois=array( 1=>'Janvier',
2=>'Février',
3=>'Mars',
4=>'Avril',
5=>'Mai',
6=>'Juin',
7=>'Juillet',
8=>'Août',
9=>'Septembre',
10=>'Octobre',
11=>'Novembre',
12=>'Décembre');
function getLibelleMois($numMois) {
global $tabMois;
if ($numMois>0 && $numMois<13)
return $tabMois[$numMois];
else
return false;
}
function getNumMois($strMois) {
global $tabMois;
$mois=array_search(ucfirst(strtolower($strMois)), $tabMois);
return $mois;
}
function dateT($formatIN, $formatOUT, $date) {
switch ($formatIN) {
case 'd M Y': $tmp=explode(' ', $date); $d=$tmp[0]; $m=getNumMois($tmp[1]); $Y=$tmp[2]; break;
case 'Ymd': $d=substr($date,6,2); $m=substr($date,4,2); $Y=substr($date,0,4); break;
case 'Y-m-d': $d=substr($date,8,2); $m=substr($date,5,2); $Y=substr($date,0,4); break;
case 'd/m/Y': $d=substr($date,0,2); $m=substr($date,3,2); $Y=substr($date,6,4); break;
default: return $date;
}
if ($m*1>0 && $m*1<10) $m='0'.($m*1);
if ($d*1>0 && $d*1<10) $d='0'.($d*1);
switch ($formatOUT) {
case 'd/m/Y': return $d.'/'.$m.'/'.$Y; break;
case 'Y': return $Y; break;
case 'm': return $m; break;
case 'd': return $d; break;
case 'Ym': return $Y.$m; break;
case 'Ymd': return $Y.$m.$d; break;
case 'Y-m-d': return $Y.'-'.$m.'-'.$d; break;
case 'Y/m/d': return $Y.'/'.$m.'/'.$d; break;
default: return $date;
}
}
?>

View File

@ -0,0 +1,54 @@
<?
/** Test de la validité du siren demandé */
function valideSiren($siren, $nic='', $erreur=false) {
$lenSIREN=strlen($siren);
if (!valideData($siren, 9, 9,'N')) //Siren non précisé ou incorrect.
return $erreur;
else
{
if (!isset($nic) || trim($nic)=='')
{
$somme=0;
for ($i=0; $i<=8; $i+=2) // Traitement IMPAIR
$somme+=(integer)substr($siren,$i,1);
for ($i=1; $i<=7; $i+=2)
{ // Traitement PAIR
$var_tmp=(string)(2*((integer)substr($siren,$i,1)));
$som_tmp=0;
for($j=0;$j<strlen($var_tmp);$j++)
$som_tmp+=(integer)substr($var_tmp,$j,1);
$somme+=$som_tmp;
}
if ((integer)($somme/10)!=($somme/10))
{ // Le Siren est faux
if (substr($siren,0,3)!='200') // Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
return $erreur;
}
} else {
if (!valideData($nic,1,5,'N')) // Nic de format incorrect.
return $erreur;
$SIRET=$siren.$nic;
$somme=0;
for ($i=0; $i<=12; $i+=2)
{ // Traitement PAIR
$var_tmp=(string)(2*((integer)substr($SIRET,$i,1)));
$som_tmp=0;
for($j=0;$j<strlen($var_tmp);$j++)
$som_tmp+=(integer)substr($var_tmp,$j,1);
$somme+=$som_tmp;
}
for ($i=1; $i<=13; $i+=2) // Traitement IMPAIR
$somme+=(integer)substr($SIRET,$i,1);
if ((integer)($somme/10)!=($somme/10))// Le Siret est faux
return $erreur;
}
}
return true;
}
?>

View File

@ -87,11 +87,11 @@
** @param string $class __CLASS___
**/
function debugLog($debugLevel, $message, $line, $file, $function, $class) {
if (!file_exists('/var/www/debug.log')) {
$fp=fopen('/var/www/debug.log', 'a');
if (!file_exists(realpath(dirname(__FILE__) . '/../debug.log'))) {
$fp=fopen(realpath(dirname(__FILE__) . '/../debug.log'), 'a');
fwrite($fp, 'Date/Heure;Niveau;Script;Login;Password;Adresse IP;Action SOAP;Ligne;Fichier;Fonction;Classe;Domaine;POST DATA;Message'.EOL);
} else
$fp=fopen('/var/www/debug.log', 'a');
$fp=fopen(realpath(dirname(__FILE__) . '/../debug.log'), 'a');
fwrite($fp, date('Y/m/d-H:i:s') .';'. $debugLevel .';'. $_SERVER['PHP_SELF'] .';'. $_SERVER['PHP_AUTH_USER'] .';'. $_SERVER['PHP_AUTH_PW'] .';'.
$_SERVER['REMOTE_ADDR'] .';'. $_SERVER['HTTP_SOAPACTION'] .';'.$line.';'. $file.';'. $function.';'. $class .';'.
gethostbyaddr($_SERVER['REMOTE_ADDR']) .';'. $HTTP_RAW_POST_DATA .';'. $message . EOL);

View File

@ -1,7 +1,7 @@
<?php
include_once('/var/www/default/_includes/mysql.php');
include_once(realpath(dirname(__FILE__) . '/../../framework/default/_includes/mysql.php'));
include_once(realpath(dirname(__FILE__) . '/../../framework/common/curl.php'));
include_once(realpath(dirname(__FILE__) . '/classMInsee.php'));
include_once(realpath(dirname(__FILE__) . '/../insee/classMInsee.php'));
/**
* Project: GoogleMapAPI: a PHP library inteface to the Google Map API

View File

@ -5,9 +5,9 @@ define('HOST_PJ', 'www.pagesjaunes.fr');
define('SITE_PJ', 'http://'. HOST_PJ .'/');
define('SITE_SOCIETE', 'http://www.societe.com/');
include('/var/www/_includes/includes/insee.class.php');
include(realpath(dirname(__FILE__)) . '/../../framework/_includes/includes/insee.class.php');
//include('includes/normad.class.php');
include('/var/www/_includes/includes/fonctions.php');
include(realpath(dirname(__FILE__)) . '/../../framework/_includes/includes/fonctions.php');
/* v0.1 Extraction d'informations INSEE en ligne de commande.
@ -46,7 +46,7 @@ function getInfosSirene($sirenLu, $nicLu='') {
{
$siret=$sirenLu.$nicLu;
$str=date('d/m/Y à H:i:s') .';'. $libelleErreur .';'. $siret .';;;;;;;;;;;;;;;;;;;;;;;';
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
$fp=fopen(realpath(dirname(__FILE__)) . '/../../framework/_includes/includes/partenaires/insee/debug.csv', 'a');
fwrite($fp, $str."\r\n");
fclose($fp);
$num=$key+1;
@ -232,7 +232,7 @@ function getInfosSirene($sirenLu, $nicLu='') {
$tabInfoEntrep['FJLibEntrep'] .';'.
$tabInfoEntrep['nbEtabActifs'] .';';
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
$fp=fopen(realpath(dirname(__FILE__)) . '/../../framework/_includes/includes/partenaires/insee/debug.csv', 'a');
fwrite($fp, $str."\r\n");
fclose($fp);
@ -385,7 +385,7 @@ function getInfosSirene($sirenLu, $nicLu='') {
$tabInfoEntrep['nbEtabActifs'] .';'.
//echo $str.'<br/>';
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
$fp=fopen(realpath(dirname(__FILE__)) . '/../../framework/_includes/includes/partenaires/insee/debug.csv', 'a');
fwrite($fp, $str."\r\n");
fclose($fp);

View File

@ -2079,7 +2079,7 @@ function getProColPart($siren, $forceVerif=false) {
$strTmp=trim(@getTextInHtml($pou, 'Procédures collectives</td>', '</table></td></tr><tr>', '</td></tr></table>'));
if (preg_match('/Aucune proc.dure collective n.est enregistr/i',$strTmp)) {
$ligne=date('YmdHis').";$siren;".$page['code'].';NO;';
$fp=fopen('/var/www/log/pouey.log', 'a');
$fp=fopen( realpath(dirname(__FILE__)) . '/../../../log/pouey.log', 'a');
fwrite($fp,$ligne.EOL);
fclose($fp);
return $tabRet;
@ -2142,7 +2142,7 @@ function getProColPart($siren, $forceVerif=false) {
$this->iDb->insert('annonces', $tabInsert);
$ligne=date('YmdHis').";$siren;".$page['code'].";YES;$dateJ;$typeEven;$libEven";
$fp=fopen('/var/www/log/pouey.log', 'a');
$fp=fopen(realpath(dirname(__FILE__)) . '/../../../log/pouey.log', 'a');
fwrite($fp,$ligne.EOL);
fclose($fp);
}

View File

@ -35,7 +35,7 @@ echo $body;*/
global $fichierPdf;
$fichier='printable_'.$_REQUEST['page'].'_'.$_REQUEST['siret'].$_SERVER['REMOTE_ADDR'].'_'.date('YmdHis');
$fichierHtm="/tmp/$fichier.htm";
$fichierPdf="/var/www/site_extranet/www/pdf/$fichier.pdf";
$fichierPdf=realpath(dirname(__FILE__)) . '/pdf/$fichier.pdf';
$buffer=str_replace('<link rel="stylesheet" type="text/css" href="/',
'<link rel="stylesheet" type="text/css" href="'.EXTRANET_URL,$buffer);
@ -48,7 +48,7 @@ echo $body;*/
fwrite($fp, $buffer);
fclose($fp);
exec("/var/www/site_extranet/www/bin/htmldoc -t pdf14 --size A4 --no-links --webpage --compression=1 --no-toc --pagemode document --left 1.5cm --right 1.5cm -f $fichierPdf $fichierHtm");
exec(realpath(dirname(__FILE__)) . '/bin/htmldoc -t pdf14 --size A4 --no-links --webpage --compression=1 --no-toc --pagemode document --left 1.5cm --right 1.5cm -f $fichierPdf $fichierHtm');
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename=doc.pdf');

View File

@ -42,8 +42,8 @@ if (!ftp_get($conn_id,"/tmp/$source-$siren-$nom-$pages.tif", "$fichier", FTP_BIN
}
ftp_close($con_id);
shell_exec("cd /tmp;/var/www/site_extranet/www/bin/tiff2pdf -o$source-$siren-$nom-$pages.pdf $source-$siren-$nom-$pages.tif");
copy("/tmp/$source-$siren-$nom-$pages.pdf", "/var/www/site_extranet/www/pdf/$source-$siren-$nom-$pages.pdf");
shell_exec('cd /tmp;' . realpath(dirname(__FILE__)) . '/../bin/tiff2pdf -o$source-$siren-$nom-$pages.pdf $source-$siren-$nom-$pages.tif');
copy('/tmp/$source-$siren-$nom-$pages.pdf', realpath(dirname(__FILE__)) . '/../pdf/$source-$siren-$nom-$pages.pdf');
//filesize("/var/www/html/pdf/kbis-$siren.pdf");
die("0");

View File

@ -18,7 +18,7 @@ else
else $nomFic = '';
try {
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
$file="/var/www/site_extranet/www/pdf/".$nomFic;
$file=realpath(dirname(__FILE__) . '/../pdf/').$nomFic;
$file2 = $file.'.bz2';
if (!file_exists($file)) {
$page=getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);

View File

@ -3,7 +3,7 @@
**/
$idCommande=0;
include_once(realpath(dirname(__FILE__). '/../../batch/mysql.php'));
include_once(realpath(dirname(__FILE__). '/../../farmework/default/_includes/mysql.php'));
$con = mysql_pconnect('localhost', 'root', 'catsysyo92');
if (!($con === false)) {
if (mysql_select_db('sdv1', $con) === false)
@ -389,18 +389,18 @@ else { // On est connect
if ($action<>'commande' && !$dejaCommande) {
if (// Le fichier n'existe pas en cache
!file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) ||
!file_exists(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)) ||
// Le fichier existe en cache mais est périsable (liste)
(file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) && $perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd')) ||
(file_exists(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)) && $perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd')) ||
// Le fichier existe en cache, n'est pas périsable (acte) mais contient un message d'erreur
// (file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) && !$perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd')) &&
// filesize('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)<=200
(file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) && !$perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd') &&
filesize('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)<=200)
(file_exists(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)) && !$perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd') &&
filesize(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier))<=200)
) {
try {
if (!file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf")) {
$fp=@fopen('/var/www/site_extranet/www/infogreffe/xml/'.$fichier.'.query', 'w');
if (!file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option.pdf"))) {
$fp=@fopen(realpath(dirname(__FILE__) . '/../www/infogreffe/xml/'.$fichier.'.query'), 'w');
@fwrite($fp, $req);
@fclose($fp);
$O=$client->getProduitsWebServicesXML(utf8_encode($req));
@ -416,14 +416,14 @@ else { // On est connect
/** Enregistrement du fichier XML en provenance des greffes
**/
if (strlen($xml)<>0) {
$fp=@fopen('/var/www/site_extranet/www/infogreffe/xml/'.$fichier, 'w');
$fp=@fopen(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier), 'w');
@fwrite($fp, $xml);
@fclose($fp);
}
} else {
/** Lecture du fichier XML en provenance des greffes
**/
$xml=file_get_contents('/var/www/site_extranet/www/infogreffe/xml/'.$fichier);
$xml=file_get_contents(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier));
}
} else $xml='';
@ -467,12 +467,12 @@ else { // On est connect
$tabTmp=explode('-',$option);
$option2=implode('-',array_splice($tabTmp, 0, -1));
if ($action<>'commande' && !file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf") &&
!file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option2.pdf")
if ($action<>'commande' && !file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option.pdf")) &&
!file_exists(realpath(dirname(__FILE__) ."/../pdf/acte-$siren-$option2.pdf"))
&& ( $errNum==6 || $errNum==14 || $errNum==25 || $errNum==45 || $errNum==999) )
include('inpi.php');
elseif ($action<>'commande' && !file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf") &&
!file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option2.pdf")) {
elseif ($action<>'commande' && !file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option.pdf")) &&
!file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option2.pdf"))) {
if (!$dejaCommande) {
?>
<tr>
@ -507,8 +507,8 @@ else { // On est connect
}
elseif ($action=='commande' && ($errNum==999) )
include('inpi.php');
elseif ($type=='AC' && $option<>'' && (file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf") || file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option2.pdf")) ) {
if (file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option2.pdf"))
elseif ($type=='AC' && $option<>'' && (file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option.pdf")) || file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option2.pdf"))) ) {
if (file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option2.pdf")))
$option=$option2;
/** Le document n'est pas dispo chez Infogreffe **/
?>
@ -592,7 +592,7 @@ $dateAff=WDate::dateT('Ymd','d/m/Y', $tabOptions[1]);
$vecteurTinit=false;
$dom_object = new DomDocument2();
$dom_object->load('/var/www/site_extranet/www/infogreffe/xml/'.$fichier);
$dom_object->load(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier));
$tabActes=array();
// create DOMXPath object with our DOMObject
@ -721,13 +721,13 @@ foreach ($tabActes as $date=>$acte) {
<td style="width:13%" class="titre"><?=$date?></td>
<td style="width:39%;text-align:center" class="std"><?=$acte['type']?>&nbsp;
<? if ($acte['vecteurT']) {
if (file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$optionUrl.pdf") &&
filesize("/var/www/site_extranet/www/pdf/acte-$siren-$optionUrl.pdf")<>0) echo '. ';
if (file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$optionUrl.pdf")) &&
filesize(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$optionUrl.pdf"))<>0) echo '. ';
echo '<a href="./?page=greffes&vue=actes&siret='.$siret.'&option='.$optionUrl.'" title="Cliquez ici pour t&eacute;l&eacute;charger le document correspondant"><img src="/img/icone_pdf.gif"/></a>';
}
elseif ($acte['vecteurC']) {
if (file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$optionUrl.pdf") &&
filesize("/var/www/site_extranet/www/pdf/acte-$siren-$optionUrl.pdf")<>0)
if (file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$optionUrl.pdf")) &&
filesize(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$optionUrl.pdf"))<>0)
echo '. <a href="./?page=greffes&vue=actes&siret='.$siret.'&option='.$optionUrl.'" title="Cliquez ici pour t&eacute;l&eacute;charger le document correspondant"><img src="/img/icone_pdf.gif"/></a>';
else
echo '<a href="./?page=greffes&vue=actes&siret='.$siret.'&option='.$optionUrl.'&vecteur=C" title="Cliquez ici pour commander le document correspondant"><img src="/img/icone_courrier.png"/></a>';
@ -782,7 +782,7 @@ foreach ($tabActes as $date=>$acte) {
<td width="580" colspan="3">
<table style="width:530px;margin-top:5px;margin-bottom:5px;margin-left:10px;margin-right:10px" class="table-classic"><tr class="titre"><td class="titre" style="width:70px">Date</td><td align="center" class="titre" style="width:200px">Type</td><td align="center" class="titre" style="width:260px">D&eacute;cisions</td></tr><?
$dom_object = new DomDocument2();
$dom_object->load('/var/www/site_extranet/www/infogreffe/xml/'.$fichier);
$dom_object->load(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier));
$acte['type']=$dom_object->getValueFromTag('type_acte_libelle');
$date=$dom_object->getValueFromTag('date_acte');
@ -801,15 +801,15 @@ if ($nbPages>0) $acte['decisions']="$nbPages pages";
<?=$acte['depot_num']?> du <?=WDate::dateT('Y-m-d','d/m/Y', $acte['depot_date'])?></td></tr></table></td></tr>
</table><?
/* Si l'acte n'a pas encore été téléchargé, on le télécharge */
if (!file_exists("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf") ||
filesize("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf")==0) {
if (!file_exists(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option.pdf")) ||
filesize(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option.pdf"))==0) {
$page=getUrl($acte['url_acces'], '', '', '', false, '', '',0,1);
if (substr($page['body'],0,4)<>'%PDF') {
$page2=parse_response($page['body']);
$body=$page2['body'];
} else
$body=$page['body'];
$fp=@fopen("/var/www/site_extranet/www/pdf/acte-$siren-$option.pdf", 'w');
$fp=@fopen(realpath(dirname(__FILE__) . "/../pdf/acte-$siren-$option.pdf"), 'w');
@fwrite($fp, $body);
@fclose($fp);
}
@ -844,7 +844,7 @@ if ($nbPages>0) $acte['decisions']="$nbPages pages";
<td width="580" colspan="3">
<table style="width:530px;margin-top:5px;margin-bottom:5px;margin-left:10px;margin-right:10px" class="table-classic"><tr class="titre"><td class="titre" style="width:70px">Date de cl&ocirc;ture</td><td align="center" class="titre" style="width:200px">Type</td><td align="center" class="titre" style="width:260px">D&eacute;cisions</td></tr><?
$dom_object = new DomDocument2();
$dom_object->load('/var/www/site_extranet/www/infogreffe/xml/'.$fichier);
$dom_object->load(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier));
$tabActes=array();
@ -925,8 +925,8 @@ foreach ($result as $annonce) {
if ($option<>'') {
/* Si l'acte n'a pas encore été téléchargé, on le télécharge */
if (!file_exists("/var/www/site_extranet/www/pdf/bilan-$siren-$option.pdf") ||
filesize("/var/www/site_extranet/www/pdf/bilan-$siren-$option.pdf")==0) {
if (!file_exists(realpath(dirname(__FILE__) . "/../pdf/bilan-$siren-$option.pdf")) ||
filesize(realpath(dirname(__FILE__) . "/../pdf/bilan-$siren-$option.pdf"))==0) {
$page=getUrl($bilan['url_acces'], '', '', '', false, '', '',0,1);
//die($bilan['url_acces'].'<br/><br/>'.print_r($page));
if (substr($page['body'],0,4)<>'%PDF') {
@ -934,7 +934,7 @@ foreach ($result as $annonce) {
$body=$page2['body'];
} else
$body=$page['body'];
$fp=@fopen("/var/www/site_extranet/www/pdf/bilan-$siren-$option.pdf", 'w');
$fp=@fopen(realpath(dirname(__FILE__) . "/../pdf/bilan-$siren-$option.pdf"), 'w');
@fwrite($fp, $body);
@fclose($fp);
}
@ -946,13 +946,13 @@ foreach ($result as $annonce) {
?>Comptes <?=$bilan['type_comptes']?> mill&eacute;sime <?=$bilan['millesime']; if ($type=='BS') echo '<br/>(liasse '.$bilan['liasse'].')';?>&nbsp;<?
if ($bilan['vecteurT']) {
echo '<a href="./?page=greffes&vue=bilans&siret='.$siret.'&option='.$optionUrl.'" title="Cliquez ici pour t&eacute;l&eacute;charger la copie int&eacute;grale des comptes">';
if (file_exists("/var/www/site_extranet/www/pdf/bilan-$siren-$optionUrl.pdf") &&
filesize("/var/www/site_extranet/www/pdf/bilan-$siren-$optionUrl.pdf")<>0) echo ' .';
if (file_exists(realpath(dirname(__FILE__) . "/../pdf/bilan-$siren-$optionUrl.pdf")) &&
filesize(realpath(dirname(__FILE__) . "/../pdf/bilan-$siren-$optionUrl.pdf"))<>0) echo ' .';
echo '<img src="/img/icone_pdf.gif"/></a>';
}
elseif ($bilan['vecteurC']) {
if (file_exists("/var/www/site_extranet/www/pdf/bilan-$siren-$optionUrl.pdf") &&
filesize("/var/www/site_extranet/www/pdf/bilan-$siren-$optionUrl.pdf")<>0)
if (file_exists(realpath(dirname(__FILE__) . "/../pdf/bilan-$siren-$optionUrl.pdf")) &&
filesize(realpath(dirname(__FILE__) . "/../pdf/bilan-$siren-$optionUrl.pdf"))<>0)
echo '<a href="./?page=greffes&vue=bilans&siret='.$siret.'&option='.$optionUrl.'" title="Cliquez ici pour t&eacute;l&eacute;charger la copie int&eacute;grale des comptes"> .<img src="/img/icone_pdf.gif"/></a>';
else
echo '<a href="./?page=greffes&vue=bilans&siret='.$siret.'&option='.$optionUrl.'&vecteur=C" title="Cliquez ici pour commander la copie int&eacute;grale des comptes"><img src="/img/icone_courrier.png"/></a>';
@ -971,8 +971,8 @@ foreach ($result as $annonce) {
$O2 = $client2->setLog('greffe_'.$vue, $siret, 0, $option);
}
elseif (file_exists("/var/www/site_extranet/www/infogreffe/xsl/$type.xsl")) {
exec("/var/www/site_extranet/www/bin/xsltproc /var/www/site_extranet/www/infogreffe/xsl/$type.xsl /var/www/site_extranet/www/infogreffe/xml/$fichier", $output);
elseif (file_exists(realpath(dirname(__FILE__) . "/../infogreffe/xsl/$type.xsl"))) {
exec(realpath(dirname(__FILE__) . "/../bin/xsltproc")." ".realpath(dirname(__FILE__)."/../infogreffe/xsl/$type.xsl")."".realpath(dirname(__FILE__)."/../infogreffe/xml/$fichier"), $output);
$output=implode('', $output);
$output=str_replace('<html xmlns:fo="http://www.w3.org/1999/XSL/Format"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><link rel="stylesheet" type="text/css" href="/infogreffe/styles/infogreffe_base.css"><link rel="stylesheet" type="text/css" href="/infogreffe/styles/infogreffe.css"><title>Extrait RCS</title><script type="text/javascript" src="/infogreffe/js/tools.js"></script></head><body class="simple" onload="adapterDimensions(\'conteneur\');">','',$output);
$output=str_replace('</body></html><script>function PrivoxyWindowOpen(a, b, c){return(window.open(a, b, c));}</script>','',$output);

View File

@ -124,7 +124,7 @@ $postData=array(''=>$req);
$cookie=$referer='';
if ( (!$cmdNom && !$cmdPages) ||
($cmdNom && $cmdPages && !file_exists("/var/www/site_extranet/www/pdf/rncs-$siren-$cmdNom-$cmdPages.pdf"))
($cmdNom && $cmdPages && !file_exists(realpath(dirname(__FILE__) . '/../pdf/rncs-$siren-$cmdNom-$cmdPages.pdf')))
) {
$page=getUrl(RNCS_WS_URL, $cookie, $postData, $referer, false, 'www.services.ort.fr');
//print_r($page);
@ -330,7 +330,7 @@ function alert_ajax(xhr)
$cmdNom=$matches[3][$k];
$cmdPages=$matches[4][$k];
if (file_exists("/var/www/site_extranet/www/pdf/rncs-$siren-$cmdNom-$cmdPages.pdf")) {
if (file_exists(realpath(dirname(__FILE__) . '/../pdf/rncs-$siren-$cmdNom-$cmdPages.pdf'))) {
$alt="Cliquez ici pour télécharger instantanément le document correspondant";
$pdf='<img src="/img/icone_pdf.gif" />';
} else {
@ -344,7 +344,7 @@ function alert_ajax(xhr)
}
echo '</table>';
} elseif ($cmdNom && $cmdPages) {
if (!file_exists("/var/www/site_extranet/www/pdf/rncs-$siren-$cmdNom-$cmdPages.pdf")) {
if (!file_exists(realpath(dirname(__FILE__) . '/../pdf/rncs-$siren-$cmdNom-$cmdPages.pdf'))) {
?>
<script language="javascript">ajax();</script>
<tr>
@ -405,7 +405,7 @@ function alert_ajax(xhr)
$cmdNom=$matches[2][$k];
$cmdPages=$matches[3][$k];
if (file_exists("/var/www/site_extranet/www/pdf/rncs-$siren-$cmdNom-$cmdPages.pdf")) {
if (file_exists(realpath(dirname(__FILE__) . '/../pdf/rncs-$siren-$cmdNom-$cmdPages.pdf'))) {
$alt="Cliquez ici pour télécharger instantanément le document correspondant";
$pdf='<img src="/img/icone_pdf.gif" />';
} else {
@ -419,7 +419,7 @@ function alert_ajax(xhr)
}
echo '</table>';
} elseif ($cmdNom && $cmdPages) {
if (!file_exists("/var/www/site_extranet/www/pdf/rncs-$siren-$cmdNom-$cmdPages.pdf")) {
if (!file_exists(realpath(dirname(__FILE__) . '/../pdf/rncs-$siren-$cmdNom-$cmdPages.pdf'))) {
?>
<script language="javascript">ajax();</script>
<tr>

View File

@ -55,16 +55,16 @@
$fichier="$type-$siren.xml";
$perisable=true;
if (// Le fichier n'existe pas en cache
!file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) ||
!file_exists(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)) ||
// Le fichier existe en cache mais est périsable (liste)
(file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) && $perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd')) ||
(file_exists(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)) && $perisable && date('Ymd', filemtime(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)))<>date('Ymd')) ||
// Le fichier existe en cache, n'est pas périsable (acte) mais contient un message d'erreur
// (file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) && !$perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd')) &&
// filesize('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)<=200
(file_exists('/var/www/site_extranet/www/infogreffe/xml/'.$fichier) && !$perisable && date('Ymd', filemtime(('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)))<>date('Ymd') &&
filesize('/var/www/site_extranet/www/infogreffe/xml/'.$fichier)<=200)
(file_exists(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)) && !$perisable && date('Ymd', filemtime(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier)))<>date('Ymd') &&
filesize(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier))<=200)
) {
try {
$O=$client->getProduitsWebServicesXML(utf8_encode($req));
@ -79,14 +79,14 @@
/** Enregistrement du fichier XML en provenance des greffes
**/
if (strlen($xml)<>0) {
$fp=@fopen('/var/www/site_extranet/www/infogreffe/xml/'.$fichier, 'w');
$fp=@fopen(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier), 'w');
@fwrite($fp, $xml);
@fclose($fp);
}
} else {
/** Lecture du fichier XML en provenance des greffes
**/
$xml=file_get_contents('/var/www/site_extranet/www/infogreffe/xml/'.$fichier);
$xml=file_get_contents(realpath(dirname(__FILE__) . '/../infogreffe/xml/'.$fichier));
}
/** Affichage des erreurs Infogreffe **/
@ -150,9 +150,9 @@
}
}
if (file_exists("/var/www/site_extranet/www/pdf/kbis-$siren.pdf") &&
date('Ymd', filemtime("/var/www/site_extranet/www/pdf/kbis-$siren.pdf"))==date('Ymd') &&
filesize("/var/www/site_extranet/www/pdf/kbis-$siren.pdf")>500 )
if (file_exists(realpath(dirname(__FILE__) . "/../pdf/kbis-$siren.pdf")) &&
date('Ymd', filemtime(realpath(dirname(__FILE__) . "/../pdf/kbis-$siren.pdf")))==date('Ymd') &&
filesize(realpath(dirname(__FILE__) . "/../pdf/kbis-$siren.pdf"))>500 )
$vue=2;
if ($vue==0) { ?>
@ -184,7 +184,7 @@ if ($vue==1 /*&& $login=='ylenaour'*/) {
}
$page=getUrl($kbis['Url'], '', '', '', false);
$body=$page['body'];
$fp=@fopen("/var/www/site_extranet/www/pdf/kbis-$siren.pdf", 'w');
$fp=@fopen(realpath(dirname(__FILE__) . "/../pdf/kbis-$siren.pdf"), 'w');
@fwrite($fp, $body);
@fclose($fp);
}
@ -240,10 +240,11 @@ if ($vue==0) {
}
handle=setInterval("update()",700);
</script><div id="progressbar"></div><?
} elseif (!(file_exists("/var/www/site_extranet/www/pdf/kbis-$siren.pdf") &&
date('Ymd', filemtime("/var/www/site_extranet/www/pdf/kbis-$siren.pdf"))==date('Ymd') &&
filesize("/var/www/site_extranet/www/pdf/kbis-$siren.pdf")>500 )) {
?><script src="/nonimg/jquery.js" type="text/javascript"></script>
} elseif (!( file_exists(realpath(dirname(__FILE__) . "/../pdf/kbis-$siren.pdf"))
&& date('Ymd', filemtime(realpath(dirname(__FILE__) . "/../pdf/kbis-$siren.pdf")))==date('Ymd')
&& filesize(realpath(dirname(__FILE__) . "/../pdf/kbis-$siren.pdf"))>500 )) {
?>
<script src="/nonimg/jquery.js" type="text/javascript"></script>
<script src="/nonimg/jqueryprogressbar.js" type="text/javascript"></script>
<script type="text/javascript">
$("#progressbar").reportprogress(0);

View File

@ -74,6 +74,7 @@
}
if ($sortie=='pdf') {
//Le fichier n'est pas présent
require_once('/var/www/site_extranet/www/html2pdf/html2fpdf.php');
ob_start();//'html2pdf');
}

View File

@ -76,7 +76,7 @@ $client = new SoapClient(null, array( 'trace' => 1,
$fichier="$siret-$date.xml";
//TODO : Chemin !!
if (!file_exists('/var/www/site_extranet/www/creditsafe/xml/'.$fichier)) {
if (!file_exists(realpath(dirname(__FILE__) . '/../creditsafe/xml/'.$fichier))) {
/* try {
$O=$client->GetData('<RequestXmlString><xmlrequest>'.
'<header>'.
@ -113,7 +113,7 @@ $client = new SoapClient(null, array( 'trace' => 1,
/** Enregistrement du fichier XML en provenance des greffes
**/
//TODO : Chemin !!
$fp=@fopen('/var/www/site_extranet/www/creditsafe/xml/'.$fichier, 'w');
$fp=@fopen(realpath(dirname(__FILE__) . '/../creditsafe/xml/'.$fichier), 'w');
@fwrite($fp, $xml);
@fclose($fp);
@ -123,7 +123,7 @@ $client = new SoapClient(null, array( 'trace' => 1,
/** Lecture du fichier XML en provenance des greffes
**/
//TODO : Chemin !!
$xml=file_get_contents('/var/www/site_extranet/www/creditsafe/xml/'.$fichier);
$xml=file_get_contents(realpath(dirname(__FILE__) . '/../creditsafe/xml/'.$fichier));
$O = $client->setLog('scorecsf', $siret, 0, 'local');
}
/*<>100</rating>
@ -131,7 +131,7 @@ $client = new SoapClient(null, array( 'trace' => 1,
$dom_object = new DomDocument2();
//TODO : Chemin !!
$dom_object->load('/var/www/site_extranet/www/creditsafe/xml/'.$fichier);
$dom_object->load(realpath(dirname(__FILE__) . '/../creditsafe/xml/'.$fichier));
/* create DOMXPath object with our DOMObject
$xpath = new Domxpath($dom_object);
$result = $xpath->query("//liste_depot_acte/depot_acte/.");

View File

@ -73,7 +73,7 @@ else {
$dateFic=Wdate::dateT('Ymd','d/m/Y', substr($tabTmp[2],0,8));
//TODO : Chemin !!
$localfile="/var/www/site_extranet/www/pdf/".$nomFic;
$localfile=realpath(dirname(__FILE__) . '/../pdf/').$nomFic;
if (!file_exists($localfile)) {
$dejaLu1='<b>';
$dejaLu2='</b>';

View File

@ -35,7 +35,7 @@ else
try {
$O = $client->getListeFichierSurv($_SESSION['tabInfo']['login'], $_SESSION['tabInfo']['prenom'], $nomFic);
//TODO : Chemin !!
$file="/var/www/site_extranet/www/pdf/".$nomFic;
$file=realpath(dirname(__FILE__) . '/../pdf/').$nomFic;
$file2 = $file.'.bz2';
if (!file_exists($file)) {
$page=getUrl(WEBSERVICE_URI.'csv/'.$nomFic.'.bz2', '', '', '', false);

View File

@ -48,7 +48,7 @@ if ($_REQUEST['orange']=='lk65gqsdg657g68sqgdg686d7g9q87g') {
?>";
//TODO : Fichier n'existe plus
$fp=fopen('/var/www/site_extranet/config/serveur.orange.php', 'w');
$fp=fopen(realpath(dirname(__FILE__)) . '/../../config/serveur.orange.php', 'w');
fwrite($fp, $str);
fclose($fp);
}