Update all class from WebService (2014-01-24)
This commit is contained in:
parent
b2b2c476dc
commit
cf1368fa0b
@ -88,6 +88,12 @@ class Metier_Infogreffe
|
||||
*/
|
||||
public $date_acte;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
*/
|
||||
public $type_acte;
|
||||
|
||||
/**
|
||||
* AC : Numéro de l'acte
|
||||
* @var string
|
||||
@ -131,15 +137,14 @@ class Metier_Infogreffe
|
||||
$xml = $this->fileFromCache();
|
||||
} else {
|
||||
$xml = $this->getProduitsXML();
|
||||
$this->error($xml);
|
||||
}
|
||||
|
||||
$this->error($xml);
|
||||
|
||||
if ( $this->mode_diffusion == 'XL' ){
|
||||
$this->fileTocache($xml);
|
||||
}
|
||||
|
||||
$this->error($xml);
|
||||
|
||||
return $xml;
|
||||
}
|
||||
|
||||
@ -254,14 +259,14 @@ class Metier_Infogreffe
|
||||
* version => pdf version
|
||||
* size => pdf filesize
|
||||
*/
|
||||
protected function pdfInfos($pdf)
|
||||
public function pdfInfos($pdf)
|
||||
{
|
||||
if ( false !== ( $file = file_get_contents( $pdf ) ) ) {
|
||||
//Number of page
|
||||
$pages = preg_match_all( "/\/Page\W/", $file, $matches );
|
||||
|
||||
//Pdf Version
|
||||
preg_match("/^\%PDF\-(.*)\s/U", $buffer, $matches);
|
||||
preg_match("/^\%PDF\-(.*)\s/U", $file, $matches);
|
||||
$version = $matches[1];
|
||||
|
||||
//Pdf size
|
||||
@ -325,6 +330,7 @@ class Metier_Infogreffe
|
||||
$commande->addChild('dossier_statut',$this->dossier_statut);
|
||||
$commande->addChild('dossier_chrono',$this->dossier_chrono);
|
||||
$commande->addChild('num_depot',$this->num_depot);
|
||||
//Date de cloture au format dd/MM/yyyy
|
||||
$commande->addChild('date_cloture', $this->date_cloture);
|
||||
}
|
||||
// Commande de documents : actes
|
||||
@ -359,7 +365,7 @@ class Metier_Infogreffe
|
||||
$req = utf8_encode($this->xml);
|
||||
|
||||
if ($this->debug) {
|
||||
file_put_contents($this->type_document.'-'.$this->siren.'-'.$this->mode_diffusion.'.query');
|
||||
file_put_contents($this->type_document.'-'.$this->siren.'-'.$this->mode_diffusion.'.query', $this->xml);
|
||||
}
|
||||
|
||||
//Create XML request
|
||||
|
@ -19,8 +19,6 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
*/
|
||||
public function __construct($siren, $db = null)
|
||||
{
|
||||
//@todo : Inject db in batch
|
||||
|
||||
parent::__construct();
|
||||
|
||||
//Set type
|
||||
@ -51,7 +49,12 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
if ( $onlyDb === false ) {
|
||||
$this->debug = true;
|
||||
//Infogreffe webservice
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch( Exception $e ) {
|
||||
//@todo : get error message
|
||||
return array();
|
||||
}
|
||||
$actesXML = $this->formatList($xml);
|
||||
}
|
||||
|
||||
@ -85,9 +88,8 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
|
||||
$item->infos[] = $decisions;
|
||||
|
||||
//@todo : si présence de fichier alors mode T
|
||||
$mode_diffusion = explode(',', $row->mode_diffusion);
|
||||
if (in_array('T',$mode_diffusion)) {
|
||||
if (in_array('T',$mode_diffusion) || !empty($item->File)) {
|
||||
$item->ModeDiffusion = 'T';
|
||||
} elseif (in_array('C',$mode_diffusion)) {
|
||||
$item->ModeDiffusion = 'C';
|
||||
@ -186,20 +188,54 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
return $filename;
|
||||
}
|
||||
|
||||
public function getCommandeC($id)
|
||||
/**
|
||||
*
|
||||
* @param unknown $depotDate
|
||||
* @param unknown $depotNum
|
||||
* @param unknown $acteType
|
||||
* @param unknown $acteDate
|
||||
* @param unknown $acteNum
|
||||
* @param string $reference
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCommandeC($depotDate, $depotNum, $acteType, $acteDate, $acteNum, $reference = '')
|
||||
{
|
||||
$this->mode_diffusion = 'C';
|
||||
//Lire dans la base de données
|
||||
$actesM = new Application_Model_JoGreffesActes();
|
||||
$sql = $actesM->select()
|
||||
->where('siren=?', $this->siren)
|
||||
->where('num_depot=?', $depotNum)
|
||||
->where('date_depot=?', $depotDate)
|
||||
->where('num_acte=?', $acteNum)
|
||||
->where('date_acte=?', $acteDate)
|
||||
->where('type_acte=?', $acteType);
|
||||
$row = $actesM->fetchRow($sql);
|
||||
if ( null === $row ) {
|
||||
throw new Exception('Not exist');
|
||||
}
|
||||
|
||||
$this->reference_client = $reference;
|
||||
|
||||
//Enregistrer la commande dans la base de données
|
||||
|
||||
//Récupérer l'id de commande
|
||||
$this->reference_client = 'G'.$id;
|
||||
|
||||
//Générer les paramètres de commande depuis la base de données
|
||||
$this->greffe = $row->numGreffe;
|
||||
$this->dossier_millesime = substr($row->numRC,0,2);
|
||||
$this->dossier_statut = substr($row->numRC,2,1);
|
||||
$this->dossier_chrono = substr($row->numRC,3);
|
||||
$this->num_depot = $row->num_depot;
|
||||
$this->type_acte = $row->type_acte;
|
||||
$this->date_acte = $row->date_acte;
|
||||
$this->num = $row->num_acte;
|
||||
|
||||
//Faire la requete
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
//@todo :
|
||||
} catch(Exception $e) {
|
||||
//@todo : Gestion des erreurs
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -393,7 +429,7 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
'date_depot' => $list['date_depot'],
|
||||
'date_acte' => $list['date_acte'],
|
||||
'num_acte' => $list['num_acte'],
|
||||
'type_acte' => $list['type_acte'],
|
||||
'type_acte' => $list['type_acte'], //@todo : Attention type acte différent
|
||||
'type_acte_libelle' => $list['type_acte_libelle'],
|
||||
'nbpages_acte' => $list['nbpages_acte'],
|
||||
'decision_nature' => $list['decision']['nature'],
|
||||
@ -409,8 +445,7 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
->where('num_depot=?', $list['num_depot'])
|
||||
->where('date_depot=?', $list['date_depot'])
|
||||
->where('date_acte=?', $list['date_acte'])
|
||||
->where('num_acte=?', $list['num_acte'])
|
||||
->where('type_acte=?', $list['type_acte']); //Attention type lors du téléchargement
|
||||
->where('num_acte=?', $list['num_acte']);
|
||||
if ( null === $acteM->fetchRow($sql) ) {
|
||||
$result = $acteM->insert($data);
|
||||
}
|
||||
|
@ -13,6 +13,12 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* consolides|sociaux
|
||||
* @var string
|
||||
*/
|
||||
public $type_comptes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $siren
|
||||
@ -36,6 +42,7 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $onlyDb
|
||||
* @return array
|
||||
*/
|
||||
@ -49,7 +56,12 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
if ( $onlyDb === false ) {
|
||||
$this->debug = true;
|
||||
//Infogreffe webservice
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch( Exception $e ) {
|
||||
//@todo : get error message
|
||||
return array();
|
||||
}
|
||||
$bilansXML = $this->formatList($xml);
|
||||
}
|
||||
|
||||
@ -70,11 +82,14 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
$item->Millesime = $row->millesime;
|
||||
$item->NumDepot = $row->num_depot;
|
||||
$item->DateCloture = $row->date_cloture;
|
||||
if ( empty($type_comptes) ) {
|
||||
$item->Type = 'sociaux';
|
||||
} else {
|
||||
$item->Type = $row->type_comptes;
|
||||
|
||||
}
|
||||
$mode_diffusion = explode(',', $row->mode_diffusion);
|
||||
//@todo : si présence de fichier alors mode T
|
||||
if (in_array('T',$mode_diffusion)) {
|
||||
|
||||
if (in_array('T',$mode_diffusion) || !empty($item->File)) {
|
||||
$item->ModeDiffusion = 'T';
|
||||
} elseif (in_array('C',$mode_diffusion)) {
|
||||
$item->ModeDiffusion = 'C';
|
||||
@ -180,12 +195,11 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
* @todo : Vérifier fonctionnement
|
||||
* @param string $dateCloture
|
||||
* @param string $type
|
||||
* @param string $email
|
||||
* @param string $reference
|
||||
* @throws Exception
|
||||
* @return unknown
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCommandeC($dateCloture = null, $type = 'sociaux', $email = '', $reference = '')
|
||||
public function getCommandeC($dateCloture = null, $type = 'sociaux', $reference = '')
|
||||
{
|
||||
$this->mode_diffusion = 'C';
|
||||
|
||||
@ -204,36 +218,7 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
throw new Exception('Not exist');
|
||||
}
|
||||
|
||||
/*
|
||||
- Importer table commandes
|
||||
- Renommer en table greffes_commandes
|
||||
- Supprimer colonnes idUser, typeCommande
|
||||
- Ajouter colonnes typeDocument, raisonSociale, refClient
|
||||
|
||||
*/
|
||||
|
||||
//Attention, si mode diffusion vide => alors faire commande courrier SD
|
||||
|
||||
//Enregistrer la commande dans la base de données
|
||||
// commandes => Créer la table dans BigData
|
||||
|
||||
// id => id de la commande
|
||||
// login => login
|
||||
// email => email de l'utilisateur
|
||||
|
||||
// Ajouter référence client
|
||||
|
||||
// typeDocument => BI, AC ($this->type_document)
|
||||
// siren => siren de la société
|
||||
// raisonSociale => RS de la société getIdentiteLight()
|
||||
// refDocument =>
|
||||
// libDocument =>
|
||||
// commentaire =>
|
||||
// dateCommande =>
|
||||
// dateReception =>
|
||||
|
||||
//Récuperer l'id de commande - depuis la base de données
|
||||
$this->reference_client = 'G'.$id;
|
||||
$this->reference_client = $reference;
|
||||
|
||||
//Générer les paramètres de commande depuis la base de données
|
||||
$this->greffe = $row->numGreffe;
|
||||
@ -248,9 +233,10 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
$xml = $this->callRequest();
|
||||
} catch(Exception $e) {
|
||||
//@todo : Gestion des erreurs
|
||||
return false;
|
||||
}
|
||||
|
||||
return $id;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,9 +316,9 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
$date = $bilan['date_cloture_iso'];
|
||||
if( !empty($date) )
|
||||
{
|
||||
$datef = substr($date,0,4).substr($date,5,2).substr($date,8,2);
|
||||
$key = substr($date,0,4).substr($date,5,2).substr($date,8,2).'-'.$bilan['num_depot'];
|
||||
//Affectation liste générale avec un index permettant le tri
|
||||
$bilans[$datef] = $bilan;
|
||||
$bilans[$key] = $bilan;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -393,14 +379,13 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
$bilanM = new Application_Model_JoGreffesBilans();
|
||||
$sql = $bilanM->select()
|
||||
->where('siren=?', $this->siren)
|
||||
->where('date_cloture=?', $list['date_cloture_iso']);
|
||||
if ( null === $bilanM->fetchRow($sql) ) {
|
||||
->where('date_cloture=?', $list['date_cloture_iso'])
|
||||
->where('type_comptes=?', $list['type_comptes']);
|
||||
$test = $bilanM->fetchRow($sql);
|
||||
if ( null === $test ) {
|
||||
$result = $bilanM->insert($data);
|
||||
} else {
|
||||
$result = $bilanM->update($data, array(
|
||||
'siren="'.$list['num_siren'].'"',
|
||||
'date_cloture="'.$list['date_cloture_iso'].'"',
|
||||
));
|
||||
$result = $bilanM->update($data, 'id='.$test->id);
|
||||
}
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
@ -423,18 +408,20 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
* @param string $version
|
||||
* @return boolean
|
||||
*/
|
||||
protected function dbSetFile($filename, $size, $numberOfPage, $version)
|
||||
public function dbSetFile($filename, $size, $numberOfPage, $version)
|
||||
{
|
||||
$data = array(
|
||||
'pdfLink' => $filename,
|
||||
'pdfSize' => $size,
|
||||
'pdfPage' => $numberOfPage,
|
||||
'pdfVer' => $version
|
||||
'pdfVer' => $version,
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
|
||||
$where = array(
|
||||
'siren="'.$this->siren."'",
|
||||
'date_cloture="'.$this->date_cloture."'",
|
||||
'siren='.$this->siren,
|
||||
'date_cloture="'.substr($this->date_cloture,0,4).'-'.substr($this->date_cloture,4,2).'-'.substr($this->date_cloture,6,2).'"',
|
||||
'type_comptes="'.$this->type_comptes.'"',
|
||||
);
|
||||
|
||||
try {
|
||||
|
98
1.2/library/Metier/Search/Engine.php
Normal file
98
1.2/library/Metier/Search/Engine.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
class Metier_Search_Engine
|
||||
{
|
||||
protected $client = null;
|
||||
protected $host = null;
|
||||
protected $port = null;
|
||||
protected $timeout = 1;
|
||||
protected $offset = 0;
|
||||
protected $limit = 300;
|
||||
protected $max_matches = 1000;
|
||||
protected $query = null;
|
||||
|
||||
public function __construct($version = 1)
|
||||
{
|
||||
//Load the API following the version
|
||||
if ($version == 1){
|
||||
require_once 'Vendors/sphinxapi/sphinxapi-0.9.9.php';
|
||||
} elseif ($version == 2){
|
||||
require_once 'Vendors/sphinxapi/sphinxapi-2.1.2.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function loadClient()
|
||||
{
|
||||
if ( null === $this->host ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( null === $this->port ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->client = new SphinxClient();
|
||||
$this->client->SetServer( $this->host, $this->port );
|
||||
$this->client->SetConnectTimeout( $timeout );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setHost($value)
|
||||
{
|
||||
$this->host = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setPort($value)
|
||||
{
|
||||
$this->port = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setOffset($value)
|
||||
{
|
||||
$this->offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setLimit($value)
|
||||
{
|
||||
$this->limit = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setMaxMatches($value)
|
||||
{
|
||||
$this->max_matches = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function constructQuery($p)
|
||||
{
|
||||
$this->query = $p;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -21,6 +21,12 @@ class Metier_Sfr
|
||||
*/
|
||||
public $notCalculateInError = false;
|
||||
|
||||
/**
|
||||
* Force la récupération de l'identite et de toutes les valeurs
|
||||
* @var boolean
|
||||
*/
|
||||
public $forceIdentite = false;
|
||||
|
||||
/**
|
||||
* Debug mode
|
||||
* @var boolean
|
||||
@ -432,6 +438,8 @@ class Metier_Sfr
|
||||
{
|
||||
Zend_Date::setOptions(array('extend_month' => true));
|
||||
|
||||
if ($this->debug) file_put_contents('sfr.log', "SIREN = $siren\n", FILE_APPEND);
|
||||
|
||||
//Set ValContratAge
|
||||
if ( !empty($this->ValContratDate) ) {
|
||||
$dateContrat = new Zend_Date($this->ValContratDate, 'yyyyMMdd');
|
||||
@ -508,9 +516,13 @@ class Metier_Sfr
|
||||
$this->SituationJuridique = $result->procol;
|
||||
}
|
||||
|
||||
//Aucun résultat, faire le calcul || donnée manquante
|
||||
if ( $this->ValNAF === null || $this->ValFJ === null || $this->ValInseeActif === null
|
||||
|| $this->ValInseeAge === null) {
|
||||
//Aucun résultat, faire le calcul || donnée manquante || force identite
|
||||
if ( $this->ValNAF === null
|
||||
|| $this->ValFJ === null
|
||||
|| $this->ValInseeActif === null
|
||||
|| $this->ValInseeAge === null
|
||||
|| $this->forceIdentite === true
|
||||
) {
|
||||
|
||||
//Identite - @todo : Gérer les erreurs techniques
|
||||
$identite = $classInsee->getIdentiteEntreprise($siren, 0, 0, false, false);
|
||||
@ -677,9 +689,6 @@ class Metier_Sfr
|
||||
$this->rules($type);
|
||||
}
|
||||
|
||||
//Init displayPO
|
||||
$this->displayPo = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -896,6 +896,20 @@ return array(
|
||||
'Version' => 12,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'2103' => array(
|
||||
'libEven' => "Transformation du capital fixe en variable",
|
||||
'Bodacc_Code' => "BODB",
|
||||
'Rubrique' => "mmd",
|
||||
'Version' => 18,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'2104' => array(
|
||||
'libEven' => "Transformation du capital variable en capital fixe",
|
||||
'Bodacc_Code' => "BODB",
|
||||
'Rubrique' => "mmd",
|
||||
'Version' => 18,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'2200' => array(
|
||||
'libEven' => "Cessation d'activité",
|
||||
'Bodacc_Code' => "BODB",
|
||||
@ -1561,6 +1575,13 @@ return array(
|
||||
'Version' => 12,
|
||||
'LienEtab' => 1,
|
||||
),
|
||||
'2893' => array(
|
||||
'libEven' => "Location gérance relative à une partie du fonds",
|
||||
'Bodacc_Code' => "BODB",
|
||||
'Rubrique' => "mmd",
|
||||
'Version' => 18,
|
||||
'LienEtab' => 1,
|
||||
),
|
||||
'2900' => array(
|
||||
'libEven' => "Transfert d'établissement",
|
||||
'Bodacc_Code' => "BODB",
|
||||
@ -1841,6 +1862,13 @@ return array(
|
||||
'Version' => 12,
|
||||
'LienEtab' => 1,
|
||||
),
|
||||
'5106' => array(
|
||||
'libEven' => "Cession de l'exploitation agricole",
|
||||
'Bodacc_Code' => "BODA",
|
||||
'Rubrique' => "ventes",
|
||||
'Version' => 18,
|
||||
'LienEtab' => 1,
|
||||
),
|
||||
'5200' => array(
|
||||
'libEven' => "Branche ou Partie d'activité",
|
||||
'Bodacc_Code' => "BODA",
|
||||
@ -1989,7 +2017,7 @@ return array(
|
||||
'LienEtab' => 1,
|
||||
),
|
||||
'5600' => array(
|
||||
'libEven' => "Entreprise « Précédent exploitant »",
|
||||
'libEven' => "Entreprise « Précédent exploitant »",
|
||||
'Bodacc_Code' => "BODA",
|
||||
'Rubrique' => "ventes",
|
||||
'Version' => 12,
|
||||
|
@ -1,302 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
<?
|
||||
|
||||
function isinPoidsLettre($lettre) {
|
||||
$ascii=ord($lettre);
|
||||
if ($ascii>64 && $ascii<91 )
|
||||
/* En ASCII : A=65 et Z=90
|
||||
En ISIN... A=10 et Z=35 */
|
||||
return ($ascii-55);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Test si un code ISIN donné est valable à partir de son algo de contrôle.
|
||||
** @param string $isin Code ISIN à vérifier
|
||||
** @return bool
|
||||
**/
|
||||
function isValidIsin($isin) {
|
||||
|
||||
$pays=substr($isin, 0,2);
|
||||
$nsin=''.substr($isin, 2,9);
|
||||
$clef=substr($isin,11,1)*1;
|
||||
|
||||
$calcul=''.isinPoidsLettre($pays[0]).isinPoidsLettre($pays[1]).$nsin;
|
||||
//echo "Etape 1 = $calcul".EOL;
|
||||
|
||||
$sommeImpair=$sommePair=0;
|
||||
for ($impair=0; $impair<12; $impair=$impair+2) {
|
||||
$strImpair=''.$calcul[$impair]*2;
|
||||
if (isset($strImpair[1])) $reste=$strImpair[1]*1;
|
||||
else $reste=0;
|
||||
$sommeImpair+=$strImpair[0]*1+$reste;
|
||||
}
|
||||
|
||||
for ($pair=1; $pair<12; $pair=$pair+2)
|
||||
$sommePair+=$calcul[$pair]*1;
|
||||
|
||||
$totalcalcul=$sommeImpair+$sommePair;
|
||||
//echo "Etape 3 = $sommeImpair + $sommePair = $totalcalcul".EOL;
|
||||
|
||||
$dizSuperieur=ceil($totalcalcul/10)*10;
|
||||
$delta=$dizSuperieur-$totalcalcul;
|
||||
//echo "Etape 4 = $dizSuperieur - $totalcalcul = $delta".EOL;
|
||||
|
||||
if ($delta==$clef) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
?>
|
@ -1,339 +0,0 @@
|
||||
<?
|
||||
/** 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;
|
||||
}
|
||||
|
||||
|
||||
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é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éraire</b>'));
|
||||
$dispoPhoto =(bool)(strpos($value, '<b>Photo</b>'));
|
||||
$dispoWeb =(bool)(strpos($value, '<b>Site</b></a> '));
|
||||
$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];
|
||||
}
|
||||
?>
|
@ -1,548 +0,0 @@
|
||||
<?
|
||||
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 d\'activité notée le : ');
|
||||
if ($pos>0) $tabRet['dateAbsActivite']=substr($responseSiege, $pos+78, 10);
|
||||
else {
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence d\'activité');
|
||||
if ($pos>0) $tabRet['dateAbsActivite']='';
|
||||
}
|
||||
}
|
||||
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>n° SIRET :</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 de création :</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 :</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 :</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 :</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 </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é principale :</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 :</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(' ', '/', $AdresseTabLigne[0]);
|
||||
$tabRet['AdresseLigne2']=str_replace(' ', '/', $AdresseTabLigne[1]);
|
||||
$tabRet['AdresseLigne3']=str_replace(' ', '/', $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 est connue au répertoire comme ');
|
||||
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 est cessée le : ');
|
||||
$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 de création :</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 :</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é principale :</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 juridique :</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 établissements actifs :</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é</td>', 'class="basictext">', '</td>');
|
||||
$tabRet['adresseSiege']=getTextInHtml($pageHtml, '<td align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Siè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è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> </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é</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é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   (', '(', '</tr><tr>');
|
||||
$tabTmp=explode('</td>', $strCapital);
|
||||
$tabRet['capital_source']=str_replace(')', '', $tabTmp[0]);
|
||||
$tabTmp=explode(' ', $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> </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(' ', $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> </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> </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"> Qui sommes nous </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 </a>-<a href="http://www.coface.fr" target="_blank"> Qui sommes nous </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(' ', $tabRS_Adr[1]);
|
||||
$tabRet['AdresseLigne1']=trim($tabRS_Adr1[0]);
|
||||
$tabRet['AdresseLigne2']=trim($tabRS_Adr1[1]);
|
||||
$tabRS_Adr1=explode(' ', $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(' ', ' ', @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<>' ') {
|
||||
$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é</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'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é</td></tr>
|
||||
onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_INSCRIPTIONS_REQ')">Lancer la recherche sans l'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>
|
||||
*/
|
||||
}
|
||||
?>
|
@ -1,89 +0,0 @@
|
||||
<?
|
||||
//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"> </p>
|
||||
<p class="mongrasvert" align="right"> Référentiels
|
||||
d'avril 2006 </p>
|
||||
*/
|
||||
|
||||
} ?>
|
@ -1,170 +0,0 @@
|
||||
<?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:');
|
||||
|
||||
?>
|
@ -1,9 +0,0 @@
|
||||
<?
|
||||
class Rncs {
|
||||
|
||||
function Rncs () {}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
@ -1,795 +0,0 @@
|
||||
<?php
|
||||
require_once 'framework/common/chiffres.php';
|
||||
require_once 'framework/common/dates.php';
|
||||
require_once 'Metier/bodacc/classMBodacc.php';
|
||||
require_once 'Metier/insee/classMInsee.php';
|
||||
require_once 'Metier/partenaires/classMRncs.php';
|
||||
require_once 'Metier/partenaires/classMBilans.php';
|
||||
require_once 'Metier/partenaires/classMBourse.php';
|
||||
require_once 'Metier/partenaires/classMLiens.php';
|
||||
require_once 'Metier/scores/classMFinancier.php';
|
||||
require_once 'Metier/scores/classMSolvabilite.php';
|
||||
require_once 'Metier/scores/classMScores.php';
|
||||
require_once 'Metier/partenaires/classMTva.php';
|
||||
require_once 'Metier/partenaires/classMMap.php';
|
||||
require_once 'Metier/partenaires/classMGreffes.php';
|
||||
require_once 'Metier/partenaires/classMPrivileges.php';
|
||||
require_once 'Metier/scores/Variables/configMRatios.php';
|
||||
|
||||
require_once 'framework/mail/sendMail.php';
|
||||
|
||||
global $tabEvenSolib;
|
||||
global $tabEven2SO;
|
||||
global $tabEven2RO;
|
||||
|
||||
$tabEvenSolib=array(1=>'CR',
|
||||
11=>'CR',
|
||||
13=>'CR',
|
||||
14=>'CR',
|
||||
15=>'CR',
|
||||
16=>'CR',
|
||||
17=>'CR',
|
||||
18=>'CR',
|
||||
19=>'CR',
|
||||
2=>'VT',
|
||||
21=>'VT',
|
||||
22=>'VT',
|
||||
24=>'VT',
|
||||
25=>'VT',
|
||||
3=>'CE',
|
||||
31=>'ME',
|
||||
32=>'ME',
|
||||
33=>'ME',
|
||||
34=>'ME',
|
||||
35=>'Rec',
|
||||
36=>'MAF',
|
||||
37=>'LG',
|
||||
38=>'LG',
|
||||
39=>'MD',
|
||||
4=>'RD',
|
||||
41=>'DIS',
|
||||
42=>'FLG',
|
||||
51=>'RJ',
|
||||
52=>'RJ',
|
||||
53=>'RA',
|
||||
56=>'PIE',
|
||||
57=>'SAUVJ',
|
||||
58=>'SAUVP',
|
||||
59=>'RR',
|
||||
6=>'R&L',
|
||||
61=>'LB',
|
||||
62=>'LJ',
|
||||
63=>'FP',
|
||||
64=>'INT',
|
||||
65=>'LQ',
|
||||
69=>'RL',
|
||||
7=>'Suite',
|
||||
71=>'SRJ',
|
||||
72=>'SRLJ',
|
||||
73=>'SP',
|
||||
74=>'AP',
|
||||
75=>'MP',
|
||||
76=>'EP',
|
||||
77=>'PRO',
|
||||
78=>'DC',
|
||||
79=>'CIA',
|
||||
8=>'INFR',
|
||||
91=>'DC',
|
||||
92=>'CP',
|
||||
);
|
||||
|
||||
$tabEven2SO=array( // PROCOL
|
||||
1010=>92, // Déclaration de cessation de paiement
|
||||
1050=>7, // Homologation de la conciliation
|
||||
1055=>7, // Résolution de la conciliation
|
||||
1100=>57, // Jugement de sauvegarde
|
||||
1101=>58, // Plan de sauvegarde
|
||||
1200=>52, // Redressement Judiciaire
|
||||
1201=>52, // Conversion sauvegarde en Redressement Judiciaire
|
||||
1202=>75, // Renouv. Periode Observation
|
||||
1203=>78, // Avis de dépot de l'état de collocation
|
||||
1204=>78, // Dépôt des créances
|
||||
1205=>78,
|
||||
1206=>78,
|
||||
1207=>53, // Règlemement amiable
|
||||
1208=>78,
|
||||
1209=>51, // Règlement Judiciaire
|
||||
1210=>77, // Production
|
||||
1211=>52, // Redressement Judiciaire par extension au(x) gérant(s)
|
||||
1212=>69, // Rectif ou Annul.LJ
|
||||
1214=>78, // Avis de dépôt de l'état des créances (Loi de 1985)
|
||||
1215=>7, // Jugement de désignation des organes de la procédure
|
||||
1216=>78, // Autre avis de dépôt
|
||||
1300=>62, // Conversion Redressement Judiciaire en Liquidation
|
||||
1301=>62, // Ouverture Liquidation Judiciaire
|
||||
1302=>66, // Ouverture Liquidation Judiciaire Simplifiée
|
||||
1303=>62, // Ouverture Liquidation Judiciaire sur résolution
|
||||
1304=>62, // Réouverture Liquidation Judiciaire
|
||||
1305=>62, // Liquidation Judiciaire
|
||||
1306=>66, // Liquidation Judiciaire simplifiée
|
||||
1307=>62, // Conversion sauvegarde en Liquidation Judiciaire
|
||||
1308=>62, // Fin du régime de Liquidation Judiciaire Simplifiée
|
||||
1309=>62, // Conversion Liquidation Judiciaire en Liquidation
|
||||
1310=>56, // Procédure d'Insolvabilité Européenne
|
||||
1311=>62, // Liquidation Judiciaire par extension au(x) gérants
|
||||
1312=>62, // Liquidation Judiciaire avec continuation d'exploitation
|
||||
1313=>62, // Liquidation Judiciaire sans remise des accessoires
|
||||
1346=>7, // Procédure d'insolvabilité (Règlement 1346/2000 du Conseil Européen)
|
||||
1400=>7, // Nomination d'un administrateur judiciaire
|
||||
1401=>7, // Nomination d'un mandataire judiciaire
|
||||
1402=>7, // Nomination d'un représentant des créanciers
|
||||
1403=>7, // Nominnation/Remplacement de commissaire à l'exécution du plan
|
||||
1404=>7, // Prolongement de la mission du commissaire à l'exécution du plan
|
||||
1405=>7, // Nomination d'un juge commissaire
|
||||
1406=>7, // Changement de SYNDIC
|
||||
1407=>75, // Modif. de Plan
|
||||
1408=>75, // Modification du plan de cession
|
||||
1409=>75, // Modif. de de continuation
|
||||
1410=>75, // Suite de jugement/règlement/liquidation
|
||||
1411=>75, // Arrêt du plan de cession
|
||||
1412=>75, // Arrêt du plan de cession partielle
|
||||
1413=>75, // Arrêt du plan de continuation
|
||||
1414=>75, // Arrêt du plan de redressement
|
||||
1415=>75, // Prolongement du plan cession
|
||||
1416=>75, // Jugement constatant la bonne exécution du plan
|
||||
1417=>62, // Jugement d'extension de liquidation judiciaire
|
||||
1418=>52, // Jugement d'extension d'une procédure de redressement judiciaire
|
||||
1419=>57, // Jugement d'extension d'une procédure de sauvegarde
|
||||
1420=>7, // Nomination d'un liquidateur judiciaire
|
||||
1421=>7, // Jugement prorogeant le plan de redressement
|
||||
1425=>7, // Plan de cession avec location gérance
|
||||
1430=>7, // Jugement autorisant la poursuite d'activité
|
||||
1431=>7, // Jugement de cessation partielle d'activité
|
||||
1435=>7, // Suspension de l'exécution provisoire
|
||||
1436=>7, // Suspension provisoire des poursuites
|
||||
1440=>7, // Jugement accordant un délai pour déposer la liste des créances
|
||||
1445=>7, // Concordat
|
||||
1450=>92, //Cessation paiement
|
||||
1455=>7, // Jugement arrêtant le plan d'apurement du passif
|
||||
1460=>7, // Homologation du plan
|
||||
1470=>7, // Fin de mission d'administrateur judiciaire
|
||||
1480=>7, // Jugement ordonnant la jonction des procédures
|
||||
1500=>79, // Clôture de la procédure
|
||||
1501=>79, // Clôture de la procédure après cession totale
|
||||
1502=>76, // Clôture de la procédure pour extinction du passif
|
||||
1503=>79, // Cloture insuf.Actif
|
||||
1504=>79, // Clôture sauvegarde pour absence de projet de plan
|
||||
1505=>74, // Appel de jugement
|
||||
1506=>59, // Rectif ou Annulation RJ
|
||||
1507=>74, // Appel de jugement
|
||||
1508=>7, // Extinction du plan de sauvegarde
|
||||
1509=>7, // Extinction du plan de redressement
|
||||
1510=>74, // Rejet du plan
|
||||
1511=>7, // Résolution du plan de cession
|
||||
1512=>7, // Résolution du plan de continuation
|
||||
1513=>7, // Résolution du plan de sauvegarde
|
||||
1515=>74, // Arrêt divers
|
||||
1517=>59, // Rectification d'une erreur matérielle
|
||||
1520=>7, // Ordonnance
|
||||
1525=>74, // Appel du ministère public
|
||||
1530=>7, // Jugement constatant l'impécuniosité de la procédure de liquidation
|
||||
1540=>7, // Ordonnance statuant sur les contestations du projet de répartition
|
||||
1541=>74, // Rétractation de prononcé de liquidation judiciaire sur tierce opposition
|
||||
1542=>74, // Rétractation de jugement d'ouverture d'une procédure de sauvegarde sur tierce opposition
|
||||
1543=>74, // Rétractation de jugement d'ouverture d'une procédure de redressement judiciaire sur tierce opposition
|
||||
1544=>74, // Rétractation de jugement d'ouverture d'une procédure de liquidation judiciaire sur tierce opposition
|
||||
1545=>74, // Rétractation de jugement d'ouverture sur tierce opposition
|
||||
1546=>74, // Autre rétractation sur tierce opposition
|
||||
1550=>7, // Suites de jugements
|
||||
1580=>7, // Jugement prononçant la continuation de l'activité par apurement du passif
|
||||
1600=>63, // Faillite personnelle
|
||||
1601=>64, // Interdiction de gérer
|
||||
1602=>7, // Jugement de réhabilitation
|
||||
1603=>61, // Liquidation de Biens
|
||||
1604=>8, // Banqueroute
|
||||
1605=>7, // Jugement autorisant la reprise des poursuites individuelles
|
||||
1610=>8, // Faillite personnelle (Loi de 1985)
|
||||
1611=>8, // Interdiction de gérer (Loi de 1985)
|
||||
1620=>7, // Jugement condamnant le dirigeant en comblement du passif
|
||||
1650=>8, // Rétablissement Personnel
|
||||
1700=>7, // Décision soumise à publicité
|
||||
1900=>8, // Interdiction temporaire d'exercice de la profession de CAC
|
||||
1901=>8, // Radiation de la liste des CAC
|
||||
1999=>7, // Autre procédure collective
|
||||
// MMD
|
||||
2000=>4, // Mention d'office
|
||||
2100=>39, // Chg.Capital/Cess.apport de parts
|
||||
2101=>39, // Chg.Capital/Cess.apport de parts
|
||||
2102=>39, // Chg.Capital/Cess.apport de parts
|
||||
2200=>4, // Cessation d'activité
|
||||
2201=>4, // Cessation d'activité temporaire
|
||||
2202=>41, // Dissolution
|
||||
2203=>41, // Dissolution de la société
|
||||
2204=>41, // Cessation d'activité avec dissolution
|
||||
2205=>4, // Fermeture du fonds
|
||||
2206=>39, // Mise en sommeil de la société
|
||||
2207=>39, // Suppression d'une branche d'activité
|
||||
2208=>39, // Suppression de l'établissement principal
|
||||
2209=>39, // Vente du fonds
|
||||
2210=>39, // Déclaration de dissolution par l'associé unique.
|
||||
2211=>39, // Clôture de la liquidation
|
||||
2212=>39, // Liquidation amiable
|
||||
2300=>39, // Changement d'Adresse
|
||||
2301=>39, // Modification de l'adresse du siège
|
||||
2302=>39, // Modification de l'enseigne
|
||||
2303=>39, // Modification de la date de clôture de l'exercice
|
||||
2304=>39, // Modification de la date de début d'activité
|
||||
2305=>39, // Modification de la dénomination
|
||||
2306=>39, // Modification de la durée de la société
|
||||
2307=>39, // Modification de la forme juridique
|
||||
2308=>39, // Modification du nom
|
||||
2309=>39, // Modification du nom commercial
|
||||
2310=>39, // Modification du pseudonyme
|
||||
2311=>39, // Modification sur l'exploitation
|
||||
2312=>39, // Modification(s) diverse(s)
|
||||
2313=>39, // Modification de l'activité
|
||||
2314=>39, // Poursuite de l'activité
|
||||
2315=>39, // Modification de l'administration
|
||||
2316=>39, // Mise en activité de la société
|
||||
2317=>39, // Modification du sigle
|
||||
2318=>39, // Modifications diverses
|
||||
2319=>39, // Poursuite de l'activité malgré la perte de plus de...
|
||||
2320=>39, // Reconsitution de l'actif net
|
||||
2321=>39, // Reconsitution de la moitié de l'actif net
|
||||
2350=>39, // Déclaration des associés (loi du 1er février 2005)
|
||||
2401=>39, // Changement de régime matrimonial
|
||||
2402=>39, // Changement de régime matrimonial (divorce)
|
||||
2403=>39, // Changement de régime matrimonial (mariage)
|
||||
2404=>39, // Changement de régime matrimonial (veuvage)
|
||||
2405=>39, // Changement de régime matrimonial (contrat de maria...
|
||||
2406=>39, // Reprise du fonds par le conjoint
|
||||
2407=>39, // Mention du conjoint collaborateur
|
||||
2408=>39, // Radiation du conjoint collaborateur
|
||||
2500=>3, // Confirmation établissement principal ou secondaire
|
||||
2510=>39, // L'établissement secondaire devient principal
|
||||
2520=>39, // Extension de l'établissement principal
|
||||
2600=>39, // Décès
|
||||
2610=>39, // Décision de l'unique actionnaire
|
||||
2620=>39, // Transmission universelle du patrimoine
|
||||
2630=>39, // Donation/Partage
|
||||
2635=>39, // Cession de parts
|
||||
2639=>39, // Nantissement de parts sociales
|
||||
2640=>39, // Changement de domicile personnel
|
||||
2650=>39, // Changement de nationalité
|
||||
2660=>39, // Réalisation de l'apport partiel d'actif
|
||||
2661=>39, // Apport partiel
|
||||
2700=>39, // Fusion/Absorption (entitée absorbante)
|
||||
2701=>39, // Fusion/Absorption (Entitée absorbante. Entité abso...
|
||||
2702=>39, // Fusion/Absorption (Entitée absorbante. Entité abso...
|
||||
2703=>39, // Fusion/Absorption (Entitée absorbante. Entité abso...
|
||||
2710=>39, // Projet de fusion (entitée absorbante)
|
||||
2720=>39, // Fusion/Absorption (entitée absorbée)
|
||||
2721=>39, // Fusion/Absorption (entitée absorbée non identifiée...
|
||||
2725=>39, // Fusion/Absorption
|
||||
2726=>39, // Projet de Fusion/Absorption
|
||||
2730=>39, // Projet de fusion (entitée absorbée)
|
||||
2740=>39, // Scission
|
||||
2750=>39, // Société participation
|
||||
2800=>37, // Location gérance reçue
|
||||
2840=>38, // Location/Gérance
|
||||
2850=>38, // Location gérance donnée : Précédent propriétaire e...
|
||||
2851=>38, // Location gérance donnée : Précédent propriétaire
|
||||
2860=>38, // Location gérance donnée : Précédent exploitant
|
||||
2870=>38, // Location gérance donnée
|
||||
2875=>38, // Gérance/Mandat
|
||||
2880=>38, // Renouvellement de location gérance
|
||||
2881=>38, // Changement de location gérance
|
||||
2885=>42, // Fin de location gérance
|
||||
2890=>38, // Location gérance relative à une branche
|
||||
2891=>39, // Location gérance relative à un établissement
|
||||
2892=>39, // Location gérance relative à un fond
|
||||
2900=>32, // Transfert d'établissement
|
||||
2901=>32, // Transfert de siège
|
||||
2902=>32, // Transfert du fonds
|
||||
2903=>32, // Projet de transfert du siège
|
||||
2904=>32, // Transfert du siège à l'étranger
|
||||
2950=>32, // Création de fonds
|
||||
2980=>32, // Transfert entre tribunaux
|
||||
// DEPOTS DES COMPTES
|
||||
3100=>91,
|
||||
3200=>91,
|
||||
3300=>91,
|
||||
3999=>91,
|
||||
// CREATIONS
|
||||
4000=>1, // Création d'entreprise
|
||||
4050=>1, // Création d'entreprise sans activité
|
||||
4100=>1, // Création d'entreprise sans établissement
|
||||
4200=>17, // Création d'établissement
|
||||
4250=>17, // Création suite à transfert
|
||||
4300=>17, // Création suite à reprise d'activité
|
||||
4350=>1, // Création suite à fin de location-gérance
|
||||
4355=>1, // Création suite à prise en location-gérance
|
||||
4360=>1, // Reprise d'activité par suite de la résolution de v
|
||||
4400=>1, // Création suite à changement de FJ
|
||||
4410=>1, // Création suite à héritage ou donation
|
||||
4450=>1, // Création suite à reprise par le conjoint
|
||||
4500=>17, // Fonds acquis dans le cadre d'une PC
|
||||
4501=>17, // Fonds acquis par achat
|
||||
4502=>17, // Fonds acquis par apport
|
||||
4600=>1, // Immatriculation d'une société de droit européen
|
||||
4999=>1, // Création
|
||||
|
||||
// ventes !!!
|
||||
5500=>2, // Entreprise réalisant la vente
|
||||
5501=>2, // Entreprise réalisant la vente : Ancien propriétair... BODA ventes 12 0000-00-00 00:00:00
|
||||
5502=>2, // Entreprise réalisant la vente : Ancien propriétair... BODA ventes 12 0000-00-00 00:00:00
|
||||
5503=>2, // Entreprise réalisant la vente : Ancien propriétair... BODA ventes 12 0000-00-00 00:00:00
|
||||
5510=>2, // Entreprise réalisant la vente : Co-propriétaire BODA ventes 12 0000-00-00 00:00:00
|
||||
5600=>2, // Entreprise réalisant l'acquisition BODA ventes 12 0000-00-00 00:00:00
|
||||
5650=>2,
|
||||
5700=>2, // Entreprise réalisant l'acquisition BODA ventes 12 0000-00-00 00:00:00
|
||||
5999=>2,
|
||||
|
||||
// RADIATIONS
|
||||
6000=>4, //Radiation pour cause de clôture de la liquidation (amiable/simplifié/général)
|
||||
6001=>4, //Radiation pour cause de clôture de la liquidation amiable
|
||||
6002=>4, //Radiation pour cause de clôture de la liquidation judiciaire pour IA
|
||||
6003=>4, //Radiation pour cause de clôture de la liquidation judiciaire
|
||||
6004=>4, //Radiation pour cause de clôture de la liquidation judiciaire simplifié
|
||||
6005=>4, //Radiation pour clôture du plan de cession
|
||||
6100=>4, //Radiation pour cause de décès
|
||||
6200=>4, //Radiation pour cause de mention d'office
|
||||
6201=>4, //Radiation pour cause de cessation d'activité
|
||||
6300=>4, //Radiation pour cause de non-exercice
|
||||
6400=>4, //Radiation pour cause de transfert
|
||||
6500=>4, //Radiation pour cause de jugement de clôture du plan de cession
|
||||
6600=>4, //Radiation d'un établissement
|
||||
6700=>4, //Radiation
|
||||
);
|
||||
$tabEven2RO=array( 2305=>'a',
|
||||
2308=>'a', // Chg de dénomination(RS,Ens,Sigle)
|
||||
2309=>'a', // Modification du nom commercial BODB mmd 12 0000-00-00 00:00:00
|
||||
2310=>'a', // Modification du pseudonyme
|
||||
2300=>'b', // Changement d'Adresse
|
||||
2301=>'b',
|
||||
2900=>'b', // Transfert d'établissement
|
||||
2901=>'b', // Transfert de siège
|
||||
2902=>'b', // Transfert du fonds
|
||||
2903=>'b', // Projet de transfert du siège
|
||||
2904=>'b', // Transfert du siège à l'étranger
|
||||
2950=>'b', // Création de fonds
|
||||
2980=>'b', // Transfert entre tribunaux
|
||||
2101=>'c', // Chg.Capital/Cess.apport de parts
|
||||
2315=>'d', // Changement de Dirigeants
|
||||
2313=>'e', // Mod Act/obj.soc./Cess./Mise somm.
|
||||
2307=>'f', // Changement de Forme juridique
|
||||
2318=>'g', // Opération sur Participations
|
||||
2725=>'h', // Fusion Absorption
|
||||
2318=>'i', // Mod.garantie financière/Caution
|
||||
2401=>'j', // Changement de régime matrimonial
|
||||
2319=>'k', // Non dissolution anticipée
|
||||
2318=>'l', // Non dissolution anticipée
|
||||
2318=>'m', // Dissolution anticipée (ou non)
|
||||
2303=>'n', // Mod.date cloture exercice social
|
||||
5500=>'V', // Entreprise réalisant la vente
|
||||
5501=>'V', // Entreprise réalisant la vente : Ancien propriétair... BODA ventes 12 0000-00-00 00:00:00
|
||||
5502=>'V', // Entreprise réalisant la vente : Ancien propriétair... BODA ventes 12 0000-00-00 00:00:00
|
||||
5503=>'V', // Entreprise réalisant la vente : Ancien propriétair... BODA ventes 12 0000-00-00 00:00:00
|
||||
5510=>'V', // Entreprise réalisant la vente : Co-propriétaire BODA ventes 12 0000-00-00 00:00:00
|
||||
5600=>'V',
|
||||
5650=>'V',
|
||||
5700=>'A', // Entreprise réalisant l'acquisition BODA ventes 12 0000-00-00 00:00:00
|
||||
1411=>'F', // Arrêt du plan de cession
|
||||
1408=>'G', // Modification du plan de cession
|
||||
1409=>'N', // Modification du plan de continuation
|
||||
1414=>'M', // Arrêt du plan de redressement
|
||||
|
||||
);
|
||||
|
||||
|
||||
function exporte($txt, $lon, $sep='') {
|
||||
$txt=strtr(trim($txt),array('''=>"'",'&'=>'&', '²'=>'²', "\r"=>'', "\n"=>'', "\t"=>''));
|
||||
|
||||
if ($sep=='') return sprintf("%-".$lon.'.'.$lon."s", $txt);
|
||||
|
||||
return trim(sprintf("%-".$lon.'.'.$lon."s", $txt)).$sep;
|
||||
}
|
||||
|
||||
|
||||
function conversionSd2So2000($nomFichierIn, $numeroAbonneBil='000960030', $nomFichierOut='', $optionFicheId='S') {
|
||||
|
||||
$message='';
|
||||
$iDb=new WDB();
|
||||
$iBodacc=new MBodacc();
|
||||
$iInsee=new MInsee();
|
||||
$iRncs=new MRncs();
|
||||
|
||||
global $tabEvenSolib;
|
||||
global $tabEven2SO;
|
||||
global $tabEven2RO;
|
||||
|
||||
$tabLignes=file($nomFichierIn);
|
||||
//print_r($tabLignes);
|
||||
//die();
|
||||
|
||||
$ligne001=$ligne100=$ligne104=$ligne999=0;
|
||||
if ($nomFichierOut=='') $nomFichierOut=$nomFichierIn.'.bil';
|
||||
|
||||
$fp=fopen($nomFichierOut, 'w');
|
||||
$dateJ=date('Ymd');
|
||||
$ecrireLignePre=false;
|
||||
|
||||
/** Codes/Variables à gérer **/
|
||||
$depPar=0;
|
||||
$SOSTAE='';
|
||||
$typeFicheId='I'; // Fiche Identifiant
|
||||
$optExtInsee=$optScore=false;
|
||||
|
||||
/** Type de fiche Id **/
|
||||
if (strpos($optionFicheId, 'S')==true) $typeFicheId='S'; // Fiche Standard
|
||||
elseif (strpos($optionFicheId, 'C')==true) $typeFicheId='C'; // Fiche Complète
|
||||
if (strpos($optionFicheId, 'E')==true) $optExtInsee=true; // Option Extension INSEE
|
||||
if (strpos($optionFicheId, 'N')==true) $optScore=true; // Option Score
|
||||
|
||||
foreach ($tabLignes as $i=>$ligne) {
|
||||
$typeLigne=substr($ligne, 0, 3)*1;
|
||||
switch ($typeLigne) {
|
||||
case 1: // Ligne ignorée
|
||||
// Ecriture de l'entête
|
||||
$ligne001++;
|
||||
break;
|
||||
case 100: // Structure Bodacc
|
||||
case 999: // Fin
|
||||
$strTxt=wordwrap($txtAnn, 39, EOL);
|
||||
$tabTxt=explode(EOL, $strTxt);
|
||||
foreach($tabTxt as $j=>$txt) {
|
||||
$SOSEQ++;
|
||||
if($j%16==0) {
|
||||
// Type d'enregistrement 1=EntConf, 2=Rejet, 4=Multipropo, 5=Suivi MAJ Entrep, 7=Infos, 8=Envoi documen, 9=Annonce
|
||||
$typEnr=9;
|
||||
if ($j==0) $ligneTXT =initstr($SONABO, 9, '0', ALIGN_RIGHT); // Numéro d'abonné BIL ?
|
||||
else $ligneTXT.=EOL.initstr($SONABO, 9, '0', ALIGN_RIGHT); // Numéro d'abonné BIL ?
|
||||
$ligneTXT.=initstr($SONUME, 9, '0', ALIGN_RIGHT); // Numéro d'entreprise BIL ?
|
||||
$ligneTXT.=initstr($SONUS, 9, '0', ALIGN_RIGHT); // Numéro d'UFS BIL ?
|
||||
$ligneTXT.=initstr($nann, 9, '0', ALIGN_RIGHT); // Numéro d'annonce BIL ?
|
||||
$ligneTXT.=initstr($siren, 9, '0', ALIGN_RIGHT); // Siren
|
||||
$ligneTXT.=initstr($nic, 5, '0', ALIGN_RIGHT); // Nic
|
||||
$ligneTXT.=exporte('SE', 2); // Code produit BIL ? SE, DE, DI, SJ
|
||||
$ligneTXT.=initstr($SOSEQ, 5, '0', ALIGN_RIGHT); // Numéro dans la séquence
|
||||
$ligneTXT.=initstr($dateJ, 8, '0', ALIGN_RIGHT); // Numéro dans la séquence
|
||||
$ligneTXT.=exporte($typEnr, 1); // Type d'enregistrement 1=EntConf, 2=Rejet, 4=Multipropo, 5=Suivi MAJ Entrep, 7=Infos, 8=Envoi documen, 9=Annonce
|
||||
$ligneTXT.=exporte('TXT', 3); // Structure identité
|
||||
$ligneTXT.=exporte('A', 1); // Confirmation 'A'uto ou 'C' pour manuelle
|
||||
$ligneTXT.=exporte($ref, 30); // Réf. Client
|
||||
$ligneTXT.=exporte($SOORIG, 1); // 1:Insee actif, 2=Ufs, 3=Annonce, 4=Manuelle, 5=Asso, 7=RCS actif, 8=Insee cessa eco, 9=Insee/RCS radié
|
||||
$ligneTXT.=exporte($SOJAL, 3); // 001=Bodacc A, 200=Bodacc B, 300=Bodacc C
|
||||
$ligneTXT.=initstr($datePar, 8, '0', ALIGN_RIGHT); // Date de parution
|
||||
$ligneTXT.=initstr(0, 5, '0', ALIGN_RIGHT); // Page
|
||||
$ligneTXT.=exporte($codeEve, 2); //
|
||||
$ligneTXT.=initstr($depPar, 2, '0', ALIGN_RIGHT);
|
||||
$ligneTXT.=initstr($numAnn, 6, '0', ALIGN_RIGHT);
|
||||
$ligneTXT.=exporte($codeRol, 1); //
|
||||
$ligneTXT.=exporte('T', 1);
|
||||
}
|
||||
$ligneTXT.=exporte($txt, 40);
|
||||
}
|
||||
$codeEve=$codeRol='';
|
||||
$ligneOut=$ligneID.EOL.$ligneANN.EOL.$ligneTXT;
|
||||
if ($ligne100>1) $ecrireLignePre=true;
|
||||
if($typeLigne==999) {
|
||||
$ligne999++;
|
||||
break;
|
||||
}
|
||||
|
||||
$nann = trim(substr($ligne, 3 , 10 ))*1; // N° d'annonce
|
||||
$siren = substr($ligne, 13 , 9 ); // Siren de l'entreprise concernée par l'annonce
|
||||
$tabIdentite=@$iInsee->getIdentiteEntreprise($siren);
|
||||
$nic = trim(substr($ligne, 22, 5 ))*1; // Nic
|
||||
$ref = trim(substr($ligne, 71, 18 )); // Référence Client
|
||||
$numPar = substr($ligne, 27 , 3 ); // Numéro de parution du Bodacc dans l'année
|
||||
$bodacc = substr($ligne, 30 , 1 ); // Code Bodacc (A, B ou C) A, B ou C
|
||||
$datePar= substr($ligne, 31 , 8 )*1; // Date de parution du Bodacc Format AAAAMMJJ
|
||||
$numAnn = substr($ligne, 39 , 5 ); // Numéro de l'annonce dans le Bodacc
|
||||
$typeAnn= substr($ligne, 47 , 1 ); // Type d'annonce Bodacc I=Insertion (publication d'une annonce), A=Additif (ajout à une précédente annonce), (1) R=Rectificatif (correction d'une annonce), S=Suppression d'une annonce
|
||||
$corNumA= substr($ligne, 48 , 5 ); // Numéro de l'annonce corrigée Si annonce différent de Insertion
|
||||
$corDate= substr($ligne, 53 , 8 ); // Date du Bodacc de l'annonce corrigée Si annonce différent de Insertion. Format AAAAMMJJ
|
||||
$corPage= substr($ligne, 61 , 6 ); // Première page du Bodacc de l'annonce corrigée Si annonce différent de Insertion
|
||||
$corNumP= substr($ligne, 67 , 4 ); // Numéro parution du Bodacc dans l'année de l'annonce corrigée Si annonce différent de Insertion
|
||||
$numRC = trim(substr($ligne,95 , 9 )); // Numéro de RC (Registre du Commerce) de l'entreprise
|
||||
$rs = trim(substr($ligne,104, 150 )); // Raison sociale de l'entreprise
|
||||
$nomCom = trim(substr($ligne,254, 100 )); // Nom Commerciale
|
||||
$ens = trim(substr($ligne,354, 100 )); // Enseigne
|
||||
$fj = trim(substr($ligne,484, 4 ))*1; // FJ
|
||||
$fjLib = trim(substr($ligne,488, 90 )); // FJ libellé
|
||||
$capMnt = trim(substr($ligne,578, 15 )); // Capital
|
||||
$capDev = trim(substr($ligne,593, 3 )); // Capital Devise
|
||||
$adrNum = trim(substr($ligne,596, 4 )); //
|
||||
$adrBtq = trim(substr($ligne,600, 1 )); // FJ libellé
|
||||
$adrVoi = trim(substr($ligne,601, 5 )); // FJ libellé
|
||||
$adrLib = trim(substr($ligne,606, 50 )); // FJ libellé
|
||||
$adrL2 = trim(substr($ligne,656, 50 )); // FJ libellé
|
||||
$adrL3 = trim(substr($ligne,706, 40 )); // FJ libellé
|
||||
$adrCP = trim(substr($ligne,746, 5 ))*1; // FJ libellé
|
||||
$adrVil = trim(substr($ligne,751, 45 )); // FJ libellé
|
||||
if ($adrCP==0) {
|
||||
$adrNum = trim(substr($ligne,796, 4 )); // FJ libellé
|
||||
$adrBtq = trim(substr($ligne,800, 1 )); // FJ libellé
|
||||
$adrVoi = trim(substr($ligne,801, 5 )); // FJ libellé
|
||||
$adrLib = trim(substr($ligne,806, 50 )); // FJ libellé
|
||||
$adrL2 = trim(substr($ligne,856, 50 )); // FJ libellé
|
||||
$adrL3 = trim(substr($ligne,906, 40 )); // FJ libellé
|
||||
$adrCP = trim(substr($ligne,946, 5 ))*1; // FJ libellé
|
||||
$adrVil = trim(substr($ligne,951, 45 )); // FJ libellé
|
||||
}
|
||||
$even=array();
|
||||
$even[7]= substr($ligne, 996 , 4 )*1; // Code Evènement Bodacc n°1 Cf. Table EVEN
|
||||
$even[6]= substr($ligne, 1000, 4 )*1; // Code Evènement Bodacc n°2 Cf. Table EVEN
|
||||
$even[5]= substr($ligne, 1004, 4 )*1; // Code Evènement Bodacc n°3 Cf. Table EVEN
|
||||
$even[4]= substr($ligne, 1008, 4 )*1; // Code Evènement Bodacc n°4 Cf. Table EVEN
|
||||
$even[3]= substr($ligne, 1012, 4 )*1; // Code Evènement Bodacc n°5 Cf. Table EVEN
|
||||
$even[2]= substr($ligne, 1016, 4 )*1; // Code Evènement Bodacc n°6 Cf. Table EVEN
|
||||
$even[1]= substr($ligne, 1020, 4 )*1; // Code Evènement Bodacc n°7 Cf. Table EVEN
|
||||
$even[0]= substr($ligne, 1024, 4 )*1; // Code Evènement Bodacc n°8 Cf. Table EVEN
|
||||
$txtEven='';
|
||||
foreach ($even as $codeEven)
|
||||
if ($codeEven<>0) {
|
||||
if (@$codeEve=='') $codeEve=$tabEven2SO[$codeEven];
|
||||
if (@$codeRol=='') $codeRol=$tabEven2RO[$codeEven];
|
||||
$txtEven.=$iBodacc->getEvenement($codeEven).', ';
|
||||
$catEven=$iBodacc->getChapitreEvenement($codeEven);
|
||||
}
|
||||
else
|
||||
$txtEven.='';
|
||||
$txtEven=substr($txtEven,0,strlen($txtEven)-2);
|
||||
$dateCess= substr($ligne, 1136, 8 )*1; // Date de cessat° des paiements
|
||||
$dateJuge= substr($ligne, 1144, 8 )*1; // Date de jugement
|
||||
$dateEffet=substr($ligne, 1161, 8 )*1; // Date d'effet
|
||||
if ($dateEffet*1==0) $dateEffet=$dateJuge;
|
||||
|
||||
$vteMnt=trim(substr($ligne, 1169, 15 ))*1; // Montant de la vente
|
||||
$vteDev=substr($ligne, 1184, 3 ); // Devise de la vente
|
||||
|
||||
|
||||
if ($nic*1==0) $nic=$tabIdentite['Nic'];
|
||||
|
||||
$SONABO=$numeroAbonneBil;
|
||||
if ($tabIdentite['Actif']==1) $SOORIG=1;
|
||||
elseif (!isset($tabIdentite['Actif'])) $SOORIG=3;
|
||||
elseif ($tabIdentite['Actif']==0 && ($tabIdentite['EntActiveRCS']==1||$tabIdentite['EtabActifRCS']==1)) $SOORIG=7;
|
||||
elseif ($tabIdentite['Actif']==0 && $tabIdentite['EntActiveRCS']==0 && $tabIdentite['EtabActifRCS']==0) $SOORIG=9;
|
||||
else $SOORIG=8;
|
||||
|
||||
if ($tabIdentite['Civilite']==1) $SOTSEX='M';
|
||||
elseif ($tabIdentite['Civilite']==2) $SOTSEX='F';
|
||||
else $SOTSEX='';
|
||||
$SONUME=''.preg_replace('/^0+/','', $tabIdentite['Source']).$tabIdentite['SourceId'];
|
||||
$SONUS='000000000';
|
||||
$SOSEQ=1;
|
||||
if ($adrCP==0) {
|
||||
$adrNum = $tabIdentite['AdresseNum'];
|
||||
$adrBtq = $tabIdentite['AdresseBtq'];
|
||||
$adrVoi = $tabIdentite['AdresseVoie'];
|
||||
$adrLib = $tabIdentite['AdresseRue'];
|
||||
$adrL2 = $tabIdentite['Adresse2'];
|
||||
$adrL3 = '';
|
||||
$adrCP = $tabIdentite['CP'];
|
||||
$adrVil = $tabIdentite['Ville'];
|
||||
}
|
||||
$typEnr=1;
|
||||
$DBILS2 =initstr($SONABO, 9, '0', ALIGN_RIGHT); // Numéro d'abonné BIL ?
|
||||
$DBILS2.=initstr($SONUME, 9, '0', ALIGN_RIGHT); // Numéro d'entreprise BIL ?
|
||||
$DBILS2.=initstr($SONUS, 9, '0', ALIGN_RIGHT); // Numéro d'UFS BIL ?
|
||||
$DBILS2.=initstr($nann, 9, '0', ALIGN_RIGHT); // Numéro d'annonce BIL ?
|
||||
$DBILS2.=initstr($siren, 9, '0', ALIGN_RIGHT); // Siren
|
||||
$DBILS2.=initstr($nic, 5, '0', ALIGN_RIGHT); // Nic
|
||||
$DBILS2.=exporte('SE', 2); // Code produit BIL ? SE, DE, DI, SJ
|
||||
$DBILS2.=initstr($SOSEQ, 5, '0', ALIGN_RIGHT); // Numéro dans la séquence dans le groupe
|
||||
$DBILS2.=initstr($dateJ, 8, '0', ALIGN_RIGHT); // Date d'envoi de l'info
|
||||
$DBILS2.=exporte($typEnr, 1); // Type d'enregistrement 1=EntConf, 2=Rejet, 4=Multipropo, 5=Suivi MAJ Entrep, 7=Infos, 8=Envoi documen, 9=Annonce
|
||||
$DBILS2.=exporte('ID', 3); // Structure identité
|
||||
$DBILS2.=exporte('A', 1); // Confirmation 'A'uto ou 'C' pour manuelle
|
||||
$DBILS2.=exporte($ref, 30); // Réf. Client
|
||||
//($annonce['codePostalSiege'], 5, '0', ALIGN_RIGHT)
|
||||
$DBILS2.=exporte($SOORIG, 1); // 1:Insee actif, 2=Ufs, 3=Annonce, 4=Manuelle, 5=Asso, 7=RCS actif, 8=Insee cessa eco, 9=Insee/RCS radié
|
||||
$DBILS2.=exporte('', 1); // D=Siren douteux
|
||||
$DBILS2.=exporte('', 9); // Témoin de MAJ
|
||||
$DBILS2.=exporte($rs, 60); //
|
||||
$DBILS2.=exporte(substr($rs,60),30); //
|
||||
$DBILS2.=exporte($tabIdentite['Sigle'], 30); // Vide !
|
||||
$DBILS2.=exporte($ens, 60); //
|
||||
$DBILS2.=initstr($adrNum, 4, '0', ALIGN_RIGHT); //
|
||||
$DBILS2.=exporte($adrBtq, 1); //
|
||||
$DBILS2.=exporte(preg_replace('/ +/',' ',$adrVoi.' '.$adrLib), 33); //
|
||||
$DBILS2.=exporte($adrVil, 32); //
|
||||
$DBILS2.=initstr($adrCP, 5, '0', ALIGN_RIGHT); //
|
||||
$DBILS2.=exporte(preg_replace('/ +/',' ',$adrL2.' '.$adrL3), 30); //
|
||||
$DBILS2.=initstr($tabIdentite['DateCreaEn'], 8, '0', ALIGN_RIGHT); // Date créa ENT
|
||||
$DBILS2.=exporte($tabIdentite['Siege'], 1); // Statut de l'établissement
|
||||
$DBILS2.=initstr($tabIdentite['FJ'], 4, 0, ALIGN_RIGHT);
|
||||
$DBILS2.=exporte($SOTSEX, 1); // Sexe M/F
|
||||
|
||||
$DBILS2.=initstr($tabIdentite['NbEtab']*1, 4, 0, ALIGN_RIGHT);
|
||||
$DBILS2.=exporte($SOSTAE, 4); // NAF4 ENT
|
||||
$DBILS2.=exporte('', 4); // Famille ENT
|
||||
$DBILS2.=exporte($SOSTAE, 4); // NAF4 ETAB
|
||||
$DBILS2.=exporte('', 4); // Famille ETAB
|
||||
$DBILS2.=exporte('', 1); // Indicateur Procol
|
||||
$DBILS2.=exporte('', 2); // Code monnaie
|
||||
$DBILS2.=initstr(0, 13, '0', ALIGN_RIGHT); // Montant du capital
|
||||
$DBILS2.=exporte('', 7); // Effectif
|
||||
$DBILS2.=exporte('', 9); // Num RC
|
||||
$DBILS2.=initstr(strtr($tabIdentite['Tel'],array('.'=>'','+'=>'00',' '=>'','-'=>'','/'=>'')), 10, '0', ALIGN_RIGHT);
|
||||
$DBILS2.=initstr(strtr($tabIdentite['Fax'],array('.'=>'','+'=>'00',' '=>'','-'=>'','/'=>'')), 10, '0', ALIGN_RIGHT);
|
||||
//5630Z5630Z RUE 00000000 00000000 2901929019
|
||||
$DBILS2.=exporte($tabIdentite['Web'], 40);
|
||||
$DBILS2.=exporte('', 3); // Qualité du dirigeant
|
||||
$DBILS2.=exporte('', 60); // NOM, Prénom du dirigeant
|
||||
$DBILS2.=initstr(0, 8, '0', ALIGN_RIGHT); // Date Naiss Diri
|
||||
// $DBILS2.=exporte('', 79);
|
||||
$DBILS2.=exporte('', 35); // Lieu de Naissance
|
||||
if ($optScore) {
|
||||
$tabTmp=$iDb->select('scores_surveillance',
|
||||
'siren, actif, procol, indiScore, indiScore20, encours, indiScoreDate, dateBilan, indiScorePre, indiScore20Pre, encoursPre, indiScoreDatePre, sourceModif, nbModifs, dateUpdate',
|
||||
"siren=$siren AND indiScoreDate>0", false, MYSQL_ASSOC);
|
||||
if (@$tabTmp[0]['siren']*1==$siren) {
|
||||
echo "$siren, parution Annonce le $datePar, calcul le ".@$tabTmp[0]['dateUpdate'].EOL;
|
||||
$tabScore=$tabTmp[0];
|
||||
$note=$tabScore['indiScore20'];
|
||||
$encours=round($tabScore['encours']/1000);
|
||||
} else {
|
||||
echo "$siren, parution Annonce le $datePar, pas de calcul !".EOL;
|
||||
$tabScore=@calculIndiScore($siren, $nic, false, 0, false);
|
||||
$note=$tabScore['Indiscore20'];
|
||||
$encours=round($tabScore['encours']/1000);
|
||||
}
|
||||
$encoursDev='EUR';
|
||||
} else
|
||||
$note=$encours=$encoursDev='';
|
||||
$DBILS2.=initstr($note, 2, '0', ALIGN_RIGHT); //37 Note sur 20
|
||||
$DBILS2.=initstr($encours, 7, '0', ALIGN_RIGHT); //44 Encours KE KF
|
||||
$DBILS2.=exporte('', 1); //45 Code paiement
|
||||
$DBILS2.=exporte('', 1); //46 Code situfi
|
||||
$DBILS2.=exporte('', 1); //47 Code Avis
|
||||
$DBILS2.=exporte($encoursDev,3); //47 Encours de la devise
|
||||
$DBILS2.=exporte('', 6); // Code Sicovam
|
||||
$DBILS2.=exporte('', 2); // Type de marché RM, CT, SM, HC, MO, NM, ML, AL, MR
|
||||
$DBILS2.=exporte('', 12); // Code ISIN
|
||||
$DBILS2.=exporte('', 9); // Filler Bil anciennement sur 83, 32 puis 9
|
||||
$DBILS2.=exporte($tabIdentite['NafEnt'], 5);
|
||||
$DBILS2.=exporte($tabIdentite['NafEtab'], 5);//
|
||||
$DBILS2.=exporte('', 18); //60 Filler
|
||||
$DBILS2.=exporte('', 4); // Filler RUE ?
|
||||
$DBILS2.=exporte('', 5); // Nic source cible de l'étab
|
||||
$DBILS2.=initstr(0, 8, '0', ALIGN_RIGHT); // Date de MAJ du capital
|
||||
$DBILS2.=exporte('', 3); // Monnaie d'origine du capital
|
||||
$DBILS2.=exporte('', 3); // Monnaie de livraison du capital (fin de l'ancien filler)
|
||||
$DBILS2.=initstr(0, 8, '0', ALIGN_RIGHT); // Date de création de l'établissement
|
||||
$DBILS2.=exporte('', 1); // Origine création
|
||||
$DBILS2.=exporte('', 2); // Tr Eff Ent
|
||||
$DBILS2.=exporte('', 2); // Tr Eff Etab
|
||||
$DBILS2.=exporte('', 2); // NAP 40 Entrep
|
||||
$DBILS2.=exporte('', 2); // NAP 40 Etab
|
||||
$DBILS2.=exporte('', 5); // Act Artisanale Etab
|
||||
$DBILS2.=exporte('', 1); // Modalité activité entrep
|
||||
$DBILS2.=exporte('', 1); // Modalité activité etab
|
||||
$DBILS2.=exporte('', 2); // Code Région Entrep
|
||||
$DBILS2.=exporte('', 2); // Code Région Etab
|
||||
$DBILS2.=exporte($tabIdentite['Dept'], 2); // Département du siège
|
||||
$DBILS2.=exporte($tabIdentite['codeCommune'], 3); // Localité
|
||||
$DBILS2.=exporte($tabIdentite['Dept'], 2); // Département de l'étab
|
||||
$DBILS2.=exporte($tabIdentite['codeCommune'], 3); // Localité
|
||||
$DBILS2.=exporte('', 1); // Dept Outre Mer
|
||||
$DBILS2.=exporte('', 1); // Arrondissement
|
||||
$DBILS2.=exporte('', 1); // Canton Dom ?
|
||||
$DBILS2.=exporte('', 2); // Canton
|
||||
$DBILS2.=exporte('', 8); // Code Ilot
|
||||
$DBILS2.=exporte('', 2); // ZEMET
|
||||
$DBILS2.=exporte('', 2); // Tranche Comm Etab
|
||||
$DBILS2.=exporte('', 2); // Dept Unite urbaine
|
||||
$DBILS2.=exporte('', 1); // Taille UU
|
||||
$DBILS2.=exporte('', 2); // UU etab
|
||||
$DBILS2.=exporte('', 5); // Code rivoli
|
||||
$DBILS2.=exporte('', 2); // PPale région entrep
|
||||
$DBILS2.=exporte('', 1); // Code monoreg
|
||||
$DBILS2.=exporte('', 1); // Code monoact
|
||||
$DBILS2.=exporte('', 1); // Code tranche CA
|
||||
$DBILS2.=exporte('', 1); // Tranche part CA export
|
||||
$DBILS2.=exporte('', 1); // RECME
|
||||
$DBILS2.=exporte('', 1); // Ordinarité
|
||||
$DBILS2.=exporte('', 2); // Code nature étab
|
||||
$DBILS2.=exporte('', 2); // Sigularité étab
|
||||
|
||||
$ligneID=$DBILS2;
|
||||
$ligne100++;
|
||||
$cor='';
|
||||
if ($typeAnn<>'I')
|
||||
$cor=" - Annonce n°$corNumA $corNumP, page $corPage, du ".WDate::dateT('Ymd','d/M/Y',$corDate);
|
||||
switch($typeAnn) {
|
||||
case 'I': $cor='Insertion'.$cor; break;
|
||||
case 'A': $cor='Additif'.$cor; break;
|
||||
case 'R': $cor='Rectificatif'.$cor; break;
|
||||
case 'S': $cor='Suppression'.$cor; break;
|
||||
default: break;
|
||||
}
|
||||
$codeTri= substr($ligne, 89 , 6 ); // Code Tribunal Codification interne utilisée par le Bodacc
|
||||
$libTri=$iBodacc->getTribunalNom($codeTri);
|
||||
|
||||
$SOSEQ++;
|
||||
if ($bodacc=='A') $SOJAL='001';
|
||||
elseif ($bodacc=='B') $SOJAL='200';
|
||||
elseif ($bodacc=='C') $SOJAL='300';
|
||||
else $SOJAL='999';
|
||||
$DBILS2 =initstr($SONABO, 9, '0', ALIGN_RIGHT); // Numéro d'abonné BIL ?
|
||||
$DBILS2.=initstr($SONUME, 9, '0', ALIGN_RIGHT); // Numéro d'entreprise BIL ?
|
||||
$DBILS2.=initstr($SONUS, 9, '0', ALIGN_RIGHT); // Numéro d'UFS BIL ?
|
||||
$DBILS2.=initstr($nann, 9, '0', ALIGN_RIGHT); // Numéro d'annonce BIL ?
|
||||
$DBILS2.=initstr($siren, 9, '0', ALIGN_RIGHT); // Siren
|
||||
$DBILS2.=initstr($nic, 5, '0', ALIGN_RIGHT); // Nic
|
||||
$DBILS2.=exporte('SE', 2); // Code produit BIL ? SE, DE, DI, SJ
|
||||
$DBILS2.=initstr($SOSEQ, 5, '0', ALIGN_RIGHT); // Numéro dans la séquence
|
||||
$DBILS2.=initstr($dateJ, 8, '0', ALIGN_RIGHT); // Numéro dans la séquence
|
||||
$DBILS2.=exporte('9', 1); // Type d'enregistrement 1=EntConf, 2=Rejet, 4=Multipropo, 5=Suivi MAJ Entrep, 7=Infos, 8=Envoi documen, 9=Annonce
|
||||
$DBILS2.=exporte('ANN', 3); // Structure identité
|
||||
$DBILS2.=exporte('A', 1); // Confirmation 'A'uto ou 'C' pour manuelle
|
||||
$DBILS2.=exporte($ref, 30); // Réf. Client
|
||||
//($annonce['codePostalSiege'], 5, '0', ALIGN_RIGHT)
|
||||
$DBILS2.=exporte($SOORIG, 1); // 1:Insee actif, 2=Ufs, 3=Annonce, 4=Manuelle, 5=Asso, 7=RCS actif, 8=Insee cessa eco, 9=Insee/RCS radié
|
||||
$DBILS2.=exporte($SOJAL, 3); // 001=Bodacc A, 200=Bodacc B, 300=Bodacc C
|
||||
$DBILS2.=initstr($datePar, 8, '0', ALIGN_RIGHT); // Date de parution
|
||||
$DBILS2.=initstr(0, 5, '0', ALIGN_RIGHT); // Page
|
||||
if ($codeEve=='') {
|
||||
$message.="Siren : $siren, Bodacc $bodacc, code évènement non géré : '$codeEven'".EOL;
|
||||
/*$nann = trim(substr($ligne, 3 , 10 ))*1; // N° d'annonce
|
||||
$siren = substr($ligne, 13 , 9 ); // Siren de l'entreprise concernée par l'annonce
|
||||
$tabIdentite=@$iInsee->getIdentiteEntreprise($siren);
|
||||
$nic = trim(substr($ligne, 22, 5 ))*1; // Nic
|
||||
$ref = trim(substr($ligne, 71, 18 )); // Référence Client
|
||||
$numPar = substr($ligne, 27 , 3 ); // Numéro de parution du Bodacc dans l'année
|
||||
= substr($ligne, 30 , 1 ); // Code Bodacc (A, B ou C) A, B ou C
|
||||
$datePar= substr($ligne, 31 , 8 )*1; // Date de parution du Bodacc Format AAAAMMJJ
|
||||
$numAnn*/
|
||||
sendMail('infoslegales@scores-decisions.com', 'ylenaour@scores-decisions.com', "Surveillance Annonces Legales SOFID (ERREUR)", $message);
|
||||
return $message;
|
||||
}
|
||||
$DBILS2.=exporte($codeEve, 2); //
|
||||
$DBILS2.=initstr($depPar, 2, '0', ALIGN_RIGHT);
|
||||
$DBILS2.=initstr($numAnn, 6, '0', ALIGN_RIGHT);
|
||||
$DBILS2.=exporte($codeRol, 1); //
|
||||
$DBILS2.=exporte($tabEvenSolib[$codeEve], 5);
|
||||
$DBILS2.=exporte($codeTri, 6); //
|
||||
$DBILS2.=exporte($numPar, 3); //
|
||||
$DBILS2.=initstr($dateJuge, 8, '0', ALIGN_RIGHT); // Date de jugement
|
||||
$DBILS2.=initstr($dateEffet, 8, '0', ALIGN_RIGHT); // Date d'effet
|
||||
$DBILS2.=initstr($dateCess, 8, '0', ALIGN_RIGHT); // Date de cessat° des paiements
|
||||
$DBILS2.=exporte($vteDev, 2); // Devise de la vente
|
||||
$DBILS2.=initstr($vteMnt, 11, '0', ALIGN_RIGHT); // Montant de la vente
|
||||
$DBILS2.=exporte('', 33); // Particularité
|
||||
$DBILS2.=exporte('', 4); // Code rubrique du Bodacc A1xx
|
||||
$DBILS2.=exporte('', 6); // Code lib injecté
|
||||
|
||||
$tabJuge=$iRncs->getIntervenants($siren);
|
||||
foreach ($tabJuge as $iDepot=>$depot) {
|
||||
$DBILS2.=exporte($depot['admid'], 5); // Mot clé Nom
|
||||
$DBILS2.=exporte($depot['admtype'], 1); // Type officier ministeriel
|
||||
$DBILS2.=initstr($depot['admid'], 7, '0', ALIGN_RIGHT); // Code Bil
|
||||
$DBILS2.=exporte($depot['admnom'], 30); // Nom syndic
|
||||
$DBILS2.=initstr($depot['admadrNum'], 4, '0', ALIGN_RIGHT); // N° rue
|
||||
$DBILS2.=exporte($depot['admadrInd'], 1); // Bis
|
||||
$DBILS2.=exporte($depot['admadrType'], 3); // Type Voie
|
||||
$DBILS2.=exporte($depot['admadrVoie'], 33); // Lib Voie
|
||||
$DBILS2.=exporte($depot['admadr2'], 32); // Lieu
|
||||
$DBILS2.=exporte($depot['admadrCP'], 5); // CP
|
||||
$DBILS2.=exporte($depot['admadrVille'], 32); // Ville
|
||||
$DBILS2.=exporte('', 10); // Tel
|
||||
if ($iDepot==1) break;
|
||||
}
|
||||
|
||||
$ligneANN=$DBILS2;
|
||||
$txtAnn='';
|
||||
//if ($ligne100>1) $ecrireLignePre=true;
|
||||
break;
|
||||
case 104: // Annonce
|
||||
$ligne104++;
|
||||
$txtAnn=trim($txtAnn.' '.trim(substr($ligne, 89 , 1910))); // Texte Annonce
|
||||
break;
|
||||
default: // Ligne non gérée
|
||||
break;
|
||||
}
|
||||
if ($ecrireLignePre) {
|
||||
fwrite($fp, $ligneOut.EOL);
|
||||
$ecrireLignePre=false;
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
return true;
|
||||
}
|
@ -1645,6 +1645,8 @@ class MInsee
|
||||
'Localisation' => $etab['Loc'],
|
||||
'id' => $etab['id'],
|
||||
'Pertinence' => 100,
|
||||
'Source' => $etab['source'],
|
||||
'SoruceId' => $etab['source_id'],
|
||||
'Siret' => $etab['siret'],
|
||||
'Siege' => $etab['siege'],
|
||||
'Nom' => $nom,
|
||||
@ -1715,7 +1717,7 @@ class MInsee
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep,".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.adr_dep, e.adr_com, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep,".
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif",
|
||||
"TEL=$id OR FAX=$id $filtreActif ORDER BY e.siege DESC, e.actif DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
@ -1749,16 +1751,25 @@ class MInsee
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.adr_dep, e.adr_com, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif",
|
||||
"autre_id IN ('$strId') $filtreActif $strDep ORDER BY siege DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
foreach ($listeEtab as $etab) {
|
||||
foreach ($listeEtab as $etab)
|
||||
{
|
||||
$pays = 'France';
|
||||
if ( $etab['adr_dep']==99 ) {
|
||||
$resultPays = $this->iDb->select("tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$pays = $resultPays[0]['libPays'];
|
||||
}
|
||||
|
||||
$tabRet[]=array(
|
||||
'Localisation'=>$etab['Loc'],
|
||||
'id'=>$etab['id'],
|
||||
'Pertinence'=>100,
|
||||
'Source' => $etab['source'],
|
||||
'SourceId' => $etab['source_id'],
|
||||
'Siret'=>$etab['siret'],
|
||||
'Siege'=>$etab['siege'],
|
||||
'Nom'=>$etab['raisonSociale'],
|
||||
@ -1769,6 +1780,7 @@ class MInsee
|
||||
'Adresse2'=>trim(preg_replace('/ +/', ' ', $etab['adr_comp'])),
|
||||
'CP'=>$etab['adr_cp'],
|
||||
'Ville'=>$etab['adr_ville'],
|
||||
'Pays' => $pays,
|
||||
'Tel'=>$etab['tel'],
|
||||
'Fax'=>$etab['fax'],
|
||||
'FJ'=>$etab['cj'],
|
||||
@ -3545,7 +3557,7 @@ TOTAL : $dureeTot s\n";
|
||||
if ($histo) {
|
||||
$bodacc=$this->iDb->select(
|
||||
'bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.dirSiren, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC, d.fonction DESC", true, MYSQL_ASSOC);
|
||||
if (count($bodacc)>0) {
|
||||
foreach ($bodacc as $k=>$ann) {
|
||||
@ -3558,6 +3570,7 @@ TOTAL : $dureeTot s\n";
|
||||
continue;*/
|
||||
$tabRet[]=array( 'Fonction' => $ann['fonction'],
|
||||
'Titre' => $ann['libelle'],
|
||||
'Siren' => $ann['dirSiren'],
|
||||
'Societe' => $ann['rs'],
|
||||
'Nom' => trim(strtr($ann['nom'], array( "Modification d'"=>'',
|
||||
"Modification de"=>'',
|
||||
@ -3689,7 +3702,7 @@ TOTAL : $dureeTot s\n";
|
||||
if (!$histo) {
|
||||
$bodacc=$this->iDb->select(
|
||||
'bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.dirSiren, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct AND d.fonction BETWEEN 300 AND 304 GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC, d.fonction DESC", false, MYSQL_ASSOC);
|
||||
if (count($bodacc)>0) {
|
||||
foreach ($bodacc as $k=>$ann) {
|
||||
@ -3710,6 +3723,7 @@ TOTAL : $dureeTot s\n";
|
||||
//if ($rs==$nom)
|
||||
$tabRet[]=array('Fonction' => $ann['fonction'],
|
||||
'Titre' => $ann['libelle'],
|
||||
'Siren' => $ann['dirSiren'],
|
||||
'Societe' => $rs,
|
||||
'Nom' => $nom,
|
||||
'Prenom' => $prenom,
|
||||
|
@ -2,8 +2,8 @@
|
||||
ini_set('soap.wsdl_cache_enabled', 0);
|
||||
ini_set('default_socket_timeout', 30);
|
||||
|
||||
class MAmabis {
|
||||
|
||||
class MAmabis
|
||||
{
|
||||
private $client;
|
||||
|
||||
function __construct()
|
||||
@ -19,7 +19,8 @@ class MAmabis {
|
||||
));
|
||||
}
|
||||
|
||||
function getZonage($adrNum, $adrIndRep, $adrTypeVoie, $adrLibVoie, $cp, $ville='', $codeRivoli='', $rnvp=false, $raisonSociale='TEST', $debug=false) {
|
||||
function getZonage($adrNum, $adrIndRep, $adrTypeVoie, $adrLibVoie, $cp, $ville='', $codeRivoli='', $rnvp=false, $raisonSociale='TEST', $debug=false)
|
||||
{
|
||||
$tabRep=array();
|
||||
if (!$rnvp) {
|
||||
if ($cp<10000) $cp='0'.$cp;
|
||||
@ -27,7 +28,7 @@ class MAmabis {
|
||||
$dep3=substr($cp,0,3)*1;
|
||||
switch ($dep2) {
|
||||
case 0:
|
||||
case 5:
|
||||
/*case 5:
|
||||
case 9:
|
||||
case 15:
|
||||
case 19:
|
||||
@ -35,7 +36,7 @@ class MAmabis {
|
||||
case 32:
|
||||
case 46:
|
||||
case 48:
|
||||
case 82:
|
||||
case 82:*/
|
||||
case 97: // DOM
|
||||
case 98: // TOM
|
||||
case 99: // Etranger
|
||||
@ -50,10 +51,19 @@ class MAmabis {
|
||||
$iDb=new WDB();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret=$iDb->select( 'zonage', 'zus, zru, zfu, cucs', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
$majForcee=false;
|
||||
|
||||
$ret=$iDb->select( 'zonage', 'zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6, adr7, numVoieA, indRepA,
|
||||
typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD, libVoieSec, adr4n32, adr4n38, clePostaleVoie,
|
||||
secteur, cleRoutage, cpx, cleAd, codPaysIso2, codPaysIso3, libPays, codeInsee',
|
||||
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
$zones=@$ret[0];
|
||||
if (count($ret)>0) {
|
||||
$zones=$ret[0];
|
||||
|
||||
if ($zones['rnvpStatut']===null && $rnvp) $majForcee=true;
|
||||
$tabRep['ZUS']=$tabRep['ZFU']=$tabRep['ZRU']=$tabRep['CUCS']='NON';
|
||||
//$tabRep['NZUS']=$tabRep['NZFU']=$tabRep['NZRU']=$tabRep['NCUCS']='';
|
||||
|
||||
if (trim($zones['zus'])<>'') {
|
||||
if (trim($zones['zus'])=='NSP') $tabRep['ZUS']='NSP';
|
||||
else $tabRep['ZUS']='OUI';
|
||||
@ -74,9 +84,26 @@ class MAmabis {
|
||||
else $tabRep['CUCS']='OUI';
|
||||
$tabRep['NCUCS']=$zones['cucs'];
|
||||
}
|
||||
//return $tabRep;
|
||||
|
||||
} else {
|
||||
|
||||
/** Autres Informations de la RNVP
|
||||
**/
|
||||
if ($rnvp) {
|
||||
//$tabRep['ADR1']=@trim($tabZones['ADR1']);
|
||||
//$tabRep['ADR2']=@trim($tabZones['ADR2']);
|
||||
if (strtoupper(@trim($zones['adr7']))=='FRANCE') $zones['adr7']='';
|
||||
$tabRep['ADR3']=@trim($zones['adr3']);
|
||||
$tabRep['ADR4']=@trim($zones['adr4']);
|
||||
$tabRep['ADR5']=@trim($zones['adr5']);
|
||||
$tabRep['ADR6']=@trim($zones['adr6']);
|
||||
$tabRep['ADR7']=trim($zones['adr7']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (count($ret)==0 || $majForcee) {
|
||||
|
||||
try {
|
||||
if (trim($raisonSociale)=='') $raisonSociale='TEST'; // Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
|
||||
$rep=$this->client->zonage( new SoapParam(strtr("$raisonSociale:$adresse:$cp:$ville",
|
||||
@ -101,60 +128,137 @@ class MAmabis {
|
||||
if (trim($tabTmp[0])<>'')
|
||||
$tabRep[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
if ($tabRep['ZUS']=='NSP') $tabRep['NZUS']='NSP';
|
||||
if ($tabRep['ZRU']=='NSP') $tabRep['NZRU']='NSP';
|
||||
if ($tabRep['ZFU']=='NSP') $tabRep['NZFU']='NSP';
|
||||
if ($tabRep['CUCS']=='NSP') $tabRep['NCUCS']='NSP';
|
||||
if (@$tabRep['ZUS']=='NSP') $tabRep['NZUS']='NSP';
|
||||
if (@$tabRep['ZRU']=='NSP') $tabRep['NZRU']='NSP';
|
||||
if (@$tabRep['ZFU']=='NSP') $tabRep['NZFU']='NSP';
|
||||
if (@$tabRep['CUCS']=='NSP') $tabRep['NCUCS']='NSP';
|
||||
$adresse=stripslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=stripslashes($ville);
|
||||
$tabInsert=array( 'address'=>$adresse,
|
||||
$tabRepTmp=array();
|
||||
$tabTmp=explode('=',utf8_decode($rep['objdesc']));
|
||||
//print_r($tabTmp);
|
||||
//die();
|
||||
$tabZones=array();
|
||||
foreach ($tabTmp as $iZone=>$zone) {
|
||||
$pos=strrpos($zone,',');
|
||||
if ($iZone==0) {
|
||||
$nomZoneSuiv=$zone;
|
||||
continue;
|
||||
}
|
||||
$tabZones[$nomZoneSuiv]=substr($zone,0,$pos);
|
||||
$nomZoneSuiv=substr($zone,$pos+1);
|
||||
}
|
||||
if (strtoupper(@trim($tabZones['ADR7']))=='FRANCE') $tabZones['ADR7']='';
|
||||
$tabTmp=explode('|', $tabZones['VOIEA']);
|
||||
$typeVoieAcourt=@trim($tabTmp[1]);
|
||||
$tabInsert=array(
|
||||
'address'=>$adresse,
|
||||
'adr_cp'=>$cp,
|
||||
'adr_ville'=>$ville,
|
||||
'zus'=>$tabRep['NZUS'],
|
||||
'zru'=>$tabRep['NZRU'],
|
||||
'zfu'=>$tabRep['NZFU'],
|
||||
'cucs'=>$tabRep['NCUCS'],
|
||||
'zus'=>@$tabRep['NZUS'],
|
||||
'zru'=>@$tabRep['NZRU'],
|
||||
'zfu'=>@$tabRep['NZFU'],
|
||||
'cucs'=>@$tabRep['NCUCS'],
|
||||
);
|
||||
$tabUpdate=array(
|
||||
'adrNum'=>$adrNum,
|
||||
'adrIndRep'=>$adrIndRep,
|
||||
'adrTypeVoie'=>$adrTypeVoie,
|
||||
'adrLibVoie'=>$adrLibVoie,
|
||||
'rivoli'=>$codeRivoli,
|
||||
// Ajouté le 16/12/2013
|
||||
'rnvpStatut' => substr($tabZones['STATUTC'],0,2),
|
||||
'rnvpCorr' => substr($tabZones['STATUTC'],2,1),
|
||||
'rnvpTrt' => trim(substr($tabZones['STATUTC'],3,2)),
|
||||
'adr3' => @trim($tabZones['ADR3']),
|
||||
'adr4' => @trim($tabZones['ADR4']),
|
||||
'adr5' => @trim($tabZones['ADR5']),
|
||||
'adr6' => @trim($tabZones['ADR6']),
|
||||
'adr7' => trim($tabZones['ADR7']),
|
||||
'numVoieA' => @trim($tabZones['NUM1']),
|
||||
'indRepA' => @trim($tabZones['BTQC1']),
|
||||
'typeVoieAlong' => @trim($tabZones['TYPVOIEL']),
|
||||
'typeVoieAcourt' => $typeVoieAcourt,
|
||||
'corpVoie' => @trim($tabZones['CORPSVOIE']),
|
||||
'motDir' => @trim($tabZones['MOTDIR']),
|
||||
'motDirD' => @trim($tabZones['MOTDIRD']),
|
||||
'libVoieSec' => @trim($tabZones['VOIREFLIBS']),
|
||||
'adr4n32' => @trim($tabZones['VOIREFLIBPOS']),
|
||||
'adr4n38' => @trim($tabZones['VOIREFLIBPOS2']),
|
||||
'clePostaleVoie' => @trim($tabZones['VOIREFCLEPOST']),
|
||||
'secteur' => @trim($tabZones['SECTEUR']),
|
||||
'cleRoutage' => @trim($tabZones['CLER']),
|
||||
'cpx' => @trim($tabZones['CPX']),
|
||||
'cleAd' => @trim($tabZones['CLEAD']),
|
||||
'codPaysIso2' => @trim($tabZones['NATREFISO2']),
|
||||
'codPaysIso3' => @trim($tabZones['NATREFISO3']),
|
||||
'libPays' => @trim($tabZones['NATREFLIB']),
|
||||
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
|
||||
'source' => 'Amabis',
|
||||
);
|
||||
$iDb->insert('zonage', $tabInsert);
|
||||
$dateInsert=0;
|
||||
if ($majForcee) {
|
||||
$adresseL=addslashes($adresse);
|
||||
$villeL=addslashes($ville);
|
||||
|
||||
$ret=$iDb->select('zonage', 'dateInsert*1 as dateInsert', "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
|
||||
$dateInsert=@$ret[0]['dateInsert']*1;
|
||||
$iDb->update('zonage', array_merge($tabUpdate,array('dateInsert'=>$dateInsert)), "address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'", false);
|
||||
//echo "Mise à jour de l'adresse du $dateInsert pour address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'".EOL;
|
||||
}
|
||||
|
||||
if ($dateInsert==0) {
|
||||
$iDb->insert('zonage', array_merge($tabInsert,$tabUpdate), false);
|
||||
//echo "Insertion de l'adresse (".$zones['rnvpStatut'].")!".EOL;
|
||||
}
|
||||
|
||||
$tabTmp[0]=explode(',', $tabZones['LOCREFCLEP']);
|
||||
$tabTmp[1]=explode(',', $tabZones['LOCREFCP']);
|
||||
$tabTmp[2]=explode(',', $tabZones['LOCREFTYPP']);
|
||||
$tabTmp[3]=explode(',', $tabZones['LOCREFLIBD']);
|
||||
$tabTmp[4]=explode(',', $tabZones['LOCREFLIBD2']);
|
||||
foreach($tabTmp[0] as $iCleP=>$cleP) {
|
||||
$tabInsert=array(
|
||||
'codeInsee' => @trim($tabZones['LOCREFCLEO']),
|
||||
'villeLib' => @trim($tabZones['LOCREFLIBP']),
|
||||
'villePopu' => @trim($tabZones['LOCREFPOP']),
|
||||
'cleAchPost'=> $cleP,
|
||||
'codePostal'=> $tabTmp[1][$iCleP],
|
||||
'typePostal'=> $tabTmp[2][$iCleP],
|
||||
'libAchP32' => @preg_replace('/^\//','',$tabTmp[3][$iCleP]),
|
||||
'libAchP38' => @preg_replace('/^\//','',$tabTmp[4][$iCleP]),
|
||||
'source' => 'Amabis',
|
||||
'dateInsert'=> date('YmdHis'),
|
||||
);
|
||||
$iDb->insert('villesCP', $tabInsert);
|
||||
//echo mysql_error().EOL;
|
||||
}
|
||||
|
||||
/** Autres Informations de la RNVP
|
||||
**/
|
||||
if ($rnvp || $debug) {
|
||||
$tabRepTmp=array();
|
||||
$tabZones=explode(',',$rep['objdesc']);
|
||||
foreach ($tabZones as $zone) {
|
||||
$tabTmp=explode('=',$zone);
|
||||
if (trim($tabTmp[0])<>'')
|
||||
$tabRepTmp[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
if (!$debug) {
|
||||
$tabRep['ADR1']=@$tabRepTmp['ADR1'];
|
||||
$tabRep['ADR2']=@$tabRepTmp['ADR2'];
|
||||
$tabRep['ADR3']=@$tabRepTmp['ADR3'];
|
||||
$tabRep['ADR4']=@$tabRepTmp['ADR4'];
|
||||
$tabRep['ADR5']=@$tabRepTmp['ADR5'];
|
||||
$tabRep['ADR6']=@$tabRepTmp['ADR6'];
|
||||
$tabRep['ADR7']=@$tabRepTmp['ADR7'];
|
||||
} else {
|
||||
$tabRep=array_merge($tabRep, $tabRepTmp);
|
||||
}
|
||||
if ($rnvp) {
|
||||
//$tabRep['ADR1']=@trim($tabZones['ADR1']);
|
||||
//$tabRep['ADR2']=@trim($tabZones['ADR2']);
|
||||
$tabRep['ADR3']=@trim($tabZones['ADR3']);
|
||||
$tabRep['ADR4']=@trim($tabZones['ADR4']);
|
||||
$tabRep['ADR5']=@trim($tabZones['ADR5']);
|
||||
$tabRep['ADR6']=@trim($tabZones['ADR6']);
|
||||
$tabRep['ADR7']=trim($tabZones['ADR7']);
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
echo 'ERREUR SOAP :'.EOL;
|
||||
print_r($fault);
|
||||
echo $this->client->__getLastRequest()."\n";
|
||||
echo $this->client->__getLastResponse()."\n";
|
||||
//echo 'ERREUR SOAP :'.EOL;
|
||||
//print_r($fault);
|
||||
//echo $this->client->__getLastRequest()."\n";
|
||||
//echo $this->client->__getLastResponse()."\n";
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
}
|
||||
//return $tabRep;
|
||||
}
|
||||
|
||||
/** Zonages AFR et ZRR
|
||||
**/
|
||||
$codeInsee=substr($codeRivoli,0,5);
|
||||
$ret=$iDb->select( 'zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
|
||||
$tabRep['ZRR']=$tabRep['AFR']='NON';
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,12 @@ class MLiens2
|
||||
*/
|
||||
protected $findId = array();
|
||||
|
||||
/**
|
||||
* Coutry List ISO3 => Label
|
||||
* @var array
|
||||
*/
|
||||
protected $country = null;
|
||||
|
||||
/**
|
||||
* Stop the process to looks for company group head
|
||||
* @var boolean
|
||||
@ -92,7 +98,7 @@ class MLiens2
|
||||
'dateEffetLien', 'dateInsert', 'dateUpdate'))
|
||||
->where('idPar=?', $id)
|
||||
->join(array('r'=>$this->_schema.'.liensRef'), 'l.idAct=r.id',
|
||||
array('LPAD(siren, 9, 000000000) AS siren','PpPm', 'RS', 'civilite', 'nom', 'prenom', 'nom_usage',
|
||||
array('LPAD(siren, 9, 000000000) AS siren','PpPm', 'RS', 'sigle', 'civilite', 'nom', 'prenom', 'nom_usage',
|
||||
'naissance_date', 'naissance_dept_pays', 'naissance_lieu', 'nat',
|
||||
'adresse_num', 'adresse_btq', 'adresse_codvoie', 'adresse_libvoie',
|
||||
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays',
|
||||
@ -109,6 +115,9 @@ class MLiens2
|
||||
}
|
||||
}
|
||||
|
||||
//Don't display deleted - anomaly
|
||||
$sql->where('l.dateSuppr=?', '0000-00-00 00:00:00');
|
||||
|
||||
$liens = $this->db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
||||
@ -148,7 +157,7 @@ class MLiens2
|
||||
'dateEffetLien', 'dateInsert', 'dateUpdate'))
|
||||
->where('idAct=?', $id)
|
||||
->join(array('r'=>$this->_schema.'.liensRef'), 'l.idPar=r.id',
|
||||
array('LPAD(siren, 9, 000000000) AS siren','PpPm', 'RS', 'civilite', 'nom', 'prenom', 'nom_usage',
|
||||
array('LPAD(siren, 9, 000000000) AS siren','PpPm', 'RS', 'sigle', 'civilite', 'nom', 'prenom', 'nom_usage',
|
||||
'naissance_date', 'naissance_dept_pays', 'naissance_lieu', 'nat',
|
||||
'adresse_num', 'adresse_btq', 'adresse_codvoie', 'adresse_libvoie',
|
||||
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays',
|
||||
@ -165,6 +174,9 @@ class MLiens2
|
||||
}
|
||||
}
|
||||
|
||||
//Don't display deleted - anomaly
|
||||
$sql->where('l.dateSuppr=?', '0000-00-00 00:00:00');
|
||||
|
||||
$liens = $this->db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
throw new Exception(__METHOD__ . ': ' . $e->getMessage());
|
||||
@ -223,9 +235,12 @@ class MLiens2
|
||||
/**
|
||||
* Retourne la maison mère
|
||||
* @param int $id
|
||||
* Id de la fiche de départ
|
||||
* @param int $detention
|
||||
* Niveau de détention (Une filiale est une entreprise détenue à plus de 50% par une autre entreprise)
|
||||
* @return int
|
||||
*/
|
||||
public function getHead($id = null)
|
||||
public function getHead($id = null, $detention = 0)
|
||||
{
|
||||
if ( null === $id ) {
|
||||
$id = $this->idRef;
|
||||
@ -256,15 +271,15 @@ class MLiens2
|
||||
}
|
||||
//PDetention>50
|
||||
elseif ( $item->PDetention > 50 && $item->idAct > 1000 ) {
|
||||
return $this->getHead($item->idAct);
|
||||
return $this->getHead($item->idAct, $detention);
|
||||
}
|
||||
//MajMin=+
|
||||
elseif ( $item->MajMin == '+' && $item->idAct > 1000 ) {
|
||||
return $this->getHead($item->idAct);
|
||||
elseif ( $item->PDetention > $detention && $item->MajMin == '+' && $item->idAct > 1000 ) {
|
||||
return $this->getHead($item->idAct, $detention);
|
||||
}
|
||||
//--
|
||||
elseif ( $item->idAct > 1000 ) {
|
||||
return $this->getHead($item->idAct);
|
||||
elseif ( $item->PDetention > $detention && $item->idAct > 1000 ) {
|
||||
return $this->getHead($item->idAct, $detention);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -285,7 +300,7 @@ class MLiens2
|
||||
|
||||
$refM = new Application_Model_JoLiensRef();
|
||||
$row = $refM->find($id);
|
||||
if (null !== row) {
|
||||
if (null !== $row) {
|
||||
return $row->current();
|
||||
}
|
||||
}
|
||||
@ -303,19 +318,16 @@ class MLiens2
|
||||
if ( $this->stopAtFirstIsin === true ) {
|
||||
$id = $this->idRef;
|
||||
$identity = $this->getIdentity($this->idRef);
|
||||
if ( !empty($isin) ) {
|
||||
if ( !empty($identity->isin) ) {
|
||||
$itemWithIsin = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $itemWithIsin !== true ) {
|
||||
|
||||
//Récupération de la maison mère
|
||||
$id = $this->getHead();
|
||||
|
||||
$id = $this->getHead(null, 50);
|
||||
//Informations de la maison mère
|
||||
$identity = $this->getIdentity($id);
|
||||
|
||||
}
|
||||
|
||||
$this->findId = array();
|
||||
@ -326,13 +338,22 @@ class MLiens2
|
||||
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
||||
}
|
||||
|
||||
if ( $this->country === null ) {
|
||||
$this->country = $this->getCountry();
|
||||
}
|
||||
|
||||
$pays = $identity->adresse_pays;
|
||||
if ( array_key_exists($identity->adresse_pays, $this->country) ) {
|
||||
$pays = $this->country[$identity->adresse_pays];
|
||||
}
|
||||
|
||||
//Retour
|
||||
$tabRet = array (
|
||||
'id' => $identity->id,
|
||||
'name' => $nom,
|
||||
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
|
||||
'pmin' => $item->PDetention,
|
||||
'pays' => $identity->adresse_pays,
|
||||
'pays' => $pays,
|
||||
'children' => $this->getTreeRecursive($identity->id, $pctMin, 1, $nbNiveaux),
|
||||
);
|
||||
|
||||
@ -364,12 +385,21 @@ class MLiens2
|
||||
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
||||
}
|
||||
|
||||
if ($this->country === null) {
|
||||
$this->country = $this->getCountry();
|
||||
}
|
||||
|
||||
$pays = $identity->adresse_pays;
|
||||
if ( array_key_exists($identity->adresse_pays, $this->country) ) {
|
||||
$pays = $this->country[$identity->adresse_pays];
|
||||
}
|
||||
|
||||
$data = array (
|
||||
'id' => $identity->id,
|
||||
'name' => $nom,
|
||||
'siren' => str_pad($identity->siren, 9, '0', STR_PAD_LEFT),
|
||||
'pmin' => $item->PDetention,
|
||||
'pays' => $identity->adresse_pays,
|
||||
'pays' => $pays,
|
||||
'children' => array(),
|
||||
);
|
||||
//Pour éviter d'avoir des boucles infinis
|
||||
@ -481,4 +511,24 @@ class MLiens2
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all countries
|
||||
*/
|
||||
protected function getCountry()
|
||||
{
|
||||
$countryM = new Application_Model_JoTabPays();
|
||||
$sql = $countryM->select()
|
||||
->from($countryM, array('codPays3', 'libPays'))
|
||||
->where('codPays3 IS NOT NULL');
|
||||
$rows = $countryM->fetchAll($sql);
|
||||
if ( $rows !== null ) {
|
||||
$data = array();
|
||||
foreach($rows as $item) {
|
||||
$data[$item->codPays3] = $item->libPays;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
if ( !function_exists('htmlspecialchars_decode') )
|
||||
{
|
||||
function htmlspecialchars_decode($text)
|
||||
@ -138,7 +138,6 @@ function ALG0013($Tx,$Ty,$Tz,$D,$Rx,$Ry,$Rz,$U) {
|
||||
$V['X'] = $Tx + $U['X'] * (1 + $D) + $U['Z'] * $Ry - $U['Y'] * $Rz;
|
||||
$V['Y'] = $Ty + $U['Y'] * (1 + $D) + $U['X'] * $Rz - $U['Z'] * $Rx;
|
||||
$V['Z'] = $Tz + $U['Z'] * (1 + $D) + $U['Y'] * $Rx - $U['X'] * $Ry;
|
||||
|
||||
return $V;
|
||||
}
|
||||
|
||||
@ -173,7 +172,6 @@ function ALG0019($lambda0,$phi0,$k0,$X0,$Y0,$a,$e) {
|
||||
function ALG0021($phi,$a,$e) {
|
||||
$N = $a/sqrt( 1 - $e * $e * sin($phi) * sin($phi) );
|
||||
return $N;
|
||||
|
||||
}
|
||||
|
||||
/** Calcul des constantes d'une projection Lambert conique conforme dans le cas sécant
|
||||
@ -206,7 +204,6 @@ function ALG0054($lambda0,$phi0,$X0,$Y0,$phi1,$phi2,$a,$e) {
|
||||
'Xs'=> $Xs,
|
||||
'Ys'=> $Ys);
|
||||
return $tab;
|
||||
|
||||
}
|
||||
|
||||
function Lambert2WGS84($X,$Y,$orig='L93') {
|
||||
@ -420,7 +417,7 @@ print_r(geos2lambert(48.838245134184 ,2.2227849815878));
|
||||
"boundary" if the point sits on the boundary. If $pointOnVertex is false, then "boundary" is also returned if the point is on a vertex.
|
||||
"inside" if the point is inside the polygon.
|
||||
"outside" if, you guessed it, the point is outside of the polygon.
|
||||
*/
|
||||
*/
|
||||
class pointLocation {
|
||||
|
||||
var $pointOnVertex = true; // Check if the point sits exactly on one of the vertices
|
||||
@ -437,8 +434,8 @@ class pointLocation {
|
||||
foreach ($polygon as $vertex) {
|
||||
$vertices[] = $this->pointStringToCoordinates($vertex);
|
||||
}
|
||||
//print_r($vertices);
|
||||
//die();
|
||||
//print_r($vertices);
|
||||
//die();
|
||||
// Check if the point sits exactly on a vertex
|
||||
if ($this->pointOnVertex == true && $this->pointOnVertex($point, $vertices) == true) {
|
||||
return "vertex";
|
||||
@ -499,9 +496,10 @@ class MMap {
|
||||
private $header = '';
|
||||
private $cookie = '';
|
||||
private $codeRetour = 0;
|
||||
private $codeRetourG = 0; // Code retour de l'api Google
|
||||
private $codeRetourY = 0; // Code retour de l'api Yahoo
|
||||
private $codeRetourM = 0; // Code retour de l'api Mappy
|
||||
public $codeRetourG = 0; // Code retour de l'api Google
|
||||
public $codeRetourY = 0; // Code retour de l'api Yahoo
|
||||
public $codeRetourM = 0; // Code retour de l'api Mappy
|
||||
public $codeRetourC = 0; // Code retour de l'api Cloudmade
|
||||
|
||||
public $geocodeur='';
|
||||
|
||||
@ -520,6 +518,7 @@ class MMap {
|
||||
private $apiKeyG='ABQIAAAAuKBtUyFonYJBl1fqfc78tRQvADPcxwXf3Q2QIE-M32vuSkrxiBRLUHDB_YSLeTscTDeWRKM_wILaaw';
|
||||
// private $apiKey='ABQIAAAAuKBtUyFonYJBl1fqfc78tRT4Qe_2x2fax4Crd4sBzQI-tDkl3BRm2l2feTV5Lnx0Ah-aTIlwHtglpA';
|
||||
private $apiKeyY='klII0gzV34Ho2TCsN3XiXeh4No033AifxMeDXfFXj8TDCXO3WAtOLj9c74VsV45HcII-';
|
||||
private $apiKeyC='ae5216123e414fcd84b8ca9a0f43a68c';
|
||||
|
||||
function __construct($accesDist=true) {// $adresse, $cp, $ville, $pays='France') {
|
||||
$this->accesDist=$accesDist;
|
||||
@ -557,7 +556,8 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
|
||||
$res=json_decode($page['body']);
|
||||
$result=$res->geocode->answer;
|
||||
//print_r($result);die();
|
||||
//print_r($page);
|
||||
//print_r($result);die($url);
|
||||
//$this->codeRetourM=
|
||||
|
||||
switch ($result->geocode_level->code) {
|
||||
@ -609,88 +609,153 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
return false;
|
||||
}
|
||||
|
||||
public function geoCodeAdrCpVilleC($adresse,$cp,$ville,$pays='') {
|
||||
|
||||
private function geoCodeAdrCpVilleY($address) {
|
||||
$_url = 'http://api.local.yahoo.com/MapsService/V1/geocode';
|
||||
$_url .= sprintf('?appid=%s&location=%s',$this->apiKeyY,rawurlencode($address));
|
||||
$_result = false;
|
||||
$page=getUrl($_url, '', '', '', false, '', '', 3);
|
||||
$_result=$page['body'];
|
||||
// die("URL='$_url'".EOL.print_r($page));
|
||||
$try=1;
|
||||
while ($page['code']!=200 && $page['code']!=403) {
|
||||
$page=getUrl($_url, '', '', '', false, '', '', 3);
|
||||
$_result=$page['body'];
|
||||
echo 'Yahoo '.$page['code']." : $address... Attente...".EOL;
|
||||
$try++;
|
||||
if ($try>=4) break;
|
||||
sleep(1);
|
||||
}
|
||||
if ($page['code']==400 && preg_match('/<Message>unable to parse location<\/Message>/', $_result)) {
|
||||
$this->latitudeDec=$this->longitudeDec=0;
|
||||
$this->latitudeDeg=$this->longitudeDeg=0;
|
||||
$this->geocodeur='Yahoo';
|
||||
$this->geocodeur='Cloudmade';
|
||||
$this->precision=0;
|
||||
return false;
|
||||
} elseif ($page['code']==403 && preg_match('/<Message>limit exceeded<\/Message>/', $_result)) {
|
||||
$this->latitudeDec=$this->longitudeDec=0;
|
||||
$this->latitudeDeg=$this->longitudeDeg=0;
|
||||
$this->geocodeur='Yahoo';
|
||||
$this->precision=0;
|
||||
$this->codeRetourY=620; // On adopte les codes Google
|
||||
} elseif ($page['code']==408) { // Connexion impossible au site du partenaire
|
||||
$this->latitudeDec=$this->longitudeDec=0;
|
||||
$this->latitudeDeg=$this->longitudeDeg=0;
|
||||
$this->geocodeur='Yahoo';
|
||||
$this->precision=0;
|
||||
$this->codeRetourY=500; // On adopte les codes Google
|
||||
} elseif ($page['code']==200) {
|
||||
preg_match('!<Latitude>(.*)</Latitude><Longitude>(.*)</Longitude>!U', $_result, $_match);
|
||||
$lng = $_match[2];
|
||||
$lat = $_match[1];
|
||||
preg_match('/warning="(.*)"/Ui', $_result, $_match);
|
||||
/*
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
*/
|
||||
$this->precision=0; // Unknown location
|
||||
switch(@$_match[1]) {
|
||||
case "The exact location could not be found. Here is a nearby county.": $this->precision=3; break; // Sub-region
|
||||
case "The city could not be found. Here is the state/province.": $this->precision=3; break; // Sub-region
|
||||
case "The exact location could not be found. Here is a nearby neighorhood.": $this->precision=4; break; // Town level
|
||||
case "The exact location could not be found. Here is the center of the ZIP code.":
|
||||
case "The street could not be found. Here is the center of the city.": $this->precision=5; break; // Post code (zip code)
|
||||
case "The street number could not be found. Here is a nearby location.":
|
||||
case "The Street name might have been changed": $this->precision=6; break; // Street level accuracy
|
||||
case '': $this->precision=8; break; // Address level
|
||||
|
||||
$fileName=REP_TEMP.'/geoCodeur'.$this->geocodeur;
|
||||
$tmp=@explode(',',file_get_contents($filename));
|
||||
$nbQuery=$tmp[0]*1;
|
||||
|
||||
if ($pays=='') $pays='France';
|
||||
/*if (preg_match('/^([0-9]{1,4} )(.*)$/', $adresse, $matches)) {
|
||||
$adresseVoie=trim($matches[2]);
|
||||
$adresseNum=trim($matches[1]);
|
||||
} else {
|
||||
$adresseVoie=trim($adresse);
|
||||
$adresseNum='';
|
||||
}*/
|
||||
$url='http://beta.geocoding.cloudmade.com/v3/'.$this->apiKeyC.'/api/geo.location.search.2?format=json&source=OSM&enc=UTF-8&limit=10&locale=fr&q='.urlencode("$adresse $cp $ville $pays");
|
||||
$page=getUrl($url, '', '', '', false, '', '', 15);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
|
||||
$nbQuery=($nbQuery*1)+1;
|
||||
file_put_contents($fileName, $nbQuery.','.$this->codeRetour.",$url,".date('Y-m-d H:i:s').EOL);
|
||||
|
||||
$res=@json_decode(utf8_decode($page['body']));
|
||||
if ($this->codeRetour==200 && $res->status->success==1) {
|
||||
$geoCodage=$res->places[0];
|
||||
$this->codeRetourC=1;
|
||||
switch($geoCodage->addressType) {
|
||||
case 'housenumber': $this->precision=8; break;
|
||||
case 'street': $this->precision=6; break;
|
||||
case 'zip': $this->precision=5; break;
|
||||
default:
|
||||
if (preg_match('/The exact location could not be found, here is the closest match/', @$_match[1]))
|
||||
$this->precision=6;
|
||||
else
|
||||
die('Precisions Inconnue : "'.$_match[1].'"'.EOL.$_result);
|
||||
//print_r($res);
|
||||
//die('addressType inconnue : '.$geoCodage->addressType.EOL);
|
||||
break;
|
||||
}
|
||||
|
||||
preg_match('!<Address>(.*)</Address>(?:|.*)<City>(.*)</City>(?:|.*)<State>(.*)</State>!Ui', $_result, $_match);
|
||||
$adrValide=utf8_decode($_match[1].', '.$_match[2].', '.$_match[3]);
|
||||
$this->adresseValidee=strtoupper(str_replace(''', "'", htmlspecialchars_decode($adrValide,ENT_QUOTES)));
|
||||
$this->latitudeDec=$lat;
|
||||
$this->longitudeDec=$lng;
|
||||
$this->adresseValidee=@trim(strtoupper(preg_replace('/\s+/',' ',$geoCodage->houseNumber.' '.$geoCodage->street.', '.
|
||||
$geoCodage->zip.' '.$geoCodage->city.', '.str_replace(',',' ',$geoCodage->country))));
|
||||
|
||||
$this->latitudeDec=$geoCodage->position->lat;
|
||||
$this->longitudeDec=$geoCodage->position->lon;
|
||||
$this->latitudeDeg=dec2dms($this->latitudeDec);
|
||||
$this->longitudeDeg=dec2dms($this->longitudeDec);
|
||||
$this->geocodeur='Yahoo';
|
||||
if ($lat==0 && $lng==0 || $this->precision==0) die('Réponse Yahoo = '.$_result.EOL);
|
||||
return true;//array("lat"=>$lat,"lng"=>$lng,"address"=>$address);
|
||||
|
||||
/*print_r($res);
|
||||
echo $this->adresseValidee.EOL;
|
||||
echo 'lat='.$this->latitudeDec.EOL;
|
||||
echo 'lon='.$this->longitudeDec.EOL;
|
||||
echo 'precis='.$this->precision.EOL;
|
||||
die($url);*/
|
||||
return true;
|
||||
}
|
||||
else {die("URL='$_url'".EOL.print_r($page));
|
||||
//print_r($page);
|
||||
//print_r($res);
|
||||
//die($url);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private function geoCodeAdrCpVilleY($address) {
|
||||
$this->geocodeur='Yahoo';
|
||||
$this->precision=0;
|
||||
|
||||
$fileName=REP_TEMP.'/geoCodeur'.$this->geocodeur;
|
||||
$tmp=@explode(',',file_get_contents($filename));
|
||||
$nbQuery=$tmp[0]*1;
|
||||
|
||||
$_url='http://query.yahooapis.com/v1/public/yql?q=select+*+from+geo.placefinder+where+text%3D%22'.rawurlencode($address).'%22&format=xml';
|
||||
$_result = false;
|
||||
$page=getUrl($_url, '', '', '', false, '', '', 3);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
|
||||
$nbQuery=($nbQuery*1)+1;
|
||||
file_put_contents($fileName, $nbQuery.','.$this->codeRetour.",$url,".date('Y-m-d H:i:s').EOL);
|
||||
|
||||
if ($this->codeRetour==200) {
|
||||
|
||||
/*Réponse Yahoo = <?xml version="1.0" encoding="UTF-8"?>
|
||||
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2013-09-25T13:52:43Z" yahoo:lang="en-US"><results><Result><quality>71</quality>
|
||||
<latitude>45.782864</latitude><longitude>4.828002</longitude><offsetlat>45.782864</offsetlat><offsetlon>4.828002</offsetlon><radius>400</radius>
|
||||
<name/><line1>Rue Jacques Louis-Henon</line1><line2>69004 Lyon</line2><line3/><line4>France</line4><house/><street>Rue Jacques Louis-Henon</street><xstreet/>
|
||||
<unittype/><unit/><postal>69004</postal><neighborhood>4E Arrondissement</neighborhood><city>Lyon</city><county>Rhône</county><state>Rhone-Alpes</state>
|
||||
<country>France</country><countrycode>FR</countrycode><statecode/><countycode/><uzip>69004</uzip><hash/><woeid>20068131</woeid><woetype>11</woetype></Result></results>
|
||||
</query><!-- total: 90 -->
|
||||
<!-- engine8.yql.bf1.yahoo.com -->
|
||||
*/
|
||||
|
||||
//echo "Yahoo :'$address'".EOL.$this->body.EOL;
|
||||
if (preg_match('! yahoo:count="0" !U', $this->body, $_match)) {
|
||||
$this->codeRetourY='ZERO_RESULTS';
|
||||
//echo $this->codeRetourY.EOL;
|
||||
return false;
|
||||
} elseif (preg_match('!<quality>(.*)</quality><latitude>(.*)</latitude><longitude>(.*)</longitude>!U', $this->body, $_match)) {
|
||||
$quality=$_match[1];
|
||||
$this->codeRetourY='OK';
|
||||
if ($quality>87) $this->precision=9; // POI or Coordinate
|
||||
elseif ($quality>82) $this->precision=8; // Address
|
||||
elseif ($quality>75) $this->precision=7; // Intersection
|
||||
elseif ($quality>70) $this->precision=6; // Street match
|
||||
elseif ($quality>40) $this->precision=5; // Zip Code
|
||||
elseif ($quality>30) $this->precision=4; // Town
|
||||
elseif ($quality>20) $this->precision=3; // Sous/Région
|
||||
elseif ($quality>10) $this->precision=2; // Region/state
|
||||
elseif ($quality> 8) $this->precision=1; // Country
|
||||
else { $this->precision=0; // Not an address
|
||||
$this->codeRetourY='ZERO_RESULTS';
|
||||
}
|
||||
$this->latitudeDec=$_match[2];
|
||||
$this->longitudeDec=$_match[3];
|
||||
$this->latitudeDeg=dec2dms($this->latitudeDec);
|
||||
$this->longitudeDeg=dec2dms($this->longitudeDec);
|
||||
if (preg_match('!<line1>(.*)</line1>(?:|.*)<line2>(.*)</line2>(?:|.*)<line4>(.*)</line4>!Ui', $this->body, $_match)) {
|
||||
$adrValide=utf8_decode($_match[1].', '.$_match[2].', '.$_match[3]);
|
||||
$this->adresseValidee=strtoupper(str_replace(''', "'", htmlspecialchars_decode($adrValide,ENT_QUOTES)));
|
||||
$this->codeRetourY='OK';
|
||||
} elseif (preg_match('!<line2>(.*)</line2>(?:|.*)<line4>(.*)</line4>!Ui', $this->body, $_match)) {
|
||||
$adrValide=utf8_decode($_match[2].', '.$_match[3]);
|
||||
$this->adresseValidee=strtoupper(str_replace(''', "'", htmlspecialchars_decode($adrValide,ENT_QUOTES)));
|
||||
$this->codeRetourY='OK';
|
||||
} else
|
||||
$this->codeRetourY='INVALID_REQUEST';
|
||||
} else
|
||||
//die('Code Retour Yahoo 200 mais :'.$this->body.EOL);
|
||||
|
||||
if ($this->latitudeDec==0 && ($this->longitudeDec==0 || $this->precision==0)) die('Réponse Yahoo = '.$this->body.EOL);
|
||||
return true;//array("lat"=>$lat,"lng"=>$lng,"address"=>$address);
|
||||
} else
|
||||
$this->codeRetourY='INVALID_REQUEST';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function geoCodeAdrCpVilleG($adresse,$cp,$ville,$pays, $proxy='') {
|
||||
$this->geocodeur='Google';
|
||||
$this->precision=0;
|
||||
|
||||
$url='http://maps.google.com/maps/geo?q='.urlencode($adresse.', '.$cp.' '. $ville.', '.$pays).'&output=xml&key='.$this->apiKeyG;
|
||||
$fileName=REP_TEMP.'/geoCodeur'.$this->geocodeur;
|
||||
$tmp=@explode(',',file_get_contents($filename));
|
||||
$nbQuery=$tmp[0]*1;
|
||||
|
||||
$url='http://maps.googleapis.com/maps/api/geocode/xml?address='.urlencode($adresse.', '.$cp.' '. $ville.', '.$pays).'&sensor=false';
|
||||
|
||||
$page=getUrl($url, '', '', $this->referer, false, 'maps.google.com', $proxy,3);
|
||||
//getUrl($url, $strCookies='', $postData='', $referer='', $debug=false, $host='', $proxy='', $timeout=0) {
|
||||
@ -698,13 +763,13 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
|
||||
$nbQuery=($nbQuery*1)+1;
|
||||
file_put_contents($fileName, $nbQuery.','.$this->codeRetour.",$url,".date('Y-m-d H:i:s').EOL);
|
||||
|
||||
if ($this->codeRetour==200) {
|
||||
// REVERSE GEOCODING
|
||||
// http://maps.google.com/maps/geo?oe=utf-8&ll=48.808955,2.34227&output=xml&key=ABQIAAAAuKBtUyFonYJBl1fqfc78tRQvADPcxwXf3Q2QIE-M32vuSkrxiBRLUHDB_YSLeTscTDeWRKM_wILaaw
|
||||
|
||||
//die($this->body=$page['body']);
|
||||
//{"name":"3 rue viète, 75017 paris, france","Status":{"code":200,"request":"geocode"},"Placemark":[{"id":"p1","address":"3, Rue Viète, 75017 17ème Arrondissement, Paris, France","AddressDetails":{"Country":{"CountryNameCode":"FR","AdministrativeArea":{"AdministrativeAreaName":"Ile-de-France","SubAdministrativeArea":{"SubAdministrativeAreaName":"Paris","Locality":{"LocalityName":"Paris","DependentLocality":{"DependentLocalityName":"17ème Arrondissement","Thoroughfare":{"ThoroughfareName":"3, Rue Viète"},"PostalCode":{"PostalCodeNumber":"75017"}}}}}},"Accuracy": 8},"Point":{"coordinates":[2.306174,48.883705,0]}}]}
|
||||
/*<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.0"><Response><name>3 rue viète, 75017 paris, france</name><Status><code>200</code><request>geocode</request></Status><Placemark id="p1"><address>3, Rue Viète, 75017 17ème Arrondissement, Paris, France</address><AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>FR</CountryNameCode><AdministrativeArea><AdministrativeAreaName>Ile-de-France</AdministrativeAreaName><SubAdministrativeArea><SubAdministrativeAreaName>Paris</SubAdministrativeAreaName><Locality><LocalityName>Paris</LocalityName><DependentLocality><DependentLocalityName>17ème Arrondissement</DependentLocalityName><Thoroughfare><ThoroughfareName>3, Rue Viète</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>75017</PostalCodeNumber></PostalCode></DependentLocality></Locality></SubAdministrativeArea></AdministrativeArea></Country></AddressDetails><Point><coordinates>2.306174,48.883705,0</coordinates></Point></Placemark></Response></kml>*/
|
||||
|
||||
/*
|
||||
0 Unknown location. (Since 2.59)
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
@ -716,8 +781,26 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
8 Address level accuracy. (Since 2.59)
|
||||
*/
|
||||
$this->codeRetourG=@getTextInHtml($this->body, '<Status>', '<code>', '/code>');
|
||||
$this->precision=@getTextInHtml($this->body, '<AddressDetails Accuracy', '="', '" ');
|
||||
$this->codeRetourG=@getTextInHtml($this->body, '<GeocodeResponse>', '<status>', '</status>');
|
||||
$location_type=@getTextInHtml($this->body, '<geometry>', '<location_type>', '</location_type>');
|
||||
switch($location_type) {
|
||||
case 'ROOFTOP': // Precise geocode for which we have location information accurate down to street address precision.
|
||||
$this->precision=8;
|
||||
break;
|
||||
case 'RANGE_INTERPOLATED': // Approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.
|
||||
$this->precision=7;
|
||||
break;
|
||||
case 'GEOMETRIC_CENTER': // Geometric center of a result such as a polyline (for example, a street) or polygon (region).
|
||||
$this->precision=6;
|
||||
break;
|
||||
case 'APPROXIMATE': // indicates that the returned result is approximate.
|
||||
$this->precision=4;
|
||||
break;
|
||||
default:
|
||||
if ($this->codeRetourG=='ZERO_RESULTS') // Indicates that the geocode was successful but returned no results.
|
||||
$this->precision=0; // This may occur if the geocode was passed a non-existent address or a latlng in a remote location.
|
||||
break;
|
||||
}
|
||||
|
||||
$this->adresseValidee=strtoupper(str_replace(''', "'", htmlspecialchars_decode(utf8_decode(@getTextInHtml($this->body, '<Placemark', '<address>', '</address>')),ENT_QUOTES)));
|
||||
$strTmp=@getTextInHtml($this->body, '<Point><coordinates>', '<coordinates>', '</coordinates>');
|
||||
@ -726,9 +809,6 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
$this->longitudeDec=$tabTmp[0];
|
||||
$this->latitudeDeg=dec2dms($this->latitudeDec);
|
||||
$this->longitudeDeg=dec2dms($this->longitudeDec);
|
||||
|
||||
$this->geocodeur='Google';
|
||||
|
||||
/*
|
||||
200 G_GEO_SUCCESS No errors occurred; the address was successfully parsed and its geocode has been returneds->geocodeur='Google';
|
||||
|
||||
@ -745,23 +825,44 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
there is no route available between the two points, or because we do not have data for routing in that region.
|
||||
610 G_GEO_BAD_KEY The given key is either invalid or does not match the domain for which it was given.
|
||||
620 G_GEO_TOO_MANY_QUERIES The given key has gone over the requests limit in the 24 hour period.
|
||||
*/
|
||||
if ($this->codeRetourG==200)
|
||||
return true;
|
||||
|
||||
<GeocodeResponse><status>OK</status><result><type>street_address</type><formatted_address>2 Route du Cure, 92410 Ville-d'Avray, France</formatted_address><address_component><long_name>2</long_name><short_name>2</short_name><type>street_number</type></address_component><address_component><long_name>Route du Cure</long_name><short_name>Route du Cure</short_name><type>route</type></address_component><address_component><long_name>Ville-d'Avray</long_name><short_name>Ville-d'Avray</short_name><type>locality</type><type>political</type></address_component><address_component><long_name>Hauts-de-Seine</long_name><short_name>92</short_name><type>administrative_area_level_2</type><type>political</type></address_component><address_component><long_name>Île-de-France</long_name><short_name>IDF</short_name><type>administrative_area_level_1</type><type>political</type></address_component><address_component><long_name>France</long_name><short_name>FR</short_name><type>country</type><type>political</type></address_component><address_component><long_name>92410</long_name><short_name>92410</short_name><type>postal_code</type></address_component><geometry><location><lat>48.8252802</lat><lng>2.1821693</lng></location>
|
||||
|
||||
/*
|
||||
"OK" indicates that no errors occurred; the address was successfully parsed and at least one geocode was returned.
|
||||
|
||||
"OVER_QUERY_LIMIT" indicates that you are over your quota.
|
||||
"REQUEST_DENIED" indicates that your request was denied, generally because of lack of a sensor parameter.
|
||||
"" generally indicates that the query (address or latlng) is missing.
|
||||
UNKNOWN_ERROR indicates that the request could not be processed due to a server error. The request may succeed if you try again.
|
||||
*/
|
||||
|
||||
if ($this->codeRetourG=='OK')
|
||||
return true;
|
||||
elseif ($this->codeRetourG=='ZERO_RESULTS' || // http://maps.googleapis.com/maps/api/geocode/xml?address=0044+RUE+JACQUES+-+LOUIS+HENON%2C+69004+LYON+4EME%2C+France&sensor=false
|
||||
$this->codeRetourG=='INVALID_REQUEST' || // http://maps.googleapis.com/maps/api/geocode/xml?address=0028+B+RUE+MGR+DE+BEAUMONT%2C+97400+SAINT+DENIS%2C+La+R%E9union&sensor=false
|
||||
$this->codeRetourG=='OVER_QUERY_LIMIT') {
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
//echo $url.' ('.$this->codeRetour.')'.EOL;
|
||||
//die('Code Retour Google ='.$this->codeRetourG.EOL);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Géocodage d'une adresse
|
||||
** 0 Unknown location. (Since 2.59)
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
|
||||
3 Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)
|
||||
4 Town (city, village) level accuracy. (Since 2.59)
|
||||
5 Post code (zip code) level accuracy. (Since 2.59)
|
||||
6 Street level accuracy. (Since 2.59)
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
8 Address level accuracy. (Since 2.59)
|
||||
0 Unknown location. (Since 2.59)
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
|
||||
3 Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)
|
||||
4 Town (city, village) level accuracy. (Since 2.59)
|
||||
5 Post code (zip code) level accuracy. (Since 2.59)
|
||||
6 Street level accuracy. (Since 2.59)
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
8 Address level accuracy. (Since 2.59)
|
||||
9 Address level accuracy +++
|
||||
**/
|
||||
function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='') {
|
||||
$iDb=new WDB();
|
||||
@ -821,15 +922,16 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
die("Code Rivoli non géré : '$codeRivoli'".EOL);
|
||||
|
||||
$retG=$this->geoCodeAdrCpVilleG($adresse, $cp, $ville, $pays);
|
||||
if ($this->codeRetourG==620 || $this->precision==0)
|
||||
/*if ($this->codeRetourG==620)
|
||||
$retY=$this->geoCodeAdrCpVilleY("$adresse, $cp $ville");
|
||||
|
||||
if ($this->codeRetourY==620 || $this->codeRetourY==503 || $this->precision==0)*/
|
||||
$retM=$this->geoCodeAdrCpVilleM($adresse, $cp, $ville, $pays);
|
||||
if ($this->codeRetourG=='OVER_QUERY_LIMIT' || $this->precision==0) {
|
||||
$retY=$this->geoCodeAdrCpVilleY("$adresse, $cp $ville, $pays");
|
||||
if ($this->codeRetourY=='OVER_QUERY_LIMIT' || $this->codeRetourY<>'OK' || $this->precision==0)
|
||||
$retC=$this->geoCodeAdrCpVilleC($adresse, $cp, $ville, $pays);
|
||||
// $retM=$this->geoCodeAdrCpVilleM($adresse, $cp, $ville, $pays);
|
||||
}
|
||||
|
||||
// On récupère l'altitude
|
||||
if ($this->precision>5) {
|
||||
echo ('Précision : '. $this->precision.EOL);
|
||||
if ($this->precision>5 && $this->latitudeDec<>0 && $this->longitudeDec<>0) {
|
||||
$alt=$this->getAltitude($this->latitudeDec,$this->longitudeDec);
|
||||
$this->altitude=$alt['alt'];
|
||||
}
|
||||
@ -837,7 +939,9 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
$this->l93x=$tmp['x_93'];
|
||||
$this->l93y=$tmp['y_93'];
|
||||
|
||||
if ($retG || $retY || $retM) {
|
||||
echo ('$retG='.$retG.EOL.'$retY='.$retY.EOL.'$retC='.$retC.EOL.'$retM='.$retM.EOL);
|
||||
|
||||
if ($retG || $retY || $retM || $retC) {
|
||||
$adresse=stripslashes(strtoupper(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie"))));
|
||||
$ville=stripslashes($ville);
|
||||
$tabInsert=array( 'address'=>$adresse,
|
||||
@ -860,9 +964,20 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
);
|
||||
/** Insertion de l'adresse que si elle est possible
|
||||
**/
|
||||
if ($this->latitudeDec<>0 && $this->longitudeDec<>0)
|
||||
echo ('Avant Insert '.$this->latitudeDec.EOL.$this->longitudeDec.EOL);
|
||||
if ($this->latitudeDec<>0 && $this->longitudeDec<>0) {
|
||||
print_r($tabInsert);
|
||||
echo ($this->latitudeDec.EOL.$this->longitudeDec.EOL);
|
||||
$iDb->insert('zonageXY', $tabInsert);
|
||||
|
||||
if (mysql_errno()>0) echo mysql_error().die(EOL);
|
||||
} else {
|
||||
$this->precision=$this->latitudeDec=$this->longitudeDec=0;
|
||||
$this->adresseValidee='';
|
||||
$this->latitudeDeg=$this->longitudeDeg='';
|
||||
$ligne="Erreur Geocodage : $adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville, $pays, $codeRivoli, ".$this->body;
|
||||
//die('Latitude et longitude à zero :'.$this->latitudeDec.EOL.$this->longitudeDec.EOL);
|
||||
}
|
||||
echo ('Après Insert : '.$this->latitudeDec.EOL.$this->longitudeDec.EOL);
|
||||
$ligne='Accès Google : '.print_r($tabInsert, true);
|
||||
}
|
||||
else {
|
||||
@ -872,7 +987,6 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
$ligne="Erreur : $adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville, $pays, $codeRivoli, ".$this->body;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* if (latnorth == 'S') latdir='-'
|
||||
if (lonwest == 'W') longdir='-'
|
||||
|
3581
1.2/library/Metier/scores/Cache/CacheTabFormules.php
Normal file
3581
1.2/library/Metier/scores/Cache/CacheTabFormules.php
Normal file
File diff suppressed because it is too large
Load Diff
25
1.2/library/Metier/scores/Cache/CacheTabInfla.php
Normal file
25
1.2/library/Metier/scores/Cache/CacheTabInfla.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
return array(
|
||||
1991=>3.2,
|
||||
1992=>2.4,
|
||||
1993=>2.1,
|
||||
1994=>1.7,
|
||||
1995=>1.7,
|
||||
1996=>2,
|
||||
1997=>1.2,
|
||||
1998=>0.7,
|
||||
1999=>0.5,
|
||||
2000=>1.7,
|
||||
2001=>1.7,
|
||||
2002=>1.9,
|
||||
2003=>2.1,
|
||||
2004=>2.1,
|
||||
2005=>1.8,
|
||||
2006=>1.6,
|
||||
2007=>1.5,
|
||||
2008=>2.8,
|
||||
2009=>0.1,
|
||||
2010=>1.5,
|
||||
2011=>2.1,
|
||||
2012=>2,
|
||||
);
|
22
1.2/library/Metier/scores/Cache/CacheTabRendObli.php
Normal file
22
1.2/library/Metier/scores/Cache/CacheTabRendObli.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
return array(
|
||||
1994=>5.65,
|
||||
1995=>5.29,
|
||||
1996=>4.69,
|
||||
1997=>4.93,
|
||||
1998=>3.92,
|
||||
1999=>3.99,
|
||||
2000=>4.35,
|
||||
2001=>3.35,
|
||||
2002=>2.83,
|
||||
2003=>2.68,
|
||||
2004=>2.45,
|
||||
2005=>2.46,
|
||||
2006=>2.66,
|
||||
2007=>2.86,
|
||||
2008=>3.45,
|
||||
2009=>2.81,
|
||||
2010=>2.17,
|
||||
2011=>1.7,
|
||||
2012=>0,
|
||||
);
|
6008
1.2/library/Metier/scores/Cache/CacheTabVariables.php
Normal file
6008
1.2/library/Metier/scores/Cache/CacheTabVariables.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,17 @@
|
||||
Problème à debugger
|
||||
===================
|
||||
Version 411 :
|
||||
FRANCHISE AMO ET SOFT
|
||||
Commentaires
|
||||
Faire disparaitre <BLOC>
|
||||
Code 34810 supprimé espace sur ' {NOMEN}'
|
||||
Code 9995 ajouté fin de balise </I>
|
||||
Code 396000, ligne 20 : apostrophe
|
||||
Code 740160, ligne 10 : apostrophe sur "les frais d'établissement"
|
||||
Code 770061, ligne 10 : apostrophe sur "la durée moyenne d'extinction"
|
||||
Code 770221, ligne : apostrophe sur "l'article"
|
||||
Code 770222, ligne : apostrophe sur "l'article"
|
||||
|
||||
Amélioration des scores
|
||||
=======================
|
||||
|
||||
|
4922
1.2/library/Metier/scores/Variables/CommentsIndiscore409.php
Normal file
4922
1.2/library/Metier/scores/Variables/CommentsIndiscore409.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@ $tabCommentaires[8021][2][10] = "L'avis de Dissolution anticipée de la Sociét
|
||||
$tabCommentaires[8101][2][10] = "<BR>{\"NOMEN\"} fait partie des 2000 plus grosses entreprises Françaises. La complexité de la structure du groupe limite la portée de l'analyse des Forces & Faiblesses de cette seule entité. L'analyse complète est désactivée mais nous conservons les tableaux synthétiques.";
|
||||
$tabCommentaires[8102][2][10] = "<BR>{\"NOMEN\"} fait partie des 2000 plus grosses entreprises Françaises. La complexité de la structure du groupe limite la portée de l'analyse des Forces & Faiblesses de cette seule entité. L'analyse complète est désactivée mais nous conservons les tableaux synthétiques.";
|
||||
$tabCommentaires[8103][2][10] = "<BR>{\"NOMEN\"} fait partie des 2000 plus grosses entreprises Françaises. La complexité de la structure du groupe limite la portée de l'analyse des Forces & Faiblesses de cette seule entité. L'analyse complète est désactivée mais nous conservons les tableaux synthétiques.";
|
||||
$tabCommentaires[9995][2][1] = "L'objet social publié dans les annonces légales est libellé comme : <I>\"{ANNONCEOBJET}\".
|
||||
$tabCommentaires[9995][2][1] = "L'objet social publié dans les annonces légales est libellé comme : <I>\"{ANNONCEOBJET}\"</I>.
|
||||
";
|
||||
$tabCommentaires[9996][2][1] = "Au répertoire national l'activité est codifiée {APEENT(5)}, ({APEENT}).
|
||||
";
|
||||
@ -71,7 +71,7 @@ $tabCommentaires[31070][2][0] = "Les activités principales des établissements
|
||||
$tabCommentaires[34800][2][10] = "\" {NOMEN}\" est identifiée avec le n° SIREN: {SIREN}, son siège n'a pas changé d'adresse depuis sa création.";
|
||||
$tabCommentaires[34801][2][10] = "\" {NOMEN}\" est identifiée avec le n° SIREN: {SIREN}, son siège a déjà changé d'adresse depuis sa création mais il est revenu à son adresse d'origine.";
|
||||
$tabCommentaires[34802][2][10] = "\" {NOMEN}\" est identifiée avec le n° SIREN: {SIREN}, son siège, n'a pas changé d'adresse depuis sa création. Les opérations de fusions intervenues peuvent masquer d'éventuels changements d'adresse des sociétés absorbées.";
|
||||
$tabCommentaires[34810][2][10] = "\" {NOMEN}\" est identifiée avec le n° SIREN: {SIREN}, son siège a déjà changé d'adresse depuis sa création.";
|
||||
$tabCommentaires[34810][2][10] = "\"{NOMEN}\" est identifiée avec le n° SIREN: {SIREN}, son siège a déjà changé d'adresse depuis sa création.";
|
||||
$tabCommentaires[34819][2][10] = "\" {NOMEN}\" est identifiée avec le n° SIREN: {SIREN}.";
|
||||
$tabCommentaires[34820][2][10] = "Elle est aussi répertoriée au Registre des Intermédiaires en Assurance (ORIAS) avec le N° {ORIASID}, comme {ORIASCAT}.";
|
||||
$tabCommentaires[34830][2][10] = "Elle est aussi répertoriée au Registre des Intermédiaires en Assurance (ORIAS) avec le N° {ORIASID}.";
|
||||
@ -451,7 +451,7 @@ $tabCommentaires[350000][2][10] = "Dans le cadre de cette procédure collective,
|
||||
$tabCommentaires[355000][2][50] = "Durant l'exécution du plan, une modification a eu lieu en date du {ANNONCEDATE}.";
|
||||
$tabCommentaires[395000][2][10] = "Ce holding financier est en procédure collective, impactant de fait l'ensemble des filiales participations";
|
||||
$tabCommentaires[396000][2][10] = "La conciliation à fait l'objet de son homologation publiée le {ANNONCEHOMDATE} montrant ainsi que, malgré les difficultés, les termes de l'accord sont de nature à assurer la pérennité de l'activité de l'entreprise.";
|
||||
$tabCommentaires[396000][2][20] = "L'entreprise n'est plus en situation de cessation des paiements et l?accord ne porte pas atteinte aux intérêts des créanciers non signataires, s'il ne concerne pas tous les créanciers.";
|
||||
$tabCommentaires[396000][2][20] = "L'entreprise n'est plus en situation de cessation des paiements et l'accord ne porte pas atteinte aux intérêts des créanciers non signataires, s'il ne concerne pas tous les créanciers.";
|
||||
$tabCommentaires[396000][2][30] = "Par conséquent, nous reprenons notre étude des éléments financiers.";
|
||||
$tabCommentaires[400000][2][10] = "Le caractère historique de la procédure de liquidation ne semble plus avoir d'impact sur l'activité, une nouvelle évaluation a donc eu lieu.";
|
||||
$tabCommentaires[400101][2][10] = "L'historique des annonces légales fait état d'un changement dans l'administration de l'entreprise publié le {ANNONCEDIRDATE}.";
|
||||
@ -764,9 +764,9 @@ $tabCommentaires[714000][2][10] = "<C.>. Cette amélioration rétablit la marge
|
||||
$tabCommentaires[715000][2][10] = "<C.>. Cette dégradation fait passer le résultat d'exploitation du dernier exercice en négatif ({Rp[150]} <LI=> {R[150]}).";
|
||||
$tabCommentaires[716000][2][10] = "<C.>. Cette dégradation détruit la marge d'exploitation de l'exercice.";
|
||||
$tabCommentaires[717000][2][10] = "<C.>. Cette dégradation sensible détruit la marge d'exploitation de l'exercice.";
|
||||
$tabCommentaires[718000][2][10] = "En première approche on peut dire que la performance globale de l'entreprise par rapport à l'actif mis en ?uvre pour créer de la valeur est faible.";
|
||||
$tabCommentaires[719000][2][10] = "En première approche on peut dire que la performance globale de l'entreprise par rapport à l'actif mis en ?uvre pour créer de la valeur est satisfaisante.";
|
||||
$tabCommentaires[719500][2][10] = "En première approche on peut dire que la performance globale de l'entreprise par rapport à l'actif mis en ?uvre pour créer de la valeur est particulièrement élevée.";
|
||||
$tabCommentaires[718000][2][10] = "En première approche on peut dire que la performance globale de l'entreprise par rapport à l'actif mis en œuvre pour créer de la valeur est faible.";
|
||||
$tabCommentaires[719000][2][10] = "En première approche on peut dire que la performance globale de l'entreprise par rapport à l'actif mis en œuvre pour créer de la valeur est satisfaisante.";
|
||||
$tabCommentaires[719500][2][10] = "En première approche on peut dire que la performance globale de l'entreprise par rapport à l'actif mis en œuvre pour créer de la valeur est particulièrement élevée.";
|
||||
$tabCommentaires[722000][2][10] = "Enfin, la rentabilité financière, (résultat net de {BILANANNEE} rapporté aux capitaux propres), est faible. Ce taux de {R[523]} de rendement du capital investi, reste sous la norme de l'efficacité avec laquelle une entreprise utilise le capital pour générer ses profits. D'ailleurs la rentabilité de l'entreprise est bien en dessous de la moyenne du secteur qui est à {+Rs[523]}.";
|
||||
$tabCommentaires[722010][2][10] = "Enfin, la rentabilité financière, (résultat net de {BILANANNEE} rapporté aux capitaux propres), est très faible. Ce taux de {R[523]} de rendement du capital investi, est très en dessous de l'efficacité avec laquelle une entreprise utilise le capital pour générer ses profits, ni même le rendement d'un placement sur livret.";
|
||||
$tabCommentaires[722020][2][10] = "Enfin, la rentabilité financière, (résultat net de {BILANANNEE} rapporté aux capitaux propres), est plutot faible. Ce taux de {R[523]} de rendement du capital investi, reste sous la norme de l'efficacité avec laquelle une entreprise utilise le capital pour générer ses profits. ";
|
||||
@ -841,7 +841,7 @@ $tabCommentaires[740110][2][10] = "Le poids des capitaux fixes dans le patrimoin
|
||||
$tabCommentaires[740111][2][30] = "<C.>, et il augmente de {!Revol[524]} depuis {BILANANNEEp}.";
|
||||
$tabCommentaires[740112][2][30] = "<C.>, bien qu'il se soit réduit de {!Revol[524]} depuis {BILANANNEEp}.";
|
||||
$tabCommentaires[740115][2][30] = "A noter que le foncier, à lui seul, se monte à {R[311]} représentant {R[314]} du total bilan.";
|
||||
$tabCommentaires[740160][2][10] = "Le poids des immobilisations incorporelles (concessions, les brevets, les frais de recherche et développement, les frais d?établissement, le fonds de commerce, le droit au bail), par rapport au total bilan, est de {R[554]}. Il est d'une hauteur anormale par rapport au secteur qui affiche {Rs[554]}.";
|
||||
$tabCommentaires[740160][2][10] = "Le poids des immobilisations incorporelles (concessions, les brevets, les frais de recherche et développement, les frais d'établissement, le fonds de commerce, le droit au bail), par rapport au total bilan, est de {R[554]}. Il est d'une hauteur anormale par rapport au secteur qui affiche {Rs[554]}.";
|
||||
$tabCommentaires[740161][2][30] = "<C.>, et il augmente de {!Revol[554]} depuis {BILANANNEEp}.";
|
||||
$tabCommentaires[740162][2][30] = "<C.>, bien qu'il se soit réduit de {!Revol[554]} depuis {BILANANNEEp}.";
|
||||
$tabCommentaires[740210][2][10] = "Le poids des immobilisations financières (par exemple des participations dans d'autres sociétés) par rapport à l'Actif total, est de {R[533]}. Il est d'une hauteur anormale par rapport au secteur qui affiche {Rs[533]}.";
|
||||
@ -1033,9 +1033,9 @@ $tabCommentaires[770030][2][10] = "<TR CLASS=\"NORMAL\"><TD>Annuité/recettes
|
||||
$tabCommentaires[770031][2][10] = "<TR CLASS=\"NORMAL\"><TD>Annuité/recettes réelles de fonctionnement(total recettes) </TD><TD>{RQ[830]} </TD><TD><I>Ce ratio présente un très fort effet d'inertie, il faut plusieurs années pour le dégrader mais aussi pour le ramener à la normale. La norme est de l'ordre de 19%. La moyenne de la strate le situe à {RT[830]}.</I> </TD> </TR>";
|
||||
$tabCommentaires[770040][2][10] = "<TR CLASS=\"NORMAL\"><TD>Annuité/recettes fiscales de fonctionnement </TD><TD>{RQ[861]} </TD><TD> </TD> </TR>";
|
||||
$tabCommentaires[770050][2][10] = "<TR CLASS=\"NORMAL\"><TD>Ratio de surendettement (en-cours de la dette/produits de fonctionnement) </TD><TD>{RQ[829]} </TD><TD><I></I> </TD> </TR>";
|
||||
$tabCommentaires[770051][2][10] = "<TR CLASS=\"NORMAL\"><TD>Ratio de surendettement (en-cours de la dette/produits de fonctionnement) </TD><TD>{RQ[829]} </TD><TD><I>Indique les marges de man?uvre pour les années à venir. Le seuil d'alerte est à 121 %</I> </TD> </TR>";
|
||||
$tabCommentaires[770051][2][10] = "<TR CLASS=\"NORMAL\"><TD>Ratio de surendettement (en-cours de la dette/produits de fonctionnement) </TD><TD>{RQ[829]} </TD><TD><I>Indique les marges de manœuvre pour les années à venir. Le seuil d'alerte est à 121 %</I> </TD> </TR>";
|
||||
$tabCommentaires[770060][2][10] = "<TR CLASS=\"NORMAL\"><TD>Durée d'extinction de la dette (dette/épargne brute) </TD><TD>{R[869]} </TD><TD><I> </I> </TD> </TR>";
|
||||
$tabCommentaires[770061][2][10] = "<TR CLASS=\"NORMAL\"><TD>Durée d'extinction de la dette (dette/épargne brute) </TD><TD>{R[869]} </TD><TD><I> Pour les communes de plus de 10 000 hab , la durée moyenne d ?extinction de la dette est de 5,8 années.</I> </TD> </TR>";
|
||||
$tabCommentaires[770061][2][10] = "<TR CLASS=\"NORMAL\"><TD>Durée d'extinction de la dette (dette/épargne brute) </TD><TD>{R[869]} </TD><TD><I> Pour les communes de plus de 10 000 hab , la durée moyenne d'extinction de la dette est de 5,8 années.</I> </TD> </TR>";
|
||||
$tabCommentaires[770100][2][0] = "<H4>Analyse des charges";
|
||||
$tabCommentaires[770100][2][1] = "<TABLE CLASS=\"TABLEAUSIMPLEDROITE\" id=\"ANACHARGES\">";
|
||||
$tabCommentaires[770100][2][2] = "<TR CLASS=\"TITRES\"> <TH>année {COLLANNEE} </TH><TH>Ratio </TH><TH>Observations </TH></TR>";
|
||||
@ -1046,8 +1046,8 @@ $tabCommentaires[770140][2][10] = "<TR CLASS=\"NORMAL\"><TD>Coefficient d'auto
|
||||
$tabCommentaires[770150][2][10] = "<TR CLASS=\"NORMAL\"><TD>Taux d'autofinancement de l'investissement (Epargne nette après remboursement de l'annuité en capital)/ Dépense d'équipement brut) </TD><TD>{R[875]} </TD><TD><I>Ce ratio peut être faussé selon la technique de prise en compte de l'amortissement en capital. (moyenne nationale : 19%) </I></TD> </TR>";
|
||||
$tabCommentaires[770210][2][1] = "Le résultat comptable de l'année {COLLANNEE} est déficitaire de {!R[811]} ({!R[876]} des recettes de fonctionnement).";
|
||||
$tabCommentaires[770211][2][1] = "<C.>, ce qui représente {!RH[811]} par habitant.";
|
||||
$tabCommentaires[770221][2][1] = "Pour une commune de moins de 20.000 habitants, ce déficit dépassant 10% des produits de fonctionnement, entre dans le cadre de l?article L. 1612-14 du C.G.C.T.";
|
||||
$tabCommentaires[770222][2][1] = "Pour une commune de plus de 20.000 habitants, ce déficit dépassant 5% des produits de fonctionnement, entre dans le cadre de l?article L. 1612-14 du C.G.C.T.";
|
||||
$tabCommentaires[770221][2][1] = "Pour une commune de moins de 20.000 habitants, ce déficit dépassant 10% des produits de fonctionnement, entre dans le cadre de l'article L. 1612-14 du C.G.C.T.";
|
||||
$tabCommentaires[770222][2][1] = "Pour une commune de plus de 20.000 habitants, ce déficit dépassant 5% des produits de fonctionnement, entre dans le cadre de l'article L. 1612-14 du C.G.C.T.";
|
||||
$tabCommentaires[770300][2][0] = "<H4>Service rendu";
|
||||
$tabCommentaires[770300][2][1] = "<TABLE CLASS=\"TABLEAUSIMPLEDROITE\" id=\"SERVICERENDU\">";
|
||||
$tabCommentaires[770300][2][2] = "<TR CLASS=\"TITRES\"> <TH>année {COLLANNEE} </TH><TH>Ratio </TH><TH>Observations </TH></TR>";
|
||||
@ -1224,7 +1224,7 @@ $tabCommentaires[2500100][2][0] = "\"- La mobilisation du potentiel fiscal n'ét
|
||||
$tabCommentaires[2500110][2][0] = "\"- L'encours de la dette est limité ({RQ[829]}), et il reste encore une marge possible d'appel à l'emprunt pour les investissements.";
|
||||
$tabCommentaires[2500120][2][0] = "\"- Les dépenses obligatoires incompressibles (personnel, assurances, intérêts des emprunts, etc...) représentant {R[872]} des recettes de fonctionnement restent sous le seuil d'alerte. S'il est prévu d'engager de nouvelles dépenses elles devraient être absorbées pour autant que la rigidité structurelle ne passe pas la barre des 65%.";
|
||||
$tabCommentaires[2500130][2][0] = "\"- L'autofinancement est satisfaisant {R[873]}, la collectivité est capable d'engager des opérations plus importantes.";
|
||||
$tabCommentaires[2500999][2][0] = "<H4> Marges de man?uvre";
|
||||
$tabCommentaires[2500999][2][0] = "<H4> Marges de manœuvre";
|
||||
$tabCommentaires[2590000][2][0] = "<I><B>Bien que le dernier bilan publié soit trop ancien et que les commentaires financiers aient été occultés, nous maintenons l'analyse des éléments favorables et défavorables.</B></I>";
|
||||
$tabCommentaires[2595000][2][0] = "<LI+> Entreprise en place depuis de nombreuses années.";
|
||||
$tabCommentaires[2600000][2][0] = "<LI+> Entreprise établie depuis longtemps.";
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?
|
||||
/** Ratios pour les collectivités **/
|
||||
global $tabZones2Ratios;
|
||||
|
||||
@ -209,6 +209,7 @@
|
||||
'R44c'=>'Rs[841]',
|
||||
);
|
||||
|
||||
|
||||
/** Conversion des zones pour les collectivités **/
|
||||
function convertZones($codeR, $zonesDB) {
|
||||
global $tabZones2Ratios;
|
||||
@ -223,4 +224,4 @@
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
?>
|
||||
?>
|
@ -254,7 +254,7 @@ function formatValeur($variable, $longeur=0, $fonction='')
|
||||
return $variable;
|
||||
} else {
|
||||
if ($nomVar=='ZEMET') {
|
||||
$strTmp=eval("return $valeur;");
|
||||
global $RPEN;
|
||||
if (isset($tabVariables['ZEMET'][$RPEN.$ZEMET]['art']))
|
||||
return $tabVariables['ZEMET'][$RPEN.$ZEMET]['art'];
|
||||
else
|
||||
@ -637,7 +637,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$tabCommentaires = $tabTri = $tabTriAff = array();
|
||||
switch( $type ) {
|
||||
case 'scores':
|
||||
$version = '405';
|
||||
$version = '411';
|
||||
require_once 'Metier/scores/Variables/CommentsIndiscore'.$version.'.php';
|
||||
break;
|
||||
case 'valo':
|
||||
@ -826,11 +826,11 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$SOCIETE_COTE_ISIN=$tabIdentite['Isin'];
|
||||
if ($SOCIETE_COTE_ISIN<>'') {
|
||||
$SOCIETE_COTE=true;
|
||||
$SOCIETE_COTE_PLACE=$tabRet['Bourse']['placeCotation'];
|
||||
$SOCIETE_COTE_MARCHE=$tabRet['Bourse']['marche'];
|
||||
$SOCIETE_COTE_CAPITALISATION=$tabRet['Bourse']['capitalisation']; // Afficher en KE
|
||||
$SOCIETE_COTE_COURS=$tabRet['Bourse']['derCoursCloture'];
|
||||
$SOCIETE_COTE_COURS_DATE=$tabRet['Bourse']['derCoursDate'];
|
||||
$SOCIETE_COTE_PLACE=$tabIdentite['Bourse']['placeCotation'];
|
||||
$SOCIETE_COTE_MARCHE=$tabIdentite['Bourse']['marche'];
|
||||
$SOCIETE_COTE_CAPITALISATION=$tabIdentite['Bourse']['capitalisation']; // Afficher en KE
|
||||
$SOCIETE_COTE_COURS=$tabIdentite['Bourse']['derCoursCloture'];
|
||||
$SOCIETE_COTE_COURS_DATE=$tabIdentite['Bourse']['derCoursDate'];
|
||||
$SOCIETE_COTE_COURS_MIN=0;//@todo:$tabRet['Bourse']['derCoursDate'];
|
||||
$SOCIETE_COTE_COURS_MAX=0;//@todo:$tabRet['Bourse']['derCoursDate'];
|
||||
}
|
||||
@ -2977,8 +2977,9 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
elseif ($indiscore20>=8) $classeRisque=2;
|
||||
else $classeRisque=1;
|
||||
|
||||
if (($ACTIFRNCS*1==0 && $ACTIFINSEE*1==0) ||
|
||||
$tabIdentite['SituationJuridique']<>'')
|
||||
if ( ($ACTIFRNCS*1==0 && $ACTIFINSEE*1==0)
|
||||
|| $tabIdentite['SituationJuridique'] == 'P'
|
||||
|| $tabIdentite['SituationJuridique'] == 'PL')
|
||||
$classeRisque=9;
|
||||
elseif ($ENCOURS=='N/A') $classeRisque=8;
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
00
|
||||
11 IT
|
||||
12 I
|
||||
13 T
|
||||
21 D NR
|
||||
22 D VNR
|
||||
23 DL N
|
||||
24 DL NR
|
||||
25 P NR
|
||||
26 P VN
|
||||
27 PD VNR
|
||||
28 PD N
|
||||
30 S
|
||||
31 SE
|
||||
32 SE R
|
||||
33 SE N
|
||||
34 SE NR
|
||||
35 SE V
|
||||
36 SE V R
|
||||
37 SE VNR
|
||||
40 SE D
|
||||
41 SE D N
|
||||
42 SE D V
|
||||
43 SE D V R
|
||||
44 SE D VN
|
||||
45 SE D VNR
|
||||
46 SE DL
|
||||
47 SE DL R
|
||||
48 SE DL N
|
||||
49 SE DL NR
|
||||
60 SEP
|
||||
61 SEP N
|
||||
62 SEP NR
|
||||
63 SEP V
|
||||
64 SEP V R
|
||||
65 SEP VNR
|
||||
71 SEPD
|
||||
72 SEPD R
|
||||
73 SEPD N
|
||||
74 SEPD NR
|
||||
75 SEPD V
|
||||
76 SEPD V R
|
||||
77 SEPD VN
|
||||
78 SEPD VNR
|
||||
81 SEPDL R
|
||||
82 SEPDL N
|
||||
83 SEPDL NR
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
include_once('listeCpVilles.php');
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// bsearch
|
||||
// --------------------------------------------------------------------------- //
|
||||
function bsearch(&$tab, $a, $b, $s, $l)
|
||||
{
|
||||
if ($a > $b) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$m = ($a + $b) >> 1;
|
||||
|
||||
$c = strcmp($s, substr($tab[$m], 0, $l));
|
||||
if ($c == 0) {
|
||||
return $m;
|
||||
} else if ($c < 0) {
|
||||
return bsearch($tab, $a, $m - 1, $s, $l);
|
||||
} else {
|
||||
return bsearch($tab, $m + 1, $b, $s, $l);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Main
|
||||
// --------------------------------------------------------------------------- //
|
||||
$completion = array();
|
||||
$strlen = strlen($_GET['val']);
|
||||
$upper = strtoupper($_GET['val']) ;
|
||||
$i = bsearch($cpVilles, 0, sizeof($cpVilles) - 1, $upper, $strlen);
|
||||
if ($i >= 0) {
|
||||
while ($i > 0 && substr($cpVilles[$i - 1], 0, $strlen) == $upper) {
|
||||
--$i;
|
||||
}
|
||||
while ($i < sizeof($cpVilles) &&
|
||||
substr($cpVilles[$i], 0, $strlen) == $upper) {
|
||||
$completion[] = '"'.$cpVilles[$i].'"';
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
|
||||
// Envoi au javascript au format JSON ['valeur1','valeur2', ...]
|
||||
print '['.join(',', $completion).']';
|
||||
?>
|
@ -1,114 +0,0 @@
|
||||
; COMBINAISON de DEPART
|
||||
; (présence 1 ou +mots critère)
|
||||
;sITSEPDLVNR CODES COMBINAISONS DE CRITERES + P=phonétique ou O=Orthographique
|
||||
1 IT 12
|
||||
1 I 00
|
||||
1 I SEP 12
|
||||
1 T 00
|
||||
1 TSEP 13 61 61o61p
|
||||
1 D VNR 24 45o24o24p
|
||||
1 D NR 21o21p
|
||||
1 DL NR 21 21o21p
|
||||
1 DLVNR 45 24 45o24o24p
|
||||
1 P VNR 74 78o74o74p
|
||||
1 PD VNR 74 78o74o74p
|
||||
1 PDL NR 78 83o74 74o74p
|
||||
1 PDLV R 78 81 82 77 71
|
||||
1 PDLVN 78 82 75 28 71
|
||||
1 PDLVNR 78 74 82 78o74o82o82p
|
||||
1 S 30o30p
|
||||
1 S R 72o71 71o71p
|
||||
1 S N 31
|
||||
1 S NR 77 43 71
|
||||
1 S V 35o35p30
|
||||
1 S VN 75 77o75o77p75p
|
||||
1 S V R 75 83
|
||||
1 S VNR 43 44 75 83 61 71
|
||||
1 S D 40p40o61p61
|
||||
1 S D R 45o77 77o77p
|
||||
1 S D N 71
|
||||
1 S D NR 77 43 71 31
|
||||
1 S D V 77o40 40o
|
||||
1 S D V R 75 72 71
|
||||
1 S D VN 43 41 77 71
|
||||
1 S D VNR 44 43 49 73 75 72 71
|
||||
1 S DL 78 78p61p61p
|
||||
1 S DL R 82 78 77 71
|
||||
1 S DL N 41 71
|
||||
1 S DL NR 78 82 81 78p77 43 71 31
|
||||
1 S DLV 78 78p71
|
||||
1 S DLV R 78 83 82 75 72 40 71
|
||||
1 S DLVN 78 82 78p43 71
|
||||
1 S DLVNR 78 49 77 43 78p75 41 72 71 22
|
||||
1 S P 60o60p31 31o31p
|
||||
1 S P R 45 77 41
|
||||
1 S P N 71 71o45 45p
|
||||
1 S P NR 77 72 33 32
|
||||
1 S P V 63o45 45o45p
|
||||
1 S P VN 45 43 61 64
|
||||
1 S P V R 75 83 45 35
|
||||
1 S P VNR 77 45 44 43 73 75 72 71 41 42 40
|
||||
1 S PD 45 71p71o
|
||||
1 S PD R 77 45 71
|
||||
1 S PD N 71 71o45 45o
|
||||
1 S PD NR 77 76 45 41 43 40
|
||||
1 S PD V 45 45o71 42 42p
|
||||
1 S PD V R 77 83 43 71 41
|
||||
1 S PD VN 83 75 71 44 83o75o71o44o43 41 40 40o40p
|
||||
1 S PD VNR 77 74 45 44 43 75 71 61 63 60 40
|
||||
1 S PDL 71 71o71p45 45o
|
||||
1 S PDL R 78 82 75 45 44
|
||||
1 S PDL N 73 48 41
|
||||
1 S PDL NR 78 82 81 49 77 65 44 43 75 60 31
|
||||
1 S PDLV 78 45 45o71 42 42p40
|
||||
1 S PDLV R 78 83 82 75 45 49 46 42 71 40
|
||||
1 S PDLVN 78 83 77 45 71 42 41 40
|
||||
1 S PDLVNR 78 83 27 74 45 44 43 42 40
|
||||
1 SE 31o31p
|
||||
1 SE R 72o71 71o71p
|
||||
1 SE N 31
|
||||
1 SE NR 77 43 71
|
||||
1 SE V 35o35p30
|
||||
1 SE V R 75 83
|
||||
1 SE VN 75 77
|
||||
1 SE VNR 43 44 75 83 61 71
|
||||
1 SE D 40o30
|
||||
1 SE D R 45o77
|
||||
1 SE D N 71
|
||||
1 SE D NR 77 43 71 31
|
||||
1 SE D V 77o40
|
||||
1 SE D V R 75 72 71
|
||||
1 SE D VN 43 41 77
|
||||
1 SE D VNR 44 43 49 73 75 72 71
|
||||
1 SE DL 40
|
||||
1 SE DL R 82 78 77
|
||||
1 SE DL N 45 43 82o45o43o43p
|
||||
1 SE DL NR 78 82 81 46 77 43 71 31
|
||||
1 SE DLV 78 78o71 71o71p
|
||||
1 SE DLV R 78 83 82 75 72 40
|
||||
1 SE DLVN 78 82 46 43 71
|
||||
1 SE DLVNR 78 49 77 43 46 75 41 72 71 22
|
||||
1 SEP 61p31 31p30
|
||||
1 SEP R 45 77 41
|
||||
1 SEP N 71 71o45 45p
|
||||
1 SEP NR 77 72 33 32
|
||||
1 SEP V 63o45
|
||||
1 SEP V R 75 83 45 35
|
||||
1 SEP VN 45 43 61 64
|
||||
1 SEP VNR 77 45 44 43 73 75 72 71 41 42 40
|
||||
1 SEPD 45 71p
|
||||
1 SEPD R 77 45
|
||||
1 SEPD N 71 71o45 40
|
||||
1 SEPD NR 77 76 45 41 43 40
|
||||
1 SEPD V 45 71p71o40
|
||||
1 SEPD V R 77 83 43 71 41 40
|
||||
1 SEPD VN 83 75 71 44 83o75o71o44o43 41 40 40o40p
|
||||
1 SEPD VNR 77 74 45 44 43 75 71 61 63 60 40
|
||||
1 SEPDL 45 71p40
|
||||
1 SEPDL R 78 82 75 45 44 40
|
||||
1 SEPDL N 73 48 41 40
|
||||
1 SEPDL NR 78 82 81 49 77 65 44 43 75 60 31
|
||||
1 SEPDLV 78 45 45o71 42 42p
|
||||
1 SEPDLV R 78 83 82 75 45 49 46 42 71 40
|
||||
1 SEPDLVN 78 83 77 45 71 42 41 40
|
||||
1 SEPDLVNR 78 83 27 74 45 44 43 42 40
|
@ -14,17 +14,123 @@ if (defined('LOCAL') == false) {
|
||||
// --------------------------------------------------------------------------- //
|
||||
function nouvelleSequence(&$criteres)
|
||||
{
|
||||
if (LOCAL == true) {
|
||||
$crit2seq = file('crit2seq.prn');
|
||||
} else {
|
||||
$crit2seq = file(realpath(dirname(__FILE__)).'/crit2seq.prn');
|
||||
}
|
||||
foreach ($crit2seq as $ligne) {
|
||||
if (($pos = strpos($ligne, ';')) != false) {
|
||||
$ligne = substr($ligne, 0, $pos);
|
||||
}
|
||||
if (strstr(substr($ligne, 2, 10), $criteres) != false) {
|
||||
return str_split(substr($ligne, 13, -1), 3);
|
||||
$sequence = array(
|
||||
array( 'crit' => 'IT ', 'next' => '12' ),
|
||||
array( 'crit' => 'I ', 'next' => '00' ),
|
||||
array( 'crit' => 'I SEP ', 'next' => '12' ),
|
||||
array( 'crit' => ' T ', 'next' => '00' ),
|
||||
array( 'crit' => ' TSEP ', 'next' => '13 61 61o61p' ),
|
||||
array( 'crit' => ' D VNR', 'next' => '24 45o24o24p' ),
|
||||
array( 'crit' => ' D NR', 'next' => '21o21p' ),
|
||||
array( 'crit' => ' DL NR', 'next' => '21 21o21p' ),
|
||||
array( 'crit' => ' DLVNR', 'next' => '36 45 24 45o24o24p' ),
|
||||
array( 'crit' => ' P VNR', 'next' => '74 78o74o74p' ),
|
||||
array( 'crit' => ' PD VNR', 'next' => '74 78o74o74p' ),
|
||||
array( 'crit' => ' PDL NR', 'next' => '78 83o74 74o74p' ),
|
||||
array( 'crit' => ' PDLV R', 'next' => '78 81 82 77 71' ),
|
||||
array( 'crit' => ' PDLVN ', 'next' => '82 75 28 71' ),
|
||||
array( 'crit' => ' PDLVNR', 'next' => '78 74 82 78o74o82o82p' ),
|
||||
array( 'crit' => ' S ', 'next' => '30o30p' ),
|
||||
array( 'crit' => ' S R', 'next' => '72o71 71o71p' ),
|
||||
array( 'crit' => ' S N ', 'next' => '31' ),
|
||||
array( 'crit' => ' S NR', 'next' => '77 43 71' ),
|
||||
array( 'crit' => ' S V ', 'next' => '35o35p30' ),
|
||||
array( 'crit' => ' S VN ', 'next' => '75 77o75o77p75p' ),
|
||||
array( 'crit' => ' S V R', 'next' => '75 83' ),
|
||||
array( 'crit' => ' S VNR', 'next' => '43 44 75 83 61 71' ),
|
||||
array( 'crit' => ' S D ', 'next' => '40p40o61p61' ),
|
||||
array( 'crit' => ' S D R', 'next' => '45o77 77o77p' ),
|
||||
array( 'crit' => ' S D N ', 'next' => '71' ),
|
||||
array( 'crit' => ' S D NR', 'next' => '77 43 71 31' ),
|
||||
array( 'crit' => ' S D V ', 'next' => '77o40 40o' ),
|
||||
array( 'crit' => ' S D V R', 'next' => '75 72 71' ),
|
||||
array( 'crit' => ' S D VN ', 'next' => '43 41 77 71' ),
|
||||
array( 'crit' => ' S D VNR', 'next' => '44 43 49 73 75 72 71' ),
|
||||
array( 'crit' => ' S DL ', 'next' => '78 78p61p61p' ),
|
||||
array( 'crit' => ' S DL R', 'next' => '82 78 77 71' ),
|
||||
array( 'crit' => ' S DL N ', 'next' => '41 71' ),
|
||||
array( 'crit' => ' S DL NR', 'next' => '78 82 81 78p77 43 71 31' ),
|
||||
array( 'crit' => ' S DLV ', 'next' => '78 78p71' ),
|
||||
array( 'crit' => ' S DLV R', 'next' => '78 83 82 75 72 40 71' ),
|
||||
array( 'crit' => ' S DLVN ', 'next' => '78 82 78p43 71' ),
|
||||
array( 'crit' => ' S DLVNR', 'next' => '78 49 77 43 78p75 41 72 71 22' ),
|
||||
array( 'crit' => ' S P ', 'next' => '60o60p31 31o31p' ),
|
||||
array( 'crit' => ' S P R', 'next' => '45 77 41' ),
|
||||
array( 'crit' => ' S P N ', 'next' => '71 71o45 45p' ),
|
||||
array( 'crit' => ' S P NR', 'next' => '77 72 33 32' ),
|
||||
array( 'crit' => ' S P V ', 'next' => '63o45 45o45p' ),
|
||||
array( 'crit' => ' S P VN ', 'next' => '45 43 61 64' ),
|
||||
array( 'crit' => ' S P V R', 'next' => '75 83 45 35' ),
|
||||
array( 'crit' => ' S P VNR', 'next' => '77 45 44 43 73 75 72 71 41 42 40' ),
|
||||
array( 'crit' => ' S PD ', 'next' => '45 71p71o' ),
|
||||
array( 'crit' => ' S PD R', 'next' => '77 45 71' ),
|
||||
array( 'crit' => ' S PD N ', 'next' => '71 71o45 45o' ),
|
||||
array( 'crit' => ' S PD NR', 'next' => '77 76 45 41 43 40' ),
|
||||
array( 'crit' => ' S PD V ', 'next' => '45 45o71 42 42p' ),
|
||||
array( 'crit' => ' S PD V R', 'next' => '77 83 43 71 41' ),
|
||||
array( 'crit' => ' S PD VN ', 'next' => '83 75 71 44 83o75o71o44o43 41 40 40o40p' ),
|
||||
array( 'crit' => ' S PD VNR', 'next' => '77 74 45 44 43 75 71 61 63 60 40' ),
|
||||
array( 'crit' => ' S PDL ', 'next' => '71 71o71p45 45o' ),
|
||||
array( 'crit' => ' S PDL R', 'next' => '78 82 75 45 44' ),
|
||||
array( 'crit' => ' S PDL N ', 'next' => '73 48 41' ),
|
||||
array( 'crit' => ' S PDL NR', 'next' => '78 82 81 49 77 65 44 43 75 60 31' ),
|
||||
array( 'crit' => ' S PDLV ', 'next' => '78 45 45o71 42 42p40' ),
|
||||
array( 'crit' => ' S PDLV R', 'next' => '78 83 82 75 45 49 46 42 71 40' ),
|
||||
array( 'crit' => ' S PDLVN ', 'next' => '78 83 77 45 71 42 41 40' ),
|
||||
array( 'crit' => ' S PDLVNR', 'next' => '78 83 27 74 45 44 43 42 40' ),
|
||||
array( 'crit' => ' SE ', 'next' => '31o31p' ),
|
||||
array( 'crit' => ' SE R', 'next' => '72o71 71o71p' ),
|
||||
array( 'crit' => ' SE N ', 'next' => '31' ),
|
||||
array( 'crit' => ' SE NR', 'next' => '77 43 71' ),
|
||||
array( 'crit' => ' SE V ', 'next' => '35o35p30' ),
|
||||
array( 'crit' => ' SE V R', 'next' => '75 83' ),
|
||||
array( 'crit' => ' SE VN ', 'next' => '75 77' ),
|
||||
array( 'crit' => ' SE VNR', 'next' => '43 44 75 83 61 71' ),
|
||||
array( 'crit' => ' SE D ', 'next' => '40o30' ),
|
||||
array( 'crit' => ' SE D R', 'next' => '45o77' ),
|
||||
array( 'crit' => ' SE D N ', 'next' => '71' ),
|
||||
array( 'crit' => ' SE D NR', 'next' => '77 43 71 31' ),
|
||||
array( 'crit' => ' SE D V ', 'next' => '77o40' ),
|
||||
array( 'crit' => ' SE D V R', 'next' => '75 72 71' ),
|
||||
array( 'crit' => ' SE D VN ', 'next' => '43 41 77' ),
|
||||
array( 'crit' => ' SE D VNR', 'next' => '44 43 49 73 75 72 71' ),
|
||||
array( 'crit' => ' SE DL ', 'next' => '40' ),
|
||||
array( 'crit' => ' SE DL R', 'next' => '82 78 77' ),
|
||||
array( 'crit' => ' SE DL N ', 'next' => '45 43 82o45o43o43p' ),
|
||||
array( 'crit' => ' SE DL NR', 'next' => '78 82 81 46 77 43 71 31' ),
|
||||
array( 'crit' => ' SE DLV ', 'next' => '78 78o71 71o71p' ),
|
||||
array( 'crit' => ' SE DLV R', 'next' => '78 83 82 75 72 40' ),
|
||||
array( 'crit' => ' SE DLVN ', 'next' => '78 82 46 43 71' ),
|
||||
array( 'crit' => ' SE DLVNR', 'next' => '78 49 77 43 46 75 41 72 71 22' ),
|
||||
array( 'crit' => ' SEP ', 'next' => '61p31 31p30' ),
|
||||
array( 'crit' => ' SEP R', 'next' => '45 77 41' ),
|
||||
array( 'crit' => ' SEP N ', 'next' => '71 71o45 45p' ),
|
||||
array( 'crit' => ' SEP NR', 'next' => '77 72 33 32' ),
|
||||
array( 'crit' => ' SEP V ', 'next' => '63o45' ),
|
||||
array( 'crit' => ' SEP V R', 'next' => '75 83 45 35' ),
|
||||
array( 'crit' => ' SEP VN ', 'next' => '45 43 61 64' ),
|
||||
array( 'crit' => ' SEP VNR', 'next' => '77 45 44 43 73 75 72 71 41 42 40' ),
|
||||
array( 'crit' => ' SEPD ', 'next' => '45 71p' ),
|
||||
array( 'crit' => ' SEPD R', 'next' => '77 45' ),
|
||||
array( 'crit' => ' SEPD N ', 'next' => '71 71o45 40' ),
|
||||
array( 'crit' => ' SEPD NR', 'next' => '77 76 45 41 43 40' ),
|
||||
array( 'crit' => ' SEPD V ', 'next' => '45 71p71o40' ),
|
||||
array( 'crit' => ' SEPD V R', 'next' => '77 83 43 71 41 40' ),
|
||||
array( 'crit' => ' SEPD VN ', 'next' => '83 75 71 44 83o75o71o44o43 41 40 40o40p' ),
|
||||
array( 'crit' => ' SEPD VNR', 'next' => '77 74 45 44 43 75 71 61 63 60 40' ),
|
||||
array( 'crit' => ' SEPDL ', 'next' => '45 71p40' ),
|
||||
array( 'crit' => ' SEPDL R', 'next' => '78 82 75 45 44 40' ),
|
||||
array( 'crit' => ' SEPDL N ', 'next' => '73 48 41 40' ),
|
||||
array( 'crit' => ' SEPDL NR', 'next' => '78 82 81 49 77 65 44 43 75 60 31' ),
|
||||
array( 'crit' => ' SEPDLV ', 'next' => '78 45 45o71 42 42p' ),
|
||||
array( 'crit' => ' SEPDLV R', 'next' => '78 83 82 75 45 49 46 42 71 40' ),
|
||||
array( 'crit' => ' SEPDLVN ', 'next' => '78 83 77 45 71 42 41 40' ),
|
||||
array( 'crit' => ' SEPDLVNR', 'next' => '78 83 27 74 45 44 43 42 40' ),
|
||||
);
|
||||
|
||||
foreach ($sequence as $ligne) {
|
||||
if (strstr($ligne['crit'], $criteres) != false) {
|
||||
return str_split($ligne['next'], 3);
|
||||
}
|
||||
}
|
||||
return array();
|
||||
@ -36,9 +142,10 @@ function nouvelleSequence(&$criteres)
|
||||
function nouvelleCombinaison(&$sequence, &$sequencePos, $pass, &$index, &$mode)
|
||||
{
|
||||
for (;;) {
|
||||
if (isset($sequence[$sequencePos]) == false) {
|
||||
if (isset($sequence[$sequencePos]) === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$combinaison = trim($sequence[$sequencePos]);
|
||||
++$sequencePos;
|
||||
|
||||
@ -48,11 +155,16 @@ function nouvelleCombinaison(&$sequence, &$sequencePos, $pass, &$index, &$mode)
|
||||
|
||||
// Passage en phonetique ou en orthographique
|
||||
if (strlen($combinaison) == 3) {
|
||||
if ($pass == 2 ||
|
||||
$pass == 3) {
|
||||
if ($pass == 2 || $pass == 3) {
|
||||
continue;
|
||||
}
|
||||
$car = strtolower(substr($combinaison, 2, 1));
|
||||
|
||||
//Search Engine Version 2, we remove the orthographique
|
||||
if (SPHINX_ENT_VERSION == 2 && $car == 'o') {
|
||||
return strtolower(substr($combinaison, 0, 2));
|
||||
}
|
||||
|
||||
switch($car) {
|
||||
case 'p':
|
||||
$index = 'ent_phx';
|
||||
@ -67,6 +179,10 @@ function nouvelleCombinaison(&$sequence, &$sequencePos, $pass, &$index, &$mode)
|
||||
}
|
||||
} else if ($pass == 1) {
|
||||
$index = 'ent_mns';
|
||||
//Search Engine Version 2, we remove the orthographique
|
||||
if (SPHINX_ENT_VERSION == 2) {
|
||||
$index = 'ent';
|
||||
}
|
||||
}
|
||||
|
||||
return $combinaison;
|
||||
@ -76,13 +192,13 @@ function nouvelleCombinaison(&$sequence, &$sequencePos, $pass, &$index, &$mode)
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Nouveaux criteres
|
||||
// --------------------------------------------------------------------------- //
|
||||
function nouveauxCriteres(&$comb2crit, &$combinaison)
|
||||
function nouveauxCriteres($comb2crit, $combinaison)
|
||||
{
|
||||
foreach ($comb2crit as $ligne) {
|
||||
if (strstr($ligne, $combinaison) != false) {
|
||||
return substr($ligne, 3, -1);
|
||||
}
|
||||
if ( array_key_exists($combinaison, $comb2crit) ) {
|
||||
$ligne = $comb2crit[$combinaison];
|
||||
return $ligne;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
?>
|
@ -1,338 +0,0 @@
|
||||
<?php
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Formulaire de recherche Sphinx
|
||||
// --------------------------------------------------------------------------- //
|
||||
define('DEBUG', 1);
|
||||
define('LOCAL', 0);
|
||||
define('NBREP', 25);
|
||||
|
||||
include_once('/var/www/includes/config.php');
|
||||
require_once('rechercheFonc.php');
|
||||
|
||||
$vue = $_GET['vue'];
|
||||
if (isset($_POST['formR']) == true) {
|
||||
$formR = $_POST['formR'];
|
||||
} else {
|
||||
$formR = array('type' => $vue);
|
||||
}
|
||||
if (isset($_GET['deb']) == true) {
|
||||
$deb = $_GET['deb'];
|
||||
} else {
|
||||
$deb = 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Affiche un champs dans le formulaire
|
||||
// --------------------------------------------------------------------------- //
|
||||
function afficheChamps(&$form, $nomForm, $nom, $size, $maxlength, $extra = '')
|
||||
{
|
||||
print '<input type="text" name="'.$nomForm.'['.$nom.']" size="'.$size.
|
||||
'" maxlength="'.$maxlength.'" '.$extra;
|
||||
if (empty($form[$nom]) == false) {
|
||||
$valeur = str_replace('"', '"', $form[$nom]);
|
||||
print ' value="'.$valeur.'"';
|
||||
}
|
||||
print ' />';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Affiche un libelle dans le formulaire
|
||||
// --------------------------------------------------------------------------- //
|
||||
function afficheLibelle($nom)
|
||||
{
|
||||
print '<td width="208" align="right" class="StyleRechercheLib"><b>'.
|
||||
$nom.'</b></td>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Extranet Scores & Décisions - Recherche</title>
|
||||
|
||||
<script language="javascript">
|
||||
var http = null;
|
||||
if (window.XMLHttpRequest) {
|
||||
// Firefox
|
||||
http = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
// Internet Explorer
|
||||
http = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} else {
|
||||
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest.");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// selectCompletion
|
||||
// --------------------------------------------------------------------------- //
|
||||
function selectCompletion()
|
||||
{
|
||||
if (http == null) {
|
||||
return;
|
||||
}
|
||||
val = document.completion_form.completion_text.value;
|
||||
if (val.length >= 3) {
|
||||
http.open("GET", "cpVilles.php?&val=" + escape(val), true);
|
||||
http.onreadystatechange = selectVilles;
|
||||
http.send(null);
|
||||
} else {
|
||||
var sel = document.completion_form.completion_select;
|
||||
sel.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// selectVilles
|
||||
// --------------------------------------------------------------------------- //
|
||||
function selectVilles()
|
||||
{
|
||||
if (http.readyState == 4) {
|
||||
villes = eval('(' + http.responseText + ')'); // [id1,id2, ...]
|
||||
|
||||
var sel = document.completion_form.completion_select;
|
||||
if (villes.length <= 10) {
|
||||
sel.attributes['size'].value = villes.length;
|
||||
} else {
|
||||
sel.attributes['size'].value = 10;
|
||||
}
|
||||
|
||||
while (sel.options.length > 0) {
|
||||
sel.options[0] = null;
|
||||
}
|
||||
for (i = 0; i < villes.length; ++i) {
|
||||
sel.options[sel.options.length] = new Option(villes[i], villes[i]);
|
||||
}
|
||||
|
||||
if (sel.options.length) {
|
||||
sel.style.display = 'block';
|
||||
} else {
|
||||
sel.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// selectClic
|
||||
// --------------------------------------------------------------------------- //
|
||||
function selectClic()
|
||||
{
|
||||
var sel = document.completion_form.completion_select ;
|
||||
document.completion_form.completion_text.value =
|
||||
sel.options[sel.selectedIndex].value ;
|
||||
sel.style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form method="post" name="completion_form">
|
||||
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top" width="580" height="200" align="center">
|
||||
|
||||
<?php
|
||||
if ($vue == 'ent') {
|
||||
?>
|
||||
|
||||
<input type="hidden" name="formR[type]" value="ent" />
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h2>RECHERCHE ENTREPRISE V2</h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<?php afficheLibelle('SIREN'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'siret', 25, 20,
|
||||
'style=vertical-align:middle;'); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php afficheLibelle('RAISON SOCIALE<br/>ENSEIGNE / SIGLE'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'raisonSociale', 25, 250); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<?php afficheLibelle('N° & VOIE'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'numVoie', 4, 4); ?>
|
||||
<?php afficheChamps($formR, 'formR', 'voie', 17, 250); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php afficheLibelle('CP OU DÉP. / VILLE'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'cpVille', 25, 250,
|
||||
'onkeyup="selectCompletion();"'.
|
||||
' id="completion_text"'); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="208"> </td>
|
||||
<td width="300" align="left">
|
||||
<select id="completion_select"
|
||||
size="1"
|
||||
onclick="selectClic();"
|
||||
style="display:none;">
|
||||
</select>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<?php afficheLibelle('TÉL / FAX'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'telFax', 15, 15); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<?php afficheLibelle('NAF'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'naf', 15, 666); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
} else if ($vue == 'dir') {
|
||||
?>
|
||||
|
||||
<input type="hidden" name="formR[type]" value="dir" />
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h2>RECHERCHE PAR DIRIGEANT V2</h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<?php afficheLibelle('NOM'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'nom', 25, 40,
|
||||
'style=vertical-align:middle;'); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php afficheLibelle('PRENOM'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'prenom', 25, 40); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<?php afficheLibelle('DATE NAISSANCE'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'dirDateNaissJJ', 2, 2); ?>/
|
||||
<?php afficheChamps($formR, 'formR', 'dirDateNaissMM', 2, 2); ?>/
|
||||
<?php afficheChamps($formR, 'formR', 'dirDateNaissAAAA', 4, 4); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php afficheLibelle('CP OU DÉP. / VILLE DE NAISSANCE'); ?>
|
||||
<td width="300" align="left">
|
||||
<?php afficheChamps($formR, 'formR', 'cpVille', 25, 40,
|
||||
'onkeyup="selectCompletion();"'.
|
||||
' id="completion_text"'); ?>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="208"> </td>
|
||||
<td width="300" align="left">
|
||||
<select id="completion_select"
|
||||
size="1"
|
||||
onclick="selectClic();"
|
||||
style="display:none;">
|
||||
</select>
|
||||
</td>
|
||||
<td width="72"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="580">
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<input type="submit" value="Envoyer" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if (count($formR) > 1) {
|
||||
print '<form method="post" action="?vue='.$vue.'&deb='.($deb + NBREP).'">';
|
||||
foreach ($formR as $label => $valeur) {
|
||||
print '<input type="hidden" name="formR['.$label.']"'.
|
||||
'value="'.$valeur.'" />';
|
||||
}
|
||||
print '<input type="submit" value="Suite" />';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
if (empty($formR['siret']) == false) {
|
||||
$liste = verificationDuSiret($formR['siret']);
|
||||
if (DEBUG && $liste != false) {
|
||||
print 'Essayez :<br/>';
|
||||
foreach ($liste as $s) {
|
||||
if (sommeDeControle($s) != 0) {
|
||||
print 'erreur somme de controle sur '.$s.
|
||||
' ('.sommeDeControle($s).')<br/>';
|
||||
} else {
|
||||
print $s.'<br/>';
|
||||
}
|
||||
}
|
||||
// TODO: utilisation de la liste
|
||||
exit;
|
||||
}
|
||||
}
|
||||
recherche($formR, $deb, NBREP);
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,260 +0,0 @@
|
||||
<?php
|
||||
require_once 'framework/common/strings.php';
|
||||
require_once realpath(dirname(__FILE__)).'/sphinxapi2.php';
|
||||
|
||||
function search2($index, $findMe, $tabFiltres=array(), $deb=0, $nbRep=20, $max=200, $any=false) {
|
||||
$deb=$deb*1;
|
||||
$nbRep=$nbRep*1;
|
||||
$max=$max*1;
|
||||
|
||||
debugLog('I',"Search Sphinx dans $index de $findMe ($deb, $nbRep, $max) avec ".implode(',',$tabFiltres),__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$iDb=new WDB();
|
||||
|
||||
//$any = false; // si false $index='xxx'
|
||||
$cl = new SphinxClient2();
|
||||
if ($index == 'histo'){
|
||||
$cl->SetServer (SPHINX_HISTO_HOST, SPHINX_HISTO_PORT);
|
||||
} else {
|
||||
$cl->SetServer (SPHINX_HOST, SPHINX_PORT);
|
||||
}
|
||||
$cl->SetConnectTimeout ( 1 );
|
||||
$cl->SetLimits ($deb, $nbRep, $max);//0, $nbRep*10);
|
||||
//$cl->SetSortMode(SPH_SORT_ATTR_DESC, 'actif');//siege');
|
||||
if (substr($index,0,4)=='etab')
|
||||
$cl->SetSortMode(SPH_SORT_EXTENDED, 'rang DESC, actif DESC, siege DESC');//, nic DESC
|
||||
|
||||
//$cl->SetWeights ( array ( 100, 1 ) );
|
||||
//$cl->SetMatchMode ( $any ? SPH_MATCH_ANY : SPH_MATCH_ALL );
|
||||
$cl->SetMatchMode (SPH_MATCH_EXTENDED);
|
||||
foreach ($tabFiltres as $nomFiltre => $valFiltre)
|
||||
$cl->SetFilter($nomFiltre, array(0=>$valFiltre));
|
||||
|
||||
$cl->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
|
||||
//$cl->SetArrayResult ( true );
|
||||
|
||||
$res = $cl->Query ( $findMe, $index );
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Debug", print_r($res,true)) ;
|
||||
if ($res===false) {
|
||||
debugLog('I',"Search Sphinx : Pas de réponse pour $findMe avec ".implode(',',$tabFiltres).' ('.$cl->GetLastError() .')',__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
return array( 'results'=>false,
|
||||
'nbRet'=>0,
|
||||
'nbTot'=>0,
|
||||
'error'=>$cl->GetLastError(),
|
||||
'warning'=>$cl->GetLastWarning(),
|
||||
'duration'=>$res[time]);//return false;
|
||||
|
||||
} else { // Le moteur est op<6F>rationel
|
||||
if ( $cl->GetLastWarning() ) {
|
||||
debugLog('I',"Search Sphinx : Warning pour $findMe - ".$cl->GetLastWarning(),__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
print "WARNING: " . $cl->GetLastWarning() . "\n\n";
|
||||
}
|
||||
/* print "Query '$findMe' retrieved $res[total] of $res[total_found] matches in $res[time] sec.\n";
|
||||
print "Query stats :\n";
|
||||
if ( is_array($res["words"]) )
|
||||
foreach ( $res["words"] as $word => $info )
|
||||
print " - '$word' found $info[hits] times in $info[docs] documents\n";
|
||||
print "\n";*/
|
||||
debugLog('I',"'Search Sphinx dans $index de $findMe (Filtre=".implode(',',$tabFiltres)."), Deb=$deb, nbRep=$nbRep, max=$max, any=$any",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
// debugLog('I',"Search Sphinx dans $index ". print_r($tabFiltres, true));
|
||||
|
||||
$tabRet=array();
|
||||
if ( @is_array($res['matches'])) { // il y a des donn<6E>es <20> renvoyer
|
||||
if (substr($index,0,4)=='etab') { // Recherche par <20>tab
|
||||
foreach ( $res['matches'] as $doc => $docinfo ) { // On balaye chaque ligne
|
||||
$listeEtab=$iDb->select('etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif",
|
||||
"id=$doc LIMIT 0,1", true);
|
||||
$etab=$listeEtab[0];
|
||||
$tabRet[]=array( 'Localisation'=>$etab['Loc'],
|
||||
'id'=>$doc,
|
||||
'Pertinence'=>$docinfo['weight'],
|
||||
'Siret'=>$etab['siret'],
|
||||
'Siege'=>$etab['siege'],
|
||||
'Nom'=>$etab['raisonSociale'],
|
||||
'Sigle'=>$etab['sigle'],
|
||||
'Enseigne'=>$etab['enseigne'],
|
||||
'Adresse'=>trim($etab['adr_num'] .' '.
|
||||
$etab['adr_btq'] .' '.
|
||||
$etab['adr_typeVoie'] .' '.
|
||||
$etab['adr_libVoie'] .' '.
|
||||
$etab['adr_comp']),
|
||||
'CP'=>$etab['adr_cp'],
|
||||
'Ville'=>$etab['adr_ville'],
|
||||
'Tel'=>$etab['tel'],
|
||||
'Fax'=>$etab['fax'],
|
||||
'FJ'=>$etab['cj'],
|
||||
'Siren'=>$etab['siren'],
|
||||
'Nic'=>$etab['nic'],
|
||||
'Actif'=>$etab['actif'],
|
||||
'NafEtab'=>$etab['ape_etab'], // Etablissement
|
||||
//'NafEtabLib'=>$etab['LibNafEt'],
|
||||
'NafEnt'=>$etab['ape_entrep'], // Entreprise
|
||||
//'NafEntLib'=>$etab['LibNafEt'],
|
||||
);
|
||||
}
|
||||
} elseif ($index=='histo') {
|
||||
foreach ( $res['matches'] as $doc => $docinfo ) {
|
||||
$listeEtab=$iDb->select('histobodacc.bodacc_ocr',
|
||||
"'Histo' as Loc, id, nomFichier, annee1, bod, texte",
|
||||
"id=$doc");
|
||||
$etab=$listeEtab[0];
|
||||
$tabRet[]=array( 'Localisation'=>$etab['Loc'],
|
||||
'id'=>$doc,
|
||||
'Pertinence'=>$docinfo['weight'],
|
||||
'Fichier'=>$etab['nomFichier'],
|
||||
'Annee'=>$etab['annee1'],
|
||||
'Code'=>$etab['bod'],
|
||||
'Texte'=>$etab['texte'],
|
||||
);
|
||||
}
|
||||
} else { // Recherche par dirigeant
|
||||
$findMe4=trim(substr($findMe,0,4));
|
||||
foreach ( $res['matches'] as $doc => $docinfo ) { // On balaye chaque ligne dirigeant
|
||||
$listeEtab=$iDb->select('rncs_dirigeants d, etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
"CONCAT(e.siren, e.nic) as siret, /*d.rs,*/ d.nom, d.prenom, /*d.nomUsage,*/ d.naissance_date, d.naissance_lieu, ".
|
||||
"d.fonction_lib, /*d.depart,*/ e.actif",
|
||||
"d.id=$doc AND d.siren=e.siren AND e.siege=1 ORDER BY e.actif DESC LIMIT 0,1", true);
|
||||
//die(print_r($listeEtab));
|
||||
$etab=$listeEtab[0];
|
||||
$tabRet[]=array( 'Localisation'=>$etab['Loc'],
|
||||
'id'=>$doc,
|
||||
'Pertinence'=>$docinfo['weight'],
|
||||
'Siret'=>$etab['siret'],
|
||||
'Siege'=>$etab['siege'],
|
||||
'Nom'=>$etab['raisonSociale'],
|
||||
'Sigle'=>$etab['sigle'],
|
||||
'Enseigne'=>$etab['enseigne'],
|
||||
'Adresse'=>trim($etab['adr_num'] .' '.
|
||||
$etab['adr_btq'] .' '.
|
||||
$etab['adr_typeVoie'] .' '.
|
||||
$etab['adr_libVoie'] .' '.
|
||||
$etab['adr_comp']),
|
||||
'CP'=>$etab['adr_cp'],
|
||||
'Ville'=>$etab['adr_ville'],
|
||||
'Tel'=>$etab['tel'],
|
||||
'Fax'=>$etab['fax'],
|
||||
'FJ'=>$etab['cj'],
|
||||
'Siren'=>$etab['siren'],
|
||||
'Nic'=>$etab['nic'],
|
||||
'Actif'=>$etab['actif'],
|
||||
'NafEtab'=>$etab['ape_etab'], // Etablissement
|
||||
'NafEnt'=>$etab['ape_entrep'], // Entreprise
|
||||
'rs'=>'',//$etab['rs'],
|
||||
'nomD'=>$etab['nom'],
|
||||
'prenom'=>$etab['prenom'],
|
||||
'nomUsage'=>'',//$etab['nomUsage'],
|
||||
'dateEffet'=>'',//$etab['dateEffet'],
|
||||
'fonction'=>$etab['fonction_lib'],
|
||||
'depart'=>0,//$etab['depart'],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
debugLog('I','Search Sphinx : Retourne '. $res[total].'/'. $res[total_found] .' en '.$res[time] .'secondes',__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
return array( 'results'=>$tabRet,
|
||||
'nbRet'=>$res[total],
|
||||
'nbTot'=>$res[total_found],
|
||||
'duration'=>$res[time],
|
||||
'words'=>$res['words'],
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
<nafen>7020z<
|
||||
|
||||
*/
|
||||
function comptage($findMe, $tabFiltres=array(), $deb=0, $nbRep=20, $max=1000, $any=false, $fichierCsv=false) {
|
||||
$deb=$deb*1;
|
||||
$nbRep=$nbRep*1;
|
||||
$max=$max*1;
|
||||
$index='comptage';
|
||||
$iDb=new WDB();
|
||||
/*
|
||||
$cl = new SphinxClient ();
|
||||
$cl->SetServer ( $host, $port );
|
||||
$cl->SetWeights ( array ( 100, 1 ) );
|
||||
$cl->SetMatchMode ( $mode );
|
||||
if ( count($filtervals) ) $cl->SetFilter ( $filter, $filtervals );
|
||||
if ( $groupby ) $cl->SetGroupBy ( $groupby, SPH_GROUPBY_ATTR, $groupsort );
|
||||
if ( $sortby ) $cl->SetSortMode ( SPH_SORT_EXTENDED, $sortby );
|
||||
if ( $sortexpr ) $cl->SetSortMode ( SPH_SORT_EXPR, $sortexpr );
|
||||
if ( $distinct ) $cl->SetGroupDistinct ( $distinct );
|
||||
if ( $limit ) $cl->SetLimits ( 0, $limit, ( $limit>1000 ) ? $limit : 1000 );
|
||||
$res = $cl->Query ( $q, $index );
|
||||
*/
|
||||
$cl = new SphinxClient ();
|
||||
$cl->SetServer ('192.168.3.24', 3312);
|
||||
$cl->SetConnectTimeout(1);
|
||||
$cl->SetLimits ($deb, $nbRep, $max);
|
||||
// if (substr($index,0,4)=='etab')
|
||||
// $cl->SetSortMode(SPH_SORT_EXTENDED, 'rang DESC, actif DESC, siege DESC');//, nic DESC
|
||||
//$cl->SetWeights ( array ( 100, 1 ) );
|
||||
//$cl->SetMatchMode ( $any ? SPH_MATCH_ANY : SPH_MATCH_ALL );
|
||||
$cl->SetMatchMode (SPH_MATCH_EXTENDED);
|
||||
foreach ($tabFiltres as $nomFiltre => $valFiltre)
|
||||
$cl->SetFilter($nomFiltre, $valFiltre);
|
||||
/*8.4.3. SetFilterRange
|
||||
Prototype: function SetFilterRange ( $attribute, $min, $max, $exclude=false )
|
||||
Adds new integer range filter. */
|
||||
|
||||
$cl->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
|
||||
//$cl->SetArrayResult ( true );
|
||||
|
||||
$res = $cl->Query ( $findMe, $index );
|
||||
if ($res===false) {
|
||||
// debugLog('I',"Search Sphinx : Pas de r<>ponse pour $findMe avec ".implode(',',$tabFiltres).' ('.$cl->GetLastError() .')',__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
return array( 'results'=>false,
|
||||
'nbRet'=>0,
|
||||
'nbTot'=>0,
|
||||
'error'=>$cl->GetLastError(),
|
||||
'warning'=>$cl->GetLastWarning(),
|
||||
'durationCpt'=>$res[time],
|
||||
'durationExp'=>0);//return false;);//return false;
|
||||
|
||||
} else { // Le moteur est op<6F>rationel
|
||||
$tdeb=microtime(1);
|
||||
if ( $cl->GetLastWarning() ) {
|
||||
//debugLog('I',"Search Sphinx : Warning pour $findMe - ".$cl->GetLastWarning(),__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
print "WARNING: " . $cl->GetLastWarning() . "\n\n";
|
||||
}
|
||||
|
||||
$tabRet=array();
|
||||
if ( @is_array($res['matches'])) { // il y a des donn<6E>es <20> renvoyer
|
||||
$tabIdDoc=array();
|
||||
foreach ( $res['matches'] as $doc => $docinfo ) //{ // On balaye chaque ligne
|
||||
$tabIdDoc[]=$doc;
|
||||
$strDoc='('.implode(',',$tabIdDoc).')';
|
||||
$tabTmp=$iDb->select( 'etablissements_act',
|
||||
'id,ape_etab,ape_entrep,source,siren,nic,actif,siege,adr_cp,adr_dep,adr_com,tel,fax,cj,capital,age_entrep,age_etab,tca,tcaexp,teff_entrep,teff_etab,rang,dateCrea_etab,eff_entrep,eff_etab,nbEtab,bilType,bilAnnee,bilTca,bilCA,bilCAexp,bilRN',
|
||||
"id IN $strDoc", false, MYSQL_ASSOC);
|
||||
if ($fichierCsv) {
|
||||
$fp=fopen($fichierCsv, 'w');
|
||||
foreach ($tabTmp as $iTmp=>$tmp) {
|
||||
$tabRet[]=$tmp;
|
||||
fwrite($fp, implode("\t", $tmp).EOL);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return array( 'results'=>$tabRet,
|
||||
'nbRet'=>$res[total],
|
||||
'nbTot'=>$res[total_found],
|
||||
'durationCpt'=>$res[time],
|
||||
'durationExp'=>round(microtime(1)-$tdeb,3),
|
||||
'error'=>$cl->GetLastError(),
|
||||
'warning'=>$cl->GetLastWarning(),
|
||||
'words'=>$res['words'],
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
@ -2,8 +2,6 @@
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Formulaire de requete Sphinx
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Fichiers lus en entree : crit2seq.prn et comb2crit.txt
|
||||
// --------------------------------------------------------------------------- //
|
||||
if (defined('DEBUG') == false) {
|
||||
define( 'DEBUG', 0);
|
||||
}
|
||||
@ -51,7 +49,7 @@ if (DEBUG) {
|
||||
{
|
||||
/*
|
||||
$fp = fopen(LOG_PATH.'/recherchesDebug.log', 'a');
|
||||
fwrite($fp, $ln.'\n');
|
||||
fwrite($fp, $ln."\n");
|
||||
fclose($fp);
|
||||
*/
|
||||
}
|
||||
@ -521,11 +519,17 @@ function changePass(&$pass, &$mode, &$index, &$quorumActif, &$formR)
|
||||
$pass = 3;
|
||||
$mode = SPH_MATCH_ISPELL;
|
||||
$index = 'ent_mns';
|
||||
if (SPHINX_ENT_VERSION == 2) {
|
||||
$index = 'ent';
|
||||
}
|
||||
return true;
|
||||
case 3: // Pass 4 : Quorum n-1
|
||||
$pass = 4;
|
||||
$mode = SPH_MATCH_EXTENDED2;
|
||||
$index = 'ent_mns';
|
||||
if (SPHINX_ENT_VERSION == 2) {
|
||||
$index = 'ent';
|
||||
}
|
||||
$quorumActif = true;
|
||||
return true;
|
||||
case 4: // Pass 5 : Quorum n-2
|
||||
@ -650,10 +654,10 @@ function clientSphinx(&$formR)
|
||||
|
||||
switch ( $version ) {
|
||||
case 1:
|
||||
require_once realpath(dirname(__FILE__)).'/sphinxapi.php';
|
||||
require_once 'Vendors/sphinxapi/sphinxapi-0.9.9.php';
|
||||
break;
|
||||
case 2:
|
||||
require_once 'sphinxapi/sphinxapi-2.0.8.php';
|
||||
require_once 'Vendors/sphinxapi/sphinxapi-2.1.2.php';
|
||||
break;
|
||||
}
|
||||
|
||||
@ -766,6 +770,8 @@ function reponse(&$resSphinx, &$resDB, $criteres, $time, $formR, $form2crit,
|
||||
}
|
||||
}
|
||||
$ret['reponses'][$i]['Pertinence'] = $pertinence;
|
||||
$ret['reponses'][$i]['Source'] = $ligne['source'];
|
||||
$ret['reponses'][$i]['SourceId'] = $ligne['source_id'];
|
||||
$ret['reponses'][$i]['Siret'] = $ligne['siret'];
|
||||
$ret['reponses'][$i]['Siren'] = $ligne['siren'];
|
||||
$ret['reponses'][$i]['Nic'] = $ligne['nic'];
|
||||
@ -774,10 +780,13 @@ function reponse(&$resSphinx, &$resDB, $criteres, $time, $formR, $form2crit,
|
||||
$ret['reponses'][$i]['Nom2'] = '';
|
||||
$ret['reponses'][$i]['Sigle'] = $ligne['sigle'];
|
||||
$ret['reponses'][$i]['Enseigne'] = $ligne['enseigne'];
|
||||
$ret['reponses'][$i]['Adresse'] =
|
||||
$ligne['adr_num'].' '.
|
||||
$ligne['adr_typeVoie'].' '.
|
||||
$ligne['adr_libVoie'];
|
||||
$adresse = '';
|
||||
if ( intval($ligne['adr_dep'])==99 && intval($ligne['adr_num'])==0) {
|
||||
$adresse.= $ligne['adr_typeVoie'].' '.$ligne['adr_libVoie'];
|
||||
} else {
|
||||
$adresse = $ligne['adr_num'].' '.$ligne['adr_typeVoie'].' '.$ligne['adr_libVoie'];
|
||||
}
|
||||
$ret['reponses'][$i]['Adresse'] = $adresse;
|
||||
$ret['reponses'][$i]['Adresse2'] = $ligne['adr_comp'];
|
||||
$ret['reponses'][$i]['CP'] = $ligne['adr_cp'];
|
||||
$ret['reponses'][$i]['Ville'] = $ligne['adr_ville'];
|
||||
@ -948,6 +957,8 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
d.naissance_lieu,
|
||||
l.libelle AS fonction_lib,
|
||||
e.id, CONCAT(e.siren,e.nic) AS siret,
|
||||
e.source,
|
||||
e.source_id,
|
||||
e.siren,
|
||||
e.nic,
|
||||
e.siege,
|
||||
@ -960,16 +971,16 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
e.adr_comp,
|
||||
e.adr_cp,
|
||||
e.adr_ville,
|
||||
libPays AS pays,
|
||||
e.adr_dep, e.adr_com,
|
||||
e.tel,
|
||||
e.fax,
|
||||
e.cj,
|
||||
e.actif,
|
||||
e.ape_etab,
|
||||
e.ape_entrep
|
||||
FROM dirigeants d, etablissements e, bodacc_fonctions l
|
||||
WHERE
|
||||
d.fonction_code=l.codeFct
|
||||
AND d.id IN (";
|
||||
FROM dirigeants d, etablissements e LEFT OUTER JOIN tabPays ON codePaysInsee = IF(adr_dep=99,adr_com,null), bodacc_fonctions l
|
||||
WHERE d.fonction_code=l.codeFct AND d.id IN (";
|
||||
|
||||
$i = 0;
|
||||
foreach ($resSphinx['matches'] as $id => $element) {
|
||||
@ -980,7 +991,7 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
$requeteDB .= ") AND e.id = (";
|
||||
$requeteDB .= "SELECT tmp.id FROM etablissements tmp ";
|
||||
$requeteDB .= "WHERE tmp.siren=d.siren ORDER by tmp.actif DESC, tmp.siege DESC LIMIT 1";
|
||||
$requeteDB .= ")";
|
||||
$requeteDB .= ") ORDER BY e.actif DESC, e.siege DESC, e.rang DESC";
|
||||
|
||||
//file_put_contents('test.log', $requeteDB);
|
||||
|
||||
@ -1348,6 +1359,9 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
if ($total_premiere_requete == 0 ||
|
||||
$total_premiere_requete > 500) { // "huit a huit" donne 414
|
||||
$index = 'ent_mns';
|
||||
if (SPHINX_ENT_VERSION == 2) {
|
||||
$index = 'ent';
|
||||
}
|
||||
|
||||
// Requete sans les mots non significatifs
|
||||
// pour connaitre le nombre de mots trouves pour chaque champ alpha
|
||||
@ -1448,19 +1462,62 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
}
|
||||
|
||||
// Pour les nouveaux criteres
|
||||
if (LOCAL) {
|
||||
$comb2crit = file('comb2crit.txt');
|
||||
} else {
|
||||
$comb2crit = file(realpath(dirname(__FILE__)).'/comb2crit.txt');
|
||||
}
|
||||
$comb2crit = array(
|
||||
'00'=> ' ',
|
||||
'11'=> 'IT ',
|
||||
'12'=> 'I ',
|
||||
'13'=> ' T ',
|
||||
'21'=> ' D NR',
|
||||
'22'=> ' D VNR',
|
||||
'23'=> ' DL N ',
|
||||
'24'=> ' DL NR',
|
||||
'25'=> ' P NR',
|
||||
'26'=> ' P VN ',
|
||||
'27'=> ' PD VNR',
|
||||
'28'=> ' PD N ',
|
||||
'30'=> ' S ',
|
||||
'31'=> ' SE ',
|
||||
'32'=> ' SE R',
|
||||
'33'=> ' SE N ',
|
||||
'34'=> ' SE NR',
|
||||
'35'=> ' SE V ',
|
||||
'36'=> ' SE V R',
|
||||
'37'=> ' SE VNR',
|
||||
'40'=> ' SE D ',
|
||||
'41'=> ' SE D N ',
|
||||
'42'=> ' SE D V ',
|
||||
'43'=> ' SE D V R',
|
||||
'44'=> ' SE D VN ',
|
||||
'45'=> ' SE D VNR',
|
||||
'46'=> ' SE DL ',
|
||||
'47'=> ' SE DL R',
|
||||
'48'=> ' SE DL N ',
|
||||
'49'=> ' SE DL NR',
|
||||
'60'=> ' SEP ',
|
||||
'61'=> ' SEP N ',
|
||||
'62'=> ' SEP NR',
|
||||
'63'=> ' SEP V ',
|
||||
'64'=> ' SEP V R',
|
||||
'65'=> ' SEP VNR',
|
||||
'71'=> ' SEPD ',
|
||||
'72'=> ' SEPD R',
|
||||
'73'=> ' SEPD N ',
|
||||
'74'=> ' SEPD NR',
|
||||
'75'=> ' SEPD V ',
|
||||
'76'=> ' SEPD V R',
|
||||
'77'=> ' SEPD VN ',
|
||||
'78'=> ' SEPD VNR',
|
||||
'81'=> ' SEPDL R',
|
||||
'82'=> ' SEPDL N ',
|
||||
'83'=> ' SEPDL NR',
|
||||
);
|
||||
}
|
||||
|
||||
// Combinaison
|
||||
$combinaison = nouvelleCombinaison($sequence, $sequencePos, $pass, $index, $mode);
|
||||
if ($combinaison == '') {
|
||||
debugln('fin des combinaisons');
|
||||
if (changePass($pass, $mode, $index,
|
||||
$quorum_actif, $formR) == true) {
|
||||
if (changePass($pass, $mode, $index, $quorum_actif, $formR) == true) {
|
||||
$criteres = 'ITSEPDLVNR';
|
||||
initSphinx($sphinx, $mode, $pass, $deb, $nbRep, $max);
|
||||
$sequencePos = 0;
|
||||
@ -1562,6 +1619,8 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
}
|
||||
$requeteDB = 'SELECT
|
||||
id,
|
||||
source,
|
||||
source_id,
|
||||
CONCAT(siren,nic) AS siret,
|
||||
siren,
|
||||
nic,
|
||||
@ -1584,7 +1643,7 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
ape_entrep,
|
||||
(siren>200) AS sirenValide
|
||||
FROM etablissements
|
||||
LEFT OUTER JOIN tabPays ON codePaysInsee = IF(adr_dep=99,adr_com,null)
|
||||
LEFT OUTER JOIN tabPays ON codePaysInsee = IF(adr_dep=99,adr_com,null) AND tabPays.codPays3!=null
|
||||
WHERE id IN('.
|
||||
$i = 0;
|
||||
foreach ($resSphinx['matches'] as $id => $element) {
|
||||
@ -1595,6 +1654,8 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
|
||||
$requeteDB.= ') ORDER BY sirenValide DESC, actif DESC, siege DESC, rang DESC';
|
||||
|
||||
//file_put_contents('test.log', $requeteDB);
|
||||
|
||||
debugln();
|
||||
debugln("requeteDB='$requeteDB'");
|
||||
$resDB = $gDatabaseJO->query($requeteDB);
|
||||
|
@ -1,171 +0,0 @@
|
||||
<?php
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Teste la recherche avec les criteres contenus dans un fichier
|
||||
// --------------------------------------------------------------------------- //
|
||||
define('LOCAL', 1);
|
||||
|
||||
if (isset($_GET['fichier']) == true) {
|
||||
$fichier = $_GET['fichier'];
|
||||
} else {
|
||||
$fichier = 'nontrouves.txt';
|
||||
}
|
||||
if (isset($_GET['num']) == true) {
|
||||
define('DEBUG', 1);
|
||||
$num = $_GET['num'];
|
||||
} else {
|
||||
define('DEBUG', 0);
|
||||
$num = '';
|
||||
}
|
||||
if (isset($_GET['page']) == true) {
|
||||
$page = intval($_GET['page']);
|
||||
} else {
|
||||
$page = 1;
|
||||
}
|
||||
require_once('rechercheFonc.php');
|
||||
|
||||
function rechercheTest($fichierLog, $num, $page)
|
||||
{
|
||||
$NB_PAR_PAGE = 40;
|
||||
$crit2form = array('S' => 'raisonSociale',
|
||||
'N' => 'numVoie',
|
||||
'R' => 'voie',
|
||||
'L' => 'cpVille',
|
||||
'V' => 'cpVille');
|
||||
|
||||
$liste = file($fichierLog);
|
||||
if ($num != '') {
|
||||
$n = intval($num);
|
||||
$indices = array($n);
|
||||
} else {
|
||||
$n = ($page - 1) * $NB_PAR_PAGE;
|
||||
$indices = range($n, min($n + $NB_PAR_PAGE - 1, count($liste) - 1));
|
||||
}
|
||||
foreach ($indices as $i) {
|
||||
$ligne = explode('#', $liste[$i], 2);
|
||||
++$n;
|
||||
$formR = array();
|
||||
$criteres = explode(',', $ligne[0]);
|
||||
unset($nb_rep);
|
||||
$siret = '';
|
||||
// Nombre de resultats et siret
|
||||
foreach ($criteres as $c) {
|
||||
$labelvaleur = explode('=', $c);
|
||||
$label = trim($labelvaleur[0]);
|
||||
if ($label == 'NbRep' && isset($labelvaleur[1]) == true) {
|
||||
$nb_rep = intval(trim($labelvaleur[1]));
|
||||
}
|
||||
if ($label == 'SiretTrouve' && isset($labelvaleur[1]) == true) {
|
||||
$siret = trim($labelvaleur[1]);
|
||||
}
|
||||
}
|
||||
// Restrictions
|
||||
if (isset($nb_rep) == false || $nb_rep != 1 || $siret == '') {
|
||||
//continue;
|
||||
}
|
||||
// Criteres
|
||||
foreach ($criteres as $c) {
|
||||
$labelvaleur = explode('=', $c, 2);
|
||||
$label = trim($labelvaleur[0]);
|
||||
if (isset($labelvaleur[1]) == false) {
|
||||
continue;
|
||||
}
|
||||
$valeur = trim($labelvaleur[1]);
|
||||
if (isset($crit2form[$label]) == false) {
|
||||
continue;
|
||||
}
|
||||
if ($label == 'R' &&
|
||||
preg_match('/[0-9]+/', $valeur, $arrayValeur) > 0) {
|
||||
$formR['numVoie'] = $arrayValeur[0];
|
||||
$valeur = str_replace($arrayValeur[0].' ', '', $valeur);
|
||||
print 'N='.$arrayValeur[0].', ';
|
||||
}
|
||||
if (isset($formR[$crit2form[$label]]) == false) {
|
||||
$formR[$crit2form[$label]] = $valeur;
|
||||
} else {
|
||||
$formR[$crit2form[$label]] .= ' '.$valeur;
|
||||
}
|
||||
print $label.'='.$valeur.', ';
|
||||
}
|
||||
// Recherche
|
||||
$formR['type'] = 'ent';
|
||||
$res = recherche($formR, 0, 100);
|
||||
$total = 0;
|
||||
$siren = 0;
|
||||
$nic = 0;
|
||||
$resSiret = '00000000000000';
|
||||
if (isset($res['nbReponsesTotal'])) {
|
||||
$total = $res['nbReponsesTotal'];
|
||||
if ($total == 1) {
|
||||
$siren = $res['reponses'][0]['Siren'];
|
||||
$nic = $res['reponses'][0]['Nic'];
|
||||
$resSiret = sprintf("%09d%05d", $siren, $nic);
|
||||
} else if (isset($nb_rep) != false &&
|
||||
($nb_rep < $total) &&
|
||||
($nb_rep == 10 ||
|
||||
$nb_rep == 20)) {
|
||||
$total = $nb_rep;
|
||||
}
|
||||
}
|
||||
if ($siret != '') {
|
||||
if ($siret != '00000000000000' &&
|
||||
$siret != $resSiret) {
|
||||
print '<font color=#FF0000>'.$siret.' </font>';
|
||||
} else {
|
||||
print $siret.' ';
|
||||
}
|
||||
print $resSiret.' ';
|
||||
}
|
||||
if (($siret != '' &&
|
||||
$siret != '00000000000000' &&
|
||||
$siret != $resSiret) ||
|
||||
(isset($nb_rep) != false &&
|
||||
$nb_rep != 0 &&
|
||||
$nb_rep != $total) ||
|
||||
(isset($nb_rep) == false &&
|
||||
$total == 0)) {
|
||||
print '<font color=#FF0000>pass'.$res['pass'].' </font>';
|
||||
} else {
|
||||
print '<font color=#00FF00>pass'.$res['pass'].' </font>';
|
||||
}
|
||||
if (isset($nb_rep) != false) {
|
||||
if ($nb_rep != 0 &&
|
||||
$nb_rep != $total) {
|
||||
print '<font color=#FF0000>'.$nb_rep.' </font>';
|
||||
} else {
|
||||
print $nb_rep;
|
||||
}
|
||||
}
|
||||
print ' <a href=?fichier='.$fichierLog.'&num='.($n-1).'>'.
|
||||
$total.'</a>';
|
||||
if (count($ligne) == 2) {
|
||||
print ' #'.$ligne[1];
|
||||
}
|
||||
print '<br/>';
|
||||
}
|
||||
if ($num == '') {
|
||||
print '<br/>pages: ';
|
||||
for ($p = 1; $p < $page; ++$p) {
|
||||
print '<a href=?fichier='.$fichierLog.
|
||||
'&page='.$p.'>'.$p.'</a> ';
|
||||
}
|
||||
print '<b>'.$page.'</b> ';
|
||||
for ($p = $page + 1; ($p - 1) * $NB_PAR_PAGE < count($liste); ++$p) {
|
||||
print '<a href=?fichier='.$fichierLog.
|
||||
'&page='.$p.'>'.$p.'</a> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
rechercheTest($fichier, $num, $page);
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,130 +0,0 @@
|
||||
<?php
|
||||
require_once 'framework/common/strings.php';
|
||||
require_once realpath(dirname(__FILE__)).'/sphinxapi.php';
|
||||
|
||||
class SphinxCriteres
|
||||
{
|
||||
var $findMe = '';
|
||||
var $tabFiltres = array();
|
||||
var $position = 0;
|
||||
var $nbRep = 20;
|
||||
var $max = 200;
|
||||
var $any = false;
|
||||
}
|
||||
|
||||
class SphinxSearch
|
||||
{
|
||||
/**
|
||||
* Effectue une recherche en interrogeant le moteur Sphinx
|
||||
*
|
||||
* @param string $index
|
||||
* @param SphinxCriteres $criteres Critères de recherche
|
||||
* @return array $return Tableau des résultats
|
||||
*/
|
||||
public function search($index, $criteres)
|
||||
{
|
||||
debugLog('I',"Search Sphinx dans $name de ".$criteres->findMe." (".$criteres->deb.", ".$criteres->nbRep.", ".$criteres->max.") avec ".implode(',',$criteres->tabFiltres),__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$cl = new SphinxClient();
|
||||
switch (strtolower($index)) {
|
||||
case 'entrep':
|
||||
|
||||
|
||||
break;
|
||||
case 'dir':
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 'histo':
|
||||
$cl->SetServer (SPHINX_HISTO_HOST, SPHINX_HISTO_PORT);
|
||||
$cl->SetConnectTimeout ( 1 );
|
||||
$cl->SetLimits ($criteres->position, $criteres->nbRep, $criteres->max);
|
||||
$cl->SetMatchMode (SPH_MATCH_EXTENDED);
|
||||
foreach ($criteres->tabFiltres as $nomFiltre => $valFiltre) {
|
||||
$cl->SetFilter($nomFiltre, array(0=>$valFiltre));
|
||||
}
|
||||
$cl->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
|
||||
$res = $cl->Query ( $criteres->findMe, 'histo' );
|
||||
if ($res===false) {
|
||||
//Erreur
|
||||
debugLog('I',"Search Sphinx : Pas de réponse pour ".$criteres->findMe." avec ".implode(',',$criteres->tabFiltres).' ('.$cl->GetLastError() .')',__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
return array(
|
||||
'results' => false,
|
||||
'nbRet' => 0,
|
||||
'nbTot' => 0,
|
||||
'duration' => 0);
|
||||
} else {
|
||||
|
||||
if ( $cl->GetLastWarning() ) {
|
||||
debugLog('I',"Search Sphinx : Warning pour $criteres->findMe - ".$cl->GetLastWarning(),__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
print "WARNING: " . $cl->GetLastWarning() . "\n\n";
|
||||
}
|
||||
|
||||
debugLog('I',"'Search Sphinx dans $index de $criteres->findMe (Filtre=".implode(',',$criteres->tabFiltres)."), Deb=".$criteres->position.", nbRep=".$criteres->nbRep.", max=".$criteres->max.", any=".$criteres->any,__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$tabRet = array();
|
||||
if ( is_array($res['matches'])) {
|
||||
$iDb = new WDB('histobodacc');
|
||||
$iDb->query("SET NAMES 'latin1';");
|
||||
foreach ( $res['matches'] as $doc => $docinfo ) {
|
||||
$listeEtab = $iDb->select(
|
||||
'bodacc_ocr',
|
||||
"'Histo' as Loc, id, nomFichier, annee1, bod, texte",
|
||||
"id=$doc");
|
||||
$etab = $listeEtab[0];
|
||||
$tabRet[] = array(
|
||||
'Localisation' => $etab['Loc'],
|
||||
'id' => $doc,
|
||||
'Pertinence' => $docinfo['weight'],
|
||||
'Fichier' => $etab['nomFichier'],
|
||||
'Annee' => $etab['annee1'],
|
||||
'Code' => $etab['bod'],
|
||||
'Texte' => $etab['texte'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
debugLog('I','Search Sphinx : Retourne '. $res[total].'/'. $res[total_found] .' en '.$res[time] .'secondes',__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
return array(
|
||||
'results' => $tabRet,
|
||||
'nbRet' => $res[total],
|
||||
'nbTot' => $res[total_found],
|
||||
'duration' => $res[time],
|
||||
'words' => $res['words'],
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Méthode magique __call() permettant d'appeller une méthode virtuelle
|
||||
* du type searchByEnt(), searchByDir() ou searchByHisto()...
|
||||
*
|
||||
* @param string $method Nom de la méthode virtuelle appelée
|
||||
* @param array $args Tableau des critères de recherche
|
||||
* @return array|null $return Tableau des résultats ou NULL
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if(preg_match('#^searchBy#i',$method))
|
||||
{
|
||||
$name = str_replace('searchBy','',$method);
|
||||
$criteres = array(
|
||||
0 => 'findMe',
|
||||
1 => 'tabFiltres',
|
||||
2 => 'position',
|
||||
3 => 'nbRep',
|
||||
4 => 'max',
|
||||
5 => 'any',
|
||||
);
|
||||
$searchArgs = new stdClass();
|
||||
$i = 0;
|
||||
foreach($args as $argument) {
|
||||
$searchArgs->{$criteres[$i]} = $argument;
|
||||
$i++;
|
||||
}
|
||||
return $this->search($name, $searchArgs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// $Id: sphinxapi.php 2055M 2010-03-08 10:20:47Z (local) $
|
||||
// $Id: sphinxapi.php 2055 2009-11-06 23:09:58Z shodan $
|
||||
//
|
||||
|
||||
//
|
||||
@ -48,7 +48,6 @@ define ( "SPH_MATCH_BOOLEAN", 3 );
|
||||
define ( "SPH_MATCH_EXTENDED", 4 );
|
||||
define ( "SPH_MATCH_FULLSCAN", 5 );
|
||||
define ( "SPH_MATCH_EXTENDED2", 6 ); // extended engine V2 (TEMPORARY, WILL BE REMOVED)
|
||||
define("SPH_MATCH_ISPELL", 7);
|
||||
|
||||
/// known ranking modes (ext2 only)
|
||||
define ( "SPH_RANK_PROXIMITY_BM25", 0 ); ///< default mode, phrase proximity major factor and BM25 minor one
|
||||
@ -422,7 +421,7 @@ class SphinxClient
|
||||
function SphinxClient ()
|
||||
{
|
||||
// per-client-object settings
|
||||
$this->_host = "192.168.3.32";
|
||||
$this->_host = "localhost";
|
||||
$this->_port = 9312;
|
||||
$this->_path = false;
|
||||
$this->_socket = false;
|
||||
@ -725,7 +724,6 @@ class SphinxClient
|
||||
|| $mode==SPH_MATCH_BOOLEAN
|
||||
|| $mode==SPH_MATCH_EXTENDED
|
||||
|| $mode==SPH_MATCH_FULLSCAN
|
||||
|| $mode==SPH_MATCH_ISPELL
|
||||
|| $mode==SPH_MATCH_EXTENDED2 );
|
||||
$this->_mode = $mode;
|
||||
}
|
||||
@ -1624,5 +1622,5 @@ class SphinxClient
|
||||
}
|
||||
|
||||
//
|
||||
// $Id: sphinxapi.php 2055M 2010-03-08 10:20:47Z (local) $
|
||||
// $Id: sphinxapi.php 2055 2009-11-06 23:09:58Z shodan $
|
||||
//
|
File diff suppressed because it is too large
Load Diff
1810
1.2/library/Vendors/sphinxapi/sphinxapi-2.1.5.php
Normal file
1810
1.2/library/Vendors/sphinxapi/sphinxapi-2.1.5.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,878 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
) o------------------------------------------------------------------------------o
|
||||
* | This is HTMLMimeMail5. It is dual licensed as GPL and a commercial license. |
|
||||
* | If you use the code commercially (or if you don't want to be restricted by |
|
||||
* | the GPL license), you will need the commercial license. It's only £49 (GBP - |
|
||||
* | roughly $98 depending on the exchange rate) and helps me out a lot. Thanks. |
|
||||
* o------------------------------------------------------------------------------o
|
||||
*
|
||||
* © Copyright 2005 Richard Heyes
|
||||
*/
|
||||
|
||||
/**
|
||||
* RFC 822 Email address list validation Utility
|
||||
*
|
||||
* What is it?
|
||||
*
|
||||
* This class will take an address string, and parse it into it's consituent
|
||||
* parts, be that either addresses, groups, or combinations. Nested groups
|
||||
* are not supported. The structure it returns is pretty straight forward,
|
||||
* and is similar to that provided by the imap_rfc822_parse_adrlist(). Use
|
||||
* print_r() to view the structure.
|
||||
*
|
||||
* How do I use it?
|
||||
*
|
||||
* $address_string = 'My Group: "Richard Heyes" <richard@localhost> (A comment), ted@example.com (Ted Bloggs), Barney;';
|
||||
* $structure = Mail_RFC822::parseAddressList($address_string, 'example.com', TRUE)
|
||||
* print_r($structure);
|
||||
*/
|
||||
|
||||
class Mail_RFC822
|
||||
{
|
||||
/**
|
||||
* The address being parsed by the RFC822 object.
|
||||
* @private string $address
|
||||
*/
|
||||
private $address = '';
|
||||
|
||||
/**
|
||||
* The default domain to use for unqualified addresses.
|
||||
* @private string $default_domain
|
||||
*/
|
||||
private $default_domain = 'localhost';
|
||||
|
||||
/**
|
||||
* Should we return a nested array showing groups, or flatten everything?
|
||||
* @private boolean $nestGroups
|
||||
*/
|
||||
private $nestGroups = true;
|
||||
|
||||
/**
|
||||
* Whether or not to validate atoms for non-ascii characters.
|
||||
* @private boolean $validate
|
||||
*/
|
||||
private $validate = true;
|
||||
|
||||
/**
|
||||
* The array of raw addresses built up as we parse.
|
||||
* @private array $addresses
|
||||
*/
|
||||
private $addresses = array();
|
||||
|
||||
/**
|
||||
* The final array of parsed address information that we build up.
|
||||
* @private array $structure
|
||||
*/
|
||||
private $structure = array();
|
||||
|
||||
/**
|
||||
* The current error message, if any.
|
||||
* @private string $error
|
||||
*/
|
||||
private $error = null;
|
||||
|
||||
/**
|
||||
* An internal counter/pointer.
|
||||
* @private integer $index
|
||||
*/
|
||||
private $index = null;
|
||||
|
||||
/**
|
||||
* The number of groups that have been found in the address list.
|
||||
* @private integer $num_groups
|
||||
* @access public
|
||||
*/
|
||||
private $num_groups = 0;
|
||||
|
||||
/**
|
||||
* A variable so that we can tell whether or not we're inside a
|
||||
* Mail_RFC822 object.
|
||||
* @private boolean $mailRFC822
|
||||
*/
|
||||
private $mailRFC822 = true;
|
||||
|
||||
/**
|
||||
* A limit after which processing stops
|
||||
* @private int $limit
|
||||
*/
|
||||
private $limit = null;
|
||||
|
||||
|
||||
/**
|
||||
* Sets up the object. The address must either be set here or when
|
||||
* calling parseAddressList(). One or the other.
|
||||
*
|
||||
* @access public
|
||||
* @param string $address The address(es) to validate.
|
||||
* @param string $default_domain Default domain/host etc. If not supplied, will be set to localhost.
|
||||
* @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing.
|
||||
* @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance.
|
||||
*
|
||||
* @return object Mail_RFC822 A new Mail_RFC822 object.
|
||||
*/
|
||||
function __construct($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null)
|
||||
{
|
||||
if (isset($address)) $this->address = $address;
|
||||
if (isset($default_domain)) $this->default_domain = $default_domain;
|
||||
if (isset($nest_groups)) $this->nestGroups = $nest_groups;
|
||||
if (isset($validate)) $this->validate = $validate;
|
||||
if (isset($limit)) $this->limit = $limit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts the whole process. The address must either be set here
|
||||
* or when creating the object. One or the other.
|
||||
*
|
||||
* @access public
|
||||
* @param string $address The address(es) to validate.
|
||||
* @param string $default_domain Default domain/host etc.
|
||||
* @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing.
|
||||
* @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance.
|
||||
*
|
||||
* @return array A structured array of addresses.
|
||||
*/
|
||||
function parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null)
|
||||
{
|
||||
|
||||
if (!isset($this->mailRFC822)) {
|
||||
$obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit);
|
||||
return $obj->parseAddressList();
|
||||
}
|
||||
|
||||
if (isset($address)) $this->address = $address;
|
||||
if (isset($default_domain)) $this->default_domain = $default_domain;
|
||||
if (isset($nest_groups)) $this->nestGroups = $nest_groups;
|
||||
if (isset($validate)) $this->validate = $validate;
|
||||
if (isset($limit)) $this->limit = $limit;
|
||||
|
||||
$this->structure = array();
|
||||
$this->addresses = array();
|
||||
$this->error = null;
|
||||
$this->index = null;
|
||||
|
||||
while ($this->address = $this->_splitAddresses($this->address)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->address === false || isset($this->error)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reset timer since large amounts of addresses can take a long time to
|
||||
// get here
|
||||
set_time_limit(30);
|
||||
|
||||
// Loop through all the addresses
|
||||
for ($i = 0; $i < count($this->addresses); $i++){
|
||||
|
||||
if (($return = $this->_validateAddress($this->addresses[$i])) === false
|
||||
|| isset($this->error)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->nestGroups) {
|
||||
$this->structure = array_merge($this->structure, $return);
|
||||
} else {
|
||||
$this->structure[] = $return;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->structure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits an address into seperate addresses.
|
||||
*
|
||||
* @access private
|
||||
* @param string $address The addresses to split.
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function _splitAddresses($address)
|
||||
{
|
||||
|
||||
if (!empty($this->limit) AND count($this->addresses) == $this->limit) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->_isGroup($address) && !isset($this->error)) {
|
||||
$split_char = ';';
|
||||
$is_group = true;
|
||||
} elseif (!isset($this->error)) {
|
||||
$split_char = ',';
|
||||
$is_group = false;
|
||||
} elseif (isset($this->error)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Split the string based on the above ten or so lines.
|
||||
$parts = explode($split_char, $address);
|
||||
$string = $this->_splitCheck($parts, $split_char);
|
||||
|
||||
// If a group...
|
||||
if ($is_group) {
|
||||
// If $string does not contain a colon outside of
|
||||
// brackets/quotes etc then something's fubar.
|
||||
|
||||
// First check there's a colon at all:
|
||||
if (strpos($string, ':') === false) {
|
||||
$this->error = 'Invalid address: ' . $string;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now check it's outside of brackets/quotes:
|
||||
if (!$this->_splitCheck(explode(':', $string), ':'))
|
||||
return false;
|
||||
|
||||
// We must have a group at this point, so increase the counter:
|
||||
$this->num_groups++;
|
||||
}
|
||||
|
||||
// $string now contains the first full address/group.
|
||||
// Add to the addresses array.
|
||||
$this->addresses[] = array(
|
||||
'address' => trim($string),
|
||||
'group' => $is_group
|
||||
);
|
||||
|
||||
// Remove the now stored address from the initial line, the +1
|
||||
// is to account for the explode character.
|
||||
$address = trim(substr($address, strlen($string) + 1));
|
||||
|
||||
// If the next char is a comma and this was a group, then
|
||||
// there are more addresses, otherwise, if there are any more
|
||||
// chars, then there is another address.
|
||||
if ($is_group && substr($address, 0, 1) == ','){
|
||||
$address = trim(substr($address, 1));
|
||||
return $address;
|
||||
|
||||
} elseif (strlen($address) > 0) {
|
||||
return $address;
|
||||
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
// If you got here then something's off
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for a group at the start of the string.
|
||||
*
|
||||
* @access private
|
||||
* @param string $address The address to check.
|
||||
* @return boolean Whether or not there is a group at the start of the string.
|
||||
*/
|
||||
function _isGroup($address)
|
||||
{
|
||||
// First comma not in quotes, angles or escaped:
|
||||
$parts = explode(',', $address);
|
||||
$string = $this->_splitCheck($parts, ',');
|
||||
|
||||
// Now we have the first address, we can reliably check for a
|
||||
// group by searching for a colon that's not escaped or in
|
||||
// quotes or angle brackets.
|
||||
if (count($parts = explode(':', $string)) > 1) {
|
||||
$string2 = $this->_splitCheck($parts, ':');
|
||||
return ($string2 !== $string);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A common function that will check an exploded string.
|
||||
*
|
||||
* @access private
|
||||
* @param array $parts The exloded string.
|
||||
* @param string $char The char that was exploded on.
|
||||
* @return mixed False if the string contains unclosed quotes/brackets, or the string on success.
|
||||
*/
|
||||
function _splitCheck($parts, $char)
|
||||
{
|
||||
$string = $parts[0];
|
||||
|
||||
for ($i = 0; $i < count($parts); $i++) {
|
||||
if ($this->_hasUnclosedQuotes($string)
|
||||
|| $this->_hasUnclosedBrackets($string, '<>')
|
||||
|| $this->_hasUnclosedBrackets($string, '[]')
|
||||
|| $this->_hasUnclosedBrackets($string, '()')
|
||||
|| substr($string, -1) == '\\') {
|
||||
if (isset($parts[$i + 1])) {
|
||||
$string = $string . $char . $parts[$i + 1];
|
||||
} else {
|
||||
$this->error = 'Invalid address spec. Unclosed bracket or quotes';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$this->index = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a string has an unclosed quotes or not.
|
||||
*
|
||||
* @access private
|
||||
* @param string $string The string to check.
|
||||
* @return boolean True if there are unclosed quotes inside the string, false otherwise.
|
||||
*/
|
||||
function _hasUnclosedQuotes($string)
|
||||
{
|
||||
$string = explode('"', $string);
|
||||
$string_cnt = count($string);
|
||||
|
||||
for ($i = 0; $i < (count($string) - 1); $i++)
|
||||
if (substr($string[$i], -1) == '\\')
|
||||
$string_cnt--;
|
||||
|
||||
return ($string_cnt % 2 === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a string has an unclosed brackets or not. IMPORTANT:
|
||||
* This function handles both angle brackets and square brackets;
|
||||
*
|
||||
* @access private
|
||||
* @param string $string The string to check.
|
||||
* @param string $chars The characters to check for.
|
||||
* @return boolean True if there are unclosed brackets inside the string, false otherwise.
|
||||
*/
|
||||
function _hasUnclosedBrackets($string, $chars)
|
||||
{
|
||||
$num_angle_start = substr_count($string, $chars[0]);
|
||||
$num_angle_end = substr_count($string, $chars[1]);
|
||||
|
||||
$this->_hasUnclosedBracketsSub($string, $num_angle_start, $chars[0]);
|
||||
$this->_hasUnclosedBracketsSub($string, $num_angle_end, $chars[1]);
|
||||
|
||||
if ($num_angle_start < $num_angle_end) {
|
||||
$this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')';
|
||||
return false;
|
||||
} else {
|
||||
return ($num_angle_start > $num_angle_end);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sub function that is used only by hasUnclosedBrackets().
|
||||
*
|
||||
* @access private
|
||||
* @param string $string The string to check.
|
||||
* @param integer &$num The number of occurences.
|
||||
* @param string $char The character to count.
|
||||
* @return integer The number of occurences of $char in $string, adjusted for backslashes.
|
||||
*/
|
||||
function _hasUnclosedBracketsSub($string, &$num, $char)
|
||||
{
|
||||
$parts = explode($char, $string);
|
||||
for ($i = 0; $i < count($parts); $i++){
|
||||
if (substr($parts[$i], -1) == '\\' || $this->_hasUnclosedQuotes($parts[$i]))
|
||||
$num--;
|
||||
if (isset($parts[$i + 1]))
|
||||
$parts[$i + 1] = $parts[$i] . $char . $parts[$i + 1];
|
||||
}
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to begin checking the address.
|
||||
*
|
||||
* @access private
|
||||
* @param string $address The address to validate.
|
||||
* @return mixed False on failure, or a structured array of address information on success.
|
||||
*/
|
||||
function _validateAddress($address)
|
||||
{
|
||||
$is_group = false;
|
||||
|
||||
if ($address['group']) {
|
||||
$is_group = true;
|
||||
|
||||
// Get the group part of the name
|
||||
$parts = explode(':', $address['address']);
|
||||
$groupname = $this->_splitCheck($parts, ':');
|
||||
$structure = array();
|
||||
|
||||
// And validate the group part of the name.
|
||||
if (!$this->_validatePhrase($groupname)){
|
||||
$this->error = 'Group name did not validate.';
|
||||
return false;
|
||||
} else {
|
||||
// Don't include groups if we are not nesting
|
||||
// them. This avoids returning invalid addresses.
|
||||
if ($this->nestGroups) {
|
||||
$structure = new stdClass;
|
||||
$structure->groupname = $groupname;
|
||||
}
|
||||
}
|
||||
|
||||
$address['address'] = ltrim(substr($address['address'], strlen($groupname . ':')));
|
||||
}
|
||||
|
||||
// If a group then split on comma and put into an array.
|
||||
// Otherwise, Just put the whole address in an array.
|
||||
if ($is_group) {
|
||||
while (strlen($address['address']) > 0) {
|
||||
$parts = explode(',', $address['address']);
|
||||
$addresses[] = $this->_splitCheck($parts, ',');
|
||||
$address['address'] = trim(substr($address['address'], strlen(end($addresses) . ',')));
|
||||
}
|
||||
} else {
|
||||
$addresses[] = $address['address'];
|
||||
}
|
||||
|
||||
// Check that $addresses is set, if address like this:
|
||||
// Groupname:;
|
||||
// Then errors were appearing.
|
||||
if (!isset($addresses)){
|
||||
$this->error = 'Empty group.';
|
||||
return false;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($addresses); $i++) {
|
||||
$addresses[$i] = trim($addresses[$i]);
|
||||
}
|
||||
|
||||
// Validate each mailbox.
|
||||
// Format could be one of: name <geezer@domain.com>
|
||||
// geezer@domain.com
|
||||
// geezer
|
||||
// ... or any other format valid by RFC 822.
|
||||
array_walk($addresses, array($this, 'validateMailbox'));
|
||||
|
||||
// Nested format
|
||||
if ($this->nestGroups) {
|
||||
if ($is_group) {
|
||||
$structure->addresses = $addresses;
|
||||
} else {
|
||||
$structure = $addresses[0];
|
||||
}
|
||||
|
||||
// Flat format
|
||||
} else {
|
||||
if ($is_group) {
|
||||
$structure = array_merge($structure, $addresses);
|
||||
} else {
|
||||
$structure = $addresses;
|
||||
}
|
||||
}
|
||||
|
||||
return $structure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate a phrase.
|
||||
*
|
||||
* @access private
|
||||
* @param string $phrase The phrase to check.
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function _validatePhrase($phrase)
|
||||
{
|
||||
// Splits on one or more Tab or space.
|
||||
$parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$phrase_parts = array();
|
||||
while (count($parts) > 0){
|
||||
$phrase_parts[] = $this->_splitCheck($parts, ' ');
|
||||
for ($i = 0; $i < $this->index + 1; $i++)
|
||||
array_shift($parts);
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($phrase_parts); $i++) {
|
||||
// If quoted string:
|
||||
if (substr($phrase_parts[$i], 0, 1) == '"') {
|
||||
if (!$this->_validateQuotedString($phrase_parts[$i]))
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise it's an atom:
|
||||
if (!$this->_validateAtom($phrase_parts[$i])) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate an atom which from rfc822 is:
|
||||
* atom = 1*<any CHAR except specials, SPACE and CTLs>
|
||||
*
|
||||
* If validation ($this->validate) has been turned off, then
|
||||
* validateAtom() doesn't actually check anything. This is so that you
|
||||
* can split a list of addresses up before encoding personal names
|
||||
* (umlauts, etc.), for example.
|
||||
*
|
||||
* @access private
|
||||
* @param string $atom The string to check.
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function _validateAtom($atom)
|
||||
{
|
||||
if (!$this->validate) {
|
||||
// Validation has been turned off; assume the atom is okay.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for any char from ASCII 0 - ASCII 127
|
||||
if (!preg_match('/^[\\x00-\\x7E]+$/i', $atom, $matches)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for specials:
|
||||
if (preg_match('/[][()<>@,;\\:". ]/', $atom)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for control characters (ASCII 0-31):
|
||||
if (preg_match('/[\\x00-\\x1F]+/', $atom)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate quoted string, which is:
|
||||
* quoted-string = <"> *(qtext/quoted-pair) <">
|
||||
*
|
||||
* @access private
|
||||
* @param string $qstring The string to check
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function _validateQuotedString($qstring)
|
||||
{
|
||||
// Leading and trailing "
|
||||
$qstring = substr($qstring, 1, -1);
|
||||
|
||||
// Perform check.
|
||||
return !(preg_match('/(.)[\x0D\\\\"]/', $qstring, $matches) && $matches[1] != '\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate a mailbox, which is:
|
||||
* mailbox = addr-spec ; simple address
|
||||
* / phrase route-addr ; name and route-addr
|
||||
*
|
||||
* @access public
|
||||
* @param string &$mailbox The string to check.
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function validateMailbox(&$mailbox)
|
||||
{
|
||||
// A couple of defaults.
|
||||
$phrase = '';
|
||||
$comment = '';
|
||||
|
||||
// Catch any RFC822 comments and store them separately
|
||||
$_mailbox = $mailbox;
|
||||
while (strlen(trim($_mailbox)) > 0) {
|
||||
$parts = explode('(', $_mailbox);
|
||||
$before_comment = $this->_splitCheck($parts, '(');
|
||||
if ($before_comment != $_mailbox) {
|
||||
// First char should be a (
|
||||
$comment = substr(str_replace($before_comment, '', $_mailbox), 1);
|
||||
$parts = explode(')', $comment);
|
||||
$comment = $this->_splitCheck($parts, ')');
|
||||
$comments[] = $comment;
|
||||
|
||||
// +1 is for the trailing )
|
||||
$_mailbox = substr($_mailbox, strpos($_mailbox, $comment)+strlen($comment)+1);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for($i=0; $i<count(@$comments); $i++){
|
||||
$mailbox = str_replace('('.$comments[$i].')', '', $mailbox);
|
||||
}
|
||||
$mailbox = trim($mailbox);
|
||||
|
||||
// Check for name + route-addr
|
||||
if (substr($mailbox, -1) == '>' && substr($mailbox, 0, 1) != '<') {
|
||||
$parts = explode('<', $mailbox);
|
||||
$name = $this->_splitCheck($parts, '<');
|
||||
|
||||
$phrase = trim($name);
|
||||
$route_addr = trim(substr($mailbox, strlen($name.'<'), -1));
|
||||
|
||||
if ($this->_validatePhrase($phrase) === false || ($route_addr = $this->_validateRouteAddr($route_addr)) === false)
|
||||
return false;
|
||||
|
||||
// Only got addr-spec
|
||||
} else {
|
||||
// First snip angle brackets if present.
|
||||
if (substr($mailbox,0,1) == '<' && substr($mailbox,-1) == '>')
|
||||
$addr_spec = substr($mailbox,1,-1);
|
||||
else
|
||||
$addr_spec = $mailbox;
|
||||
|
||||
if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Construct the object that will be returned.
|
||||
$mbox = new stdClass();
|
||||
|
||||
// Add the phrase (even if empty) and comments
|
||||
$mbox->personal = $phrase;
|
||||
$mbox->comment = isset($comments) ? $comments : array();
|
||||
|
||||
if (isset($route_addr)) {
|
||||
$mbox->mailbox = $route_addr['local_part'];
|
||||
$mbox->host = $route_addr['domain'];
|
||||
$route_addr['adl'] !== '' ? $mbox->adl = $route_addr['adl'] : '';
|
||||
} else {
|
||||
$mbox->mailbox = $addr_spec['local_part'];
|
||||
$mbox->host = $addr_spec['domain'];
|
||||
}
|
||||
|
||||
$mailbox = $mbox;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function validates a route-addr which is:
|
||||
* route-addr = "<" [route] addr-spec ">"
|
||||
*
|
||||
* Angle brackets have already been removed at the point of
|
||||
* getting to this function.
|
||||
*
|
||||
* @access private
|
||||
* @param string $route_addr The string to check.
|
||||
* @return mixed False on failure, or an array containing validated address/route information on success.
|
||||
*/
|
||||
function _validateRouteAddr($route_addr)
|
||||
{
|
||||
// Check for colon.
|
||||
if (strpos($route_addr, ':') !== false) {
|
||||
$parts = explode(':', $route_addr);
|
||||
$route = $this->_splitCheck($parts, ':');
|
||||
} else {
|
||||
$route = $route_addr;
|
||||
}
|
||||
|
||||
// If $route is same as $route_addr then the colon was in
|
||||
// quotes or brackets or, of course, non existent.
|
||||
if ($route === $route_addr){
|
||||
unset($route);
|
||||
$addr_spec = $route_addr;
|
||||
if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Validate route part.
|
||||
if (($route = $this->_validateRoute($route)) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$addr_spec = substr($route_addr, strlen($route . ':'));
|
||||
|
||||
// Validate addr-spec part.
|
||||
if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($route)) {
|
||||
$return['adl'] = $route;
|
||||
} else {
|
||||
$return['adl'] = '';
|
||||
}
|
||||
|
||||
$return = array_merge($return, $addr_spec);
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate a route, which is:
|
||||
* route = 1#("@" domain) ":"
|
||||
*
|
||||
* @access private
|
||||
* @param string $route The string to check.
|
||||
* @return mixed False on failure, or the validated $route on success.
|
||||
*/
|
||||
function _validateRoute($route)
|
||||
{
|
||||
// Split on comma.
|
||||
$domains = explode(',', trim($route));
|
||||
|
||||
for ($i = 0; $i < count($domains); $i++) {
|
||||
$domains[$i] = str_replace('@', '', trim($domains[$i]));
|
||||
if (!$this->_validateDomain($domains[$i])) return false;
|
||||
}
|
||||
|
||||
return $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate a domain, though this is not quite what
|
||||
* you expect of a strict internet domain.
|
||||
*
|
||||
* domain = sub-domain *("." sub-domain)
|
||||
*
|
||||
* @access private
|
||||
* @param string $domain The string to check.
|
||||
* @return mixed False on failure, or the validated domain on success.
|
||||
*/
|
||||
function _validateDomain($domain)
|
||||
{
|
||||
// Note the different use of $subdomains and $sub_domains
|
||||
$subdomains = explode('.', $domain);
|
||||
|
||||
while (count($subdomains) > 0) {
|
||||
$sub_domains[] = $this->_splitCheck($subdomains, '.');
|
||||
for ($i = 0; $i < $this->index + 1; $i++)
|
||||
array_shift($subdomains);
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($sub_domains); $i++) {
|
||||
if (!$this->_validateSubdomain(trim($sub_domains[$i])))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Managed to get here, so return input.
|
||||
return $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate a subdomain:
|
||||
* subdomain = domain-ref / domain-literal
|
||||
*
|
||||
* @access private
|
||||
* @param string $subdomain The string to check.
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function _validateSubdomain($subdomain)
|
||||
{
|
||||
if (preg_match('|^\[(.*)]$|', $subdomain, $arr)){
|
||||
if (!$this->_validateDliteral($arr[1])) return false;
|
||||
} else {
|
||||
if (!$this->_validateAtom($subdomain)) return false;
|
||||
}
|
||||
|
||||
// Got here, so return successful.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate a domain literal:
|
||||
* domain-literal = "[" *(dtext / quoted-pair) "]"
|
||||
*
|
||||
* @access private
|
||||
* @param string $dliteral The string to check.
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function _validateDliteral($dliteral)
|
||||
{
|
||||
return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && $matches[1] != '\\';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate an addr-spec.
|
||||
*
|
||||
* addr-spec = local-part "@" domain
|
||||
*
|
||||
* @access private
|
||||
* @param string $addr_spec The string to check.
|
||||
* @return mixed False on failure, or the validated addr-spec on success.
|
||||
*/
|
||||
function _validateAddrSpec($addr_spec)
|
||||
{
|
||||
$addr_spec = trim($addr_spec);
|
||||
|
||||
// Split on @ sign if there is one.
|
||||
if (strpos($addr_spec, '@') !== false) {
|
||||
$parts = explode('@', $addr_spec);
|
||||
$local_part = $this->_splitCheck($parts, '@');
|
||||
$domain = substr($addr_spec, strlen($local_part . '@'));
|
||||
|
||||
// No @ sign so assume the default domain.
|
||||
} else {
|
||||
$local_part = $addr_spec;
|
||||
$domain = $this->default_domain;
|
||||
}
|
||||
|
||||
if (($local_part = $this->_validateLocalPart($local_part)) === false) return false;
|
||||
if (($domain = $this->_validateDomain($domain)) === false) return false;
|
||||
|
||||
// Got here so return successful.
|
||||
return array('local_part' => $local_part, 'domain' => $domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to validate the local part of an address:
|
||||
* local-part = word *("." word)
|
||||
*
|
||||
* @access private
|
||||
* @param string $local_part
|
||||
* @return mixed False on failure, or the validated local part on success.
|
||||
*/
|
||||
function _validateLocalPart($local_part)
|
||||
{
|
||||
$parts = explode('.', $local_part);
|
||||
|
||||
// Split the local_part into words.
|
||||
while (count($parts) > 0){
|
||||
$words[] = $this->_splitCheck($parts, '.');
|
||||
for ($i = 0; $i < $this->index + 1; $i++) {
|
||||
array_shift($parts);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate each word.
|
||||
for ($i = 0; $i < count($words); $i++) {
|
||||
if ($this->_validatePhrase(trim($words[$i])) === false) return false;
|
||||
}
|
||||
|
||||
// Managed to get here, so return the input.
|
||||
return $local_part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an approximate count of how many addresses are
|
||||
* in the given string. This is APPROXIMATE as it only splits
|
||||
* based on a comma which has no preceding backslash. Could be
|
||||
* useful as large amounts of addresses will end up producing
|
||||
* *large* structures when used with parseAddressList().
|
||||
*
|
||||
* @param string $data Addresses to count
|
||||
* @return int Approximate count
|
||||
*/
|
||||
function approximateCount($data)
|
||||
{
|
||||
return count(preg_split('/(?<!\\\\),/', $data));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a email validating function seperate to the rest
|
||||
* of the class. It simply validates whether an email is of
|
||||
* the common internet form: <user>@<domain>. This can be
|
||||
* sufficient for most people. Optional stricter mode can
|
||||
* be utilised which restricts mailbox characters allowed
|
||||
* to alphanumeric, full stop, hyphen and underscore.
|
||||
*
|
||||
* @param string $data Address to check
|
||||
* @param boolean $strict Optional stricter mode
|
||||
* @return mixed False if it fails, an indexed array
|
||||
* username/domain if it matches
|
||||
*/
|
||||
function isValidInetAddress($data, $strict = false)
|
||||
{
|
||||
$regex = $strict ? '/^([.0-9a-z_-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i' : '/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i';
|
||||
if (preg_match($regex, trim($data), $matches)) {
|
||||
return array($matches[1], $matches[2]);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
@ -1,311 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* o------------------------------------------------------------------------------o
|
||||
* | This is HTMLMimeMail5. It is dual licensed as GPL and a commercial license. |
|
||||
* | If you use the code commercially (or if you don't want to be restricted by |
|
||||
* | the GPL license), you will need the commercial license. It's only £49 (GBP - |
|
||||
* | roughly $98 depending on the exchange rate) and helps me out a lot. Thanks. |
|
||||
* o------------------------------------------------------------------------------o
|
||||
*
|
||||
* © Copyright Richard Heyes
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Raw mime encoding class
|
||||
*
|
||||
* What is it?
|
||||
* This class enables you to manipulate and build
|
||||
* a mime email from the ground up.
|
||||
*
|
||||
* Why use this instead of mime.php?
|
||||
* mime.php is a userfriendly api to this class for
|
||||
* people who aren't interested in the internals of
|
||||
* mime mail. This class however allows full control
|
||||
* over the email.
|
||||
*
|
||||
* Eg.
|
||||
*
|
||||
* // Since multipart/mixed has no real body, (the body is
|
||||
* // the subpart), we set the body argument to blank.
|
||||
*
|
||||
* $params['content_type'] = 'multipart/mixed';
|
||||
* $email = new Mail_mimePart('', $params);
|
||||
*
|
||||
* // Here we add a text part to the multipart we have
|
||||
* // already. Assume $body contains plain text.
|
||||
*
|
||||
* $params['content_type'] = 'text/plain';
|
||||
* $params['encoding'] = '7bit';
|
||||
* $text = $email->addSubPart($body, $params);
|
||||
*
|
||||
* // Now add an attachment. Assume $attach is
|
||||
* the contents of the attachment
|
||||
*
|
||||
* $params['content_type'] = 'application/zip';
|
||||
* $params['encoding'] = 'base64';
|
||||
* $params['disposition'] = 'attachment';
|
||||
* $params['dfilename'] = 'example.zip';
|
||||
* $attach =& $email->addSubPart($body, $params);
|
||||
*
|
||||
* // Now build the email. Note that the encode
|
||||
* // function returns an associative array containing two
|
||||
* // elements, body and headers. You will need to add extra
|
||||
* // headers, (eg. Mime-Version) before sending.
|
||||
*
|
||||
* $email = $message->encode();
|
||||
* $email['headers'][] = 'Mime-Version: 1.0';
|
||||
*
|
||||
*
|
||||
* Further examples are available at http://www.phpguru.org
|
||||
*
|
||||
* TODO:
|
||||
* - Set encode() to return the $obj->encoded if encode()
|
||||
* has already been run. Unless a flag is passed to specifically
|
||||
* re-build the message.
|
||||
*
|
||||
* @author Richard Heyes <richard@phpguru.org>
|
||||
* @version $Revision: 1.3 $
|
||||
* @package Mail
|
||||
*/
|
||||
|
||||
class Mail_MIMEPart
|
||||
{
|
||||
/**
|
||||
* The encoding type of this part
|
||||
* @var string
|
||||
*/
|
||||
private $encoding;
|
||||
|
||||
/**
|
||||
* An array of subparts
|
||||
* @var array
|
||||
*/
|
||||
private $subparts;
|
||||
|
||||
/**
|
||||
* The output of this part after being built
|
||||
* @var string
|
||||
*/
|
||||
private $encoded;
|
||||
|
||||
/**
|
||||
* Headers for this part
|
||||
* @var array
|
||||
*/
|
||||
private $headers;
|
||||
|
||||
/**
|
||||
* The body of this part (not encoded)
|
||||
* @var string
|
||||
*/
|
||||
private $body;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Sets up the object.
|
||||
*
|
||||
* @param $body - The body of the mime part if any.
|
||||
* @param $params - An associative array of parameters:
|
||||
* content_type - The content type for this part eg multipart/mixed
|
||||
* encoding - The encoding to use, 7bit, 8bit, base64, or quoted-printable
|
||||
* cid - Content ID to apply
|
||||
* disposition - Content disposition, inline or attachment
|
||||
* dfilename - Optional filename parameter for content disposition
|
||||
* description - Content description
|
||||
* charset - Character set to use
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($body = '', $params = array())
|
||||
{
|
||||
if (!defined('MAIL_MIMEPART_CRLF')) {
|
||||
define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", true);
|
||||
}
|
||||
|
||||
foreach ($params as $key => $value) {
|
||||
switch ($key) {
|
||||
case 'content_type':
|
||||
$headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : '');
|
||||
break;
|
||||
|
||||
case 'encoding':
|
||||
$this->encoding = $value;
|
||||
$headers['Content-Transfer-Encoding'] = $value;
|
||||
break;
|
||||
|
||||
case 'cid':
|
||||
$headers['Content-ID'] = '<' . $value . '>';
|
||||
break;
|
||||
|
||||
case 'disposition':
|
||||
$headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : '');
|
||||
break;
|
||||
|
||||
case 'dfilename':
|
||||
if (isset($headers['Content-Disposition'])) {
|
||||
$headers['Content-Disposition'] .= '; filename="' . $value . '"';
|
||||
} else {
|
||||
$dfilename = $value;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'description':
|
||||
$headers['Content-Description'] = $value;
|
||||
break;
|
||||
|
||||
case 'charset':
|
||||
if (isset($headers['Content-Type'])) {
|
||||
$headers['Content-Type'] .= '; charset="' . $value . '"';
|
||||
} else {
|
||||
$charset = $value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Default content-type
|
||||
if (!isset($headers['Content-Type'])) {
|
||||
$headers['Content-Type'] = 'text/plain';
|
||||
}
|
||||
|
||||
// Default encoding
|
||||
if (!isset($this->encoding)) {
|
||||
$this->encoding = '7bit';
|
||||
}
|
||||
|
||||
// Assign stuff to member variables
|
||||
$this->encoded = array();
|
||||
$this->headers = $headers;
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and returns the email. Also stores
|
||||
* it in the encoded member variable
|
||||
*
|
||||
* @return An associative array containing two elements,
|
||||
* body and headers. The headers element is itself
|
||||
* an indexed array.
|
||||
*/
|
||||
public function encode()
|
||||
{
|
||||
$encoded =& $this->encoded;
|
||||
|
||||
if (!empty($this->subparts)) {
|
||||
srand((double)microtime()*1000000);
|
||||
$boundary = '=_' . md5(uniqid(rand()) . microtime());
|
||||
$this->headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"';
|
||||
|
||||
// Add body parts to $subparts
|
||||
for ($i = 0; $i < count($this->subparts); $i++) {
|
||||
$headers = array();
|
||||
$tmp = $this->subparts[$i]->encode();
|
||||
foreach ($tmp['headers'] as $key => $value) {
|
||||
$headers[] = $key . ': ' . $value;
|
||||
}
|
||||
$subparts[] = implode(MAIL_MIMEPART_CRLF, $headers) . MAIL_MIMEPART_CRLF . MAIL_MIMEPART_CRLF . $tmp['body'];
|
||||
}
|
||||
|
||||
$encoded['body'] = '--' . $boundary . MAIL_MIMEPART_CRLF .
|
||||
implode('--' . $boundary . MAIL_MIMEPART_CRLF, $subparts) .
|
||||
'--' . $boundary.'--' . MAIL_MIMEPART_CRLF;
|
||||
} else {
|
||||
$encoded['body'] = $this->getEncodedData($this->body, $this->encoding) . MAIL_MIMEPART_CRLF;
|
||||
}
|
||||
|
||||
// Add headers to $encoded
|
||||
$encoded['headers'] =& $this->headers;
|
||||
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a subpart to current mime part and returns
|
||||
* a reference to it
|
||||
*
|
||||
* @param $body The body of the subpart, if any.
|
||||
* @param $params The parameters for the subpart, same
|
||||
* as the $params argument for constructor.
|
||||
* @return A reference to the part you just added.
|
||||
*/
|
||||
public function addSubPart($body, $params)
|
||||
{
|
||||
$this->subparts[] = new Mail_MIMEPart($body, $params);
|
||||
|
||||
return $this->subparts[count($this->subparts) - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns encoded data based upon encoding passed to it
|
||||
*
|
||||
* @param $data The data to encode.
|
||||
* @param $encoding The encoding type to use, 7bit, base64,
|
||||
* or quoted-printable.
|
||||
*/
|
||||
private function getEncodedData($data, $encoding)
|
||||
{
|
||||
switch ($encoding) {
|
||||
case '8bit':
|
||||
case '7bit':
|
||||
return $data;
|
||||
break;
|
||||
|
||||
case 'quoted-printable':
|
||||
return $this->quotedPrintableEncode($data);
|
||||
break;
|
||||
|
||||
case 'base64':
|
||||
return rtrim(chunk_split(base64_encode($data), 76, MAIL_MIMEPART_CRLF));
|
||||
break;
|
||||
|
||||
default:
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes data to quoted-printable standard.
|
||||
*
|
||||
* @param $input The data to encode
|
||||
* @param $line_max Optional max line length. Should
|
||||
* not be more than 76 chars
|
||||
*/
|
||||
private function quotedPrintableEncode($input , $line_max = 76)
|
||||
{
|
||||
$lines = preg_split("/\r?\n/", $input);
|
||||
$eol = MAIL_MIMEPART_CRLF;
|
||||
$escape = '=';
|
||||
$output = '';
|
||||
|
||||
while(list(, $line) = each($lines)){
|
||||
|
||||
$linlen = strlen($line);
|
||||
$newline = '';
|
||||
|
||||
for ($i = 0; $i < $linlen; $i++) {
|
||||
$char = substr($line, $i, 1);
|
||||
$dec = ord($char);
|
||||
|
||||
if (($dec == 32) AND ($i == ($linlen - 1))){ // convert space at eol only
|
||||
$char = '=20';
|
||||
|
||||
} elseif($dec == 9) {
|
||||
; // Do nothing if a tab.
|
||||
} elseif(($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) {
|
||||
$char = $escape . strtoupper(sprintf('%02s', dechex($dec)));
|
||||
}
|
||||
|
||||
if ((strlen($newline) + strlen($char)) >= $line_max) { // MAIL_MIMEPART_CRLF is not counted
|
||||
$output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay
|
||||
$newline = '';
|
||||
}
|
||||
$newline .= $char;
|
||||
} // end of for
|
||||
$output .= $newline . $eol;
|
||||
}
|
||||
$output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf
|
||||
return $output;
|
||||
}
|
||||
} // End of class
|
||||
?>
|
@ -1,103 +1,49 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
function sendMail($from, $to, $subject, $text='', $html='', /*$priority='high', $tabImgFiles=array(), */$tabAttachedFiles=array())
|
||||
{
|
||||
//return true;
|
||||
$to=preg_split("/[\s,;]+/", $to);
|
||||
//die(print_r($to));
|
||||
|
||||
require_once('Mail.php');
|
||||
require_once('Mail/mime.php');
|
||||
|
||||
$headers=array( 'From'=>$from,
|
||||
'To'=>$to,
|
||||
'Subject'=>$subject,
|
||||
// 'Reply-To'=>$from,
|
||||
// 'Return-Path'=>$from,
|
||||
'Content-Transfer-Encoding'=>'8bit',
|
||||
'MIME-Version'=>'1.0',
|
||||
'Date'=>date('D, d M Y H:i:s O'),
|
||||
'Message-ID'=>'<'.md5(date('YmdHis')).'@mail.scores-decisions.com>',
|
||||
'X-Priority'=>3,
|
||||
'X-Mailer'=>'PHP v'.phpversion(),
|
||||
);
|
||||
/*
|
||||
# Boundry for marking the split & Multitype Headers
|
||||
$mime_boundary=md5(time());
|
||||
$headers .= ''.$eol;
|
||||
$headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol;
|
||||
$msg = "";
|
||||
/**
|
||||
*
|
||||
* @param unknown $from
|
||||
* @param unknown $to
|
||||
* @param unknown $subject
|
||||
* @param string $text
|
||||
* @param string $html
|
||||
* @param unknown $tabAttachedFiles
|
||||
*/
|
||||
$mime = new Mail_mime();
|
||||
$footer="";/*
|
||||
function sendMail($from, $to, $subject, $text='', $html='', $tabAttachedFiles=array())
|
||||
{
|
||||
|
||||
_______________________________________________________________________
|
||||
Ce message et toutes les pièces jointes (ci-après le \"message\") sont établis a l'intention exclusive de ses destinataires.Si vous recevez ce message par erreur, merci de le détruire et d'en avertir immédiatement l'expéditeur par e-mail. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. Les communications sur Internet n'étant pas sécurisées, SCORES & DECISIONS S.A.S. informe qu'elle ne peut accepter aucune responsabilite quant au contenu de ce message.
|
||||
This mail message and attachments (the \"message\") are solely intended for the addressees. It is confidential in nature . If you receive this message in error, please delete it and immediately notify the sender by e-mail. Any use other than its intended purpose, dissemination or disclosure, either whole or partial, is prohibited except if formal approval is granted. As communication on the Internet is not secure, SCORES & DECISIONS S.A.S. does not accept responsability for the content of this message.
|
||||
$to = preg_split("/[\s,;]+/", $to);
|
||||
|
||||
$mail = new Zend_Mail('ISO-8859-15');
|
||||
$tr = new Zend_Mail_Transport_Smtp(SMTP_HOST, array('port'=>SMTP_PORT));
|
||||
$mail->setDefaultTransport($tr);
|
||||
$mail->setFrom($from);
|
||||
if ( count($to) > 0 ) {
|
||||
foreach ( $to as $item ) {
|
||||
$mail->addTo($item);
|
||||
}
|
||||
}
|
||||
$mail->setSubject($subject);
|
||||
|
||||
";*/
|
||||
|
||||
if ($text<>'') $mime->setTXTBody($text.$footer);
|
||||
if ($html<>'') $mime->setHTMLBody($html);
|
||||
|
||||
foreach ($tabAttachedFiles as $file)
|
||||
$mime->addAttachment($file);
|
||||
|
||||
//do not ever try to call these lines in reverse order
|
||||
$body = $mime->get();
|
||||
$headers = $mime->headers($headers);
|
||||
|
||||
$params=array( 'host'=>'smtpauth.online.net', // SMTP_HOST
|
||||
'port'=>25, //SMTP_PORT,
|
||||
);
|
||||
$params=array( 'host'=>SMTP_HOST,
|
||||
'port'=>SMTP_PORT,
|
||||
//'debug'=>true,
|
||||
//'persist'=>true,
|
||||
);
|
||||
|
||||
if (SMTP_USER=='' && SMTP_PASS=='')
|
||||
$params['auth'] = false;
|
||||
else {
|
||||
$params['username'] = SMTP_USER;
|
||||
$params['password'] = SMTP_PASS;
|
||||
}/*
|
||||
$params['auth'] = true;
|
||||
$params['username'] = 'buzuk@scores-decisions.com';
|
||||
$params['password'] = 'catsysyo92';
|
||||
*/
|
||||
|
||||
$nbEssais=0;
|
||||
while (1) {
|
||||
// Create the mail object using the Mail::factory method
|
||||
$mail_object = Mail::factory('smtp', $params);
|
||||
// Trying to send the mail
|
||||
$send = $mail_object->send($to, $headers, $body);
|
||||
$nbEssais++;
|
||||
if (PEAR::isError($send)) {
|
||||
/** @todo tester les différents codes erreur **/
|
||||
echo date('Y-m-d H:i:s'). " sendMail.php - essai #$nbEssais : ".$send->getMessage().EOL;
|
||||
if (preg_match('/too many connections|421/i', $send->getMessage()))
|
||||
sleep($nbEssais);
|
||||
else {
|
||||
$strTo=implode(';', $to);
|
||||
file_put_contents( LOG_PATH.'/sendMailError.log',
|
||||
date('Y-m-d H:i:s')."\t#$nbEssais\t$strTo\t".$send->getMessage().EOL,
|
||||
FILE_APPEND);
|
||||
break;
|
||||
if ($text!='') {
|
||||
$mail->setBodyText(mb_convert_encoding($text, 'ISO-8859-15', 'UTF-8'));
|
||||
}
|
||||
|
||||
} else {
|
||||
/** Si nous sommes en mode CLI, alors on fait en sorte de ne pas atteindre
|
||||
la limite des 25 mails par minute (ramené à 100 / minute)
|
||||
**/
|
||||
if (MODE_EXEC==MODE_CLI) usleep(500000);
|
||||
break;
|
||||
if ($html!='') {
|
||||
$mail->setBodyHtml(mb_convert_encoding($html, 'ISO-8859-15', 'UTF-8'));
|
||||
}
|
||||
|
||||
if ( count($tabAttachedFiles) > 0 ) {
|
||||
foreach ($tabAttachedFiles as $file) {
|
||||
$at = new Zend_Mime_Part( file_get_contents( $file ) );
|
||||
$mail->addAttachment($at);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Zend_Mail_Transport_Exception $e) {
|
||||
file_put_contents(LOG_PATH.'/sendMailError.log',date('Y-m-d H:i:s')." - ".$e->getMessage().PHP_EOL, FILE_APPEND);
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
||||
?>
|
@ -1,33 +0,0 @@
|
||||
<?
|
||||
|
||||
function sendMail($from, $to, $subject, $text='', $html='', $priority='high', $tabImgFiles=array(), $tabAttachedFiles=array())
|
||||
{
|
||||
|
||||
require_once("Mail.php");
|
||||
|
||||
$headers["From"] = $from;
|
||||
$headers["To"] = $to;
|
||||
$headers["Subject"] = $subject;
|
||||
|
||||
$body = $text;
|
||||
|
||||
$params["host"] = SMTP_HOST;
|
||||
$params["port"] = SMTP_PORT;
|
||||
if (SMTP_USER=='' && SMTP_PASS=='')
|
||||
$params["auth"] = false;
|
||||
else {
|
||||
$params["username"] = SMTP_USER;
|
||||
$params["password"] = SMTP_PASS;
|
||||
}
|
||||
|
||||
// Create the mail object using the Mail::factory method
|
||||
$mail_object = Mail::factory("smtp", $params);
|
||||
|
||||
$mail_object->send($to, $headers, $body);
|
||||
|
||||
if (PEAR::isError($mail_object))
|
||||
return $mail_object->getMessage();
|
||||
|
||||
return true;
|
||||
}
|
||||
?>
|
@ -1,369 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
) o------------------------------------------------------------------------------o
|
||||
* | This is HTMLMimeMail5. It is dual licensed as GPL and a commercial license. |
|
||||
* | If you use the code commercially (or if you don't want to be restricted by |
|
||||
* | the GPL license), you will need the commercial license. It's only £49 (GBP - |
|
||||
* | roughly $98 depending on the exchange rate) and helps me out a lot. Thanks. |
|
||||
* o------------------------------------------------------------------------------o
|
||||
*
|
||||
* © Copyright 2005 Richard Heyes
|
||||
*/
|
||||
|
||||
define('SMTP_STATUS_NOT_CONNECTED', 1, true);
|
||||
define('SMTP_STATUS_CONNECTED', 2, true);
|
||||
|
||||
class smtp
|
||||
{
|
||||
private $authenticated;
|
||||
private $connection;
|
||||
private $recipients;
|
||||
private $headers;
|
||||
private $timeout;
|
||||
private $errors;
|
||||
private $status;
|
||||
private $body;
|
||||
private $from;
|
||||
private $host;
|
||||
private $port;
|
||||
private $helo;
|
||||
private $auth;
|
||||
private $user;
|
||||
private $pass;
|
||||
|
||||
/**
|
||||
* Constructor function. Arguments:
|
||||
* $params - An assoc array of parameters:
|
||||
*
|
||||
* host - The hostname of the smtp server Default: localhost
|
||||
* port - The port the smtp server runs on Default: 25
|
||||
* helo - What to send as the HELO command Default: localhost
|
||||
* (typically the hostname of the
|
||||
* machine this script runs on)
|
||||
* auth - Whether to use basic authentication Default: FALSE
|
||||
* user - Username for authentication Default: <blank>
|
||||
* pass - Password for authentication Default: <blank>
|
||||
* timeout - The timeout in seconds for the call Default: 5
|
||||
* to fsockopen()
|
||||
*/
|
||||
public function __construct($params = array())
|
||||
{
|
||||
|
||||
if(!defined('CRLF'))
|
||||
define('CRLF', "\r\n", TRUE);
|
||||
|
||||
$this->authenticated = FALSE;
|
||||
$this->timeout = 5;
|
||||
$this->status = SMTP_STATUS_NOT_CONNECTED;
|
||||
$this->host = 'smtp.free.fr';
|
||||
$this->port = 25;
|
||||
$this->helo = 'srvsd01';
|
||||
$this->auth = FALSE;
|
||||
$this->user = '';
|
||||
$this->pass = '';
|
||||
$this->errors = array();
|
||||
|
||||
foreach($params as $key => $value){
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect function. This will, when called
|
||||
* statically, create a new smtp object,
|
||||
* call the connect function (ie this function)
|
||||
* and return it. When not called statically,
|
||||
* it will connect to the server and send
|
||||
* the HELO command.
|
||||
*/
|
||||
public function connect($params = array())
|
||||
{
|
||||
if (!isset($this->status)) {
|
||||
$obj = new smtp($params);
|
||||
if($obj->connect()){
|
||||
$obj->status = SMTP_STATUS_CONNECTED;
|
||||
}
|
||||
|
||||
return $obj;
|
||||
|
||||
} else {
|
||||
$this->connection = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
|
||||
if (function_exists('socket_set_timeout')) {
|
||||
@socket_set_timeout($this->connection, 5, 0);
|
||||
}
|
||||
|
||||
$greeting = $this->get_data();
|
||||
if (is_resource($this->connection)) {
|
||||
return $this->auth ? $this->ehlo() : $this->helo();
|
||||
} else {
|
||||
$this->errors[] = 'Failed to connect to server: '.$errstr;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function which handles sending the mail.
|
||||
* Arguments:
|
||||
* $params - Optional assoc array of parameters.
|
||||
* Can contain:
|
||||
* recipients - Indexed array of recipients
|
||||
* from - The from address. (used in MAIL FROM:),
|
||||
* this will be the return path
|
||||
* headers - Indexed array of headers, one header per array entry
|
||||
* body - The body of the email
|
||||
* It can also contain any of the parameters from the connect()
|
||||
* function
|
||||
*/
|
||||
public function send($params = array())
|
||||
{
|
||||
foreach ($params as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
if ($this->is_connected()) {
|
||||
|
||||
// Do we auth or not? Note the distinction between the auth variable and auth() function
|
||||
if ($this->auth AND !$this->authenticated) {
|
||||
if(!$this->auth())
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->mail($this->from);
|
||||
|
||||
if (is_array($this->recipients)) {
|
||||
foreach ($this->recipients as $value) {
|
||||
$this->rcpt($value);
|
||||
}
|
||||
} else {
|
||||
$this->rcpt($this->recipients);
|
||||
}
|
||||
|
||||
if (!$this->data()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Transparency
|
||||
$headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF, $this->headers)));
|
||||
$body = str_replace(CRLF.'.', CRLF.'..', $this->body);
|
||||
$body = substr($body, 0, 1) == '.' ? '.'.$body : $body;
|
||||
|
||||
$this->send_data($headers);
|
||||
$this->send_data('');
|
||||
$this->send_data($body);
|
||||
$this->send_data('.');
|
||||
|
||||
$result = (substr(trim($this->get_data()), 0, 3) === '250');
|
||||
//$this->rset();
|
||||
return $result;
|
||||
} else {
|
||||
$this->errors[] = 'Not connected!';
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to implement HELO cmd
|
||||
*/
|
||||
private function helo()
|
||||
{
|
||||
if(is_resource($this->connection)
|
||||
AND $this->send_data('HELO '.$this->helo)
|
||||
AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$this->errors[] = 'HELO command failed, output: ' . trim(substr(trim($error),3));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to implement EHLO cmd
|
||||
*/
|
||||
private function ehlo()
|
||||
{
|
||||
if (is_resource($this->connection)
|
||||
AND $this->send_data('EHLO '.$this->helo)
|
||||
AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$this->errors[] = 'EHLO command failed, output: ' . trim(substr(trim($error),3));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to implement RSET cmd
|
||||
*/
|
||||
private function rset()
|
||||
{
|
||||
if (is_resource($this->connection)
|
||||
AND $this->send_data('RSET')
|
||||
AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$this->errors[] = 'RSET command failed, output: ' . trim(substr(trim($error),3));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to implement QUIT cmd
|
||||
*/
|
||||
private function quit()
|
||||
{
|
||||
if(is_resource($this->connection)
|
||||
AND $this->send_data('QUIT')
|
||||
AND substr(trim($error = $this->get_data()), 0, 3) === '221' ){
|
||||
|
||||
fclose($this->connection);
|
||||
$this->status = SMTP_STATUS_NOT_CONNECTED;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$this->errors[] = 'QUIT command failed, output: ' . trim(substr(trim($error),3));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to implement AUTH cmd
|
||||
*/
|
||||
private function auth()
|
||||
{
|
||||
if (is_resource($this->connection)
|
||||
AND $this->send_data('AUTH LOGIN')
|
||||
AND substr(trim($error = $this->get_data()), 0, 3) === '334'
|
||||
AND $this->send_data(base64_encode($this->user)) // Send username
|
||||
AND substr(trim($error = $this->get_data()),0,3) === '334'
|
||||
AND $this->send_data(base64_encode($this->pass)) // Send password
|
||||
AND substr(trim($error = $this->get_data()),0,3) === '235' ){
|
||||
|
||||
$this->authenticated = true;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$this->errors[] = 'AUTH command failed: ' . trim(substr(trim($error),3));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that handles the MAIL FROM: cmd
|
||||
*/
|
||||
private function mail($from)
|
||||
{
|
||||
if ($this->is_connected()
|
||||
AND $this->send_data('MAIL FROM:<'.$from.'>')
|
||||
AND substr(trim($this->get_data()), 0, 2) === '250' ) {
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that handles the RCPT TO: cmd
|
||||
*/
|
||||
private function rcpt($to)
|
||||
{
|
||||
if($this->is_connected()
|
||||
AND $this->send_data('RCPT TO:<'.$to.'>')
|
||||
AND substr(trim($error = $this->get_data()), 0, 2) === '25' ){
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$this->errors[] = trim(substr(trim($error), 3));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that sends the DATA cmd
|
||||
*/
|
||||
private function data()
|
||||
{
|
||||
if($this->is_connected()
|
||||
AND $this->send_data('DATA')
|
||||
AND substr(trim($error = $this->get_data()), 0, 3) === '354' ) {
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$this->errors[] = trim(substr(trim($error), 3));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to determine if this object
|
||||
* is connected to the server or not.
|
||||
*/
|
||||
private function is_connected()
|
||||
{
|
||||
return (is_resource($this->connection) AND ($this->status === SMTP_STATUS_CONNECTED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to send a bit of data
|
||||
*/
|
||||
private function send_data($data)
|
||||
{
|
||||
if(is_resource($this->connection)){
|
||||
return fwrite($this->connection, $data.CRLF, strlen($data)+2);
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get data.
|
||||
*/
|
||||
private function get_data()
|
||||
{
|
||||
$return = '';
|
||||
$line = '';
|
||||
$loops = 0;
|
||||
|
||||
if(is_resource($this->connection)){
|
||||
while((strpos($return, CRLF) === FALSE OR substr($line,3,1) !== ' ') AND $loops < 100){
|
||||
$line = fgets($this->connection, 512);
|
||||
$return .= $line;
|
||||
$loops++;
|
||||
}
|
||||
return $return;
|
||||
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a variable
|
||||
*/
|
||||
public function set($var, $value)
|
||||
{
|
||||
$this->$var = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to return the errors array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
|
||||
} // End of class
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user