Remise à zéro de la branche
This commit is contained in:
parent
c0cf9ae108
commit
ad69158c4c
118
README
118
README
@ -1,118 +0,0 @@
|
||||
HOOKS
|
||||
-----
|
||||
Les fonctions du core doivent être les suivantes
|
||||
|
||||
hook_menu() => Déclaration d'un élément de menu
|
||||
hook_perm() => Déclaration de permission ou de non permission
|
||||
hook_block() => Déclaration d'un bloc de contenu
|
||||
hook_config() => Configuration
|
||||
|
||||
Référencement du nom du module
|
||||
Actif, Inactif
|
||||
Déclaration du bloc de contenu
|
||||
|
||||
Descriptif du fonctionnement
|
||||
- On charge le bootstrap pour la config, les librairies et inclusions indispensables
|
||||
- On liste les modules
|
||||
- On génére un menu
|
||||
- On affiche le contenu par défaut (module/content)
|
||||
|
||||
Le script index.php reçoit toutes les requêtes.
|
||||
Le paramètres page permet de définir quel module utiliser et quel action effectuer
|
||||
Des paramètres optionnelles permettent de rediriger vers l'action d'un module
|
||||
Il est important de pouvoir utiliser l'affichage du bloc d'un module dans un autre
|
||||
Partons du module principal scores qui déterminera la plupart des éléments du menu
|
||||
|
||||
Parcours du répertoire modules (ou liste à partir de fichier de configuration)
|
||||
Dossier existe
|
||||
[module].info
|
||||
|
||||
Page
|
||||
On charge page.tpl.php
|
||||
CSS => CSS par defaut, Lecture depuis les modules (Attention aux pages en ajax)
|
||||
JS => JS par defaut, Lecture depuis les modules (Attention aux pages en ajax)
|
||||
On charge block.tpl.php pour chaque bloc du même module ou d'autres modules
|
||||
Attention aux modules imbriqués
|
||||
Gestion module prioritaire + ordre d'affichage
|
||||
|
||||
|
||||
|
||||
Gestion des includes
|
||||
---------------------
|
||||
Le fichier prepend définit l'include path en prenant celui définit en dur dans le php.ini
|
||||
et rajoute le répertoire framework et includes.
|
||||
Pour inclure les fichiers dans l'un de ces répertoires, il n'est pas nécessaire de spécifier tous le chemin.
|
||||
|
||||
|
||||
* Inclusion de CSS et JS différents sur chaques pages
|
||||
Minify et Compression
|
||||
Mode développement qui utilise les librairies sans compression
|
||||
|
||||
* Création d'un script d'installation en PHP
|
||||
- Vérification des applications nécessaires à l'extranet et test de leur fonctionnement
|
||||
- Prise compte des différents environnement DEV ou PROD
|
||||
- Prise compte des emplacements de stockage des fichiers
|
||||
|
||||
* Modification du chemin de stockage pour les fichiers
|
||||
- Evite d'avoir à créer des liens symboliques
|
||||
- Ajouter une variable dans le fichier de config pour définir l'emplacement de stockage des fichiers
|
||||
|
||||
* Supprimer les répertoires, ils doivent être crée en lien symbolique (attention au fichier dans les URLs)
|
||||
www/credisafe => /var/www/data/creditsafe
|
||||
www/img/logos => /var/www/data/logos
|
||||
www/infogreffe => /var/www/data/infogreffe
|
||||
www/pdf => /var/www/data/pdf
|
||||
|
||||
Structure du site ....
|
||||
------------------------
|
||||
/var/www/extranet
|
||||
batch => Contient des batchs lancé par cron
|
||||
|
||||
www => contient les fichiers du site
|
||||
css => tous les fichiers css
|
||||
img => images générales du site
|
||||
js => tous les fichiers javascripts
|
||||
misc => Script divers
|
||||
pages => Toutes les pages du sites (template)
|
||||
index.php => Redirige toutes les requêtes
|
||||
|
||||
modules => modules du sites (méthodes, présentation contenu, fournisseurs, )
|
||||
modules/block
|
||||
modules/graydon
|
||||
modules/intersud
|
||||
modules/menu
|
||||
modules/saisie
|
||||
modules/scores
|
||||
modules/user
|
||||
|
||||
includes => fonctions nécessaires au site mais qui ne peuvent être incluses dans le framework
|
||||
includes/lib
|
||||
includes/lib/Doctrine
|
||||
includes/lib/Doctrine.php
|
||||
includes/lib/FirePHPCore
|
||||
includes/lib/phpmailer
|
||||
|
||||
includes/models => Modèle des bases de données
|
||||
|
||||
includes/bootstrap.inc
|
||||
includes/cache.inc
|
||||
includes/common.inc
|
||||
includes/database.inc
|
||||
includes/file.inc
|
||||
includes/models
|
||||
includes/modules.inc
|
||||
includes/session.inc
|
||||
includes/watchdog.inc
|
||||
|
||||
config => fichiers de config (mots de pass,...), en dehors du www donc protégé
|
||||
config/dev
|
||||
config/local
|
||||
config/prod
|
||||
|
||||
framework => contient le framework (fonctions complexes, librairies, communes avec le webservice)
|
||||
cache => contient les fichiers de cache
|
||||
|
||||
|
||||
includes : bootstrap, module, session, mail, cache, common, file, database, watchdog
|
||||
modules : block, menu, syslog, system, user
|
||||
|
@ -1,145 +0,0 @@
|
||||
#!/usr/bin/php -q
|
||||
<?php
|
||||
|
||||
define ('ACTES_IGNUM_LOCAL_DIR','/var/www/extranet/www/pdf/scan/');
|
||||
define ('ACTES_IG_LOCAL_DIR', '/var/www/extranet/www/pdf/');
|
||||
define ('ACTES_IGNUM_FTP_URL', 'ftp2.scores-decisions.com');
|
||||
define ('ACTES_IGNUM_FTP_USER', 'mpc2500');
|
||||
define ('ACTES_IGNUM_FTP_PASS', 'passmpc78');
|
||||
|
||||
require_once realpath(dirname(__FILE__) . '/../framework/fwk.php');
|
||||
require_once realpath(dirname(__FILE__) . '/../config/config.inc');
|
||||
require_once realpath(dirname(__FILE__) . '/mysql.php');
|
||||
|
||||
define('INCLUDE_PATH', realpath(dirname(__FILE__).'/../includes/') );
|
||||
|
||||
include_once(FWK_PATH.'/common/ftp.php');
|
||||
|
||||
$tempsMinEntreRequetes=5;
|
||||
$tempsMaxEntreRequetes=30;
|
||||
set_time_limit(0);
|
||||
$eol="\n";
|
||||
$lastJO=$dateDebut=$dateFin=$verif=false;
|
||||
$strInfoProg='Usage : '.basename($argv[0]). " [OPTION]
|
||||
Vérifie les actes numérisés reçus en provenance des Greffes.
|
||||
|
||||
Sans aucun paramètre, récupération des actes.
|
||||
";/*Sinon:
|
||||
-d:JJ/MM/AAAA Date de début de publication
|
||||
-f:JJ/MM/AAAA Date de fin de publication
|
||||
-l Dernier JO Association uniquement (*)
|
||||
-n:X Intervalle MIN en secondes entre les requêtes sur le site des JO (défaut=$tempsMinEntreRequetes)
|
||||
-i:X \" MAX \" \" \" \" \" \" \" \" \" \" (défaut=$tempsMaxEntreRequetes)
|
||||
-v Vérifier que toutes les annonces du JO sont en base !
|
||||
";*/
|
||||
|
||||
$argv=$_SERVER['argv'];
|
||||
if ($_SERVER['argc']==1) $lastJO=true;
|
||||
else {
|
||||
for ($i=1; isset($argv[$i]); $i++) {
|
||||
if (substr($argv[$i],0,1)=='-') {
|
||||
switch (substr($argv[$i],1,1)) {
|
||||
case 'd':
|
||||
$dateDebut=substr($argv[$i],3,10);
|
||||
$dateDeb=dateT('d/m/Y', 'Ymd', $dateDebut);
|
||||
break;
|
||||
case 'n':
|
||||
$tempsMinEntreRequetes=trim(substr($argv[$i],3))*1;
|
||||
if ($tempsMinEntreRequetes<0) $tempsMinEntreRequetes=0;
|
||||
break;
|
||||
case '-':
|
||||
die($strInfoProg);
|
||||
break;
|
||||
default: die('Option '. $argv[$i] . " inconnue !\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$con = mysql_pconnect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
|
||||
if (!($con === false)) {
|
||||
if (mysql_select_db(MYSQL_DB, $con) === false)
|
||||
echo date ('Y/m/d - H:i:s') .' - ERREUR : MySql n°'. mysql_errno() .') : '. mysql_error() . $eol;
|
||||
}
|
||||
else
|
||||
echo date ('Y/m/d - H:i:s') .' - ERREUR : MySql n°'. mysql_errno() .') : '. mysql_error(). $eol;
|
||||
|
||||
$tabCommandes=mysql_select('commandes', 'idCommande, idUser, login, emailCommande, siren, refDocument, dateCommande', 'dateReception=0', false, MYSQL_ASSOC);
|
||||
$nbCommandes=count($tabCommandes);
|
||||
$tabTmp=array();
|
||||
foreach ($tabCommandes as $commande) {
|
||||
$tabTmp['g'.$commande['idCommande']]=$commande;
|
||||
}
|
||||
$tabCommandes=$tabTmp;
|
||||
unset($tabTmp);
|
||||
echo date('Y/m/d - H:i:s') ." - Il y a $nbCommandes actes en attente de réception courrier ou numérisation !$eol";
|
||||
//print_r($tabCommandes);
|
||||
//die();
|
||||
|
||||
/**
|
||||
** Connexion au site FTP
|
||||
**/
|
||||
echo date('Y/m/d - H:i:s') ." - Récupération des fichiers numérisés en attente de traitement...".EOL;
|
||||
$ret=ftp_mget(ACTES_IGNUM_FTP_URL, ACTES_IGNUM_FTP_USER, ACTES_IGNUM_FTP_PASS, '*.pdf', ACTES_IGNUM_LOCAL_DIR, false);
|
||||
if ($ret===false)
|
||||
die (date ('Y/m/d - H:i:s')." - ERREUR : Récupération des actes numérisés impossible !".EOL);
|
||||
else
|
||||
echo date ('Y/m/d - H:i:s')." - FIN de la récupération des flux Hugin en FTP ($ret fichiers récupérés).".EOL;
|
||||
|
||||
/**
|
||||
** Connexion au site FTP
|
||||
**/
|
||||
echo date('Y/m/d - H:i:s') ." - Traitement des actes non encore traités !".EOL;
|
||||
$tabFichiers=array();
|
||||
$dh = opendir(ACTES_IGNUM_LOCAL_DIR);
|
||||
while (false !== ($filename = readdir($dh))) {
|
||||
if ($filename<>'.' && $filename<>'..' && strtolower(substr($filename, -4))=='.pdf')
|
||||
$tabFichiers[] = $filename;
|
||||
}
|
||||
rsort($tabFichiers);
|
||||
$tabActes=array();
|
||||
foreach ($tabFichiers as $k => $nomFichier) {
|
||||
if (strtolower(substr($nomFichier,0,1))=='g') {
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier $nomFichier disponible pour traitement.".EOL;
|
||||
$numFichier=str_replace('.pdf','', $nomFichier);
|
||||
$tabActes[] = $nomFichier;
|
||||
if (isset($tabCommandes[$numFichier]) && is_array($tabCommandes[$numFichier])) {
|
||||
$commande=$tabCommandes[$numFichier];
|
||||
echo date ('Y/m/d - H:i:s')." - Le fichier $nomFichier correspond à la commande ".$commande['refDocument'].' de '.$commande['login'].'.'.EOL;
|
||||
$numFichierSuiv=str_replace('.pdf','', $tabFichiers[$k+1]);
|
||||
if (strpos($numFichierSuiv, $numFichier) === false) {
|
||||
/** Le fichier $nomFichier est une commande livrée en un seul fichier **/
|
||||
$siren=$commande['siren'];
|
||||
$ref=$commande['refDocument'];
|
||||
$nomCible="acte-$siren-$ref.pdf";
|
||||
if (file_exists(ACTES_IG_LOCAL_DIR.$nomCible))
|
||||
echo date ('Y/m/d - H:i:s')." - La commande $nomCible est déjà mise à disposition !".EOL;
|
||||
else {
|
||||
if (rename(ACTES_IGNUM_LOCAL_DIR.$nomFichier, ACTES_IG_LOCAL_DIR.$nomCible)) {
|
||||
echo date ('Y/m/d - H:i:s')." - La commande $nomCible a été mise à disposition.".EOL;
|
||||
if (trim($commande['emailCommande'])<>'') {
|
||||
$subject="Actes ou Statuts disponible pour $siren";
|
||||
$message ="Le document commandé pour le siren $siren est disponible en téléchargement sur le site de Scores & Décisions à l'adresse suivante :\r\n\r\n";
|
||||
$message.="http://extranet.scores-decisions.com/pdf/$nomCible\r\n";
|
||||
$headers = 'From: infoslegales@scores-decisions.com' . "\r\n" .
|
||||
'Reply-To: infoslegales@scores-decisions.com';
|
||||
if (mail($commande['emailCommande'], $subject, $message, $headers))
|
||||
echo date ('Y/m/d - H:i:s').' - Un email a été envoyé à '.$commande['emailCommande']." pour la commande $nomCible.".EOL;
|
||||
else
|
||||
echo date ('Y/m/d - H:i:s').' - ERREUR : Impossible d\'envoyer l\'email à '.$commande['emailCommande']." pour la commande $nomCible.".EOL;
|
||||
}
|
||||
mysql_update('commandes', array('dateReception'=>date('YmdHis')),'idCommande='.$commande['idCommande']);
|
||||
//print_r($tabCommandes[$numFichier]);
|
||||
}
|
||||
else print 'Impossible de déplacer '.ACTES_IGNUM_LOCAL_DIR.$nomFichier.' en '.ACTES_IG_LOCAL_DIR.$nomCible.' !'.EOL;
|
||||
}
|
||||
}
|
||||
else
|
||||
// On traitera plus tard le multi fichier !
|
||||
echo date ('Y/m/d - H:i:s')." - @TODO : La commande $numFichier est en plusieur fichiers !".EOL;
|
||||
// die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,210 +0,0 @@
|
||||
#!/usr/bin/php -q
|
||||
<?php
|
||||
$version = '0.2';
|
||||
$argc = $_SERVER['argc'];
|
||||
$argv = $_SERVER['argv'];
|
||||
|
||||
if($argc > 1){
|
||||
foreach($argv as $value){
|
||||
switch($value){
|
||||
case 'availability':
|
||||
$availability = FALSE;
|
||||
break;
|
||||
case 'matchidentifiers':
|
||||
$matchidentifiers = FALSE;
|
||||
break;
|
||||
case 'matchmethods':
|
||||
$matchmethods = FALSE;
|
||||
break;
|
||||
case 'commandes':
|
||||
$checkCommandes = FALSE;
|
||||
break;
|
||||
case 'all':
|
||||
$checkCommandes = TRUE;
|
||||
$matchidentifiers = TRUE;
|
||||
$matchmethods = TRUE;
|
||||
$checkCommandes = FALSE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
print $argv[0]." version : ".$version."\n\n";
|
||||
print "Lancer le script ".$argv[0]." sans paramètres permet de charger toutes les méthodes graydon et vérifier les commandes\n\n";
|
||||
print "Les services disponibles sont :\n";
|
||||
print "\t-Disponibilité des pays graydon (availability).\n";
|
||||
print "\t-Types d'identifiant disponible par pays (matchidentifiers).\n";
|
||||
print "\t-Méthodes de recherche (matchmethods).\n";
|
||||
print "\t-Vérification des commandes (commandes).\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once '../config/prepend.php';
|
||||
//Inclure la base de données
|
||||
require_once 'dbbootstrap.php';
|
||||
//Inclure la config graydon
|
||||
require_once 'graydon/graydonws.php';
|
||||
|
||||
setDbConn('graydon');
|
||||
|
||||
if($availability == TRUE){
|
||||
//Country Availability
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
try
|
||||
{
|
||||
$result = $graydon->getCountryAvailability($request);
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
foreach($result->CountryAvailablity->CountryAndProduct as $item){
|
||||
$availability = array();
|
||||
$count = count($item->Products->Product);
|
||||
if ($count>1){
|
||||
$availability = $item->Products->Product;
|
||||
}elseif($count==1){
|
||||
$availability[] = $item->Products->Product;
|
||||
}
|
||||
//Enregistrement pour chaque pays de la disponibilité des services
|
||||
$countryavailability = new Countryavailability();
|
||||
$countryavailability->country = $item->Country;
|
||||
$countryavailability->availability = serialize($availability);
|
||||
$countryavailability->replace();
|
||||
|
||||
}
|
||||
}catch( SoapFault $fault ){}
|
||||
}
|
||||
|
||||
if($matchidentifiers == TRUE){
|
||||
//matchidentifiers
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
try
|
||||
{
|
||||
$result = $graydon->getCompanyMatchIdentifiers($request);
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
|
||||
foreach($result->CompanyMatchIdentifiers->CompanyMatchIdentifier as $item){
|
||||
$tabIdentifiers = array();
|
||||
$count = count($item->CompanyIdentifier);
|
||||
if ($count>1){
|
||||
$tabIdentifiers = $item->CompanyIdentifier;
|
||||
}elseif($count==1){
|
||||
$tabIdentifiers[] = $item->CompanyIdentifier;
|
||||
}
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchidentifiers = new Matchidentifiers();
|
||||
$matchidentifiers->country = $item->Country;
|
||||
$matchidentifiers->identifiers = serialize($tabIdentifiers);
|
||||
$matchidentifiers->replace();
|
||||
}
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)!=FALSE){
|
||||
if($code=='CWS0112'){
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchidentifiers = new Matchidentifiers();
|
||||
$matchidentifiers->country = $pays;
|
||||
$matchidentifiers->identifiers = serialize(false);
|
||||
$matchidentifiers->replace();
|
||||
}
|
||||
}else{
|
||||
graydon_processSoapFault($graydon,$fault,$tabInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($matchmethods == TRUE){
|
||||
//matchmethods
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
try
|
||||
{
|
||||
$result = $graydon->getCompanyMatchMethods($request);
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
|
||||
foreach($result->CompanyMatchMethods->CompanyMatchMethod as $item){
|
||||
$methods = array();
|
||||
$count = count($item->MatchMethods->MatchMethod);
|
||||
if ($count>1){
|
||||
$methods = $item->MatchMethods->MatchMethod;
|
||||
}elseif($count==1){
|
||||
$methods[] = $item->MatchMethods->MatchMethod;
|
||||
}
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchmethods = new Matchmethods();
|
||||
$matchmethods->country = $item->Country;
|
||||
$matchmethods->methods = serialize($methods);
|
||||
$matchmethods->replace();
|
||||
}
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/error.php';
|
||||
if(graydon_error($code, $text)!=FALSE){
|
||||
if($code=='CWS0112'){
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchmethods = new Matchmethods();
|
||||
$matchmethods->country = $pays;
|
||||
$matchmethods->methods = serialize('false');
|
||||
$matchmethods->replace();
|
||||
}
|
||||
}else{
|
||||
graydon_processSoapFault($graydon,$fault,'');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($checkCommandes == TRUE){
|
||||
//Vérification des commandes
|
||||
$q = Doctrine_Query::create()
|
||||
->select('*')
|
||||
->from('Commandes');
|
||||
$tabCommandes = $q->Execute();
|
||||
//Pour chaque commande ('Completed','Assigned','InError','Initialised','Delivered','Notified','ReCompleted')
|
||||
foreach($tabCommandes as $commande){
|
||||
//Si servicespeed = immediate alors on ne gère pas
|
||||
if($commande->servicespeed != 'Immediate'){
|
||||
switch($commande->orderstate){
|
||||
case 'Delivered': //Délivré, on a été la chercher
|
||||
//On ne fait rien
|
||||
break;
|
||||
case 'Completed': //Commande prête à télécharger
|
||||
|
||||
break;
|
||||
|
||||
case 'InError': //Problème dans la commande
|
||||
|
||||
break;
|
||||
|
||||
case 'Notified':
|
||||
|
||||
break;
|
||||
|
||||
case 'Initialised': //Commande prise en compte
|
||||
case 'Assigned': //Assigné chez graydon
|
||||
case '': // Pas d'état, commande pas encore vérifier
|
||||
case 'default':
|
||||
$q = Doctrine_Query::create()
|
||||
->update('Commandes')
|
||||
->set('orderstate', $orderstate)
|
||||
->where('reference = ?', array($commande->reference));
|
||||
|
||||
$q->execute();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,76 +0,0 @@
|
||||
<?
|
||||
//error_reporting(E_ALL);
|
||||
function mysql_trace($query, $res='') {
|
||||
if (!$fp=fopen('mysql_insert.log', 'a'))
|
||||
return false;
|
||||
if (!fwrite($fp, date('Y/m/d - H:i:s') ." - $res : $query\n"))
|
||||
return false;
|
||||
if (!fclose($fp))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Retourne la dernière valeur de l'auto-incrément ou 0 si pas d'auto-incrément
|
||||
** Penser à bien tester la valeur !== false
|
||||
**/
|
||||
function mysql_insert($table, $toAdd, $debug=false){
|
||||
$fields = implode(array_keys($toAdd), '`,`');
|
||||
foreach (array_values($toAdd) as $key=>$array_values)
|
||||
$tmp[$key]=addslashes($array_values);
|
||||
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
$query = 'INSERT INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
|
||||
$res = mysql_query($query);// OR die(mysql_error());
|
||||
if ($res!==false)
|
||||
{
|
||||
if (mysql_insert_id()>0)
|
||||
$res=mysql_insert_id();
|
||||
else
|
||||
$res=true;
|
||||
}
|
||||
if ($debug) mysql_trace($query, $res);
|
||||
|
||||
return $res;
|
||||
//-- Example of usage
|
||||
//$tToAdd = array('id'=>3, 'name'=>'Yo', 'salary' => 5000);
|
||||
//insertIntoDB('myTable', $tToAdd)
|
||||
}
|
||||
|
||||
function mysql_update($table, $update, $where, $debug=false){
|
||||
$fields = array_keys($update);
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
$query='UPDATE `'.$table.'` SET ';
|
||||
while($fields[$i]){
|
||||
if($i>0){$query.=', ';}
|
||||
$query.=' `'.$fields[$i]."`='".addslashes($values[$i])."'";
|
||||
$i++;
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
$query.=' WHERE '.$where.' LIMIT 1;';
|
||||
if ($debug) mysql_trace($query, mysql_errno());
|
||||
mysql_query($query);// or die(mysql_error());
|
||||
return true;
|
||||
|
||||
//Example
|
||||
// mysql_update('myTable', $anarray, "type = 'main'")
|
||||
|
||||
}
|
||||
|
||||
function mysql_select($table, $fields, $where, $debug=false, $assoc=MYSQL_BOTH) {
|
||||
$query="SELECT $fields FROM $table WHERE $where;";
|
||||
// if ($debug) mysql_trace($query, count($tab));
|
||||
$result=mysql_query($query) or die(mysql_error());
|
||||
$tab=array();
|
||||
while ($ligne = mysql_fetch_array($result, $assoc))
|
||||
$tab[]=$ligne;
|
||||
|
||||
mysql_free_result($result);
|
||||
if ($debug) mysql_trace($query, count($tab));
|
||||
// echo $query;
|
||||
return $tab;
|
||||
}
|
||||
|
||||
?>
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
die();
|
||||
if( LOG_BENCH != 'NONE' )
|
||||
{
|
||||
$timer->setMarker('Fin du script (append.php)');
|
||||
$mem=memory_get_usage();
|
||||
$memko=$mem/1024;
|
||||
if ( LOG_BENCH == 'FILE' || LOG_BENCH == 'BOTH' ) {
|
||||
$strInfo=DATETIME_LOG.';'.$mem.';'.$_SERVER["PHP_SELF"].';'.$_SERVER['QUERY_STRING']."\n";
|
||||
$f = fopen( LOG_PATH.'memory.log', 'a+' );
|
||||
fwrite($f, $strInfo);
|
||||
fclose($f);
|
||||
}
|
||||
if ( LOG_BENCH == 'WEB' || LOG_BENCH == 'BOTH' ) {
|
||||
echo '<br/><hr><br/>Mémoire utilisée par le script "'. $_SERVER['PHP_SELF'].'" = '.$mem . " octets ($memko ko)";
|
||||
echo "<br/>Temps d'exécution de la page :<br/>";
|
||||
$timer->display();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,51 +0,0 @@
|
||||
<?
|
||||
/** Environnement du site **/
|
||||
define ('ENVIRONNEMENT', 'DEV'); // PRD REC DEV
|
||||
|
||||
define ('EMAIL_SUPPORTDEV', 'mricois@scores-decisions.com');
|
||||
|
||||
define ('ERROR_SOAP', 'Une erreur est survenue lors de votre requête...<br/>Un message à été envoyé à l\'administrateur de l\'extranet.<br/>Nous vous remercions de bien vouloir renouveler votre demande ultérieurement');
|
||||
|
||||
/** Log des requêtes MySQL ? **/
|
||||
define ('LOG_MYSQL', 'ALL'); // NONE ou ALL
|
||||
|
||||
/** Log des performances des pages PHP (mémoire et temps d'exécution **/
|
||||
define ('LOG_BENCH', 'BOTH'); // NONE, WEB, FILE, BOTH
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('MYSQL_HOST', 'localhost');
|
||||
define ('MYSQL_DB', 'sdv1');
|
||||
define ('MYSQL_USER', 'root');
|
||||
define ('MYSQL_PASS', 'bj10sx');
|
||||
|
||||
define ('PATH_SITE', realpath(dirname(__FILE__) . '/../'));
|
||||
define ('PATH_WWW', PATH_SITE.'/www/');
|
||||
|
||||
/** Paramètres de stockage **/
|
||||
define ('PATH_DATA', '/sites/data');
|
||||
define ('PATH_LOGS', PATH_DATA.'/log/');
|
||||
define ('PATH_PDF', PATH_DATA.'/pdf/');
|
||||
define ('PATH_LOGOS', PATH_WWW.'/img/logos/');
|
||||
|
||||
define ('EXTRANET_URL', 'http://extranet.sd.com/');
|
||||
define ('IPARI_URL', 'http://tville.scores-decisions.com:8080/ipari/');
|
||||
define ('SITEINST_URL1', 'http://extranet.sd.com/localauth/');
|
||||
define ('SITEINST_URL2', 'http://extranet.sd.com/localauth/');
|
||||
|
||||
/** Celeste **/
|
||||
define ('WEBSERVICE_URL', 'http://78.31.45.206/ws2/');
|
||||
define ('WEBSERVICE_URI', 'http://78.31.45.206/');
|
||||
|
||||
/** INFOGREFFE **/
|
||||
define ('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define ('INFOGREFFE_WS_URI', 'https://webservices.infogreffe.fr/');
|
||||
define ('INFOGREFFE_WS_USER', '85000109');
|
||||
define ('INFOGREFFE_WS_PASS', '166');
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('FTPACTES_HOST', 'ftp2.scores-decisions.com');
|
||||
define ('FTPACTES_USER', 'inpi');
|
||||
define ('FTPACTES_PASS', 'coface');
|
||||
|
||||
define('INFOGREFFE_WS_REF', 'ref');
|
||||
?>
|
@ -1,56 +0,0 @@
|
||||
<?
|
||||
/** Environnement du site **/
|
||||
define ('ENVIRONNEMENT', 'DEV'); // PRD REC DEV
|
||||
|
||||
define ('EMAIL_SUPPORTDEV', 'mricois@scores-decisions.com');
|
||||
|
||||
define('ERROR_SOAP', 'Une erreur est survenue lors de votre requête...<br/>Un message à été envoyé à l\'administrateur de l\'extranet.<br/>Nous vous remercions de bien vouloir renouveler votre demande ultérieurement');
|
||||
|
||||
/** Log des requêtes MySQL ? **/
|
||||
define ('LOG_MYSQL', 'ALL'); // NONE ou ALL
|
||||
|
||||
/** Log des performances des pages PHP (mémoire et temps d'exécution **/
|
||||
define ('LOG_BENCH', 'BOTH'); // NONE, WEB, FILE, BOTH
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('MYSQL_HOST', 'localhost');
|
||||
define ('MYSQL_DB', 'extranet');
|
||||
define ('MYSQL_USER', 'root');
|
||||
define ('MYSQL_PASS', '');
|
||||
|
||||
define ('PATH_SITE', realpath(dirname(__FILE__) . '/../'));
|
||||
define ('PATH_WWW', PATH_SITE.'/www/');
|
||||
|
||||
/** Paramètres de stockage **/
|
||||
define ('PATH_DATA', realpath('d:/www/data'));
|
||||
define ('PATH_LOGS', PATH_DATA.'/log/');
|
||||
define ('PATH_PDF', PATH_DATA.'/pdf/');
|
||||
define ('PATH_LOGOS', PATH_WWW.'/img/logos/');
|
||||
|
||||
define ('EXTRANET_URL', 'http://extranet.devlocal.com/');
|
||||
define ('IPARI_URL', 'http://tville.scores-decisions.com:8080/ipari/');
|
||||
define ('SITEINST_URL1', 'http://extranet.devlocal.com/localauth/');
|
||||
define ('SITEINST_URL2', 'http://extranet.devlocal.com/localauth/');
|
||||
|
||||
/** Celeste **/
|
||||
define ('WEBSERVICE_URL', 'http://78.31.45.206/ws/');
|
||||
define ('WEBSERVICE_URI', 'http://78.31.45.206/');
|
||||
|
||||
/** INFOGREFFE **/
|
||||
//define('INFOGREFFE_WS_URL', 'https://wv2rcte.experian.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
//define('INFOGREFFE_WS_URI', 'https://wv2rcte.experian.fr/');
|
||||
//define('INFOGREFFE_WS_USER', '85009006');
|
||||
//define('INFOGREFFE_WS_PASS', '17628');
|
||||
|
||||
define('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define('INFOGREFFE_WS_URI', 'https://webservices.infogreffe.fr/');
|
||||
define('INFOGREFFE_WS_USER', '85000109');
|
||||
define('INFOGREFFE_WS_PASS', '166');
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('FTPACTES_HOST', 'ftp2.scores-decisions.com');
|
||||
define ('FTPACTES_USER', 'inpi');
|
||||
define ('FTPACTES_PASS', 'coface');
|
||||
|
||||
define('INFOGREFFE_WS_REF', 'ref');
|
||||
?>
|
@ -1,55 +0,0 @@
|
||||
<?
|
||||
/** Environnement du site **/
|
||||
define ('ENVIRONNEMENT', 'PRD'); // PRD REC DEV
|
||||
|
||||
define ('EMAIL_SUPPORTDEV', 'supportdev@scores-decisions.com');
|
||||
|
||||
define ('ERROR_SOAP', 'Une erreur est survenue lors de votre requête...<br/>Un message à été envoyé à l\'administrateur de l\'extranet.<br/>Nous vous remercions de bien vouloir renouveler votre demande ultérieurement');
|
||||
|
||||
/** Log des requêtes MySQL ? **/
|
||||
define ('LOG_MYSQL', 'ALL'); // NONE ou ALL
|
||||
|
||||
/** Log des performances des pages PHP (mémoire et temps d'exécution **/
|
||||
define ('LOG_BENCH', 'BOTH'); // NONE, WEB, FILE, BOTH
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('MYSQL_HOST', 'localhost');
|
||||
define ('MYSQL_DB', 'sdv1');
|
||||
define ('MYSQL_USER', 'root');
|
||||
define ('MYSQL_PASS', 'Cs03dfCN');
|
||||
|
||||
define ('PATH_SITE', realpath(dirname(__FILE__) . '/../'));
|
||||
define ('PATH_WWW', PATH_SITE.'/www/');
|
||||
|
||||
/** Paramètres de stockage **/
|
||||
define ('PATH_DATA', '/var/www/data');
|
||||
define ('PATH_LOGS', PATH_DATA.'/log/');
|
||||
define ('PATH_PDF', PATH_DATA.'/pdf/');
|
||||
define ('PATH_LOGOS', PATH_WWW.'/img/logos/');
|
||||
|
||||
define ('EXTRANET_URL', 'http://extranet.scores-decisions.com/');
|
||||
define ('IPARI_URL', 'http://tville.scores-decisions.com:8080/ipari/');
|
||||
define ('SITEINST_URL1', 'http://www.scores-decisions.com/');
|
||||
define ('SITEINST_URL2', 'http://www.scores-decisions.com/');
|
||||
|
||||
/** Celeste **/
|
||||
define ('WEBSERVICE_URL', 'http://78.31.45.206/ws/');
|
||||
define ('WEBSERVICE_URI', 'http://78.31.45.206/');
|
||||
|
||||
/** INFOGREFFE **/
|
||||
//define('INFOGREFFE_WS_URL', 'https://wv2rcte.experian.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
//define('INFOGREFFE_WS_URI', 'https://wv2rcte.experian.fr/');
|
||||
//define('INFOGREFFE_WS_USER', '85009006');
|
||||
//define('INFOGREFFE_WS_PASS', '17628');
|
||||
define ('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define ('INFOGREFFE_WS_URI', 'https://webservices.infogreffe.fr/');
|
||||
define ('INFOGREFFE_WS_USER', '85000109');
|
||||
define ('INFOGREFFE_WS_PASS', '166');
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('FTPACTES_HOST', 'ftp2.scores-decisions.com');
|
||||
define ('FTPACTES_USER', 'inpi');
|
||||
define ('FTPACTES_PASS', 'coface');
|
||||
|
||||
define('INFOGREFFE_WS_REF', 'ref');
|
||||
?>
|
@ -1,55 +0,0 @@
|
||||
<?
|
||||
/** Environnement du site **/
|
||||
define ('ENVIRONNEMENT', 'DEV'); // PRD REC DEV
|
||||
|
||||
define ('EMAIL_SUPPORTDEV', 'mricois@scores-decisions.com');
|
||||
|
||||
define ('ERROR_SOAP', 'Une erreur est survenue lors de votre requête...<br/>Un message à été envoyé à l\'administrateur de l\'extranet.<br/>Nous vous remercions de bien vouloir renouveler votre demande ultérieurement');
|
||||
|
||||
/** Log des requêtes MySQL ? **/
|
||||
define ('LOG_MYSQL', 'ALL'); // NONE ou ALL
|
||||
|
||||
/** Log des performances des pages PHP (mémoire et temps d'exécution **/
|
||||
define ('LOG_BENCH', 'BOTH'); // NONE, WEB, FILE, BOTH
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('MYSQL_HOST', 'localhost');
|
||||
define ('MYSQL_DB', 'sdv1');
|
||||
define ('MYSQL_USER', 'root');
|
||||
define ('MYSQL_PASS', '');
|
||||
|
||||
define ('PATH_SITE', realpath(dirname(__FILE__) . '/../'));
|
||||
define ('PATH_WWW', PATH_SITE.'/www/');
|
||||
|
||||
/** Paramètres de stockage **/
|
||||
define ('PATH_DATA', realpath('d:/www/data'));
|
||||
define ('PATH_LOGS', PATH_DATA.'/log/');
|
||||
define ('PATH_PDF', PATH_DATA.'/pdf/');
|
||||
define ('PATH_LOGOS', PATH_WWW.'/img/logos/');
|
||||
|
||||
define ('EXTRANET_URL', 'http://extranet.devlocal.com/');
|
||||
define ('IPARI_URL', 'http://tville.scores-decisions.com:8080/ipari/');
|
||||
define ('SITEINST_URL1', 'http://extranet.devlocal.com/localauth/');
|
||||
define ('SITEINST_URL2', 'http://extranet.devlocal.com/localauth/');
|
||||
|
||||
/** Celeste **/
|
||||
define ('WEBSERVICE_URL', 'http://78.31.45.206/ws2/');
|
||||
define ('WEBSERVICE_URI', 'http://78.31.45.206/');
|
||||
|
||||
/** INFOGREFFE **/
|
||||
//define('INFOGREFFE_WS_URL', 'https://wv2rcte.experian.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
//define('INFOGREFFE_WS_URI', 'https://wv2rcte.experian.fr/');
|
||||
//define('INFOGREFFE_WS_USER', '85009006');
|
||||
//define('INFOGREFFE_WS_PASS', '17628');
|
||||
define ('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE');
|
||||
define ('INFOGREFFE_WS_URI', 'https://webservices.infogreffe.fr/');
|
||||
define ('INFOGREFFE_WS_USER', '85000109');
|
||||
define ('INFOGREFFE_WS_PASS', '166');
|
||||
|
||||
/** Paramètres de la base de données **/
|
||||
define ('FTPACTES_HOST', 'ftp2.scores-decisions.com');
|
||||
define ('FTPACTES_USER', 'inpi');
|
||||
define ('FTPACTES_PASS', 'coface');
|
||||
|
||||
define('INFOGREFFE_WS_REF', 'ref');
|
||||
?>
|
@ -1,149 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Remplacement du php_value include_path dans le .htaccess
|
||||
* Attention à bien placer l'include_path dans le php.ini
|
||||
* Pour windows/wamp : include_path = ".;c:\wamp\bin\php\php-X.X.X\PEAR"
|
||||
* Pour serveur linux : include_path = ".:/usr/share/php"
|
||||
*/
|
||||
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR .
|
||||
realpath(dirname(__FILE__) . '/../framework/') . PATH_SEPARATOR .
|
||||
realpath(dirname(__FILE__) . '/../includes/')
|
||||
);
|
||||
|
||||
/**
|
||||
* Fonction globale récupérant le microtime de la machine en format float.
|
||||
* @return float Valeur courante du microtime() de la machine en format décimal
|
||||
*/
|
||||
function getmicrotime(){
|
||||
list($usec, $sec) = explode (' ', microtime());
|
||||
return ( (float)$sec + (float)$usec );
|
||||
}
|
||||
|
||||
/** On ne prend l'heure qu'une seule fois par script PHP et on initialise des constantes.
|
||||
*
|
||||
* DATETIME YmdHis
|
||||
* DATETIME_LOG Y-m-d H:i:s Date du jour pour les insertions en BDD
|
||||
* NOW His Heure d'exécution du script
|
||||
* NOW_FORMAT H:i:s Heure d'exécution du script
|
||||
* TODAY Ymd Année, Mois, Jour d'exécution du script
|
||||
* TODAY_FORMAT Y-m-d
|
||||
* TODAY_AFF d/m/Y
|
||||
*/
|
||||
define ('DATETIME', date('YmdHis'));
|
||||
define ('DATETIME_LOG', substr(DATETIME,0,4).'-'.substr(DATETIME, 4,2).'-'.substr(DATETIME, 6,2).' '.substr(DATETIME,8,2).'-'.substr(DATETIME,10,2).'-'.substr(DATETIME,12,2) );
|
||||
define ('TODAY', substr(DATETIME,0,8));
|
||||
define ('NOW', substr(DATETIME,8,6));
|
||||
define ('TODAY_FORMAT', substr(DATETIME,0,4).'-'.substr(DATETIME,4,2).'-'.substr(DATETIME,6,2));
|
||||
define ('TODAY_AFF', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
|
||||
define ('NOW_FORMAT', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
|
||||
|
||||
/**
|
||||
* Les librairies suivantes sont chargées automatiquement car tous les scripts les utilisent !
|
||||
*/
|
||||
if( !defined('ROOT_PATH') )
|
||||
{
|
||||
define ('ROOT_PATH', realpath(dirname(__FILE__) . '/../') );
|
||||
define ('WWW_PATH', realpath(ROOT_PATH.'/www/') );
|
||||
define ('LOG_PATH', realpath(ROOT_PATH.'/log/') );
|
||||
define ('INCLUDE_PATH', realpath(ROOT_PATH.'/includes/') );
|
||||
include_once realpath(INCLUDE_PATH.'/phplib/db_mysql.inc');
|
||||
include_once realpath(INCLUDE_PATH.'/auth/sessions.inc');
|
||||
//include_once realpath(INCLUDE_PATH.'/auth/sessions.local.inc');
|
||||
include_once realpath(ROOT_PATH.'/config/config.inc');
|
||||
}
|
||||
|
||||
//Debuggage
|
||||
require_once 'FirePHPCore/FirePHP.class.php';
|
||||
ob_start();
|
||||
$firephp = FirePHP::getInstance(true);
|
||||
|
||||
//Définition des options de configuration suivant le serveur
|
||||
if(ENVIRONNEMENT == 'PRD')
|
||||
{
|
||||
$firephp->setEnabled(false);
|
||||
ini_set('error_reporting', 0);
|
||||
}
|
||||
elseif(ENVIRONNEMENT == 'DEV')
|
||||
{
|
||||
$firephp->setEnabled(true); //Debuggage activé par defaut
|
||||
//ini_set('error_reporting', E_ALL ^ E_NOTICE);
|
||||
}
|
||||
|
||||
if ( LOG_BENCH != 'NONE' ){
|
||||
include_once ('Benchmark/Timer.php');
|
||||
}else{
|
||||
class Benchmark_Timer
|
||||
{
|
||||
function start() {}
|
||||
function setMarker() {}
|
||||
function stop() {}
|
||||
function getProfiling() {}
|
||||
function display() {}
|
||||
}
|
||||
}
|
||||
|
||||
/* @todo: A enlever pour la prod
|
||||
$timer = new Benchmark_Timer();
|
||||
$timer->start();
|
||||
$timer->setMarker('Debut du script (prepend.php)');
|
||||
*/
|
||||
|
||||
/** Instance de la connexion à la base de données
|
||||
* Cette instance est utilisée par tous les scripts pour accéder à la base de données
|
||||
*/
|
||||
|
||||
class DB extends DB_MySQL
|
||||
{
|
||||
function DB() {
|
||||
$this->Host = MYSQL_HOST;
|
||||
$this->Database = MYSQL_DB;
|
||||
$this->User = MYSQL_USER;
|
||||
$this->Password = MYSQL_PASS;
|
||||
}
|
||||
|
||||
function getRow() {
|
||||
$ret= $this->Record;
|
||||
for( $i= 0; $i<count($this->Record); $i++ ) { if( !isset($ret[$i]) ) break; unset($ret[$i]); }
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function query($q) {
|
||||
if ( LOG_MYSQL != 'NONE' ) $time_start=getmicrotime();
|
||||
|
||||
$ret=DB_MySQL::query($q);
|
||||
|
||||
if ( LOG_MYSQL == 'NONE' ) return $ret;
|
||||
|
||||
$time_end= getmicrotime();
|
||||
$time_total= $time_end-$time_start;
|
||||
$time_total= substr((string)$time_total,0,10);
|
||||
$now= date('Y/m/d H:i:s', $time_start);
|
||||
if ($ret<1)
|
||||
$mysqlerror = mysql_errno() .' : '. mysql_error();
|
||||
else
|
||||
$mysqlerror = '';
|
||||
|
||||
$sqlAction=strtoupper(substr(trim($q),0,6));
|
||||
if ( LOG_MYSQL=='SELECT' && $sqlAction=='SELECT' )
|
||||
$logOption='_select';
|
||||
elseif ( LOG_MYSQL=='UPDATE' && ( $sqlAction=='UPDATE' || $sqlAction=='INSERT' || $sqlAction=='DELETE' ) )
|
||||
$logOption='_update';
|
||||
else
|
||||
$logOption='';
|
||||
|
||||
$fh=@fopen( LOG_PATH . 'db_mysql'.$logOption.'.log', 'a+');
|
||||
if ($fh) {
|
||||
@fwrite($fh, "$now\t$time_total\t" . MYSQL_HOST ."\t". MYSQL_USER ."\t". MYSQL_DB ."\t$mysqlerror\t$q\r\n");
|
||||
@fclose($fh);
|
||||
}
|
||||
|
||||
$mySqlErrTab=explode(' : ', $mysqlerror);
|
||||
$mySqlErrno=(int)$mySqlErrTab[0];
|
||||
if ( $mySqlErrno > 0 && $mySqlErrno !=1062 ) {
|
||||
// mail_admin( 'Erreur MySQL '.$mySqlErrno, $mysqlerror ."\n\n". $q );
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,39 +0,0 @@
|
||||
<?
|
||||
|
||||
class WChiffes {
|
||||
|
||||
private static $tabChiffresEnLEttres = array( 0=>'zéro',
|
||||
1=>'un',
|
||||
2=>'deux',
|
||||
3=>'trois',
|
||||
4=>'quatre',
|
||||
5=>'cinq',
|
||||
6=>'six',
|
||||
7=>'sept',
|
||||
8=>'huit',
|
||||
9=>'neuf',
|
||||
10=>'dix',
|
||||
11=>'onze',
|
||||
12=>'douze',
|
||||
13=>'treize',
|
||||
14=>'quatorze',
|
||||
15=>'quinze',
|
||||
16=>'seize',
|
||||
17=>'dix sept',
|
||||
18=>'dix huit',
|
||||
19=>'dix neuf',
|
||||
20=>'vingt',
|
||||
30=>'trente',
|
||||
40=>'quarante',
|
||||
50=>'cinquante',
|
||||
60=>'soixante',
|
||||
70=>'soixante dix',
|
||||
80=>'quatre vingt',
|
||||
90=>'quatre vingt dix');
|
||||
|
||||
public function ChiffresEnLettres($chiffre) {
|
||||
return array_search($chiffre, self::$tabChiffresEnLEttres);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,173 +0,0 @@
|
||||
<?
|
||||
|
||||
//include_once('/var/www/default/_includes/timer.php');
|
||||
|
||||
/** Parse une page Html et retourne son contenu dans un tableau :
|
||||
** "code" => Code réponse Serveur
|
||||
** "header" => Headers du serveur
|
||||
** "body" => Page HTML
|
||||
**/
|
||||
function parse_response($this_response) {
|
||||
|
||||
// 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='', $proxy='', $timeout=0, $acceptRedir=0) {
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
if ($host=='') {
|
||||
$tabTmp = parse_url($url);
|
||||
$hostUrl = $tabTmp['host'];
|
||||
$this_header = array('Host: '. $hostUrl);
|
||||
} else
|
||||
$this_header = array('Host: '. $host);
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
if ($proxy<>'') curl_setopt($ch, CURLOPT_PROXY, $proxy);
|
||||
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password'); // Pas nécessaire en authentification NT
|
||||
|
||||
if (((int)$timeout)<>0) curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
if ($acceptRedir>0) {
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($ch, CURLOPT_MAXREDIRS, $acceptRedir);
|
||||
}
|
||||
$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);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
//print_r($this_header);
|
||||
|
||||
$page=curl_exec($ch);
|
||||
if($page === false) {
|
||||
if (curl_errno($ch) == 28) //TIMEOUT
|
||||
$response=array('code' =>408, 'header' =>array(), 'body' =>'Connexion impossible au site du partenaire');
|
||||
else
|
||||
$response=array('code' =>400, 'header' =>array(), 'body' =>'Erreur Curl : ' . curl_error($ch));
|
||||
} else {
|
||||
$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('insee/'. date('Ymd-His') .'-'. microtime_float(true) .'-'. $url2 . '.html', 'a');
|
||||
fwrite($fp, $url."\r\n");
|
||||
fwrite($fp, $page);
|
||||
fclose($fp);
|
||||
//echo strip_tags(html_entity_decode($response['body']), '<td>');
|
||||
}
|
||||
//print_r(curl_getinfo($ch));
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/** Recherche un texte dans une page HTML
|
||||
**
|
||||
**/
|
||||
function getTextInHtml($pageHtml, $strToFind, $strDeb, $strEnd, $include_strDeb=false, $include_strEnd=false, $ltrim=true, $rtrim=true, &$fin, $nbOcc=1) {
|
||||
$tabRet=array();
|
||||
$deb=$nbOccTrouve=0;
|
||||
while( is_int(($deb=strpos($pageHtml,$strToFind,$fin))) ) {
|
||||
$deb++;
|
||||
$deb2 = strpos($pageHtml,$strDeb, $deb);
|
||||
$fin = strpos($pageHtml,$strEnd, $deb2);
|
||||
if (!$include_strDeb)
|
||||
$deb2+=strlen($strDeb);
|
||||
$s_temp = substr($pageHtml, $deb2, ($fin-$deb2));
|
||||
|
||||
if ($ltrim) $s_temp=ltrim($s_temp);
|
||||
if ($rtrim) $s_temp=rtrim($s_temp);
|
||||
|
||||
if ($nbOcc==1) return $s_temp;
|
||||
//echo $s_temp."\r\n";
|
||||
//$a_temp = explode('" class="basic">', $s_temp);
|
||||
$tabUrl[$nbOccTrouve]=$s_temp;
|
||||
$nbOccTrouve++;
|
||||
|
||||
if ($nbOcc==$nbOccTrouve) {
|
||||
// echo "j'ai trouvé le nb demandé, je sort\r\n";
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return $tabUrl;
|
||||
/*<span class="mongrasvert">
|
||||
<li>Le type de voie a été modifié<br>
|
||||
<li>L'orthographe du mot directeur a été modifiée<br>
|
||||
<li>Le code postal a été forcé à partir du département et de la localité<br> </span>
|
||||
*/
|
||||
}
|
||||
|
||||
?>
|
@ -1,124 +0,0 @@
|
||||
<?
|
||||
|
||||
include_once('chiffres.php');
|
||||
|
||||
|
||||
/**
|
||||
* Classe de gestion des méthodes relatives à la date et à l'heure
|
||||
*
|
||||
* <p>détail de la classe</p>
|
||||
*
|
||||
* @name nom de la classe
|
||||
* @author Nom de l'auteur <adresse@Email.dom>
|
||||
* @link
|
||||
* @copyright Prénom Nom Année
|
||||
* @version 1.0.0
|
||||
* @package Nom du package
|
||||
*/
|
||||
|
||||
class WDate {
|
||||
|
||||
private static $tabMoisEnLettres = array( 1=>'Janvier',
|
||||
2=>'Février',
|
||||
3=>'Mars',
|
||||
4=>'Avril',
|
||||
5=>'Mai',
|
||||
6=>'Juin',
|
||||
7=>'Juillet',
|
||||
8=>'Août',
|
||||
9=>'Septembre',
|
||||
10=>'Octobre',
|
||||
11=>'Novembre',
|
||||
12=>'Décembre');
|
||||
|
||||
/** Retourne le numéro du mois donné au format texte (janvier, mars, etc...)
|
||||
* @param string Mois en toute lettres (janvier, mars, etc...)
|
||||
* @return string Mois en Chiffe (1, 3, 12) / false en cas d'erreur
|
||||
*/
|
||||
public function getNumMois($moisEnLettres) {
|
||||
foreach (self::$tabMoisEnLettres as $num=>$mois)
|
||||
$tabMoisSansAccents[$num]=strtr($mois, 'ééû','eeu');
|
||||
return array_search(ucfirst(strtolower(strtr($moisEnLettres, 'ééû','eeu'))), $tabMoisSansAccents);
|
||||
}
|
||||
|
||||
/** Retourne le libellé nu numéro du mois passé en paramètre
|
||||
* @param int $moisEnChiffre
|
||||
* @return string Libellé du mois / false si le mois passé en paramètre est invalide
|
||||
*/
|
||||
public function getLibelleMois($moisEnChiffre) {
|
||||
if ($moisEnChiffre>0 && $moisEnChiffre<13)
|
||||
return self::$tabMoisEnLettres[$moisEnChiffre];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion de formats de dates selon les formats de dates définits en php
|
||||
* @param string Format de la date d'entrée
|
||||
* @param string Format de la date de sortie
|
||||
* @param string Date d'entrée
|
||||
* @return string Date formatée
|
||||
*/
|
||||
public function dateT($formatIN, $formatOUT, $date) {
|
||||
$M='';
|
||||
switch ($formatIN) {
|
||||
case 'd M Y': $tmp=explode(' ', $date); $d=str_replace('1er', '1', $tmp[0]); $m=getNumMois($tmp[1]); $Y=$tmp[2]; break;
|
||||
case 'dMY': $Y=substr($date,-4);
|
||||
if (substr($date,0,3)=='1er') { $d=1; $posM=3; }
|
||||
elseif (is_numeric(substr($date,1,1))) { $d=substr($date,0,2); $posM=2; }
|
||||
else { $d=substr($date,0,1); $posM=1; }
|
||||
$M=substr($date, $posM, strlen($date)-4-$posM);
|
||||
$m=self::getNumMois($M);
|
||||
break;
|
||||
case 'Ymd': $d=substr($date,6,2); $m=substr($date,4,2); $Y=substr($date,0,4); break;
|
||||
case 'Y-m-d': $d=substr($date,8,2); $m=substr($date,5,2); $Y=substr($date,0,4); break;
|
||||
case 'd/m/Y': $d=substr($date,0,2); $m=substr($date,3,2); $Y=substr($date,6,4); break;
|
||||
default: return $date;
|
||||
}
|
||||
|
||||
if ($m*1>0 && $m*1<10) $m='0'.($m*1); if ($d*1>0 && $d*1<10) $d='0'.($d*1);
|
||||
|
||||
switch ($formatOUT) {
|
||||
case 'd/m/Y': return $d.'/'.$m.'/'.$Y; break;
|
||||
case 'm/Y': return $m.'/'.$Y; break;
|
||||
// case 'M Y': return $this->tabMoisEnLettres[$m].' '.$Y; break;
|
||||
case 'Y': return $Y; break;
|
||||
case 'm': return $m; break;
|
||||
case 'd': return $d; break;
|
||||
case 'Ym': return $Y.$m; break;
|
||||
case 'Ymd': return $Y.$m.$d; break;
|
||||
case 'Y-m-d': return $Y.'-'.$m.'-'.$d; break;
|
||||
case 'Y/m/d': return $Y.'/'.$m.'/'.$d; break;
|
||||
default: return $date;
|
||||
}
|
||||
}
|
||||
|
||||
/** Calcul de la date après application de la période textuelle (deux ans, six mois, quinze jours, etc...)
|
||||
* @todo Fonction ne fonctionnant qu'avec un chiffre en un seul mot du genre dix mais pas quatre vingt dix !!!
|
||||
* @param date $dateIN au format Ymd
|
||||
* @param string $period (ex : cinq mois, six ans, un jour)
|
||||
* @return date
|
||||
*/
|
||||
function period2Days($dateIN, $period) {
|
||||
$dateV=self::dateT('Ymd', 'Ymd', $dateIN);
|
||||
if ($dateV<>$dateIN) return NULL;
|
||||
$d=substr($dateIN,6,2);
|
||||
$m=substr($dateIN,4,2);
|
||||
$Y=substr($dateIN,0,4);
|
||||
$period=trim(strtr($period, "-.,", ' '));
|
||||
if ($period=='') return NULL;
|
||||
$tabP=explode(' ', $period);
|
||||
$chiffre=WChiffes::ChiffresEnLettres($tabP[0]);
|
||||
switch (end($tabP)) {
|
||||
case 'mois': $dateOUT=date('Ymd', mktime(0, 0, 0, $m+$chiffre, $d, $Y)); break;
|
||||
case 'an':
|
||||
case 'ans': $dateOUT=date('Ymd', mktime(0, 0, 0, $m, $d, $Y+$chiffre)); break;
|
||||
case 'jour':
|
||||
case 'jours': $dateOUT=date('Ymd', mktime(0, 0, 0, $m, $d+$chiffre, $Y)); break;
|
||||
default: $dateOUT=NULL;
|
||||
}
|
||||
return $dateOUT;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
function ftp_mget($ftp_url, $ftp_user, $ftp_pass, $ftp_dir, $local_dir, $debug=null) {
|
||||
$conn_id = @ftp_connect($ftp_url);
|
||||
if (!$conn_id) {
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de se connecter au serveur FTP ($ftp_url) !".EOL;
|
||||
return false;
|
||||
}
|
||||
|
||||
$login_result = @ftp_login($conn_id, $ftp_user, $ftp_pass);
|
||||
if (!$login_result) {
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de s'authentifier sur le serveur FTP (user=$ftp_user)!".EOL;
|
||||
return false;
|
||||
}
|
||||
// Récupération du contenu d'un dossier
|
||||
$contents = ftp_nlist($conn_id, $ftp_dir);
|
||||
$nbFic=0; // Nombre de fichiers récupérés
|
||||
if (is_array($contents))
|
||||
foreach($contents as $k => $server_file) {
|
||||
$tailleDist = ftp_size($conn_id, $server_file);
|
||||
$dateDist = ftp_mdtm($conn_id, $server_file);
|
||||
$tailleLoc=0;
|
||||
if ($dateDist != -1) {
|
||||
$tabFichiers[$server_file]['dateDispo']=date('Y-m-d H:i:s', $dateDist);
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s') ." - Le fichier distant $server_file a été modifié le ".date("d/m/Y à H:i:s.",$dateDist)."\n";
|
||||
} else {
|
||||
$tabFichiers[$server_file]['dateDispo']=NULL;
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de récupérer l'heure de modification du fichier distant $server_file !\n";
|
||||
}
|
||||
$tabFichiers[$server_file]['taille']=$tailleDist;
|
||||
if ($tailleDist != -1) {
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s') ." - Taille du fichier distant $server_file est de $tailleDist octets\n";
|
||||
}
|
||||
if (file_exists($local_dir . $server_file)) {
|
||||
$dateLoc=filemtime($local_dir . $server_file);
|
||||
$tabFichiers[$server_file]['dateDownload']=date('Y-m-d H:i:s', $dateLoc);
|
||||
$tailleLoc=filesize($local_dir . $server_file);
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s') ." - Taille du fichier local $server_file = $tailleLoc octets\n";
|
||||
}
|
||||
if ($tailleDist<>$tailleLoc) {
|
||||
if (ftp_get($conn_id, $local_dir. $server_file, $server_file, FTP_BINARY)) {
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s')." - Fichier distant $server_file téléchargé avec succès".EOL;
|
||||
$nbFic++;
|
||||
} else {
|
||||
if ($debug<>null) echo date ('Y/m/d - H:i:s')." - ERREUR : Fichier distant $server_file non téléchargé !".EOL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fermeture de la connexion
|
||||
ftp_close($conn_id);
|
||||
return $nbFic;
|
||||
}
|
||||
|
||||
?>
|
@ -1,151 +0,0 @@
|
||||
<?php
|
||||
|
||||
class WDB {
|
||||
|
||||
private $host;
|
||||
private $database;
|
||||
private $user;
|
||||
private $password;
|
||||
private $con_id; // Connection ID with MySQL
|
||||
private $result;
|
||||
|
||||
public function __construct($database='', $host='', $user='', $password='') {
|
||||
|
||||
if ($host=='') $this->host=MYSQL_HOST;
|
||||
else $this->host=$host;
|
||||
if ($user=='') $this->user=MYSQL_USER;
|
||||
else $this->user=$user;
|
||||
if ($password=='') $this->password=MYSQL_PASS;
|
||||
else $this->password=$password;
|
||||
if ($database=='') $this->database=MYSQL_DEFAULT_DB;
|
||||
else $this->database=$database;
|
||||
|
||||
$this->con_id = mysql_pconnect($this->host, $this->user, $this->password);
|
||||
if (!($this->con_id === false)) {
|
||||
if (mysql_select_db($this->database, $this->con_id) === false) {
|
||||
echo date('Y/m/d - H:i:s') ." - ERREUR ".mysql_errno()." : Connection à la base de données impossible !".EOL;
|
||||
echo date ('Y/m/d - H:i:s'). mysql_error();
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setCharSet($charSet) {
|
||||
return (mysql_query("SET CHARACTER SET $charSet;", $this->con_id));
|
||||
}
|
||||
|
||||
/** INSERTION d'un tableau dans une table.
|
||||
** Les index doivent avoir les mêmes noms que les champs.
|
||||
** @param string Table
|
||||
** @param array Valeurs insérer
|
||||
** @return int Dernière valeur de l'auto-incrément, 1 si pas d'auto-incrément et 0 si erreur
|
||||
**/
|
||||
public function insert($table, $toAdd, $debug=false){
|
||||
$fields = implode(array_keys($toAdd), '`,`');
|
||||
foreach (array_values($toAdd) as $key=>$array_values)
|
||||
$tmp[$key]=checkaddslashes($array_values);
|
||||
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
|
||||
$query = 'INSERT INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$res = mysql_query($query, $this->con_id);
|
||||
if ($res!==false)
|
||||
{
|
||||
if (mysql_insert_id()>0)
|
||||
$res=mysql_insert_id();
|
||||
else
|
||||
$res=true;
|
||||
}
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function update($table, $update, $where, $debug=false){
|
||||
$fields = array_keys($update);
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
$query='UPDATE `'.$table.'` SET ';
|
||||
while(isset($fields[$i])){
|
||||
if($i>0) { $query.=', '; }
|
||||
$query.=' `'.$fields[$i]."`='".addslashes($values[$i])."'";
|
||||
$i++;
|
||||
}
|
||||
$query.=' WHERE '.$where.' LIMIT 1;';
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$res=mysql_query($query, $this->con_id);
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete($table, $where, $debug=false) {
|
||||
$query='DELETE FROM `'.$table.'` WHERE '.$where.' LIMIT 1;';
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$res=mysql_query($query, $this->con_id);
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function select($table, $fields, $where, $debug=false, $assoc=MYSQL_BOTH, $huge=false) {
|
||||
if (mysql_select_db($this->database, $this->con_id) === false) {
|
||||
echo date('Y/m/d - H:i:s') ." - ERREUR ".mysql_errno()." : Connection à la base de données impossible !".EOL;
|
||||
echo date ('Y/m/d - H:i:s'). mysql_error();
|
||||
die();
|
||||
}
|
||||
$query="SELECT $fields FROM $table WHERE $where;";
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$this->result=mysql_query($query, $this->con_id);// or die(mysql_error());
|
||||
if (mysql_errno()) die(mysql_errno() .' : '. mysql_error());
|
||||
// echo $query;
|
||||
if (!$huge) {
|
||||
$tab=array();
|
||||
while ($ligne = mysql_fetch_array($this->result, $assoc))
|
||||
$tab[]=$ligne;
|
||||
|
||||
if ($debug) $this->trace($query, sizeof($tab), $tdeb);
|
||||
return $tab;
|
||||
} else {
|
||||
$nbRows=mysql_num_rows($this->result);
|
||||
if ($debug) $this->trace($query, $nbRows, $tdeb);
|
||||
return $nbRows;
|
||||
}
|
||||
}
|
||||
|
||||
public function fetch($assoc=MYSQL_BOTH) {
|
||||
return mysql_fetch_array($this->result, $assoc);
|
||||
}
|
||||
|
||||
public function trace($query, $res='', $tdeb=-1) {
|
||||
if (!$fp=fopen('mysql_insert.log', 'a'))
|
||||
return false;
|
||||
$errnum=mysql_errno($this->con_id);
|
||||
if ($tdeb>-1) $duree=substr(''.microtime_float()-$tdeb, 0, 5);
|
||||
else $duree='N/D';
|
||||
if (!fwrite($fp, date('Y/m/d - H:i:s') ." - $errnum - $res - $duree - $query\n"))
|
||||
return false;
|
||||
if (!fclose($fp))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Exécute la requête passé en paramètre **/
|
||||
public function query($query, $debug=false){
|
||||
return mysql_query($query, $this->con_id);
|
||||
}
|
||||
|
||||
/** Retourne le libellé de la dernière erreur **/
|
||||
public function getLastErrorMsg() {
|
||||
return mysql_error($this->con_id);
|
||||
}
|
||||
/** Retourne le numéro de la dernière erreur **/
|
||||
public function getLastErrorNum() {
|
||||
return mysql_errno($this->con_id);
|
||||
}
|
||||
|
||||
/** Retourne le libellé et le numéro de la dernière erreur **/
|
||||
public function getLastError() {
|
||||
return mysql_error($this->con_id).' ('.mysql_errno($this->con_id).')';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -1,419 +0,0 @@
|
||||
<?
|
||||
|
||||
define ('BEFORE', 0);
|
||||
define ('AFTER', 1);
|
||||
define ('BOTH', 2);
|
||||
define ('ALIGN_LEFT', 0);
|
||||
define ('ALIGN_RIGHT', 1);
|
||||
|
||||
|
||||
/**Initialisation d'une chaîne de caractère
|
||||
*
|
||||
* @param string $chaine Chaîne de caractère initiale
|
||||
* @param int $taille Taille de la chaîne de caractère à initialiser
|
||||
* @param string $caractere_pour_combler Caractère à utiliser pour combler la chaîne de caractère (espace par défaut)
|
||||
* @param string $align Aligner la chaîne de caractère à droite (right) ou à gauche (left, par défaut)
|
||||
* @return string
|
||||
*/
|
||||
function initstr($chaine, $taille, $caractere_pour_combler=' ', $align=ALIGN_LEFT) {
|
||||
if ($align==ALIGN_RIGHT) {
|
||||
$str2='';
|
||||
for ($i=0;$i<($taille-strlen($chaine));$i++)
|
||||
$str2.=$caractere_pour_combler;
|
||||
$str=$str2.$chaine;
|
||||
} else {
|
||||
if (strlen($chaine)>=$taille)
|
||||
return substr($chaine,0,$taille);
|
||||
$str=$chaine;
|
||||
for ($i=strlen($chaine);$i<$taille;$i++)
|
||||
$str = $str . $caractere_pour_combler;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout d'anti-slashs s'il y a lieu en vu d'une insertion en BDD
|
||||
*
|
||||
* @param string $str Chaine de caractère
|
||||
* @return unknown
|
||||
*/
|
||||
|
||||
function checkaddslashes($str){
|
||||
return addslashes(preg_replace('/\\[^nrt\']/i', '\\', $str));
|
||||
}
|
||||
|
||||
function checkaddslashes2($str){
|
||||
if(strpos(str_replace("\'",''," $str"),"'")!=false)
|
||||
return addslashes($str);
|
||||
else
|
||||
return $str;
|
||||
}
|
||||
|
||||
function trimAccent ($strWithAccent) {
|
||||
$strWithAccent = htmlentities(strtolower($strWithAccent ));
|
||||
$strWithAccent = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $strWithAccent );
|
||||
$strWithAccent = preg_replace("/([^a-z0-9]+)/", " ", html_entity_decode($strWithAccent ));
|
||||
$strWithAccent = trim($strWithAccent , "-");
|
||||
return $strWithAccent;
|
||||
}
|
||||
|
||||
//function SRSaufVoyelle ($strIn, $mot1, $mot2) {
|
||||
function str_replace_except_voy($mot1, $mot2, $strIn, $rule=0) {
|
||||
$Voyelle=array('a','e','i','o','u','y', '1', '2', '3', '4');
|
||||
if ($mot1==$mot2) return $strIn;
|
||||
if (strpos($mot2,$mot1)===false)
|
||||
{
|
||||
//foreach ($Voyelle as $k => $voy)
|
||||
$posMot1=strpos($strIn, $mot1);
|
||||
while ($posMot1!==false) {
|
||||
$lettreAV=$strIn[$posMot1-1];
|
||||
$lettreAP=$strIn[$posMot1+strlen($mot1)];
|
||||
//echo "Lettre AV=$lettreAV<br/>";
|
||||
//echo "Lettre AP=$lettreAP<br/>";
|
||||
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
|
||||
( $rule==1 && !in_array($lettreAP, $Voyelle) ) ||
|
||||
( $rule==2 && !in_array($lettreAV, $Voyelle) && !in_array($lettreAP, $Voyelle) ))
|
||||
$strIn=substr($strIn,0,$posMot1) . $mot2 . substr($strIn,$posMot1+strlen($mot1),strlen($strIn));
|
||||
//echo "Le Mot devient : $strIn<br/>";
|
||||
$posMot1=strpos($strIn, $mot1, $posMot1+strlen($mot1));
|
||||
}
|
||||
return $strIn;
|
||||
}
|
||||
//echo "Erreur : $mot2 contient $mot1 !<br>";
|
||||
return $strIn;
|
||||
}
|
||||
|
||||
/** Retourne le phonex d'un mot
|
||||
**/
|
||||
function phonex($strIn) {
|
||||
if ($strIn=='') return 0.0;
|
||||
$tabSonAIA=array('aina', 'eina', 'aima', 'eima');
|
||||
$tabSonAIE=array('ainr', 'eine', 'aime', 'eime');
|
||||
$tabSonAII=array('aini', 'eini', 'aimi', 'eimi');
|
||||
$tabSonAIO=array('aino', 'eino', 'aimo', 'eimo');
|
||||
$tabSonAIU=array('ainu', 'einu', 'aimu', 'eimu');
|
||||
$tabCarPhon=array('1', '2', '3', '4', '5', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z');
|
||||
|
||||
/** On traite tout en minuscule **/
|
||||
$strIn=strtolower($strIn);
|
||||
/** On remplace les 'Y' par des 'I' **/
|
||||
$strIn=str_replace('y', 'i', $strIn);
|
||||
/** On supprime les accents **/
|
||||
$strIn=trimAccent($strIn);
|
||||
/** On retire les 'H' muets sauf ceux précédés par 'C' ou 'S' **/
|
||||
$strIn = preg_replace ('/(?<![CS])H/', '', $strIn);
|
||||
/** On remplace les 'PH' par des 'F' **/
|
||||
$strIn=str_replace('ph', 'f', $strIn);
|
||||
/** On remplace les 'G' par des 'K' devant AN AM AIN AIM **/
|
||||
$strIn=str_replace('gan', 'kan', $strIn);
|
||||
$strIn=str_replace('gain', 'kain', $strIn);
|
||||
$strIn=str_replace('gam', 'kam4', $strIn);
|
||||
$strIn=str_replace('gaim', 'kaim', $strIn);
|
||||
/** On remplace le son AI **/
|
||||
for ($i=0; $i>4; $i++) {
|
||||
$strIn=str_replace($tabSonAIA[$i], 'yna', $strIn);
|
||||
$strIn=str_replace($tabSonAIE[$i], 'yne', $strIn);
|
||||
$strIn=str_replace($tabSonAII[$i], 'yni', $strIn);
|
||||
$strIn=str_replace($tabSonAIO[$i], 'yno', $strIn);
|
||||
$strIn=str_replace($tabSonAIU[$i], 'ynu', $strIn);
|
||||
}
|
||||
/** Remplacement des groupes de 3 lettres **/
|
||||
$strIn=str_replace('eau', 'o', $strIn);
|
||||
$strIn=str_replace('oua', '2', $strIn);
|
||||
$strIn=str_replace('ein', '4', $strIn);
|
||||
$strIn=str_replace('ain', '4', $strIn);
|
||||
/** Remplacement du son 'é' **/
|
||||
$strIn=str_replace('ai', 'y', $strIn);
|
||||
$strIn=str_replace('ei', 'y', $strIn);
|
||||
$strIn=str_replace('er', 'yr', $strIn);
|
||||
$strIn=str_replace('ess', 'yss', $strIn);
|
||||
$strIn=str_replace('et', 'yt', $strIn);
|
||||
$strIn=str_replace('ez', 'yz', $strIn);
|
||||
/** Remplacement des groupes de 2 lettres sauf si voyelle ou son (1 à 4) AVANT **/
|
||||
$strIn=str_replace_except_voy('an', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('am', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('en', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('em', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BEFORE);
|
||||
/** Remplacement du son 'SCH' **/
|
||||
$strIn=str_replace('sch', '5', $strIn);
|
||||
/** Remplacement du 'S' sauf si voyelle ou son (1 à 4) avant ou après **/
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BOTH);
|
||||
/** Remplacement de groupe de 2 lettres diverses **/
|
||||
$strIn=str_replace('oe', 'e', $strIn);
|
||||
$strIn=str_replace('eu', 'e', $strIn);
|
||||
$strIn=str_replace('au', 'o', $strIn);
|
||||
$strIn=str_replace('oi', '2', $strIn);
|
||||
$strIn=str_replace('oy', '2', $strIn);
|
||||
$strIn=str_replace('ou', '3', $strIn);
|
||||
$strIn=str_replace('ch', '5', $strIn);
|
||||
$strIn=str_replace('sh', '5', $strIn);
|
||||
$strIn=str_replace('ss', 's', $strIn);
|
||||
$strIn=str_replace('sc', 's', $strIn);
|
||||
/** Remplacement du 'C' par 'S' s'il est suivi d'un 'E' ou d'un 'I' **/
|
||||
$strIn=str_replace('ce', 'se', $strIn);
|
||||
$strIn=str_replace('ci', 'si', $strIn);
|
||||
/** Remplacement divers **/
|
||||
$strIn=str_replace('c', 'k', $strIn);
|
||||
$strIn=str_replace('q', 'k', $strIn);
|
||||
$strIn=str_replace('qu', 'k', $strIn);
|
||||
|
||||
$strIn=str_replace('ga', 'ka', $strIn);
|
||||
$strIn=str_replace('go', 'ko', $strIn);
|
||||
$strIn=str_replace('gu', 'ku', $strIn);
|
||||
$strIn=str_replace('gy', 'ky', $strIn);
|
||||
$strIn=str_replace('g2', 'k2', $strIn);
|
||||
$strIn=str_replace('g1', 'k1', $strIn);
|
||||
$strIn=str_replace('g3', 'k3', $strIn);
|
||||
|
||||
$strIn=str_replace('a', 'o', $strIn);
|
||||
$strIn=str_replace('d', 't', $strIn);
|
||||
$strIn=str_replace('p', 't', $strIn);
|
||||
$strIn=str_replace('j', 'g', $strIn);
|
||||
$strIn=str_replace('b', 'f', $strIn);
|
||||
$strIn=str_replace('v', 'f', $strIn);
|
||||
$strIn=str_replace('m', 'n', $strIn);
|
||||
|
||||
/** Supression des lettres dupliquées **/
|
||||
$let=$strIn[0];
|
||||
$strIn2=$let;
|
||||
for ($i=1; $i<strlen($strIn); $i++)
|
||||
{ if ($strIn==$let)
|
||||
continue;
|
||||
else {
|
||||
$let=$strIn[$i];
|
||||
$strIn2.=$strIn[$i];
|
||||
}
|
||||
}
|
||||
$strIn=$strIn2;
|
||||
|
||||
/** Supression des terminaisons **/
|
||||
$strIn2=substr($strIn,-1);
|
||||
if ($strIn2=='t' || $strIn2=='k' || $strIn2=='s' || $strIn2=='z')
|
||||
$strIn=substr($strIn,0,-1);
|
||||
|
||||
/** Supression des caractères non autorisés **/
|
||||
$j=10;
|
||||
$sout=array();
|
||||
for ($i=0; $i<strlen($strIn); $i++)
|
||||
{
|
||||
if ($j<1) break;
|
||||
for ($k=0; $k<22; $k++)
|
||||
{
|
||||
if ($strIn[$i]==$tabCarPhon[$k])
|
||||
{
|
||||
$sout[$j]=$k;
|
||||
$j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
print_r($tabCarPhon);
|
||||
|
||||
/** Couversion en flottant **/
|
||||
$result=0.0;
|
||||
for ($j=10; $j>0; $j--)
|
||||
$result+=$sout[$j]*pow($j-1,10);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* CLASS soundex2
|
||||
* soundex2 French version
|
||||
* based on the algorithm described here : http://sqlpro.developpez.com/cours/soundex/ by Frédéric BROUARD
|
||||
*
|
||||
* author Johan Barbier <barbier_johan@hotmail.com>
|
||||
*/
|
||||
class csoundex2 {
|
||||
|
||||
/**
|
||||
* public sString
|
||||
* main string we work on
|
||||
*/
|
||||
var $sString = '';
|
||||
|
||||
/**
|
||||
* vowels replacement array
|
||||
*/
|
||||
var $aReplaceVoy1 = array (
|
||||
'E' => 'A',
|
||||
'I' => 'A',
|
||||
'O' => 'A',
|
||||
'U' => 'A'
|
||||
);
|
||||
|
||||
/**
|
||||
* consonnants replacement array
|
||||
*/
|
||||
var $aReplaceGrp1 = array (
|
||||
'GUI' => 'KI',
|
||||
'GUE' => 'KE',
|
||||
'GA' => 'KA',
|
||||
'GO' => 'KO',
|
||||
'GU' => 'K',
|
||||
'CA' => 'KA',
|
||||
'CO' => 'KO',
|
||||
'CU' => 'KU',
|
||||
'Q' => 'K',
|
||||
'CC' => 'K',
|
||||
'CK' => 'K'
|
||||
);
|
||||
|
||||
/**
|
||||
* other replacement array
|
||||
*/
|
||||
var $aReplaceGrp2 = array (
|
||||
'ASA' => 'AZA',
|
||||
'KN' => 'NN',
|
||||
'PF' => 'FF',
|
||||
'PH' => 'FF',
|
||||
'SCH' => 'SSS'
|
||||
);
|
||||
|
||||
/**
|
||||
* endings replacement array
|
||||
*/
|
||||
var $aEnd = array (
|
||||
'A',
|
||||
'T',
|
||||
'D',
|
||||
'S'
|
||||
);
|
||||
|
||||
/**
|
||||
* public function build
|
||||
* core function of the class, go through the whole process
|
||||
* @Param string sString : the string we want to check
|
||||
*/
|
||||
function build ($sString) {
|
||||
/**
|
||||
* let's check it's a real string...
|
||||
*/
|
||||
if (is_string ($sString) && !empty ($sString)) {
|
||||
$this -> sString = $sString;
|
||||
} else {
|
||||
trigger_error ('Parameter string must not be empty', E_USER_ERROR);
|
||||
}
|
||||
/**
|
||||
* remove starting and ending spaces
|
||||
*/
|
||||
$this -> sString = trim ($this -> sString);
|
||||
/**
|
||||
* remove special french characters
|
||||
*/
|
||||
$this -> trimAccent ();
|
||||
/**
|
||||
* string to upper case
|
||||
*/
|
||||
$this -> sString = strtoupper ($this -> sString );
|
||||
/**
|
||||
* let's remove every space in the string
|
||||
*/
|
||||
$this -> sString = str_replace (' ', '', $this -> sString);
|
||||
/**
|
||||
* let's remove every '-' in the string
|
||||
*/
|
||||
$this -> sString = str_replace ('-', '', $this -> sString);
|
||||
/**
|
||||
* let's process through the first replacement array
|
||||
*/
|
||||
$this -> arrReplace ($this -> aReplaceGrp1);
|
||||
/**
|
||||
* let's process through th vowels replacement
|
||||
*/
|
||||
$sChar = substr ($this -> sString, 0, 1);
|
||||
$this -> sString = substr ($this -> sString, 1, strlen ($this -> sString) - 1);
|
||||
$this -> arrReplace ($this -> aReplaceVoy1);
|
||||
$this -> sString = $sChar.$this -> sString;
|
||||
/**
|
||||
* let's process through the second replacement array
|
||||
*/
|
||||
$this -> arrReplace ($this -> aReplaceGrp2, true);
|
||||
/**
|
||||
* let's remove every 'H' but those prededed by a 'C' or an 'S'
|
||||
*/
|
||||
$this -> sString = preg_replace ('/(?<![CS])H/', '', $this -> sString);
|
||||
/**
|
||||
* let's remove every 'Y' but those preceded by an 'A'
|
||||
*/
|
||||
$this -> sString = preg_replace ('/(?<!A)Y/', '', $this -> sString);
|
||||
/**
|
||||
* remove endings in aEnd
|
||||
*/
|
||||
$length = strlen ($this -> sString) - 1;
|
||||
if (in_array ($this -> sString{$length}, $this -> aEnd)) {
|
||||
$this -> sString = substr ($this -> sString, 0, $length);
|
||||
}
|
||||
/**
|
||||
* let's remove every 'A', but the one at the beginning of the string, if any.
|
||||
*/
|
||||
$sChar = '';
|
||||
if ($this -> sString{0} === 'A') {
|
||||
$sChar = 'A';
|
||||
}
|
||||
$this -> sString = str_replace ('A', '', $this -> sString);
|
||||
$this -> sString = $sChar.$this -> sString;
|
||||
/**
|
||||
* let's have only 1 occurence of each letter
|
||||
*/
|
||||
$this -> sString = preg_replace( '/(.)\1/', '$1', $this -> sString );
|
||||
/**
|
||||
* let's have the final code : a 4 letters string
|
||||
*/
|
||||
$this -> getFinal ();
|
||||
}
|
||||
|
||||
/**
|
||||
* private function getFinal
|
||||
* gets the first 4 letters, pads the string with white space if the string length < 4
|
||||
*/
|
||||
function getFinal () {
|
||||
if (strlen ($this -> sString) < 4) {
|
||||
$this -> sString = str_pad ($this -> sString, 4, ' ', STR_PAD_RIGHT);
|
||||
} else {
|
||||
$this -> sString = substr ($this -> sString, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* private function trimAccent
|
||||
* remove every special French letters
|
||||
*/
|
||||
function trimAccent () {
|
||||
$this -> sString = htmlentities(strtolower($this -> sString ));
|
||||
$this -> sString = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $this -> sString );
|
||||
$this -> sString = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($this -> sString ));
|
||||
$this -> sString = trim($this -> sString , "-");
|
||||
}
|
||||
|
||||
/**
|
||||
* private function arrReplace
|
||||
* replacement method, given an array
|
||||
* @Param array tab : the replacement array to be used
|
||||
* @Param bool pref : if false, just replace keys by values; if true, do the same but only with prefix
|
||||
*/
|
||||
function arrReplace ($tab, $pref = false) {
|
||||
$fromRep = array_keys ($tab);
|
||||
$toRep = array_values ($tab);
|
||||
if (false === $pref) {
|
||||
$this -> sString = str_replace ($fromRep, $toRep, $this -> sString);
|
||||
} else {
|
||||
foreach ($fromRep as $clef => $val) {
|
||||
$length = strlen ($val);
|
||||
if (substr ($this -> sString, 0, $length) === $val) {
|
||||
$this -> sString = substr_replace ($this -> sString, $toRep[$clef], 0, $length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function soundex2($str) {
|
||||
$soundex2 = new csoundex2();
|
||||
|
||||
$soundex2 -> build ($str);
|
||||
return $soundex2 -> sString;
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
<?
|
||||
$tabINDREP=array('B'=>'bis',
|
||||
'T'=>'ter',
|
||||
'Q'=>'quater',
|
||||
'C'=>'quinquies',
|
||||
' '=>'',
|
||||
''=>'');
|
||||
switch($_SESSION['user']) {
|
||||
case 'MHZ': $myEmail='mheitz@scores-decisions.com'; break;
|
||||
case 'JMY': $myEmail='jmartory@scores-decisions.com'; break;
|
||||
case 'YLN': $myEmail='buzuk@scores-decisions.com'; break;
|
||||
}
|
||||
|
||||
?>
|
@ -1,177 +0,0 @@
|
||||
<?
|
||||
|
||||
//include_once(realpath(dirname(__FILE__) . '/timer.php'));
|
||||
|
||||
/** Parse une page Html et retourne son contenu dans un tableau :
|
||||
** "code" => Code réponse Serveur
|
||||
** "header" => Headers du serveur
|
||||
** "body" => Page HTML
|
||||
**/
|
||||
function parse_response($this_response, $err_num, $err_msg) {
|
||||
|
||||
// Split response into header and body sections
|
||||
list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
|
||||
$response_header_lines = explode("\r\n", $response_headers);
|
||||
|
||||
// First line of headers is the HTTP response code
|
||||
$http_response_line = array_shift($response_header_lines);
|
||||
if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
|
||||
if ($response_code==100) {
|
||||
list($response_headers, $response_body) = explode("\r\n\r\n", $response_body, 2);
|
||||
$response_header_lines = explode("\r\n", $response_headers);
|
||||
$http_response_line = array_shift($response_header_lines);
|
||||
if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
|
||||
}
|
||||
|
||||
// put the rest of the headers in an array
|
||||
$response_header_array = array();
|
||||
$nbRMID=0;
|
||||
foreach($response_header_lines as $header_line)
|
||||
{
|
||||
list($header,$value) = explode(': ', $header_line, 2);
|
||||
|
||||
if ($header=='Set-cookie' && substr($value,0,5)=='RMID=' && $nbRMID<5)//{
|
||||
$nbRMID++;
|
||||
// echo ("Je gicle le RMID n°$nbRMID\r\n");}
|
||||
else
|
||||
$response_header_array[$header] .= $value."\n";
|
||||
}
|
||||
/* if ($response_code==100) {
|
||||
print_r($response_headers);
|
||||
// print_r($response_header_lines);
|
||||
}*/
|
||||
return array('code' => $response_code, 'header' => $response_header_array, 'body' => $response_body, 'err_num'=>$err_num, 'err_msg'=>$err_msg);
|
||||
}
|
||||
|
||||
/** Récupère une page HTML en fonction des paramètres :
|
||||
** $url Url distante de la page à récupérer
|
||||
** $strCookies Chaine de caractère contenant les cookies
|
||||
** $postData Tableau des données à passer en POST uniquement
|
||||
** $referer Referer à indiquer lors de l'appel de la page
|
||||
** $debug Activer le débogage (True/False)
|
||||
**
|
||||
** ... et retourne son contenu dans un tableau :
|
||||
** "code" => Code réponse Serveur
|
||||
** "header" => Headers du serveur
|
||||
** "body" => Page HTML
|
||||
**/
|
||||
function getUrl($url, $strCookies='', $postData='', $referer='', $debug=false, $host='', $proxy='', $timeout=0) {
|
||||
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
if ($host=='')
|
||||
$this_header = array('Host: '. HOST_INSEE);
|
||||
else
|
||||
$this_header = array('Host: '. $host);
|
||||
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
if ($proxy<>'') curl_setopt($ch, CURLOPT_PROXY, $proxy);
|
||||
|
||||
if (((int)$timeout)<>0) curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
|
||||
|
||||
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password'); // Pas nécessaire en authentification NT
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
//curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
|
||||
|
||||
$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
||||
curl_setopt($ch, CURLOPT_REFERER, $referer);
|
||||
|
||||
// Add each cookie that has been returned in the response
|
||||
// If cookies need to be added/deleted or value changed, then add code here
|
||||
if ($strCookies!='') {
|
||||
//die('"'.$strCookies.'"');
|
||||
//echo $strCookies."\r\n";
|
||||
$cookies = explode("\n", $strCookies);
|
||||
// Create the basic header
|
||||
foreach($cookies as $this_cookie) {
|
||||
if (trim($this_cookie)<>'')
|
||||
array_push($this_header, 'Cookie: '.$this_cookie);
|
||||
}
|
||||
}
|
||||
|
||||
if ($postData!='') {
|
||||
if (is_array($postData))
|
||||
$post_data=$postData;
|
||||
|
||||
$o="";
|
||||
foreach ($post_data as $k=>$v)
|
||||
{
|
||||
// $o.= "$k=".utf8_encode($v)."&";
|
||||
$o.= "$k=".$v."&";
|
||||
}
|
||||
$post_data=substr($o,0,-1);
|
||||
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
||||
//if in_array('',$this_header
|
||||
// array_push($this_header, "Content-type: application/x-www-form-urlencoded");
|
||||
// array_push($this_header, "Content-Length: ".strlen($post_data));
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
|
||||
//print_r($this_header);
|
||||
|
||||
$page=curl_exec($ch);
|
||||
$response = parse_response($page, curl_errno($ch), curl_error($ch));
|
||||
if ($debug){
|
||||
$url2=str_replace('http://', '', $url);
|
||||
$url2=str_replace('/', '_', $url2);
|
||||
$url2=str_replace('?', '(param)', $url2);
|
||||
$url2=str_replace('&', '(et)', $url2);
|
||||
|
||||
|
||||
$fp=fopen('insee/'. date('Ymd-His') .'-'. microtime_float(true) .'-'. $url2 . '.html', 'a');
|
||||
fwrite($fp, $url."\r\n");
|
||||
fwrite($fp, $page);
|
||||
fclose($fp);
|
||||
//echo strip_tags(html_entity_decode($response['body']), '<td>');
|
||||
}
|
||||
//print_r(curl_getinfo($ch));
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/** Recherche un texte dans une page HTML
|
||||
**
|
||||
**/
|
||||
function getTextInHtml($pageHtml, $strToFind, $strDeb, $strEnd, $include_strDeb=false, $include_strEnd=false, $ltrim=true, $rtrim=true, &$fin, $nbOcc=1) {
|
||||
$tabRet=array();
|
||||
$deb=$nbOccTrouve=0;
|
||||
while( is_int(($deb=strpos($pageHtml,$strToFind,$fin))) ) {
|
||||
$deb++;
|
||||
$deb2 = strpos($pageHtml,$strDeb, $deb);
|
||||
$fin = strpos($pageHtml,$strEnd, $deb2);
|
||||
if (!$include_strDeb)
|
||||
$deb2+=strlen($strDeb);
|
||||
$s_temp = substr($pageHtml, $deb2, ($fin-$deb2));
|
||||
|
||||
if ($ltrim) $s_temp=ltrim($s_temp);
|
||||
if ($rtrim) $s_temp=rtrim($s_temp);
|
||||
|
||||
if ($nbOcc==1) return $s_temp;
|
||||
//echo $s_temp."\r\n";
|
||||
//$a_temp = explode('" class="basic">', $s_temp);
|
||||
$tabUrl[$nbOccTrouve]=$s_temp;
|
||||
$nbOccTrouve++;
|
||||
|
||||
if ($nbOcc==$nbOccTrouve) {
|
||||
// echo "j'ai trouvé le nb demandé, je sort\r\n";
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return $tabUrl;
|
||||
/*<span class="mongrasvert">
|
||||
<li>Le type de voie a été modifié<br>
|
||||
<li>L'orthographe du mot directeur a été modifiée<br>
|
||||
<li>Le code postal a été forcé à partir du département et de la localité<br> </span>
|
||||
*/
|
||||
}
|
||||
|
||||
?>
|
@ -1,820 +0,0 @@
|
||||
<?php
|
||||
/***********************************************************************************************************/
|
||||
/* CLASSE D'AFFICHAGE ET D'ENVOI D'UN FORMULAIRE */
|
||||
/* */
|
||||
/* Auteur : Bernard Martin-Rabaud */
|
||||
/* Email : bernard@ediweb.org */
|
||||
/* */
|
||||
/* Cette classe permet de : */
|
||||
/* - créer un formulaire */
|
||||
/* - le contrôler et l'afficher pour confirmation */
|
||||
/* - et retourner son contenu */
|
||||
/***********************************************************************************************************/
|
||||
|
||||
define("_SEPA_AFFICHE_MULTIPLE", ", ");
|
||||
define("_SEPA_VALEUR_MULTIPLE", "###");
|
||||
$erreur_message = array("min" => "caractères minimum",
|
||||
"max" => "caractères maximum",
|
||||
"texte" => "texte non valide",
|
||||
"alphanum" => "texte alphanumérique non valide",
|
||||
"num" => "valeur numérique non valide",
|
||||
"num-strict" => "valeur numérique non valide",
|
||||
"tel" => "numéro de téléphone non valide",
|
||||
"email" => "e-mail non valide",
|
||||
"url" => "url non valide",
|
||||
"date" => "date non valide",
|
||||
"datej" => "jour non valide",
|
||||
"datem" => "mois non valide",
|
||||
"datem" => "année non valide",
|
||||
"option" => "aucune option n'a été sélectionnée",
|
||||
"vide" => "champ obligatoire");
|
||||
|
||||
class ClasseForm {
|
||||
var $titre;
|
||||
var $montrer_titre;
|
||||
var $champs;
|
||||
var $taille_std;
|
||||
var $pivot_siecle;
|
||||
var $mode_retour;
|
||||
var $confirme;
|
||||
var $mode;
|
||||
var $champ_cour;
|
||||
var $log;
|
||||
var $name;
|
||||
var $closeButton;
|
||||
|
||||
function ClasseForm($titre=null, $confirme=false, $autocomplete="on", $nom='formulaire', $closeButton=false) {
|
||||
$this->titre = $titre;
|
||||
$this->montrer_titre = true;
|
||||
$this->champs = array();
|
||||
$this->taille_std = null;
|
||||
$this->pivot_siecle = 20;
|
||||
$this->mode_retour = "noms & valeurs";
|
||||
$this->confirme = $confirme;
|
||||
if ($autocomplete==false || $autocomplete=="off" || $autocomplete==null)
|
||||
$this->autocomplete = 'off';
|
||||
else
|
||||
$this->autocomplete = 'on';
|
||||
$this->name=$nom;
|
||||
$this->mode = null;
|
||||
$this->champ_cour = 0;
|
||||
$this->log = null;
|
||||
$this->closeButton=$closeButton;
|
||||
}
|
||||
|
||||
|
||||
function afficher() {
|
||||
$resultat = null;
|
||||
echo $this->javascriptSubmit();
|
||||
if (!isset($_POST) || !$_POST || ($_POST["classeform_acces"] == "annuler")) $this->mode = null;
|
||||
else {
|
||||
$this->affecterValeursChamps($_POST);
|
||||
$succes = $this->controler();
|
||||
if ($succes) $this->mode = $_POST["classeform_acces"];
|
||||
else $this->mode = "erreur";
|
||||
}
|
||||
|
||||
switch ($this->mode) {
|
||||
case "confirme" :
|
||||
echo $this->afficherTexte();
|
||||
echo $this->afficherForm(true);
|
||||
break;
|
||||
case "modif" :
|
||||
echo $this->afficherForm();
|
||||
break;
|
||||
case "envoi" :
|
||||
$resultat = $this->retournerTableauValeurs($this->mode_retour);
|
||||
//print_r($resultat);
|
||||
if ($this->log) $this->enregistrerLog($this->retournerTableauValeurs("valeurs", $resultat));
|
||||
break;
|
||||
default :
|
||||
echo $this->afficherForm();
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
|
||||
function ajoutChamp($label, $nom, $type, $format=null, $oblig=true, $min=null, $max=null, $defVal='') {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, $type, $format, $oblig, $min, $max, $defVal);
|
||||
}
|
||||
|
||||
function ajoutChampText($label, $nom, $format=null, $oblig=true, $min=null, $max=null, $defVal='', $ajaxQuery='') {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "text", $format, $oblig, $min, $max, $defVal, $ajaxQuery);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
|
||||
}
|
||||
|
||||
function ajoutChampHidden($nom) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp('', $nom, "hidden");
|
||||
}
|
||||
|
||||
function ajoutChampPassword($label, $nom, $min=null, $max=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "password", "", true, $min, $max);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 100);
|
||||
}
|
||||
|
||||
function ajoutChampTextarea($label, $nom, $format=null, $oblig=true, $min=null, $max=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "textarea", $format, $oblig, $min, $max);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 3);
|
||||
}
|
||||
|
||||
function ajoutChampFile($label, $nom, $oblig=true, $min=null, $max=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "file", "fichier", $oblig, $min, $max);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
|
||||
}
|
||||
|
||||
function ajoutChampSelect($label, $nom, $oblig=true, $taille=null, $multiple=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "select", "", $oblig, null, null);
|
||||
if ($taille) $this->champs[$this->champ_cour]->valCtlLimites($taille, null);
|
||||
if ($multiple) $this->champs[$this->champ_cour]->valMultiple();
|
||||
}
|
||||
|
||||
function ajoutChampRadio($label, $nom, $oblig=true, $fin_ligne=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$args = func_get_args();
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "radio", "", $oblig);
|
||||
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
|
||||
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
|
||||
}
|
||||
|
||||
function ajoutChampCheckbox($label, $nom, $oblig=true, $fin_ligne=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$args = func_get_args();
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "checkbox", "", $oblig);
|
||||
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
|
||||
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
|
||||
}
|
||||
|
||||
function ajoutTexte($texte) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($texte, "", "", "", false);
|
||||
}
|
||||
|
||||
function cacherTitre() {
|
||||
$this->montrer_titre = false;
|
||||
}
|
||||
|
||||
function valTailleStd($taille) {
|
||||
$this->taille_std = $taille;
|
||||
}
|
||||
|
||||
function valPivotSiecle($pivot) {
|
||||
$this->pivot_siecle = $pivot;
|
||||
}
|
||||
|
||||
function valModeRetour($mode) {
|
||||
$this->mode_retour = $mode;
|
||||
}
|
||||
|
||||
function valLog($log) {
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
function valChampFormat($format, $min=null, $max=null) {
|
||||
$this->champs[$this->champ_cour]->valFormat($format, $min, $max);
|
||||
}
|
||||
|
||||
function valChampLimites($min, $max=null) {
|
||||
$this->champs[$this->champ_cour]->valLimites($min, $max);
|
||||
}
|
||||
|
||||
function valChampCtlLimites($min, $max=null) {
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($min, $max);
|
||||
}
|
||||
|
||||
function valChampMultiple() {
|
||||
$this->champs[$this->champ_cour]->valMultiple();
|
||||
}
|
||||
|
||||
function valChampOptions() {
|
||||
if ((func_num_args() == 1) && is_array(func_get_arg(0))) $args = func_get_arg(0);
|
||||
else $args = func_get_args();
|
||||
$this->champs[$this->champ_cour]->valOptions($args);
|
||||
}
|
||||
|
||||
function valChampDescro($descro) {
|
||||
$this->champs[$this->champ_cour]->valDescro($descro);
|
||||
}
|
||||
|
||||
function valChampFinLigne($fin_ligne) {
|
||||
$this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
|
||||
}
|
||||
|
||||
function valChampOption1Vide($option_vide) {
|
||||
$this->champs[$this->champ_cour]->valOption1Vide($option_vide);
|
||||
}
|
||||
|
||||
|
||||
function afficherForm($cache=false) {
|
||||
$html = "<form method='post' action='javascript:location.href' name='$this->name' 'id='$this->name' autocomplete='$this->autocomplete'>\n";
|
||||
$html .= "<fieldset>\n";
|
||||
$html .= "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
|
||||
if ($this->titre && $this->montrer_titre && !$cache)
|
||||
$html .= "<caption class='form-caption'>$this->titre" . (($this->mode == "erreur") ? " <span class='erreur'>(erreurs)</span>" : "") . "</caption>\n";
|
||||
else if (($this->mode == "erreur"))
|
||||
$html .= "<caption class='form-caption'><span class='erreur'>(erreurs)</span></caption>\n";
|
||||
for ($i=0;$i<sizeof($this->champs);$i++) {
|
||||
if ($cache) $html .= $this->champs[$i]->afficherFormCache();
|
||||
else $html .= $this->champs[$i]->afficherForm();
|
||||
}
|
||||
if ($valeurs) $html .= $this->afficherBoutonsForm();
|
||||
else $html .= $this->afficherBoutonsForm();
|
||||
if ($this->existeChampFacultatif())
|
||||
$html .= "<tr><td class='form-info-obligatoire' colspan='2'> </td></tr>";
|
||||
$html .= "</fieldset></table></form>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherBoutonsForm() {
|
||||
if (($this->mode == null) || ($this->mode == "erreur")) {
|
||||
if ($this->confirme)
|
||||
$html = "<tr><td><input type='hidden' name='classeform_acces' value='confirme' /></td>";
|
||||
else $html = "<tr><td><input type='hidden' name='classeform_acces' value='envoi' /></td>";
|
||||
}
|
||||
else $html = "<tr><td><input type='hidden' name='classeform_acces' /></td>";
|
||||
$html .= "<td><input class='form-bouton' type='button' value='Envoyer' onClick='soumettre(\"envoi\")'/>";
|
||||
if ($this->confirme) {
|
||||
if ($this->mode == "confirme") {
|
||||
$html .= " <input class='form-bouton' type='button' value='Modifier'";
|
||||
$html .= " onClick='soumettre(\"modif\")'; />";
|
||||
}
|
||||
else {
|
||||
$html .= " <input class='form-bouton' type='button' value='Voir avant envoi'";
|
||||
$html .= " onClick='soumettre(\"confirme\")'; />";
|
||||
}
|
||||
}
|
||||
$html .= " <input class='form-bouton' type='reset' value='Rétablir' onClick='soumettre(\"annuler\")' />\n";
|
||||
if ($this->closeButton)
|
||||
$html .= " <input class='form-bouton' type='button' value='Annuler & Fermer' onClick='soumettre(\"fermer\")' />\n";
|
||||
$html .= "</td></tr>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherTexte() {
|
||||
$html = "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
|
||||
if ($this->titre) $html .= "<caption class='form-caption'>$this->titre</caption>\n";
|
||||
for ($i=0;$i<sizeof($this->champs);$i++)
|
||||
$html .= $this->champs[$i]->afficherTexte();
|
||||
$html .= "</table>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function javascriptSubmit() {
|
||||
$html = "<script language='JavaScript'>\n";
|
||||
$html .= "<!-- \n";
|
||||
$html .= "function soumettre(acces) {\n";
|
||||
$html .= " if (acces=='fermer') self.close();\n";
|
||||
$html .= " else {\n";
|
||||
$html .= " with (document.forms[0]) {\n";
|
||||
$html .= " classeform_acces.value=acces; action=location.href; submit();\n";
|
||||
$html .= " }\n";
|
||||
$html .= " }\n";
|
||||
$html .= "}\n";
|
||||
$html .= "// -->\n";
|
||||
$html .= "</script>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function controler() {
|
||||
$succes = true;
|
||||
for ($i=0;$i<sizeof($this->champs);$i++) {
|
||||
$this->champs[$i]->valeur_db=$this->champs[$i]->valeur;
|
||||
if ( $this->champs[$i]->aControler() && ($this->champs[$i]->controler($this->pivot_siecle) == false) ) {
|
||||
$succes = false;
|
||||
}
|
||||
}
|
||||
return $succes;
|
||||
}
|
||||
|
||||
function affecterValeursChamps($valeurs) {
|
||||
$valeurs = convertirPost($valeurs);
|
||||
for ($i=0;$i<sizeof($this->champs);$i++)
|
||||
$this->champs[$i]->affecterValeur($valeurs);
|
||||
}
|
||||
|
||||
function retournerTableauValeurs($mode_retour) {
|
||||
$retour = array();
|
||||
for ($i=0;$i<sizeof($this->champs);$i++)
|
||||
{// echo "------------------------------------\r\n$i : \r\n";
|
||||
//print_r($this->champs);
|
||||
//print_r($this->champs[$i]);
|
||||
//echo "\r\n\r\n";
|
||||
$this->champs[$i]->retournerTableauValeurs(&$retour, $mode_retour);}
|
||||
|
||||
return $retour;
|
||||
}
|
||||
|
||||
function envoyerMail() {
|
||||
$mail = new ClasseMail($this->titre);
|
||||
$mail->contenu = $this->champs;
|
||||
return $mail->envoyer($this->cible);
|
||||
}
|
||||
|
||||
function existeChampFacultatif() {
|
||||
$ok = false;
|
||||
for ($i=0;$i<sizeof($this->champs);$i++) {
|
||||
if ($this->champs[$i]->type && !$this->champs[$i]->valObligatoire()) {
|
||||
$ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
function enregistrerLog($valeurs, $resultat) {
|
||||
if ($f = fopen($this->log, "a")) {
|
||||
$texte = ($resultat ? "" : "ECHEC ") . "[ " . date("d/mY H:i:s") . " ] - ";
|
||||
$texte .= $this->titre ? "$this->titre - " : "";
|
||||
$texte .= $valeurs;
|
||||
fputs($f, $texte);
|
||||
fclose($f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ClasseFormChamp {
|
||||
var $label;
|
||||
var $nom;
|
||||
var $type;
|
||||
var $format;
|
||||
var $oblig;
|
||||
var $taille_max;
|
||||
var $taille_min;
|
||||
var $valeur;
|
||||
var $options;
|
||||
var $descro;
|
||||
var $multiple;
|
||||
var $fonction;
|
||||
var $ctl_taille1;
|
||||
var $ctl_taille2;
|
||||
var $fin_ligne;
|
||||
var $erreur;
|
||||
var $valeur_defaut;
|
||||
var $valeur_db;
|
||||
var $ajaxQuey;
|
||||
|
||||
function ClasseFormChamp($label, $nom, $type=null, $format=null, $oblig=true, $min=null, $max=null, $valDef='', $ajaxQuery='') {
|
||||
$this->label = $label;
|
||||
$this->nom = $nom;
|
||||
$this->type = $type;
|
||||
$this->format = $format;
|
||||
$this->taille_min = $min;
|
||||
$this->taille_max = $max;
|
||||
$this->oblig = $oblig;
|
||||
if (($type == "select") || ($type == "checkbox") || ($type == "radio")) {
|
||||
$this->valeur = array();
|
||||
$this->options = array();
|
||||
}
|
||||
else {
|
||||
$this->valeur = null;
|
||||
$this->options = null;
|
||||
}
|
||||
$this->descro = null;
|
||||
if ($type == "checkbox") $this->multiple = true;
|
||||
else $this->multiple = false;
|
||||
$this->fonction = null;
|
||||
$this->ctl_taille1 = null;
|
||||
$this->ctl_taille2 = null;
|
||||
$this->fin_ligne = null;
|
||||
$this->erreur = null;
|
||||
$this->valeur_defaut = $valDef;
|
||||
$this->ajaxQuey = $ajaxQuery;
|
||||
// $this->valeur_db=$this->valeur;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function valObligatoire() {
|
||||
if ($this->oblig) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function valFormat($format, $long_min=null, $long_max=null) {
|
||||
if ($this->type == "text") {
|
||||
$this->format = $format;
|
||||
if ($long_min) $this->taille_min = $long_min;
|
||||
if ($long_max) $this->taille_max = $long_max;
|
||||
}
|
||||
}
|
||||
|
||||
function valLimites($min, $max) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
|
||||
$this->taille_min = $min;
|
||||
$this->taille_max = $max;
|
||||
}
|
||||
}
|
||||
|
||||
function valCtlLimites($taille1, $taille2) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "select") || ($this->type == "file")) {
|
||||
$this->ctl_taille1 = $taille1;
|
||||
if ($taille2 && ($this->type != "select")) $this->ctl_taille2 = $taille2;
|
||||
}
|
||||
}
|
||||
|
||||
function valFonction($fonction) {
|
||||
$this->fonction = $fonction;
|
||||
}
|
||||
|
||||
function valDescro($descro) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
|
||||
$this->descro = $descro;
|
||||
}
|
||||
}
|
||||
|
||||
function valMultiple() {
|
||||
if ($this->type == "select") $this->multiple = true;
|
||||
}
|
||||
|
||||
function valFinLigne($fin_ligne) {
|
||||
if (($this->type == "radio") || ($this->type == "checkbox")) $this->fin_ligne = $fin_ligne;
|
||||
}
|
||||
|
||||
function valOptions($options) {
|
||||
if ($this->champAOptions()) {
|
||||
if (is_array($options)) {
|
||||
foreach ($options as $option) {
|
||||
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $option, $regs))
|
||||
$this->options[] = new ClasseFormOption($regs[1], true);
|
||||
else $this->options[] = new ClasseFormOption($option);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $options, $regs))
|
||||
$this->options[] = new ClasseFormOption($regs[1], true);
|
||||
else $this->options[] = new ClasseFormOption($options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ValOption1Vide($option_vide) {
|
||||
if ($this->type == "select") $this->fin_ligne = $option_vide;
|
||||
}
|
||||
|
||||
|
||||
function afficherForm() {
|
||||
if (!$this->type) $html = "<tr><td class='form-label' colspan='2'>$this->label</td></tr>";
|
||||
else {
|
||||
if (!is_null($this->erreur))
|
||||
$html = "<tr><td class='form-label-erreur'> > $this->label (<font size='-2'>$this->erreur</font>)</td>";
|
||||
else if ($this->oblig) $html = "<tr><td class='form-label-obligatoire'>$this->label</td>";
|
||||
else $html .= "<tr><td class='form-label-facultatif'>$this->label</td>";
|
||||
$html .= "<td class='form-td'>";
|
||||
switch ($this->type) {
|
||||
case "text" : $html .= $this->afficherFormTexte();
|
||||
break;
|
||||
case "password" : $html .= $this->afficherFormPassword();
|
||||
break;
|
||||
case "textarea" : $html .= $this->afficherFormTextarea();
|
||||
break;
|
||||
case "select" : $html .= $this->afficherFormSelect();
|
||||
break;
|
||||
case "radio" : $html .= $this->afficherFormRadio();
|
||||
break;
|
||||
case "checkbox" : $html .= $this->afficherFormCheckbox();
|
||||
break;
|
||||
case "file" : $html .= $this->afficherFormFile();
|
||||
break;
|
||||
case "hidden" : $html .= $this->afficherFormCache();
|
||||
break;
|
||||
}
|
||||
$html .= "</td></tr>\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormCache() {
|
||||
$html = "<input type='hidden' name='$this->nom' id='$this->nom'";
|
||||
if (is_array($this->valeur)) {
|
||||
$chaine = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
|
||||
$html .= " value=\"" . $chaine . "\" />\n";
|
||||
}
|
||||
else $html .= " value=\"" . $this->valeur . "\" />\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherTexte() {
|
||||
$html = "<tr><td class='form-label'>$this->label</td><td class='form-td'>";
|
||||
if (is_array($this->valeur)) {
|
||||
$chaine = implode(_SEPA_AFFICHE_MULTIPLE, $this->valeur);
|
||||
$html .= $chaine;
|
||||
}
|
||||
else $html .= $this->valeur;
|
||||
$html .= "</td></tr>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function champAOptions() {
|
||||
if (($this->type == "select") || ($this->type == "checkbox") || ($this->type == "radio")) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controler($pivot=null) {
|
||||
global $erreur_message;
|
||||
//$this->valeur_db=$this->valeur;
|
||||
if ($this->type) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
|
||||
$this->controlerChampTexte($pivot);
|
||||
if (is_null($this->erreur)) return true;
|
||||
else return false;
|
||||
}
|
||||
else if (($this->type == "select") || ($this->type == "radio")) {
|
||||
if (!$this->valeur || (sizeof($this->valeur) == 0)) {
|
||||
$this->erreur = $erreur_message["option"];
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
|
||||
function aControler() {
|
||||
if ($this->type && $this->oblig) return true;
|
||||
else return false;
|
||||
//return true;
|
||||
}
|
||||
|
||||
function retournerTableauValeurs(&$tableau, $mode_retour) {
|
||||
if (is_array($this->valeur)) {$valeur = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
|
||||
print_r($this->valeur);
|
||||
die('Cas non géré dans inc_classeform.php');
|
||||
}
|
||||
else $valeur = $this->valeur_db;
|
||||
|
||||
switch ($mode_retour) {
|
||||
case "noms & valeurs" :
|
||||
$tableau[$this->nom] = $valeur;
|
||||
break;
|
||||
case "labels & valeurs" :
|
||||
$tableau[$this->label] = $valeur;
|
||||
break;
|
||||
case "valeurs" :
|
||||
$tableau[] = $valeur;
|
||||
}
|
||||
//echo '$this->nom='.$this->nom.', $valeur='.$valeur."\r\n";
|
||||
}
|
||||
|
||||
function affecterValeur($valeurs) {
|
||||
$valeur = $valeurs[$this->nom];
|
||||
if ($this->champAOptions()) {
|
||||
if (strpos($valeur, _SEPA_VALEUR_MULTIPLE) !== false)
|
||||
$this->valeur = explode(_SEPA_VALEUR_MULTIPLE, $valeur);
|
||||
else $this->valeur = $valeur;
|
||||
for ($i=0;$i<sizeof($this->options);$i++)
|
||||
$this->options[$i]->selectionnerSiValeur($this->valeur);
|
||||
}
|
||||
else $this->valeur = $valeur;
|
||||
}
|
||||
|
||||
|
||||
function controlerChampTexte($pivot) {
|
||||
global $erreur_message;
|
||||
if (trim($this->valeur) == "") $this->erreur = $erreur_message["vide"];
|
||||
else {
|
||||
$this->erreur = champTexteConforme($this->valeur, $this->taille_min, $this->taille_max);
|
||||
if (is_null($this->erreur) && $this->format) {
|
||||
switch ($this->format) {
|
||||
case "alphanum" :
|
||||
if (!controlerAlphanum($this->valeur)) $this->erreur = $erreur_message["alphanum"];
|
||||
break;
|
||||
case "num" :
|
||||
if (!controlerNum($this->valeur)) $this->erreur = $erreur_message["num"];
|
||||
break;
|
||||
case "num-strict" :
|
||||
if (!controlerNum($this->valeur, true)) $this->erreur = $erreur_message["num"];
|
||||
break;
|
||||
case "tel" :
|
||||
if (!controlerTel($this->valeur)) $this->erreur = $erreur_message["tel"];
|
||||
break;
|
||||
case "email" :
|
||||
if (!controlerEmail($this->valeur)) $this->erreur = $erreur_message["email"];
|
||||
break;
|
||||
case "date" :
|
||||
if (!controlerDate($this->valeur, $pivot)) $this->erreur = $erreur_message["date"];
|
||||
|
||||
$tmp=explode('/', $this->valeur);
|
||||
if ($tmp[0]*1<10) $date_j='0'.$tmp[0]*1; else $date_j=''.$tmp[0]*1;
|
||||
if ($date_j*1 < 1 || $date_j>31) $this->erreur = $erreur_message["datej"];
|
||||
if ($tmp[1]*1<10) $date_m='0'.$tmp[1]*1; else $date_m=''.$tmp[1]*1;
|
||||
if ($date_m*1 < 1 || $date_m>12) $this->erreur = $erreur_message["datem"];
|
||||
$date_a=''.$tmp[2]*1;
|
||||
if ($date_a*1 < 1890 || $date_a>date('Y')) $this->erreur = $erreur_message["datea"];
|
||||
$this->valeur_db=$date_a.'-'.$date_m.'-'.$date_j;
|
||||
break;
|
||||
case "url" :
|
||||
if (!controlerUrl($this->valeur)) $this->erreur = $erreur_message["url"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function afficherFormTexte() {
|
||||
$html .= "<input class='form-input' type='text' name='$this->nom' size='$this->ctl_taille1' ";
|
||||
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
|
||||
if ($this->valeur) $html .= ' value="' . $this->valeur . '" />';
|
||||
else if ($this->valeur_defaut) $html .= ' value="' . $this->valeur_defaut . '" />';
|
||||
else if ($this->descro) { $html .= ' value="' . htmlentities(stripslashes($this->descro), ENT_QUOTES) . '"';
|
||||
$html .= " onFocus='this.value=\"\"' />";
|
||||
}
|
||||
elseif ($this->ajaxQuey) $html .= " id='$this->nom' onkeyup=\"loadData('$this->nom');\" />
|
||||
<ul id='zoneResultats_$this->nom' style='visibility: hidden;'></ul>";
|
||||
else $html .= ' value="" />';
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormPassword() {
|
||||
$html .= "<input class='form-input' type='password' name='$this->nom' size='$this->ctl_taille1'";
|
||||
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
|
||||
if ($this->valeur) $html .= ' value="' . $this->valeur . '" />';
|
||||
else if ($this->descro) {
|
||||
$html .= ' value="' . htmlentities(stripslashes($this->descro), ENT_QUOTES) . '"';
|
||||
$html .= " onFocus='this.value=\"\"' />";
|
||||
}
|
||||
else $html .= " value='' />";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormTextarea() {
|
||||
$html .= "<textarea class='form-input' name='$this->nom' cols='$this->ctl_taille1'";
|
||||
if ($this->ctl_taille2) $html .= " rows='$this->ctl_taille2'";
|
||||
else if ($this->taille_max) {
|
||||
$rows = ceil($this->taille_max / $taille_std);
|
||||
$html .= " rows='$rows'";
|
||||
}
|
||||
else $html .= " rows='3'";
|
||||
if ((trim($this->valeur) == "") || $this->descro) $html .= " onFocus='this.value=\"\"'>";
|
||||
else $html .= ">";
|
||||
if (trim($this->valeur)) $html .= $this->valeur;
|
||||
else if ($this->descro) $html .= htmlentities(stripslashes($this->descro), ENT_QUOTES);
|
||||
$html .= "</textarea>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormSelect() {
|
||||
$html = "<select name='$this->nom" . ($this->multiple ? "[]'" : "'");
|
||||
if ($this->fin_ligne && $this->multiple)
|
||||
$html .= " size='" . (($this->ctl_taille1 >= 2) ? $this->ctl_taille1 : 2 ) . "'";
|
||||
else $html .= " size='" . ($this->ctl_taille1 ? $this->ctl_taille1 : 1) . "'";
|
||||
$html .= $this->multiple ? " multiple>\n" : ">\n";
|
||||
if ($this->fin_ligne) {
|
||||
$html .= "<option class='form-option-entete' value=''>$this->fin_ligne</option>\n";
|
||||
}
|
||||
for ($i=0;$i<sizeof($this->options);$i++)
|
||||
$html .= $this->options[$i]->afficherFormSelect();
|
||||
$html .= "</select>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormRadio() {
|
||||
for ($i=0;$i<sizeof($this->options);$i++) {
|
||||
$html .= $this->options[$i]->afficherFormCase("radio", $this->nom, $this->oblig);
|
||||
$html .= $this->fin_ligne ? "<br />" : " ";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormCheckbox() {
|
||||
for ($i=0;$i<sizeof($this->options);$i++) {
|
||||
$html .= $this->options[$i]->afficherFormCase("checkbox", "$this->nom[]", $this->oblig);
|
||||
$html .= $this->fin_ligne ? "<br />" : " ";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormFile() {
|
||||
$html .= "<input class='form-input' type='file' name='$this->nom' size='$this->ctl_taille1'";
|
||||
if ($this->taille_max) $html .= " maxlength='$this->ctl_taille2'";
|
||||
if ($this->descro) $html .= " value='$this->descro' onChange='this.value=\"\"' />";
|
||||
else $html .= " value='' />";
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ClasseFormOption {
|
||||
var $valeur;
|
||||
var $selection;
|
||||
|
||||
function ClasseFormOption($val, $selec=false) {
|
||||
$this->valeur = htmlspecialchars(stripslashes($val), ENT_QUOTES);
|
||||
$this->selection = $selec;
|
||||
}
|
||||
|
||||
|
||||
function afficherFormSelect() {
|
||||
echo "<!--Valeur du select='$this->valeur'-->";
|
||||
if (strpos($this->valeur,':')>0) {
|
||||
$tab=explode(':', $this->valeur);
|
||||
$html = '<option value="'.$tab[0] .'"' . ($this->selection ? ' selected>' : '>');
|
||||
$html .= $tab[1]."</option>\n";
|
||||
}
|
||||
else {
|
||||
$html = '<option value="'. $this->valeur .'"' . ($this->selection ? ' selected>' : '>');
|
||||
$html .= "$this->valeur</option>\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormCase($type, $nom, $oblig) {
|
||||
$html = "<input type='$type' name='$nom' value=\"$this->valeur\"";
|
||||
$html .= ($this->selection) ? " checked />" : " />";
|
||||
if ($oblig) $html .= "<span class='form-input-obligatoire'>" . $this->valeur . "<span>";
|
||||
else $html .= "<span class='form-input-facultatif'>" . $this->valeur . "<span>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function selectionnerSiValeur($valeurs) {
|
||||
if (is_array($valeurs)) {
|
||||
if (in_array($this->valeur, $valeurs)) $this->selection = true;
|
||||
else $this->selection = false;
|
||||
}
|
||||
else if ($this->valeur == $valeurs) $this->selection = true;
|
||||
else $this->selection = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function controlerEmail($valeur) {
|
||||
if (preg_match("/^[\w|-]+(\.[\w|-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerDate($valeur, $pivot) {
|
||||
if (preg_match("/^(\d{1,2})[\/|\-|\.](\d{1,2})[\/|\-|\.](\d\d)(\d\d)?$/", $valeur, $regs)) {
|
||||
$jour = ($regs[1] < 10) ? "0".$regs[1] : $regs[1];
|
||||
$mois = ($regs[2] < 10) ? "0".$regs[2] : $regs[2];
|
||||
if ($regs[4]) $an = $regs[3] . $regs[4];
|
||||
else {
|
||||
if ($pivot) {
|
||||
if ($regs[3] <= $pivot) $an = $regs[3] + 2000;
|
||||
else $an = $regs[3] + 1900;
|
||||
}
|
||||
else $an = $regs[3] + 2000;
|
||||
}
|
||||
if (checkdate($mois, $jour, $an)) return true;
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerUrl($valeur) {
|
||||
if (ereg("^((http|ftp):\/\/)?([0-9a-z_]+[\.\-])+[0-9a-z]+(\/[0-9a-z_]+)*(\/[0-9a-z_]+\.[0-9a-z]+)?$", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerAlphanum($valeur) {
|
||||
//if (preg_match("/^[\w|\d|\s|'|\"|\\|,|\.|\-|&|#|;]+$/", $valeur)) return true;
|
||||
//else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function controlerNum($valeur, $strict=false) {
|
||||
if ($strict) {
|
||||
if (ereg("^[0-9]+$", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
else if (preg_match("/^[\d|\s|\-|\+|E|e|,|\.]+$/", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerTel($valeur) {
|
||||
if (preg_match("/^[\d|\s|\-|\.|\(|\)]+$/", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function champTexteConforme($valeur, $min, $max) {
|
||||
global $erreur_message;
|
||||
if ($min && (strlen($valeur) < $min)) return $min . " " . $erreur_message["min"];
|
||||
else if ($max && (strlen($valeur) > $max)) return $max . " " . $erreur_message["max"];
|
||||
else if (preg_match('/(.)\1{4,}/', $valeur)) return $erreur_message["texte"];
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
||||
function convertirPost($post) {
|
||||
$result = array();
|
||||
foreach ($post as $cle => $valeur) {
|
||||
if (is_array($valeur)) {
|
||||
for ($i=0;$i<sizeof($valeur);$i++)
|
||||
$result[$cle][] = stripslashes($valeur[$i]);//htmlspecialchars(, ENT_QUOTES);
|
||||
}
|
||||
else $result[$cle] =stripslashes($valeur);// htmlspecialchars(stripslashes(), ENT_QUOTES);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,764 +0,0 @@
|
||||
<?php
|
||||
/***********************************************************************************************************/
|
||||
/* CLASSE D'AFFICHAGE ET D'ENVOI D'UN FORMULAIRE */
|
||||
/* */
|
||||
/* Auteur : Bernard Martin-Rabaud */
|
||||
/* Email : bernard@ediweb.org */
|
||||
/* */
|
||||
/* Cette classe permet de : */
|
||||
/* - créer un formulaire */
|
||||
/* - le contrôler et l'afficher pour confirmation */
|
||||
/* - et retourner son contenu */
|
||||
/***********************************************************************************************************/
|
||||
|
||||
define("_SEPA_AFFICHE_MULTIPLE", ", ");
|
||||
define("_SEPA_VALEUR_MULTIPLE", "###");
|
||||
$erreur_message = array("min" => "caractères minimum",
|
||||
"max" => "caractères maximum",
|
||||
"texte" => "texte non valide",
|
||||
"alphanum" => "texte alphanumérique non valide",
|
||||
"num" => "valeur numérique non valide",
|
||||
"num-strict" => "valeur numérique non valide",
|
||||
"tel" => "numéro de téléphone non valide",
|
||||
"email" => "e-mail non valide",
|
||||
"url" => "url non valide",
|
||||
"date" => "date non valide",
|
||||
"option" => "aucune option n'a été sélectionnée",
|
||||
"vide" => "champ obligatoire");
|
||||
|
||||
class ClasseForm {
|
||||
var $titre;
|
||||
var $montrer_titre;
|
||||
var $champs;
|
||||
var $taille_std;
|
||||
var $pivot_siecle;
|
||||
var $mode_retour;
|
||||
var $confirme;
|
||||
var $mode;
|
||||
var $champ_cour;
|
||||
var $log;
|
||||
|
||||
function ClasseForm($titre=null, $confirme=false) {
|
||||
$this->titre = $titre;
|
||||
$this->montrer_titre = true;
|
||||
$this->champs = array();
|
||||
$this->taille_std = null;
|
||||
$this->pivot_siecle = 20;
|
||||
$this->mode_retour = "noms & valeurs";
|
||||
$this->confirme = $confirme;
|
||||
$this->mode = null;
|
||||
$this->champ_cour = 0;
|
||||
$this->log = null;
|
||||
}
|
||||
|
||||
|
||||
function afficher() {
|
||||
$resultat = null;
|
||||
echo $this->javascriptSubmit();
|
||||
if (!isset($_POST) || !$_POST || ($_POST["classeform_acces"] == "annuler")) $this->mode = null;
|
||||
else {
|
||||
$this->affecterValeursChamps($_POST);
|
||||
$succes = $this->controler();
|
||||
if ($succes) $this->mode = $_POST["classeform_acces"];
|
||||
else $this->mode = "erreur";
|
||||
}
|
||||
|
||||
switch ($this->mode) {
|
||||
case "confirme" :
|
||||
echo $this->afficherTexte();
|
||||
echo $this->afficherForm(true);
|
||||
break;
|
||||
case "modif" :
|
||||
echo $this->afficherForm();
|
||||
break;
|
||||
case "envoi" :
|
||||
$resultat = $this->retournerTableauValeurs($this->mode_retour);
|
||||
if ($this->log) $this->enregistrerLog($this->retournerTableauValeurs("valeurs", $resultat));
|
||||
break;
|
||||
default :
|
||||
echo $this->afficherForm();
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
|
||||
function ajoutChamp($label, $nom, $type, $format=null, $oblig=true, $min=null, $max=null, $defVal='') {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, $type, $format, $oblig, $min, $max, $defVal);
|
||||
}
|
||||
|
||||
function ajoutChampText($label, $nom, $format=null, $oblig=true, $min=null, $max=null, $defVal='') {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "text", $format, $oblig, $min, $max, $defVal);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
|
||||
}
|
||||
|
||||
function ajoutChampPassword($label, $nom, $min=null, $max=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "password", "", true, $min, $max);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 100);
|
||||
}
|
||||
|
||||
function ajoutChampTextarea($label, $nom, $format=null, $oblig=true, $min=null, $max=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "textarea", $format, $oblig, $min, $max);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 3);
|
||||
}
|
||||
|
||||
function ajoutChampFile($label, $nom, $oblig=true, $min=null, $max=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "file", "fichier", $oblig, $min, $max);
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($this->taille_std, 256);
|
||||
}
|
||||
|
||||
function ajoutChampSelect($label, $nom, $oblig=true, $taille=null, $multiple=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "select", "", $oblig, null, null);
|
||||
if ($taille) $this->champs[$this->champ_cour]->valCtlLimites($taille, null);
|
||||
if ($multiple) $this->champs[$this->champ_cour]->valMultiple();
|
||||
}
|
||||
|
||||
function ajoutChampRadio($label, $nom, $oblig=true, $fin_ligne=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$args = func_get_args();
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "radio", "", $oblig);
|
||||
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
|
||||
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
|
||||
}
|
||||
|
||||
function ajoutChampCheckbox($label, $nom, $oblig=true, $fin_ligne=null) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$args = func_get_args();
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($label, $nom, "checkbox", "", $oblig);
|
||||
if ($fin_ligne) $this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
|
||||
if (sizeof($args) > 4) $this->champs[$this->champ_cour]->valOptions(array_slice($args, 4));
|
||||
}
|
||||
|
||||
function ajoutTexte($texte) {
|
||||
$this->champ_cour = sizeof($this->champs);
|
||||
$this->champs[$this->champ_cour] = new ClasseFormChamp($texte, "", "", "", false);
|
||||
}
|
||||
|
||||
function cacherTitre() {
|
||||
$this->montrer_titre = false;
|
||||
}
|
||||
|
||||
function valTailleStd($taille) {
|
||||
$this->taille_std = $taille;
|
||||
}
|
||||
|
||||
function valPivotSiecle($pivot) {
|
||||
$this->pivot_siecle = $pivot;
|
||||
}
|
||||
|
||||
function valModeRetour($mode) {
|
||||
$this->mode_retour = $mode;
|
||||
}
|
||||
|
||||
function valLog($log) {
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
function valChampFormat($format, $min=null, $max=null) {
|
||||
$this->champs[$this->champ_cour]->valFormat($format, $min, $max);
|
||||
}
|
||||
|
||||
function valChampLimites($min, $max=null) {
|
||||
$this->champs[$this->champ_cour]->valLimites($min, $max);
|
||||
}
|
||||
|
||||
function valChampCtlLimites($min, $max=null) {
|
||||
$this->champs[$this->champ_cour]->valCtlLimites($min, $max);
|
||||
}
|
||||
|
||||
function valChampMultiple() {
|
||||
$this->champs[$this->champ_cour]->valMultiple();
|
||||
}
|
||||
|
||||
function valChampOptions() {
|
||||
if ((func_num_args() == 1) && is_array(func_get_arg(0))) $args = func_get_arg(0);
|
||||
else $args = func_get_args();
|
||||
$this->champs[$this->champ_cour]->valOptions($args);
|
||||
}
|
||||
|
||||
function valChampDescro($descro) {
|
||||
$this->champs[$this->champ_cour]->valDescro($descro);
|
||||
}
|
||||
|
||||
function valChampFinLigne($fin_ligne) {
|
||||
$this->champs[$this->champ_cour]->valFinLigne($fin_ligne);
|
||||
}
|
||||
|
||||
function valChampOption1Vide($option_vide) {
|
||||
$this->champs[$this->champ_cour]->valOption1Vide($option_vide);
|
||||
}
|
||||
|
||||
|
||||
function afficherForm($cache=false) {
|
||||
$html = "<form method='post' action='javascript:location.href'>\n";
|
||||
$html .= "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
|
||||
if ($this->titre && $this->montrer_titre && !$cache)
|
||||
$html .= "<caption class='form-caption'>$this->titre" . (($this->mode == "erreur") ? " <span class='erreur'>(erreurs)</span>" : "") . "</caption>\n";
|
||||
else if (($this->mode == "erreur"))
|
||||
$html .= "<caption class='form-caption'><span class='erreur'>(erreurs)</span></caption>\n";
|
||||
for ($i=0;$i<sizeof($this->champs);$i++) {
|
||||
if ($cache) $html .= $this->champs[$i]->afficherFormCache();
|
||||
else $html .= $this->champs[$i]->afficherForm();
|
||||
}
|
||||
if ($valeurs) $html .= $this->afficherBoutonsForm();
|
||||
else $html .= $this->afficherBoutonsForm();
|
||||
if ($this->existeChampFacultatif())
|
||||
$html .= "<tr><td class='form-info-obligatoire' colspan='2'> </td></tr>";
|
||||
$html .= "</table></form>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherBoutonsForm() {
|
||||
if (($this->mode == null) || ($this->mode == "erreur")) {
|
||||
if ($this->confirme)
|
||||
$html = "<tr><td><input type='hidden' name='classeform_acces' value='confirme' /></td>";
|
||||
else $html = "<tr><td><input type='hidden' name='classeform_acces' value='envoi' /></td>";
|
||||
}
|
||||
else $html = "<tr><td><input type='hidden' name='classeform_acces' /></td>";
|
||||
$html .= "<td><input class='form-bouton' type='button' value='Envoyer' onClick='soumettre(\"envoi\")'/>";
|
||||
if ($this->confirme) {
|
||||
if ($this->mode == "confirme") {
|
||||
$html .= " <input class='form-bouton' type='button' value='Modifier'";
|
||||
$html .= " onClick='soumettre(\"modif\")'; />";
|
||||
}
|
||||
else {
|
||||
$html .= " <input class='form-bouton' type='button' value='Voir avant envoi'";
|
||||
$html .= " onClick='soumettre(\"confirme\")'; />";
|
||||
}
|
||||
}
|
||||
$html .= " <input class='form-bouton' type='reset' value='Annuler' onClick='soumettre(\"annuler\")' /></td></tr>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherTexte() {
|
||||
$html = "<table class='form-table' cellspacing='0' cellpadding='2' border='0'>\n";
|
||||
if ($this->titre) $html .= "<caption class='form-caption'>$this->titre</caption>\n";
|
||||
for ($i=0;$i<sizeof($this->champs);$i++)
|
||||
$html .= $this->champs[$i]->afficherTexte();
|
||||
$html .= "</table>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function javascriptSubmit() {
|
||||
$html = "<script language='JavaScript'>\n";
|
||||
$html .= "<!-- \n";
|
||||
$html .= "function soumettre(acces) { with (document.forms[0]) {";
|
||||
$html .= "classeform_acces.value=acces; action=location.href; submit();";
|
||||
$html .= "} }\n";
|
||||
$html .= "// -->\n";
|
||||
$html .= "</script>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function controler() {
|
||||
$succes = true;
|
||||
for ($i=0;$i<sizeof($this->champs);$i++) {
|
||||
if ($this->champs[$i]->aControler() && ($this->champs[$i]->controler($this->pivot_siecle) == false)) {
|
||||
$succes = false;
|
||||
}
|
||||
}
|
||||
return $succes;
|
||||
}
|
||||
|
||||
function affecterValeursChamps($valeurs) {
|
||||
$valeurs = convertirPost($valeurs);
|
||||
for ($i=0;$i<sizeof($this->champs);$i++)
|
||||
$this->champs[$i]->affecterValeur($valeurs);
|
||||
}
|
||||
|
||||
function retournerTableauValeurs($mode_retour) {
|
||||
$retour = array();
|
||||
for ($i=0;$i<sizeof($this->champs);$i++)
|
||||
{ //echo "------------------------------------\r\n$i : \r\n";
|
||||
//print_r($this->champs);
|
||||
// print_r($this->champs[$i]);
|
||||
//echo "\r\n\r\n";
|
||||
$this->champs[$i]->retournerTableauValeurs(&$retour, $mode_retour);}
|
||||
|
||||
return $retour;
|
||||
}
|
||||
|
||||
function envoyerMail() {
|
||||
$mail = new ClasseMail($this->titre);
|
||||
$mail->contenu = $this->champs;
|
||||
return $mail->envoyer($this->cible);
|
||||
}
|
||||
|
||||
function existeChampFacultatif() {
|
||||
$ok = false;
|
||||
for ($i=0;$i<sizeof($this->champs);$i++) {
|
||||
if ($this->champs[$i]->type && !$this->champs[$i]->valObligatoire()) {
|
||||
$ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
function enregistrerLog($valeurs, $resultat) {
|
||||
if ($f = fopen($this->log, "a")) {
|
||||
$texte = ($resultat ? "" : "ECHEC ") . "[ " . date("d/mY H:i:s") . " ] - ";
|
||||
$texte .= $this->titre ? "$this->titre - " : "";
|
||||
$texte .= $valeurs;
|
||||
fputs($f, $texte);
|
||||
fclose($f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ClasseFormChamp {
|
||||
var $label;
|
||||
var $nom;
|
||||
var $type;
|
||||
var $format;
|
||||
var $oblig;
|
||||
var $taille_max;
|
||||
var $taille_min;
|
||||
var $valeur;
|
||||
var $options;
|
||||
var $descro;
|
||||
var $multiple;
|
||||
var $fonction;
|
||||
var $ctl_taille1;
|
||||
var $ctl_taille2;
|
||||
var $fin_ligne;
|
||||
var $erreur;
|
||||
var $valeur_defaut;
|
||||
var $valeur_db;
|
||||
|
||||
function ClasseFormChamp($label, $nom, $type=null, $format=null, $oblig=true, $min=null, $max=null, $valDef='') {
|
||||
$this->label = $label;
|
||||
$this->nom = $nom;
|
||||
$this->type = $type;
|
||||
$this->format = $format;
|
||||
$this->taille_min = $min;
|
||||
$this->taille_max = $max;
|
||||
$this->oblig = $oblig;
|
||||
if (($type == "select") || ($type == "checkbox") || ($type == "radio")) {
|
||||
$this->valeur = array();
|
||||
$this->options = array();
|
||||
}
|
||||
else {
|
||||
$this->valeur = null;
|
||||
$this->options = null;
|
||||
}
|
||||
$this->descro = null;
|
||||
if ($type == "checkbox") $this->multiple = true;
|
||||
else $this->multiple = false;
|
||||
$this->fonction = null;
|
||||
$this->ctl_taille1 = null;
|
||||
$this->ctl_taille2 = null;
|
||||
$this->fin_ligne = null;
|
||||
$this->erreur = null;
|
||||
$this->valeur_defaut = $valDef;
|
||||
}
|
||||
|
||||
|
||||
function valObligatoire() {
|
||||
if ($this->oblig) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function valFormat($format, $long_min=null, $long_max=null) {
|
||||
if ($this->type == "text") {
|
||||
$this->format = $format;
|
||||
if ($long_min) $this->taille_min = $long_min;
|
||||
if ($long_max) $this->taille_max = $long_max;
|
||||
}
|
||||
}
|
||||
|
||||
function valLimites($min, $max) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
|
||||
$this->taille_min = $min;
|
||||
$this->taille_max = $max;
|
||||
}
|
||||
}
|
||||
|
||||
function valCtlLimites($taille1, $taille2) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "select") || ($this->type == "file")) {
|
||||
$this->ctl_taille1 = $taille1;
|
||||
if ($taille2 && ($this->type != "select")) $this->ctl_taille2 = $taille2;
|
||||
}
|
||||
}
|
||||
|
||||
function valFonction($fonction) {
|
||||
$this->fonction = $fonction;
|
||||
}
|
||||
|
||||
function valDescro($descro) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
|
||||
$this->descro = $descro;
|
||||
}
|
||||
}
|
||||
|
||||
function valMultiple() {
|
||||
if ($this->type == "select") $this->multiple = true;
|
||||
}
|
||||
|
||||
function valFinLigne($fin_ligne) {
|
||||
if (($this->type == "radio") || ($this->type == "checkbox")) $this->fin_ligne = $fin_ligne;
|
||||
}
|
||||
|
||||
function valOptions($options) {
|
||||
if ($this->champAOptions()) {
|
||||
if (is_array($options)) {
|
||||
foreach ($options as $option) {
|
||||
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $option, $regs))
|
||||
$this->options[] = new ClasseFormOption($regs[1], true);
|
||||
else $this->options[] = new ClasseFormOption($option);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (preg_match("/^s[e|é]lection\s?=\s?(.+)$/", $options, $regs))
|
||||
$this->options[] = new ClasseFormOption($regs[1], true);
|
||||
else $this->options[] = new ClasseFormOption($options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ValOption1Vide($option_vide) {
|
||||
if ($this->type == "select") $this->fin_ligne = $option_vide;
|
||||
}
|
||||
|
||||
|
||||
function afficherForm() {
|
||||
if (!$this->type) $html = "<tr><td class='form-label' colspan='2'>$this->label</td></tr>";
|
||||
else {
|
||||
if (!is_null($this->erreur))
|
||||
$html = "<tr><td class='form-label-erreur'> > $this->label (<font size='-2'>$this->erreur</font>)</td>";
|
||||
else if ($this->oblig) $html = "<tr><td class='form-label-obligatoire'>$this->label</td>";
|
||||
else $html .= "<tr><td class='form-label-facultatif'>$this->label</td>";
|
||||
$html .= "<td class='form-td'>";
|
||||
switch ($this->type) {
|
||||
case "text" : $html .= $this->afficherFormTexte();
|
||||
break;
|
||||
case "password" : $html .= $this->afficherFormPassword();
|
||||
break;
|
||||
case "textarea" : $html .= $this->afficherFormTextarea();
|
||||
break;
|
||||
case "select" : $html .= $this->afficherFormSelect();
|
||||
break;
|
||||
case "radio" : $html .= $this->afficherFormRadio();
|
||||
break;
|
||||
case "checkbox" : $html .= $this->afficherFormCheckbox();
|
||||
break;
|
||||
case "file" : $html .= $this->afficherFormFile();
|
||||
}
|
||||
$html .= "</td></tr>\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormCache() {
|
||||
$html = "<input type='hidden' name='$this->nom'";
|
||||
if (is_array($this->valeur)) {
|
||||
$chaine = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
|
||||
$html .= " value='" . $chaine . "' />\n";
|
||||
}
|
||||
else $html .= " value='" . $this->valeur . "' />\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherTexte() {
|
||||
$html = "<tr><td class='form-label'>$this->label</td><td class='form-td'>";
|
||||
if (is_array($this->valeur)) {
|
||||
$chaine = implode(_SEPA_AFFICHE_MULTIPLE, $this->valeur);
|
||||
$html .= $chaine;
|
||||
}
|
||||
else $html .= $this->valeur;
|
||||
$html .= "</td></tr>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function champAOptions() {
|
||||
if (($this->type == "select") || ($this->type == "checkbox") || ($this->type == "radio")) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controler($pivot=null) {
|
||||
global $erreur_message;
|
||||
$this->valeur_db=$this->valeur;
|
||||
if ($this->type) {
|
||||
if (($this->type == "text") || ($this->type == "password") || ($this->type == "textarea") || ($this->type == "file")) {
|
||||
$this->controlerChampTexte($pivot);
|
||||
if (is_null($this->erreur)) return true;
|
||||
else return false;
|
||||
}
|
||||
else if (($this->type == "select") || ($this->type == "radio")) {
|
||||
if (!$this->valeur || (sizeof($this->valeur) == 0)) {
|
||||
$this->erreur = $erreur_message["option"];
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
|
||||
function aControler() {
|
||||
if ($this->type && $this->oblig) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function retournerTableauValeurs(&$tableau, $mode_retour) {
|
||||
if (is_array($this->valeur)) {$valeur = implode(_SEPA_VALEUR_MULTIPLE, $this->valeur);
|
||||
print_r($this->valeur);
|
||||
die('Cas non géré dans inc_classeform.php');
|
||||
}
|
||||
else $valeur = $this->valeur_db;
|
||||
switch ($mode_retour) {
|
||||
case "noms & valeurs" :
|
||||
$tableau[$this->nom] = $valeur;
|
||||
break;
|
||||
case "labels & valeurs" :
|
||||
$tableau[$this->label] = $valeur;
|
||||
break;
|
||||
case "valeurs" :
|
||||
$tableau[] = $valeur;
|
||||
}
|
||||
}
|
||||
|
||||
function affecterValeur($valeurs) {
|
||||
$valeur = $valeurs[$this->nom];
|
||||
if ($this->champAOptions()) {
|
||||
if (strpos($valeur, _SEPA_VALEUR_MULTIPLE) !== false)
|
||||
$this->valeur = explode(_SEPA_VALEUR_MULTIPLE, $valeur);
|
||||
else $this->valeur = $valeur;
|
||||
for ($i=0;$i<sizeof($this->options);$i++)
|
||||
$this->options[$i]->selectionnerSiValeur($this->valeur);
|
||||
}
|
||||
else $this->valeur = $valeur;
|
||||
}
|
||||
|
||||
|
||||
function controlerChampTexte($pivot) {
|
||||
global $erreur_message;
|
||||
if (trim($this->valeur) == "") $this->erreur = $erreur_message["vide"];
|
||||
else {
|
||||
$this->erreur = champTexteConforme($this->valeur, $this->taille_min, $this->taille_max);
|
||||
if (is_null($this->erreur) && $this->format) {
|
||||
switch ($this->format) {
|
||||
case "alphanum" :
|
||||
if (!controlerAlphanum($this->valeur)) $this->erreur = $erreur_message["alphanum"];
|
||||
break;
|
||||
case "num" :
|
||||
if (!controlerNum($this->valeur)) $this->erreur = $erreur_message["num"];
|
||||
break;
|
||||
case "num-strict" :
|
||||
if (!controlerNum($this->valeur, true)) $this->erreur = $erreur_message["num"];
|
||||
break;
|
||||
case "tel" :
|
||||
if (!controlerTel($this->valeur)) $this->erreur = $erreur_message["tel"];
|
||||
break;
|
||||
case "email" :
|
||||
if (!controlerEmail($this->valeur)) $this->erreur = $erreur_message["email"];
|
||||
break;
|
||||
case "date" :
|
||||
if (!controlerDate($this->valeur, $pivot)) $this->erreur = $erreur_message["date"];
|
||||
else $this->valeur_db=substr($this->valeur,6,4).'-'.substr($this->valeur,3,2).'-'.substr($this->valeur,0,2);
|
||||
break;
|
||||
case "url" :
|
||||
if (!controlerUrl($this->valeur)) $this->erreur = $erreur_message["url"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function afficherFormTexte() {
|
||||
$html .= "<input class='form-input' type='text' name='$this->nom' size='$this->ctl_taille1' ";
|
||||
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
|
||||
if ($this->valeur) $html .= " value='" . $this->valeur . "' />";
|
||||
else if ($this->valeur_defaut) $html .= " value='" . $this->valeur_defaut . "' />";
|
||||
else if ($this->descro) { $html .= " value='" . htmlentities(stripslashes($this->descro), ENT_QUOTES) . "'";
|
||||
$html .= " onFocus='this.value=\"\"' />";
|
||||
}
|
||||
else $html .= " value='' />";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormPassword() {
|
||||
$html .= "<input class='form-input' type='password' name='$this->nom' size='$this->ctl_taille1'";
|
||||
if ($this->ctl_taille2) $html .= " maxlength='$this->ctl_taille2'";
|
||||
if ($this->valeur) $html .= " value='" . $this->valeur . "' />";
|
||||
else if ($this->descro) {
|
||||
$html .= " value='" . htmlentities(stripslashes($this->descro), ENT_QUOTES) . "'";
|
||||
$html .= " onFocus='this.value=\"\"' />";
|
||||
}
|
||||
else $html .= " value='' />";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormTextarea() {
|
||||
$html .= "<textarea class='form-input' name='$this->nom' cols='$this->ctl_taille1'";
|
||||
if ($this->ctl_taille2) $html .= " rows='$this->ctl_taille2'";
|
||||
else if ($this->taille_max) {
|
||||
$rows = ceil($this->taille_max / $taille_std);
|
||||
$html .= " rows='$rows'";
|
||||
}
|
||||
else $html .= " rows='3'";
|
||||
if ((trim($this->valeur) == "") || $this->descro) $html .= " onFocus='this.value=\"\"'>";
|
||||
else $html .= ">";
|
||||
if (trim($this->valeur)) $html .= $this->valeur;
|
||||
else if ($this->descro) $html .= htmlentities(stripslashes($this->descro), ENT_QUOTES);
|
||||
$html .= "</textarea>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormSelect() {
|
||||
$html = "<select name='$this->nom" . ($this->multiple ? "[]'" : "'");
|
||||
if ($this->fin_ligne && $this->multiple)
|
||||
$html .= " size='" . (($this->ctl_taille1 >= 2) ? $this->ctl_taille1 : 2 ) . "'";
|
||||
else $html .= " size='" . ($this->ctl_taille1 ? $this->ctl_taille1 : 1) . "'";
|
||||
$html .= $this->multiple ? " multiple>\n" : ">\n";
|
||||
if ($this->fin_ligne) {
|
||||
$html .= "<option class='form-option-entete' value=''>$this->fin_ligne</option>\n";
|
||||
}
|
||||
for ($i=0;$i<sizeof($this->options);$i++)
|
||||
$html .= $this->options[$i]->afficherFormSelect();
|
||||
$html .= "</select>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormRadio() {
|
||||
for ($i=0;$i<sizeof($this->options);$i++) {
|
||||
$html .= $this->options[$i]->afficherFormCase("radio", $this->nom, $this->oblig);
|
||||
$html .= $this->fin_ligne ? "<br />" : " ";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormCheckbox() {
|
||||
for ($i=0;$i<sizeof($this->options);$i++) {
|
||||
$html .= $this->options[$i]->afficherFormCase("checkbox", "$this->nom[]", $this->oblig);
|
||||
$html .= $this->fin_ligne ? "<br />" : " ";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormFile() {
|
||||
$html .= "<input class='form-input' type='file' name='$this->nom' size='$this->ctl_taille1'";
|
||||
if ($this->taille_max) $html .= " maxlength='$this->ctl_taille2'";
|
||||
if ($this->descro) $html .= " value='$this->descro' onChange='this.value=\"\"' />";
|
||||
else $html .= " value='' />";
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ClasseFormOption {
|
||||
var $valeur;
|
||||
var $selection;
|
||||
|
||||
function ClasseFormOption($val, $selec=false) {
|
||||
$this->valeur = htmlspecialchars(stripslashes($val), ENT_QUOTES);
|
||||
$this->selection = $selec;
|
||||
}
|
||||
|
||||
|
||||
function afficherFormSelect() {
|
||||
$html = "<option value='$this->valeur'" . ($this->selection ? " selected>" : ">");
|
||||
$html .= "$this->valeur</option>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function afficherFormCase($type, $nom, $oblig) {
|
||||
$html = "<input type='$type' name='$nom' value='$this->valeur'";
|
||||
$html .= ($this->selection) ? " checked />" : " />";
|
||||
if ($oblig) $html .= "<span class='form-input-obligatoire'>" . $this->valeur . "<span>";
|
||||
else $html .= "<span class='form-input-facultatif'>" . $this->valeur . "<span>";
|
||||
return $html;
|
||||
}
|
||||
|
||||
function selectionnerSiValeur($valeurs) {
|
||||
if (is_array($valeurs)) {
|
||||
if (in_array($this->valeur, $valeurs)) $this->selection = true;
|
||||
else $this->selection = false;
|
||||
}
|
||||
else if ($this->valeur == $valeurs) $this->selection = true;
|
||||
else $this->selection = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function controlerEmail($valeur) {
|
||||
if (preg_match("/^[\w|-]+(\.[\w|-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerDate($valeur, $pivot) {
|
||||
if (preg_match("/^(\d{1,2})[\/|\-|\.](\d{1,2})[\/|\-|\.](\d\d)(\d\d)?$/", $valeur, $regs)) {
|
||||
$jour = ($regs[1] < 10) ? "0".$regs[1] : $regs[1];
|
||||
$mois = ($regs[2] < 10) ? "0".$regs[2] : $regs[2];
|
||||
if ($regs[4]) $an = $regs[3] . $regs[4];
|
||||
else {
|
||||
if ($pivot) {
|
||||
if ($regs[3] <= $pivot) $an = $regs[3] + 2000;
|
||||
else $an = $regs[3] + 1900;
|
||||
}
|
||||
else $an = $regs[3] + 2000;
|
||||
}
|
||||
if (checkdate($mois, $jour, $an)) return true;
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerUrl($valeur) {
|
||||
if (ereg("^((http|ftp):\/\/)?([0-9a-z_]+[\.\-])+[0-9a-z]+(\/[0-9a-z_]+)*(\/[0-9a-z_]+\.[0-9a-z]+)?$", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerAlphanum($valeur) {
|
||||
if (preg_match("/^[\w|\d|\s|'|\"|\\|,|\.|\-|&|#|;]+$/", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerNum($valeur, $strict=false) {
|
||||
if ($strict) {
|
||||
if (ereg("^[0-9]+$", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
else if (preg_match("/^[\d|\s|\-|\+|E|e|,|\.]+$/", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function controlerTel($valeur) {
|
||||
if (preg_match("/^[\d|\s|\-|\.|\(|\)]+$/", $valeur)) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function champTexteConforme($valeur, $min, $max) {
|
||||
global $erreur_message;
|
||||
if ($min && (strlen($valeur) < $min)) return $min . " " . $erreur_message["min"];
|
||||
else if ($max && (strlen($valeur) > $max)) return $max . " " . $erreur_message["max"];
|
||||
else if (preg_match('/(.)\1{4,}/', $valeur)) return $erreur_message["texte"];
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
||||
function convertirPost($post) {
|
||||
$result = array();
|
||||
foreach ($post as $cle => $valeur) {
|
||||
if (is_array($valeur)) {
|
||||
for ($i=0;$i<sizeof($valeur);$i++)
|
||||
$result[$cle][] = htmlspecialchars(stripslashes($valeur[$i]), ENT_QUOTES);
|
||||
}
|
||||
else $result[$cle] = htmlspecialchars(stripslashes($valeur), ENT_QUOTES);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -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,418 +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;
|
||||
}
|
||||
|
||||
/**Verification de la validité des données pour la demande*/
|
||||
function valideData($variable, $taille_min, $taille_max, $type_variable, $erreur=false){
|
||||
if ( strlen((string)$variable) < $taille_min )
|
||||
return $erreur;
|
||||
|
||||
if ( strlen((string)$variable) > $taille_max )
|
||||
return $erreur;
|
||||
|
||||
if ( $type_variable == 'A' )
|
||||
if ( is_string($variable) == true )
|
||||
return true;
|
||||
else
|
||||
return $erreur;
|
||||
|
||||
elseif ( $type_variable == 'N')
|
||||
{
|
||||
for ($i=0; $i < strlen((string)$variable); $i++)
|
||||
{
|
||||
$car = substr((string)$variable,$i,1);
|
||||
if ($car<'0' || $car>'9')
|
||||
return $erreur;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return $erreur;
|
||||
}
|
||||
|
||||
/** Test de la validité du siren demandé */
|
||||
function valideSiren($siren, $nic='', $erreur=false) {
|
||||
|
||||
$lenSIREN=strlen($siren);
|
||||
if (!valideData($siren, 9, 9,'N')) //Siren non précisé ou incorrect.
|
||||
return $erreur;
|
||||
else
|
||||
{
|
||||
if (!isset($nic) || trim($nic)=='')
|
||||
{
|
||||
$somme=0;
|
||||
for ($i=0; $i<=8; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($siren,$i,1);
|
||||
|
||||
for ($i=1; $i<=7; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($siren,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
}
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))
|
||||
{ // Le Siren est faux
|
||||
if (substr($siren,0,3)!='200') // Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
|
||||
return $erreur;
|
||||
}
|
||||
} else {
|
||||
if (!valideData($nic,1,5,'N')) // Nic de format incorrect.
|
||||
return $erreur;
|
||||
|
||||
$SIRET=$siren.$nic;
|
||||
$somme=0;
|
||||
for ($i=0; $i<=12; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($SIRET,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
}
|
||||
for ($i=1; $i<=13; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($SIRET,$i,1);
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))// Le Siret est faux
|
||||
return $erreur;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function rechercheTelephone($raisonSociale='', $adresse='', $localite='', $departement='', $activite='') {
|
||||
|
||||
$response1=getUrl(SITE_PJ.'pj.cgi?', '', '', '', true, HOST_PJ);
|
||||
//print_r($response1['header']['Set-cookie']);
|
||||
$pageHtml=$response1['body'];
|
||||
$SESSION_ID=getTextInHtml($pageHtml, '<input type="hidden" name="SESSION_ID" value="', ' value="', '">');
|
||||
$VID=getTextInHtml($pageHtml, '<input type="hidden" name="VID" value="', ' value="', '">');
|
||||
$e_cookie=getTextInHtml($pageHtml, '<noscript><img ALT="" src="http://e.pagesjaunes.fr/m/web/', 'src="', '" BORDER=0 width=1 height=1></noscript>');
|
||||
|
||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/pji.css', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/pji_PJ.css', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_open.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/alerte.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_VED.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl(SITE_PJ.'sitecrm/popup.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/AUTOPROMO_PJ_banniere_activite/hotel_pj.swf?clickTAG=http://sbx.pagesjaunes.fr/RealMedia/ads/click_lx.ads/www.pagesjaunes.fr/GENERAL/GENERAL/PJ/1238513556/Top/OasDefault/AUTOPROMO_PJ_banniere_activite/hotel_pj.html/61633130323433353434346339306330?', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_VED.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/anim_HP_v2-04-2006.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_webcam.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_photo.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_trafic.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/Edito_webcams/new_04-2006.jpg', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
$response=getUrl('http://e.pagesjaunes.fr/js/m.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
||||
|
||||
$response2=getUrl($e_cookie, $response1['header']['Set-cookie'], '', SITE_PJ, true, HOST_PJ);
|
||||
|
||||
$cookies=$response1['header']['Set-cookie'] . $response2['header']['Set-Cookie'];
|
||||
|
||||
$input_image=$VALID_ARR=$NUM_RUE=$NEW_DEPARTEMENT=$OBJ_GEO='';
|
||||
|
||||
// Requête d'interrogation
|
||||
$postData=array(
|
||||
'ACTIVITE_VALIDATED_ASCII'=>'',
|
||||
'ID_THEME_SDE'=>'',
|
||||
'LISTE_RUB_AVEC_THEME'=>'',
|
||||
'input_image'=>$input_image,
|
||||
|
||||
'FRM_ACTIVITE'=>$activite,
|
||||
'FRM_NOM'=>$raisonSociale,
|
||||
'FRM_ADRESSE'=>$adresse,
|
||||
'FRM_LOCALITE'=>$localite,
|
||||
'FRM_DEPARTEMENT'=>$departement,
|
||||
|
||||
'JF_INSCRIPTIONS_REQ.x'=>'25',
|
||||
'JF_INSCRIPTIONS_REQ.y'=>'4',
|
||||
'faire'=>'decode_input_image',
|
||||
'DEFAULT_ACTION'=>'jf_inscriptions_req',
|
||||
'SESSION_ID'=>$SESSION_ID,
|
||||
'VID'=>$VID,
|
||||
'INFO_VILLE'=>'non',
|
||||
'CODE_LOC_INFO_VILLE'=>'00000000',
|
||||
'IV_ACTIVATION'=>'oui',
|
||||
'lang'=>'FR',
|
||||
'pays'=>'FR',
|
||||
'srv'=>'PJ',
|
||||
'TYPE_RECHERCHE'=>'ZZZ');
|
||||
//print_r($postData);//die();
|
||||
sleep(1);
|
||||
$response=getUrl(SITE_PJ, $cookies, $postData, SITE_PJ, true, HOST_PJ);
|
||||
$pageHtml=$response['body'];
|
||||
|
||||
if (count($tabNT=getTabListeNonTrouve($pageHtml))>0)
|
||||
{
|
||||
// Pas de réponses pour ces critères
|
||||
// Il faut élargir la recherche !
|
||||
$tabNTk=array_keys($tabNT);
|
||||
$input_image=$tabNT[0];
|
||||
$DEFAULT_ACTION='inscriptions_req';
|
||||
$NEW_DEPARTEMENT=getTextInHtml($pageHtml, '<input type="hidden" name="NEW_DEPARTEMENT" value="', 'value="', '">');
|
||||
$OBJ_GEO=getTextInHtml($pageHtml, '<input type=hidden name=OBJ_GEO value="', 'value="', '">');
|
||||
}
|
||||
elseif (count($tabGU=getTabListeGU($pageHtml))>0)
|
||||
{
|
||||
// Plusieurs Adresses possibles pour l'adresse donnée
|
||||
// print_r($tabGU);
|
||||
$input_image=getBonneAdresse($adresse, $tabGU);
|
||||
$DEFAULT_ACTION='jf_inscriptions_req';
|
||||
$VALID_ARR=getTextInHtml($pageHtml, '<input type=hidden name=VALID_ARR value="', 'value="', '">');
|
||||
$NUM_RUE=getTextInHtml($pageHtml, '<input type=hidden name=NUM_RUE value="', 'value="', '">');
|
||||
}
|
||||
|
||||
if ($input_image<>'') {
|
||||
$CODE_LOC_INFO_VILLE=getTextInHtml($pageHtml, '<input type="hidden" name="CODE_LOC_INFO_VILLE" value="', 'value="', '">');
|
||||
|
||||
$postData=array(
|
||||
'GEO_DEP'=>'', // New
|
||||
'faire'=>'decode_input_image',
|
||||
'DEFAULT_ACTION'=>$DEFAULT_ACTION,
|
||||
'input_image'=>$input_image,// diff
|
||||
'SESSION_ID'=>$SESSION_ID,
|
||||
'VID'=>$VID,
|
||||
'INFO_VILLE'=>'oui', // non dans la recherche préc.
|
||||
'CODE_LOC_INFO_VILLE'=>$CODE_LOC_INFO_VILLE, // diff
|
||||
'IV_ACTIVATION'=>'oui',
|
||||
'lang'=>'FR',
|
||||
'pays'=>'FR',
|
||||
'srv'=>'PJ',
|
||||
'TYPE_RECHERCHE'=>'CLOC', // ZZZ
|
||||
'SAV_ADRESSE'=>$adresse, //
|
||||
'SAV_LOCALITE'=>$localite, // New
|
||||
'SAV_DEPARTEMENT'=>$departement, //
|
||||
'FRM_NOM'=>$raisonSociale,
|
||||
'FRM_ADRESSE'=>$adresse,
|
||||
'FRM_LOCALITE'=>$localite,
|
||||
'FRM_DEPARTEMENT'=>$departement,
|
||||
|
||||
'FRM_TYPE_PUB'=>'TOUS',
|
||||
'RP_FORM'=>'',
|
||||
'VALID_LOC'=>$CODE_LOC_INFO_VILLE,
|
||||
'VALID_ARR'=>$VALID_ARR,
|
||||
'NUM_RUE'=>$NUM_RUE,
|
||||
'test_flash'=>'',
|
||||
'ESPLUS'=>'',
|
||||
'NEW_DEPARTEMENT'=>$NEW_DEPARTEMENT,
|
||||
'OBJ_GEO'=>$OBJ_GEO,
|
||||
);
|
||||
print_r($postData);
|
||||
sleep(1);
|
||||
$response=getUrl(SITE_PJ, $cookies, $postData, SITE_PJ, true, HOST_PJ);
|
||||
$pageHtml=$response['body'];
|
||||
}
|
||||
|
||||
$nbReponses=trim(getTextInHtml($pageHtml, '<tr><td align="left" class=txtrequetetotal valign=middle nowrap><b>', '<b>', 'ré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,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
//script will fetch an email identified by $msgid, and parse the its parts into an
|
||||
//array $partsarray
|
||||
//structure of array:
|
||||
//$partsarray[<name of part>][<attachment/text>]
|
||||
//if attachment- subarray is [filename][binary data]
|
||||
//if text- subarray is [type of text(HTML/PLAIN)][text string]
|
||||
|
||||
//i.e.
|
||||
//$partsarray[3.1][attachment][filename]=filename of attachment in part 3.1
|
||||
//$partsarray[3.1][attachment][binary]=binary data of attachment in part 3.1
|
||||
//$partsarray[2][text][type]=type of text in part 2
|
||||
//$partsarray[2][text][string]=decoded text string in part 2
|
||||
//$partsarray[not multipart][text][string]=decoded text string in message that isn't multipart
|
||||
|
||||
function parsepart($p,$i){
|
||||
global $link,$msgid,$partsarray;
|
||||
//where to write file attachments to:
|
||||
$filestore = '[full/path/to/attachment/store/(chmod777)]';
|
||||
|
||||
//fetch part
|
||||
$part=imap_fetchbody($link,$msgid,$i);
|
||||
//if type is not text
|
||||
if ($p->type!=0){
|
||||
//DECODE PART
|
||||
//decode if base64
|
||||
if ($p->encoding==3)$part=base64_decode($part);
|
||||
//decode if quoted printable
|
||||
if ($p->encoding==4)$part=quoted_printable_decode($part);
|
||||
//no need to decode binary or 8bit!
|
||||
|
||||
//get filename of attachment if present
|
||||
$filename='';
|
||||
// if there are any dparameters present in this part
|
||||
if (count($p->dparameters)>0){
|
||||
foreach ($p->dparameters as $dparam){
|
||||
if ((strtoupper($dparam->attribute)=='NAME') ||(strtoupper($dparam->attribute)=='FILENAME')) $filename=$dparam->value;
|
||||
}
|
||||
}
|
||||
//if no filename found
|
||||
if ($filename==''){
|
||||
// if there are any parameters present in this part
|
||||
if (count($p->parameters)>0){
|
||||
foreach ($p->parameters as $param){
|
||||
if ((strtoupper($param->attribute)=='NAME') ||(strtoupper($param->attribute)=='FILENAME')) $filename=$param->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
//write to disk and set partsarray variable
|
||||
if ($filename!=''){
|
||||
$partsarray[$i][attachment] = array('filename'=>$filename,'binary'=>$part);
|
||||
$fp=fopen($filestore.$filename,"w+");
|
||||
fwrite($fp,$part);
|
||||
fclose($fp);
|
||||
}
|
||||
//end if type!=0
|
||||
}
|
||||
|
||||
//if part is text
|
||||
else if($p->type==0){
|
||||
//decode text
|
||||
//if QUOTED-PRINTABLE
|
||||
if ($p->encoding==4) $part=quoted_printable_decode($part);
|
||||
//if base 64
|
||||
if ($p->encoding==3) $part=base64_decode($part);
|
||||
|
||||
//OPTIONAL PROCESSING e.g. nl2br for plain text
|
||||
//if plain text
|
||||
|
||||
if (strtoupper($p->subtype)=='PLAIN')1;
|
||||
//if HTML
|
||||
else if (strtoupper($p->subtype)=='HTML')1;
|
||||
$partsarray[$i][text] = array('type'=>$p->subtype,'string'=>$part);
|
||||
}
|
||||
|
||||
//if subparts... recurse into function and parse them too!
|
||||
if (count($p->parts)>0){
|
||||
foreach ($p->parts as $pno=>$parr){
|
||||
parsepart($parr,($i.'.'.($pno+1)));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//require('./constantes.php');
|
||||
$imap_server='{imap.online.net}';
|
||||
$imap_account='buzuk@lenaour.org';//'scores-decisions.com';
|
||||
$imap_password='bzh4231*';//catsysyo92';
|
||||
|
||||
if (!$mbox = imap_open($imap_server, $imap_account, $imap_password)) die("Connexion IMAP impossible : ". imap_last_error());
|
||||
|
||||
$list = imap_list($mbox, $imap_server, "*");
|
||||
if(is_array($list)) {
|
||||
reset($list);
|
||||
foreach ($list as $val) {
|
||||
echo imap_utf7_decode($val) . "<br />\n";
|
||||
}
|
||||
} else {
|
||||
echo "imap_list a échoué : " . imap_last_error() . "\n";
|
||||
}
|
||||
|
||||
echo "<p><h1>Entetes de mail dans INBOX</h1>\n";
|
||||
$headers = imap_headers ($mbox);
|
||||
if ($headers == false) {
|
||||
echo "Erreur !\n";
|
||||
} else {
|
||||
while (list ($key,$val) = each ($headers)) {
|
||||
echo $val."<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$check = imap_mailboxmsginfo($mbox);
|
||||
if($check) {
|
||||
echo "Date: " . $check->Date ."<br />\n" ;
|
||||
echo "Pilote: " . $check->Driver ."<br />\n" ;
|
||||
echo "Mailbox: " . $check->Mailbox ."<br />\n" ;
|
||||
echo "Messages: ". $check->Nmsgs ."<br />\n" ;
|
||||
echo "Récent: " . $check->Recent ."<br />\n" ;
|
||||
echo "Non lus: " . $check->Unread ."<br />\n" ;
|
||||
echo "Effacés: " . $check->Deleted ."<br />\n" ;
|
||||
echo "Taille: " . $check->Size ."<br />\n" ;
|
||||
} else {
|
||||
echo "imap_check() a échoué: ".imap_last_error(). "<br />\n";
|
||||
}
|
||||
|
||||
$imap_obj = imap_check($mbox);
|
||||
$imap_sorted = imap_sort($mbox, SORTARRIVAL, 0);
|
||||
|
||||
$MN=$imap_obj->Nmsgs;
|
||||
echo '<br>Nombre de messages '.$MN.'<br/>';
|
||||
|
||||
$overview = imap_fetch_overview($mbox,"1:$MN",0);
|
||||
$k=0;
|
||||
$partsarray=array();
|
||||
while( list($key,$val) = each($overview))
|
||||
{
|
||||
if (strpos($val->from, 'rapports@neoveille.fr')!==false) {
|
||||
$unsorted[$k]=$val;//->uid;
|
||||
/*$unsorted[$k]["subject"]=imap_utf8($val->subject); // Le sujet du message
|
||||
$unsorted[$k]['from']=$val->from;
|
||||
$unsorted[$k]['to']=$val->to;
|
||||
$unsorted[$k]['date']=$val->date;// Date d'expédition
|
||||
$unsorted[$k]['message_id - Identification du message
|
||||
references - est une référence sur l'id de ce message
|
||||
in_reply_to - est une réponse à cet identifiant de message
|
||||
size - taille en octets
|
||||
uid - UID du message dans la boîte aux lettres
|
||||
msgno - numéro de séquence du message dans la boîte
|
||||
recent - Ce message est récent
|
||||
flagged - Ce message est marqué
|
||||
answered - Ce message a donné lieu à une réponse
|
||||
deleted - Ce message est marqué pour l'effacement
|
||||
seen - Ce message est déjà lu
|
||||
draft - Ce message est un brouillon
|
||||
*/
|
||||
$s=imap_fetchstructure($mbox,$val->message_id);
|
||||
/*if (count($s->parts)>0){
|
||||
foreach ($s->parts as $partno=>$partarr){
|
||||
//parse parts of email
|
||||
parsepart($partarr,$partno+1);
|
||||
}
|
||||
}
|
||||
else { //for not multipart messages
|
||||
//get body of message
|
||||
//decode if quoted-printable
|
||||
if ($s->encoding==4) $text=quoted_printable_decode($text);
|
||||
//OPTIONAL PROCESSING
|
||||
if (strtoupper($s->subtype)=='PLAIN') $text=$text;
|
||||
if (strtoupper($s->subtype)=='HTML') $text=$text;
|
||||
|
||||
$partsarray['not multipart'][text]=array('type'=>$s->subtype,'string'=>$text);
|
||||
}*/
|
||||
$full_bodacc=imap_body($mbox,$val->msgno).'[FIN]';
|
||||
$k++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//usort ($unsorted, create_function('$a,$b','setlocale(LC_ALL,$locale);return strcoll($a["subject"],$b["subject"]);'));
|
||||
|
||||
$Bodacc=explode("-------------------------------------------------- \r\n--------------------------------------------------", $full_bodacc);
|
||||
echo '<pre>';
|
||||
/*var_dump($imap_obj);
|
||||
print_r($imap_obj);
|
||||
print_r($imap_sorted);
|
||||
print_r($unsorted);
|
||||
print_r($partsarray);*/
|
||||
print_r($Bodacc);
|
||||
echo '</pre>';
|
||||
|
||||
|
||||
imap_close($mbox);
|
||||
?>
|
@ -1,76 +0,0 @@
|
||||
<?
|
||||
//error_reporting(E_ALL);
|
||||
function mysql_trace($query, $res='') {
|
||||
if (!$fp=fopen('mysql_insert.log', 'a'))
|
||||
return false;
|
||||
if (!fwrite($fp, date('Y/m/d - H:i:s') ." - $res : $query\n"))
|
||||
return false;
|
||||
if (!fclose($fp))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Retourne la dernière valeur de l'auto-incrément ou 0 si pas d'auto-incrément
|
||||
** Penser à bien tester la valeur !== false
|
||||
**/
|
||||
function mysql_insert($table, $toAdd, $debug=false){
|
||||
$fields = implode(array_keys($toAdd), '`,`');
|
||||
foreach (array_values($toAdd) as $key=>$array_values)
|
||||
$tmp[$key]=addslashes($array_values);
|
||||
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
$query = 'INSERT INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
|
||||
$res = mysql_query($query);// OR die(mysql_error());
|
||||
if ($res!==false)
|
||||
{
|
||||
if (mysql_insert_id()>0)
|
||||
$res=mysql_insert_id();
|
||||
else
|
||||
$res=true;
|
||||
}
|
||||
if ($debug) mysql_trace($query, $res);
|
||||
|
||||
return $res;
|
||||
//-- Example of usage
|
||||
//$tToAdd = array('id'=>3, 'name'=>'Yo', 'salary' => 5000);
|
||||
//insertIntoDB('myTable', $tToAdd)
|
||||
}
|
||||
|
||||
function mysql_update($table, $update, $where, $debug=false){
|
||||
$fields = array_keys($update);
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
$query='UPDATE `'.$table.'` SET ';
|
||||
while($fields[$i]){
|
||||
if($i>0){$query.=', ';}
|
||||
$query.=' `'.$fields[$i]."`='".addslashes($values[$i])."'";
|
||||
$i++;
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
$query.=' WHERE '.$where.' LIMIT 1;';
|
||||
if ($debug) mysql_trace($query, mysql_errno());
|
||||
mysql_query($query);// or die(mysql_error());
|
||||
return true;
|
||||
|
||||
//Example
|
||||
// mysql_update('myTable', $anarray, "type = 'main'")
|
||||
|
||||
}
|
||||
|
||||
function mysql_select($table, $fields, $where, $debug=false, $assoc=MYSQL_BOTH) {
|
||||
$query="SELECT $fields FROM $table WHERE $where;";
|
||||
// if ($debug) mysql_trace($query, count($tab));
|
||||
$result=mysql_query($query) or die(mysql_error());
|
||||
$tab=array();
|
||||
while ($ligne = mysql_fetch_array($result, $assoc))
|
||||
$tab[]=$ligne;
|
||||
|
||||
mysql_free_result($result);
|
||||
if ($debug) mysql_trace($query, count($tab));
|
||||
// echo $query;
|
||||
return $tab;
|
||||
}
|
||||
|
||||
?>
|
@ -1,404 +0,0 @@
|
||||
<?
|
||||
define('HOST_INSEE', 'avis-situation-sirene.insee.fr');
|
||||
define('SITE_INSEE', 'http://'. HOST_INSEE .'/');
|
||||
define('HOST_PJ', 'www.pagesjaunes.fr');
|
||||
define('SITE_PJ', 'http://'. HOST_PJ .'/');
|
||||
define('SITE_SOCIETE', 'http://www.societe.com/');
|
||||
|
||||
include('/var/www/_includes/includes/insee.class.php');
|
||||
//include('includes/normad.class.php');
|
||||
include('/var/www/_includes/includes/fonctions.php');
|
||||
|
||||
/* v0.1 Extraction d'informations INSEE en ligne de commande.
|
||||
|
||||
Usage: <?=$argv[0]?> <extract type> <fileIn> <fileInFmt> <fileOut> <fileOutFmt>
|
||||
|
||||
Where <extract type> is :
|
||||
id siren.tm.fr : Fiche d'identite INSEE (établissement+entreprise)
|
||||
lst siren.tm.fr : Liste des etablissements du SIREN (+infos entreprise)
|
||||
rncs societe.com : Informations du RNCS
|
||||
pj pagesjaunes.fr : Données des pages jaunes
|
||||
coface cofacerating.fr : Coface
|
||||
|
||||
Where <fileInFmt> is :
|
||||
csv Fichier IN au format CSV (; ou ,) SIREN;NIC;REF
|
||||
plat Fichier IN au format plat (blancs significatifs) SIREN_____NIC__REF______________
|
||||
|
||||
Where <fileOutFmt> is : csv / todo
|
||||
|
||||
Le fichier en entrée doit être au format <fileInFmt> et contenir le SIREN en première colonne.
|
||||
*/
|
||||
|
||||
$insee=&new Insee();
|
||||
function getInfosSirene($sirenLu, $nicLu='') {
|
||||
$tabRet=array();
|
||||
|
||||
$invalide=false;
|
||||
if (valideSiren($sirenLu)==false) {
|
||||
$libelleErreur='SIREN invalide';
|
||||
$invalide=true;
|
||||
}
|
||||
if ( $nicLu<>'' && valideSiren($sirenLu, $nicLu)==false) {
|
||||
$libelleErreur='SIRET invalide';
|
||||
$invalide=true;
|
||||
}
|
||||
if ($invalide==true)
|
||||
{
|
||||
$siret=$sirenLu.$nicLu;
|
||||
$str=date('d/m/Y à H:i:s') .';'. $libelleErreur .';'. $siret .';;;;;;;;;;;;;;;;;;;;;;;';
|
||||
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
|
||||
fwrite($fp, $str."\r\n");
|
||||
fclose($fp);
|
||||
$num=$key+1;
|
||||
flush();
|
||||
} else { // La demande est valide on va à l'INSEE
|
||||
/** Paramètre de requête "option" à l'insee :
|
||||
** 1: Fiche du siège + Données entreprises
|
||||
** 2: Tous les établissements de l'entreprise
|
||||
** 3: Un établissement particulier
|
||||
** 4: Département
|
||||
**/
|
||||
if ($nicLu<>'') $option=3;
|
||||
else $option=1;
|
||||
|
||||
$libelleErreur='Erreur SCRIPT Inconnue';
|
||||
$tabInfoEtab=array();
|
||||
$tabInfoEntrep=array();
|
||||
|
||||
/** Etape de connexion au site de l'INSEE pour simuler correctement un utilisateur WEB
|
||||
**/
|
||||
$response1=getUrl(SITE_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'SIRENET_Script/Accueil/script_page_accueil.asp');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
||||
|
||||
if ($nicLu=='') //Faire une boucle de recherche de tous les établissement et y inclure le reste du traitement
|
||||
{
|
||||
// Requête d'interrogation
|
||||
$postData=array(
|
||||
'siren'=>$sirenLu,
|
||||
'option'=>2,
|
||||
'nic'=>'',
|
||||
'dep'=>'',
|
||||
'listeDep'=>'');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
||||
$action='nouveau';
|
||||
$referer=SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false';
|
||||
$nbRepTot=$pageCour=$nbTotPage=$nbRepParPage=$numEtab=0;
|
||||
$tabInfoEtab=array();
|
||||
|
||||
while(true)
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action='.$action, $response1["header"]["Set-Cookie"], '', $referer);
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
||||
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',true);
|
||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
||||
if ($pos>0){
|
||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
||||
} else
|
||||
$libelleErreur='Erreur INSEE inconnue';
|
||||
}
|
||||
|
||||
// On déroule les URLs d'appels liste des établissements
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
||||
$responseListe=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', true);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_bas.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
||||
$responseListe=$responseListe['body'];
|
||||
|
||||
$pos=strpos($responseListe, 'Nombre total de réponses : '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, '</b></font>', $pos+73);
|
||||
$nbRepTot=trim(substr($responseListe, $pos+73, $posFin-($pos+73)));
|
||||
}
|
||||
$pos=strpos($responseListe, ' - Affichage de la page '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, ' - </b></font>', $pos+75);
|
||||
$strPages=trim(substr($responseListe, $pos+75, $posFin-($pos+75)));
|
||||
$tabPages=explode(' / ', $strPages);
|
||||
$pageCour=$tabPages[0];
|
||||
$nbTotPage=$tabPages[1];
|
||||
}
|
||||
$pos=strpos($responseListe, ' - </b></font>'."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, '</b></font>', $pos+60);
|
||||
$nbRepParPage=trim(substr($responseListe, $pos+60, $posFin-($pos+60)));
|
||||
}
|
||||
|
||||
/* TODO = Récupérer les infos étab + entrep pour chaque ligne du tableau !!!*
|
||||
*/
|
||||
if ($libelleErreur=='Erreur SCRIPT Inconnue')
|
||||
$libelleErreur='';
|
||||
for ($i=1;$i<11; $i++)
|
||||
{
|
||||
if ($numEtab==$nbRepTot)
|
||||
break; // Il n'y a pas plus d'établissement à récupérer ! On sort...
|
||||
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=detail&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp');
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i)
|
||||
{
|
||||
// On déroule les URLs d'appels fiche siège
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i, true);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
|
||||
// Récupération de la fiche entreprise INSEE
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste');
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, true);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
||||
$responseEntreprise=$responseEntreprise['body'];
|
||||
$tabInfoEntrep=getDataEntreprise($responseEntreprise);
|
||||
}
|
||||
elseif (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i)
|
||||
{
|
||||
// On déroule les URLs d'appels établissement
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i, true);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
}
|
||||
|
||||
$tabInfoEtab=getDataEtablissement($responseEtab);
|
||||
$tabRet[]=array_merge($tabInfoEtab, $tabInfoEntrep);
|
||||
|
||||
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
|
||||
else $siret=$tabInfoEtab['siret'];
|
||||
|
||||
$str= date('d/m/Y à H:i:s') .';'.
|
||||
$libelleErreur .';'.
|
||||
// Siège
|
||||
$siret .';'.
|
||||
$tabInfoEtab['active'] .';'.
|
||||
$tabInfoEtab['dateAbsActivite'] .';'.
|
||||
$tabInfoEtab['typeEtablissement'] .';'.
|
||||
$tabInfoEtab['dateMAJ'] .';'.
|
||||
$tabInfoEtab['dateCreation'] .';'.
|
||||
$tabInfoEtab['raisonSociale'] .';'.
|
||||
$tabInfoEtab['Enseigne'] .';'.
|
||||
$tabInfoEtab['NafCode'] .';'.
|
||||
$tabInfoEtab['NafLib'] .';'.
|
||||
$tabInfoEtab['AdresseLigne1'] .';'.
|
||||
$tabInfoEtab['AdresseLigne2'] .';'.
|
||||
$tabInfoEtab['AdresseLigne3'] .';'.
|
||||
$tabInfoEtab['etatJuridique'] .';'.
|
||||
$tabInfoEtab['dateEtatJuridique'] .';'.
|
||||
// Entreprise
|
||||
$tabInfoEntrep['dateCreationEntrep'] .';'.
|
||||
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
|
||||
$tabInfoEntrep['sigle'] .';'.
|
||||
$tabInfoEntrep['NafCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['NafLibEntrep'] .';'.
|
||||
$tabInfoEntrep['FJCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['FJLibEntrep'] .';'.
|
||||
$tabInfoEntrep['nbEtabActifs'] .';';
|
||||
|
||||
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
|
||||
fwrite($fp, $str."\r\n");
|
||||
fclose($fp);
|
||||
|
||||
$numEtab++;
|
||||
$num=$key+1;
|
||||
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
|
||||
// echo "Question $num/$nbLignes : Demande=$sirenLu$nicLu Etablissement $numEtab/$nbRepTot $typeEtablissement=$siret $libelleErreur\r\n";
|
||||
flush();
|
||||
sleep(1);
|
||||
|
||||
}//end for
|
||||
}//end if
|
||||
if ($pageCour==$nbTotPage) {
|
||||
// On sort de la boucle de passage à la page de liste suivante car il n'y a plus d'autres pages
|
||||
break;
|
||||
} else {
|
||||
$action='listeplus';
|
||||
$referer=SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp';
|
||||
}
|
||||
}
|
||||
} //Fin While
|
||||
// die('Boucle');
|
||||
} /* Fin de la boucle option 'lst' */ else
|
||||
{
|
||||
// Requête d'interrogation
|
||||
$postData=array('siren'=>$sirenLu,
|
||||
'option'=>$option,
|
||||
'nic'=>$nicLu,
|
||||
'dep'=>'',
|
||||
'listeDep'=>'');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=nouveau', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
||||
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',true);
|
||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
||||
if ($pos>0){
|
||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
||||
} else
|
||||
$libelleErreur='Erreur INSEE inconnue';
|
||||
}
|
||||
else
|
||||
{ if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege')
|
||||
// L'établissement demandé est un siège !
|
||||
$option=1;
|
||||
|
||||
if ($option==3)
|
||||
{
|
||||
// On déroule les URLs d'appels établissement
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', true);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
||||
$responseEtab=$responseEtab['body'];
|
||||
// On recherche si on est bien sur un fiche établissement
|
||||
$pos=strpos($responseEtab, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
|
||||
if ($pos<1)
|
||||
$libelleErreur='Erreur SCRIPT Fiche Etablissement non trouvée';
|
||||
else
|
||||
$libelleErreur='';
|
||||
$responseSiege=$responseEtab;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On déroule les URLs d'appels Sièges
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
||||
//sleep(1);
|
||||
// Frames réponse niveau sièges
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
||||
$responseSiege=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', true);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
||||
$responseSiege=$responseSiege['body'];//strip_tags(html_entity_decode(), '<td>');
|
||||
// On recherche si on est bien sur un fiche siège
|
||||
$pos=strpos($responseSiege, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
|
||||
if ($pos<1)
|
||||
$libelleErreur='Erreur SCRIPT Fiche Siège non trouvée';
|
||||
else
|
||||
$libelleErreur='';
|
||||
}
|
||||
|
||||
// Niveau entreprise
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege');
|
||||
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=entreprise');
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
|
||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', true);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
|
||||
$responseEntreprise=$responseEntreprise['body'];
|
||||
$pos=strpos($responseEntreprise, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Entreprise</B>');
|
||||
if ($pos<1) {
|
||||
$libelleErreur='Erreur SCRIPT Fiche Entreprise non trouvée';
|
||||
}
|
||||
|
||||
/** Recherche des données établissement
|
||||
**/
|
||||
$tabInfoEtab=getDataEtablissement($responseSiege);
|
||||
|
||||
/** Recherche des données entreprise
|
||||
**/
|
||||
$tabInfoEntrep=getDataEntreprise($responseEntreprise);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
|
||||
else $siret=$tabInfoEtab['siret'];
|
||||
|
||||
$str= date('d/m/Y à H:i:s') .';'.
|
||||
$libelleErreur .';'.
|
||||
// Siège
|
||||
$siret .';'.
|
||||
$tabInfoEtab['active'] .';'.
|
||||
$tabInfoEtab['dateAbsActivite'] .';'.
|
||||
$tabInfoEtab['typeEtablissement'] .';'.
|
||||
$tabInfoEtab['dateMAJ'] .';'.
|
||||
$tabInfoEtab['dateCreation'] .';'.
|
||||
$tabInfoEtab['raisonSociale'] .';'.
|
||||
$tabInfoEtab['Enseigne'] .';'.
|
||||
$tabInfoEtab['NafCode'] .';'.
|
||||
$tabInfoEtab['NafLib'] .';'.
|
||||
$tabInfoEtab['AdresseLigne1'] .';'.
|
||||
$tabInfoEtab['AdresseLigne2'] .';'.
|
||||
$tabInfoEtab['AdresseLigne3'] .';'.
|
||||
$tabInfoEtab['etatJuridique'] .';'.
|
||||
$tabInfoEtab['dateEtatJuridique'] .';'.
|
||||
// Entreprise
|
||||
$tabInfoEntrep['dateCreationEntrep'] .';'.
|
||||
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
|
||||
$tabInfoEntrep['sigle'] .';'.
|
||||
$tabInfoEntrep['NafCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['NafLibEntrep'] .';'.
|
||||
$tabInfoEntrep['FJCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['FJLibEntrep'] .';'.
|
||||
$tabInfoEntrep['nbEtabActifs'] .';'.
|
||||
//echo $str.'<br/>';
|
||||
|
||||
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
|
||||
fwrite($fp, $str."\r\n");
|
||||
fclose($fp);
|
||||
|
||||
$num=$key+1;
|
||||
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
|
||||
// echo "Ligne $num/$nbLignes : Question=$sirenLu$nicLu Retour $typeEtablissement=$siret $libelleErreur (PJ=$nbPJ)\r\n";
|
||||
//echo $str."<br/>";
|
||||
|
||||
flush();
|
||||
$tabRet=array(0=>array_merge($tabInfoEntrep, $tabInfoEtab));
|
||||
}
|
||||
}
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
?>
|
@ -1,54 +0,0 @@
|
||||
http://avis-situation-sirene.insee.fr/REPERTOIRE/Reponse/Liste_principal.asp
|
||||
HTTP/1.1 200 OK
|
||||
Server: Microsoft-IIS/5.0
|
||||
Date: Fri, 03 Nov 2006 00:40:09 GMT
|
||||
Content-Length: 1173
|
||||
Content-Type: text/html
|
||||
Expires: Thu, 02 Nov 2006 00:40:09 GMT
|
||||
Cache-control: private
|
||||
|
||||
|
||||
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Le répertoire SIRENE</TITLE>
|
||||
<STYLE>
|
||||
A { text-decoration: none;}
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
<BODY vlink="#0000FF" alink="#0000FF" >
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table valign="top">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<font face="Arial" size="2"> Nombre total de réponses :
|
||||
<font face="Arial" size="2"><b></b></font>
|
||||
<font face="Arial" size="2"> - Affichage de la page
|
||||
<font face="Arial" size="2"><b> / - </b></font>
|
||||
<font face="Arial" size="2"><b></b></font>
|
||||
<font face="Arial" size="2"> réponses affichées dans cette page
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table cols=2 width="100%">
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td align=right>
|
||||
Page précédente/suivante :<a href="/REPERTOIRE/Reponse/question.asp?action=listemoins" target="_top"><img src="/IMAGES/reponse/fleche_precedent.gif" width="20" height="20" border="0" alt="Page précédente"></a> <a href="/REPERTOIRE/Reponse/question.asp?action=listeplus" target="_top"><img src="/IMAGES/reponse/fleche_suivant.gif" width="20" height="20" border="0" alt="Page suivante"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
||||
|
@ -1,174 +0,0 @@
|
||||
<?
|
||||
define ('BEFORE', 0);
|
||||
define ('AFTER', 1);
|
||||
define ('BOTH', 2);
|
||||
|
||||
function trimAccent ($strWithAccent) {
|
||||
$strWithAccent = htmlentities(strtolower($strWithAccent ));
|
||||
$strWithAccent = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $strWithAccent );
|
||||
$strWithAccent = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($strWithAccent ));
|
||||
$strWithAccent = trim($strWithAccent , "-");
|
||||
return $strWithAccent;
|
||||
}
|
||||
|
||||
//function SRSaufVoyelle ($strIn, $mot1, $mot2) {
|
||||
function str_replace_except_voy($mot1, $mot2, $strIn, $rule=0) {
|
||||
$Voyelle=array('a','e','i','o','u','y', '1', '2', '3', '4');
|
||||
if ($mot1==$mot2) return $strIn;
|
||||
if (strpos($mot2,$mot1)===false)
|
||||
{
|
||||
//foreach ($Voyelle as $k => $voy)
|
||||
$posMot1=strpos($strIn, $mot1);
|
||||
while ($posMot1!==false) {
|
||||
$lettreAV=$strIn[$posMot1-1];
|
||||
$lettreAP=$strIn[$posMot1+strlen($mot1)];
|
||||
//echo "Lettre AV=$lettreAV<br/>";
|
||||
//echo "Lettre AP=$lettreAP<br/>";
|
||||
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
|
||||
( $rule==1 && !in_array($lettreAP, $Voyelle) ) ||
|
||||
( $rule==2 && !in_array($lettreAV, $Voyelle) && !in_array($lettreAP, $Voyelle) ))
|
||||
$strIn=substr($strIn,0,$posMot1) . $mot2 . substr($strIn,$posMot1+strlen($mot1),strlen($strIn));
|
||||
//echo "Le Mot devient : $strIn<br/>";
|
||||
$posMot1=@strpos($strIn, $mot1, $posMot1+strlen($mot1));
|
||||
}
|
||||
return $strIn;
|
||||
}
|
||||
//echo "Erreur : $mot2 contient $mot1 !<br>";
|
||||
return $strIn;
|
||||
}
|
||||
|
||||
/** Retourne le phonex d'un mot
|
||||
**/
|
||||
function phonex($strIn) {
|
||||
if ($strIn=='') return 0.0;
|
||||
$tabSonAIA=array('aina', 'eina', 'aima', 'eima');
|
||||
$tabSonAIE=array('ainr', 'eine', 'aime', 'eime');
|
||||
$tabSonAII=array('aini', 'eini', 'aimi', 'eimi');
|
||||
$tabSonAIO=array('aino', 'eino', 'aimo', 'eimo');
|
||||
$tabSonAIU=array('ainu', 'einu', 'aimu', 'eimu');
|
||||
$tabCarPhon=array('1', '2', '3', '4', '5', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z');
|
||||
|
||||
/** On traite tout en minuscule **/
|
||||
$strIn=strtolower($strIn);
|
||||
/** On remplace les 'Y' par des 'I' **/
|
||||
$strIn=str_replace('y', 'i', $strIn);
|
||||
/** On supprime les accents **/
|
||||
$strIn=trimAccent($strIn);
|
||||
/** On retire les 'H' muets sauf ceux précédés par 'C' ou 'S' **/
|
||||
$strIn = preg_replace ('/(?<![CS])H/', '', $strIn);
|
||||
/** On remplace les 'PH' par des 'F' **/
|
||||
$strIn=str_replace('ph', 'f', $strIn);
|
||||
/** On remplace les 'G' par des 'K' devant AN AM AIN AIM **/
|
||||
$strIn=str_replace('gan', 'kan', $strIn);
|
||||
$strIn=str_replace('gain', 'kain', $strIn);
|
||||
$strIn=str_replace('gam', 'kam4', $strIn);
|
||||
$strIn=str_replace('gaim', 'kaim', $strIn);
|
||||
/** On remplace le son AI **/
|
||||
for ($i=0; $i>4; $i++) {
|
||||
$strIn=str_replace($tabSonAIA[$i], 'yna', $strIn);
|
||||
$strIn=str_replace($tabSonAIE[$i], 'yne', $strIn);
|
||||
$strIn=str_replace($tabSonAII[$i], 'yni', $strIn);
|
||||
$strIn=str_replace($tabSonAIO[$i], 'yno', $strIn);
|
||||
$strIn=str_replace($tabSonAIU[$i], 'ynu', $strIn);
|
||||
}
|
||||
/** Remplacement des groupes de 3 lettres **/
|
||||
$strIn=str_replace('eau', 'o', $strIn);
|
||||
$strIn=str_replace('oua', '2', $strIn);
|
||||
$strIn=str_replace('ein', '4', $strIn);
|
||||
$strIn=str_replace('ain', '4', $strIn);
|
||||
/** Remplacement du son 'é' **/
|
||||
$strIn=str_replace('ai', 'y', $strIn);
|
||||
$strIn=str_replace('ei', 'y', $strIn);
|
||||
$strIn=str_replace('er', 'yr', $strIn);
|
||||
$strIn=str_replace('ess', 'yss', $strIn);
|
||||
$strIn=str_replace('et', 'yt', $strIn);
|
||||
$strIn=str_replace('ez', 'yz', $strIn);
|
||||
/** Remplacement des groupes de 2 lettres sauf si voyelle ou son (1 à 4) AVANT **/
|
||||
$strIn=str_replace_except_voy('an', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('am', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('en', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('em', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BEFORE);
|
||||
/** Remplacement du son 'SCH' **/
|
||||
$strIn=str_replace('sch', '5', $strIn);
|
||||
/** Remplacement du 'S' sauf si voyelle ou son (1 à 4) avant ou après **/
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BOTH);
|
||||
/** Remplacement de groupe de 2 lettres diverses **/
|
||||
$strIn=str_replace('oe', 'e', $strIn);
|
||||
$strIn=str_replace('eu', 'e', $strIn);
|
||||
$strIn=str_replace('au', 'o', $strIn);
|
||||
$strIn=str_replace('oi', '2', $strIn);
|
||||
$strIn=str_replace('oy', '2', $strIn);
|
||||
$strIn=str_replace('ou', '3', $strIn);
|
||||
$strIn=str_replace('ch', '5', $strIn);
|
||||
$strIn=str_replace('sh', '5', $strIn);
|
||||
$strIn=str_replace('ss', 's', $strIn);
|
||||
$strIn=str_replace('sc', 's', $strIn);
|
||||
/** Remplacement du 'C' par 'S' s'il est suivi d'un 'E' ou d'un 'I' **/
|
||||
$strIn=str_replace('ce', 'se', $strIn);
|
||||
$strIn=str_replace('ci', 'si', $strIn);
|
||||
/** Remplacement divers **/
|
||||
$strIn=str_replace('c', 'k', $strIn);
|
||||
$strIn=str_replace('q', 'k', $strIn);
|
||||
$strIn=str_replace('qu', 'k', $strIn);
|
||||
|
||||
$strIn=str_replace('ga', 'ka', $strIn);
|
||||
$strIn=str_replace('go', 'ko', $strIn);
|
||||
$strIn=str_replace('gu', 'ku', $strIn);
|
||||
$strIn=str_replace('gy', 'ky', $strIn);
|
||||
$strIn=str_replace('g2', 'k2', $strIn);
|
||||
$strIn=str_replace('g1', 'k1', $strIn);
|
||||
$strIn=str_replace('g3', 'k3', $strIn);
|
||||
|
||||
$strIn=str_replace('a', 'o', $strIn);
|
||||
$strIn=str_replace('d', 't', $strIn);
|
||||
$strIn=str_replace('p', 't', $strIn);
|
||||
$strIn=str_replace('j', 'g', $strIn);
|
||||
$strIn=str_replace('b', 'f', $strIn);
|
||||
$strIn=str_replace('v', 'f', $strIn);
|
||||
$strIn=str_replace('m', 'n', $strIn);
|
||||
|
||||
/** Supression des lettres dupliquées **/
|
||||
$let=$strIn[0];
|
||||
$strIn2=$let;
|
||||
for ($i=1; $i<strlen($strIn); $i++)
|
||||
{ if ($strIn==$let)
|
||||
continue;
|
||||
else {
|
||||
$let=$strIn[$i];
|
||||
$strIn2.=$strIn[$i];
|
||||
}
|
||||
}
|
||||
$strIn=$strIn2;
|
||||
|
||||
/** Supression des terminaisons **/
|
||||
$strIn2=substr($strIn,-1);
|
||||
if ($strIn2=='t' || $strIn2=='k' || $strIn2=='s' || $strIn2=='z')
|
||||
$strIn=substr($strIn,0,-1);
|
||||
|
||||
/** Supression des caractères non autorisés **/
|
||||
$j=10;
|
||||
$sout=array();
|
||||
for ($i=0; $i<strlen($strIn); $i++)
|
||||
{
|
||||
if ($j<1) break;
|
||||
for ($k=0; $k<22; $k++)
|
||||
{
|
||||
if ($strIn[$i]==$tabCarPhon[$k])
|
||||
{
|
||||
$sout[$j]=$k;
|
||||
$j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
//print_r($tabCarPhon);
|
||||
|
||||
/** Couversion en flottant **/
|
||||
$result=0.0;
|
||||
for ($j=10; $j>0; $j--)
|
||||
$result+=$sout[$j]*pow($j-1,10);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
@ -1,527 +0,0 @@
|
||||
codeZone;valeur;NBEntreprises;NbProCol;Pourcentage;Risque;Points
|
||||
GLOBALE;TOTAL;6447249;43572;0.006758231;0.006758231;0
|
||||
insAPEN31;DB;18973;612;0.032256364;4.729218896;-3.729218896
|
||||
insAPEN31;FA;367665;9644;0.0262304;3.845731092;-2.845731092
|
||||
insAPEN31;DJ;32346;786;0.024299759;3.562673018;-2.562673018
|
||||
insAPEN31;DM;5682;132;0.023231257;3.406016148;-2.406016148
|
||||
insAPEN31;DC;2430;55;0.022633745;3.318412852;-2.318412852
|
||||
insAPEN31;DE;36701;740;0.020162938;2.956159228;-1.956159228
|
||||
insAPEN31;DH;5546;111;0.020014425;2.934385137;-1.934385137
|
||||
insAPEN31;DD;11292;225;0.019925611;2.92136384;-1.92136384
|
||||
insAPEN31;DK;17243;334;0.019370179;2.839930026;-1.839930026
|
||||
insAPEN31;HA;242687;4586;0.018896768;2.770521585;-1.770521585
|
||||
insAPEN31;IA;111075;1916;0.017249606;2.529025356;-1.529025356
|
||||
insAPEN31;DL;20515;323;0.015744577;2.308367769;-1.308367769
|
||||
insAPEN31;GA;693458;10740;0.0154876;2.270691423;-1.270691423
|
||||
insAPEN31;DI;9391;138;0.014694921;2.154473946;-1.154473946
|
||||
insAPEN31;DA;69613;995;0.014293307;2.095591997;-1.095591997
|
||||
insAPEN31;DG;4389;61;0.013898382;2.037690661;-1.037690661
|
||||
insAPEN31;DN;33557;435;0.012963018;1.900553633;-0.900553633
|
||||
insAPEN31;ZZ;16576;119;0.007179054;1.052546337;-0.052546337
|
||||
insAPEN31;CB;2833;17;0.006000706;0.879784584;0.120215416
|
||||
insAPEN31;GG;9721;52;0.005349244;0.784271442;0.215728558
|
||||
insAPEN31;MA;70612;373;0.005282388;0.774469502;0.225530498
|
||||
insAPEN31;FF;4750;25;0.005263158;0.77165007;0.22834993
|
||||
insAPEN31;CA;195;1;0.005128205;0.751864171;0.248135829
|
||||
insAPEN31;HH;3757;16;0.004258717;0.62438547;0.37561453
|
||||
insAPEN31;JA;72234;289;0.004000886;0.586583954;0.413416046
|
||||
insAPEN31;OA;611504;2075;0.003393273;0.497499673;0.502500327
|
||||
insAPEN31;KA;2657556;7102;0.00267238;0.391807048;0.608192952
|
||||
insAPEN31;BA;14187;37;0.002608021;0.382371184;0.617628816
|
||||
insAPEN31;OO;2450;6;0.00244898;0.359053502;0.640946498
|
||||
insAPEN31;II;1476;3;0.00203252;0.297994946;0.702005054
|
||||
insAPEN31;KK;22395;40;0.001786113;0.261868298;0.738131702
|
||||
insAPEN31;AA;777002;1339;0.00172329;0.252657643;0.747342357
|
||||
insAPEN31;EA;5687;7;0.001230877;0.180463266;0.819536734
|
||||
insAPEN31;NA;432746;238;0.000549976;0.080633943;0.919366057
|
||||
insAPEN31;BB;81;;0;0;1
|
||||
insAPEN31;DF;149;;0;0;1
|
||||
insAPEN31;EE;79;;0;0;1
|
||||
insAPEN31;JJ;596;;0;0;1
|
||||
insAPEN31;LA;56364;;0;0;1
|
||||
insAPEN31;LL;79;;0;0;1
|
||||
insAPEN31;MM;343;;0;0;1
|
||||
insAPEN31;NN;772;;0;0;1
|
||||
insAPEN31;PA;32;;0;0;1
|
||||
insAPEN31;QA;510;;0;0;1
|
||||
insMONOACT;1;57315;535;0.00933438;1.368546272;-0.368546272
|
||||
insMONOACT;2;6175850;41794;0.006767328;0.992181671;0.007818329
|
||||
insMONOACT;0;214084;1243;0.005806132;0.851257436;0.148742564
|
||||
insSAISONAT;0;6422146;43477;0.006769855;0.99255229;0.00744771
|
||||
insSAISONAT;1;25103;95;0.003784408;0.554845387;0.445154613
|
||||
insDEPET;93;99100;1332;0.013440969;1.988829034;-0.988829034
|
||||
insDEPET;77;87496;937;0.010709061;1.58459497;-0.58459497
|
||||
insDEPET;94;94293;975;0.01034011;1.530002158;-0.530002158
|
||||
insDEPET;57;67886;694;0.010223021;1.51267675;-0.51267675
|
||||
insDEPET;95;72827;735;0.010092411;1.493350666;-0.493350666
|
||||
insDEPET;13;198603;1935;0.009743055;1.441657335;-0.441657335
|
||||
insDEPET;59;165430;1504;0.009091459;1.345242092;-0.345242092
|
||||
insDEPET;91;75252;675;0.008969861;1.327249612;-0.327249612
|
||||
insDEPET;06;158986;1366;0.008591951;1.271331178;-0.271331178
|
||||
insDEPET;62;87566;730;0.008336569;1.23354282;-0.23354282
|
||||
insDEPET;54;50761;411;0.008096767;1.198059904;-0.198059904
|
||||
insDEPET;90;9792;79;0.00806781;1.193775242;-0.193775242
|
||||
insDEPET;42;68973;550;0.007974135;1.179914273;-0.179914273
|
||||
insDEPET;60;52888;420;0.00794131;1.175057253;-0.175057253
|
||||
insDEPET;92;147353;1169;0.00793333;1.173876504;-0.173876504
|
||||
insDEPET;68;61653;481;0.007801729;1.154403789;-0.154403789
|
||||
insDEPET;72;43306;332;0.007666374;1.134375644;-0.134375644
|
||||
insDEPET;31;116009;868;0.007482178;1.107120578;-0.107120578
|
||||
insDEPET;02;39818;295;0.00740871;1.096249618;-0.096249618
|
||||
insDEPET;78;101841;754;0.007403698;1.095508047;-0.095508047
|
||||
insDEPET;67;93946;692;0.007365934;1.089920151;-0.089920151
|
||||
insDEPET;28;34301;252;0.007346725;1.087077834;-0.087077834
|
||||
insDEPET;33;152528;1107;0.007257684;1.07390268;-0.07390268
|
||||
insDEPET;84;67613;488;0.007217547;1.067963714;-0.067963714
|
||||
insDEPET;83;126540;909;0.007183499;1.062925765;-0.062925765
|
||||
insDEPET;66;58946;419;0.007108201;1.051784011;-0.051784011
|
||||
insDEPET;18;27790;193;0.006944944;1.027627324;-0.027627324
|
||||
insDEPET;69;174961;1214;0.006938689;1.026701782;-0.026701782
|
||||
insDEPET;88;34443;238;0.006909967;1.022451853;-0.022451853
|
||||
insDEPET;30;76395;525;0.006872177;1.0168602;-0.0168602
|
||||
insDEPET;08;23202;157;0.006766658;1.001246731;-0.001246731
|
||||
insDEPET;87;34338;231;0.006727241;0.995414275;0.004585725
|
||||
insDEPET;76;86118;579;0.006723333;0.994836039;0.005163961
|
||||
insDEPET;26;53631;358;0.006675244;0.987720376;0.012279624
|
||||
insDEPET;34;133650;876;0.006554433;0.969844315;0.030155685
|
||||
insDEPET;2A;17005;111;0.006527492;0.965857872;0.034142128
|
||||
insDEPET;25;44175;286;0.00647425;0.95797981;0.04202019
|
||||
insDEPET;38;119307;770;0.006453938;0.954974293;0.045025707
|
||||
insDEPET;41;28978;186;0.006418662;0.949754625;0.050245375
|
||||
insDEPET;45;49561;318;0.006416335;0.949410303;0.050589697
|
||||
insDEPET;2B;19519;124;0.006352784;0.940006815;0.059993185
|
||||
insDEPET;70;21399;132;0.006168513;0.912740526;0.087259474
|
||||
insDEPET;37;49723;305;0.006133982;0.907631159;0.092368841
|
||||
insDEPET;55;17276;105;0.006077796;0.899317376;0.100682624
|
||||
insDEPET;27;45311;273;0.006025027;0.891509307;0.108490693
|
||||
insDEPET;39;26947;162;0.006011801;0.889552272;0.110447728
|
||||
insDEPET;80;42871;257;0.005994728;0.887026083;0.112973917
|
||||
insDEPET;47;40592;242;0.005961766;0.882148698;0.117851302
|
||||
insDEPET;82;27230;159;0.005839148;0.864005216;0.135994784
|
||||
insDEPET;36;23734;137;0.00577231;0.854115317;0.145884683
|
||||
insDEPET;63;65589;373;0.005686929;0.841481754;0.158518246
|
||||
insDEPET;89;33216;188;0.005659923;0.837485697;0.162514303
|
||||
insDEPET;52;16860;94;0.005575326;0.824968117;0.175031883
|
||||
insDEPET;24;51134;284;0.005554034;0.821817631;0.178182369
|
||||
insDEPET;58;22345;123;0.005504587;0.814501022;0.185498978
|
||||
insDEPET;17;75422;415;0.005502373;0.814173445;0.185826555
|
||||
insDEPET;71;55680;306;0.00549569;0.813184479;0.186815521
|
||||
insDEPET;03;34938;192;0.005495449;0.813148882;0.186851118
|
||||
insDEPET;21;53379;290;0.005432848;0.803885963;0.196114037
|
||||
insDEPET;49;68055;368;0.005407391;0.800119144;0.199880856
|
||||
insDEPET;11;55513;300;0.00540414;0.799638025;0.200361975
|
||||
insDEPET;86;38412;205;0.005336874;0.789684879;0.210315121
|
||||
insDEPET;51;65810;346;0.00525756;0.777948932;0.222051068
|
||||
insDEPET;56;72609;378;0.005205966;0.770314771;0.229685229
|
||||
insDEPET;07;33636;169;0.005024379;0.74344568;0.25655432
|
||||
insDEPET;44;106703;532;0.004985802;0.73773754;0.26226246
|
||||
insDEPET;01;51685;255;0.004933733;0.730033082;0.269966918
|
||||
insDEPET;10;30663;149;0.004859277;0.71901592;0.28098408
|
||||
insDEPET;14;64428;310;0.004811573;0.711957263;0.288042737
|
||||
insDEPET;19;30160;144;0.004774536;0.706477014;0.293522986
|
||||
insDEPET;16;39889;190;0.004763218;0.704802333;0.295197667
|
||||
insDEPET;73;71454;339;0.004744311;0.702004723;0.297995277
|
||||
insDEPET;81;40986;194;0.004733324;0.700378935;0.299621065
|
||||
insDEPET;35;90680;422;0.004653727;0.688601272;0.311398728
|
||||
insDEPET;29;86330;400;0.004633384;0.685591038;0.314408962
|
||||
insDEPET;61;32758;149;0.004548507;0.673032089;0.326967911
|
||||
insDEPET;74;93707;423;0.00451407;0.667936558;0.332063442
|
||||
insDEPET;09;17626;79;0.004482015;0.663193417;0.336806583
|
||||
insDEPET;79;37656;162;0.004302103;0.636572261;0.363427739
|
||||
insDEPET;64;83756;359;0.00428626;0.634227986;0.365772014
|
||||
insDEPET;23;16174;68;0.004204278;0.622097355;0.377902645
|
||||
insDEPET;50;52775;219;0.004149692;0.614020335;0.385979665
|
||||
insDEPET;04;22787;90;0.00394962;0.58441619;0.41558381
|
||||
insDEPET;40;49541;192;0.003875578;0.573460278;0.426539722
|
||||
insDEPET;43;27370;105;0.003836317;0.567650968;0.432349032
|
||||
insDEPET;22;64491;244;0.003783474;0.559831842;0.440168158
|
||||
insDEPET;85;64417;243;0.003772296;0.558177928;0.441822072
|
||||
insDEPET;46;26030;95;0.003649635;0.54002805;0.45997195
|
||||
insDEPET;53;32932;120;0.003643872;0.539175339;0.460824661
|
||||
insDEPET;99;40894;134;0.003276764;0.484855233;0.515144767
|
||||
insDEPET;65;34146;104;0.003045745;0.450671801;0.549328199
|
||||
insDEPET;32;32543;96;0.002949943;0.436496261;0.563503739
|
||||
insDEPET;15;22199;62;0.002792919;0.413261701;0.586738299
|
||||
insDEPET;05;25212;70;0.002776456;0.410825718;0.589174282
|
||||
insDEPET;48;12747;34;0.002667294;0.394673359;0.605326641
|
||||
insDEPET;98;775;2;0.002580645;0.381852092;0.618147908
|
||||
insDEPET;12;41281;104;0.002519319;0.372777775;0.627222225
|
||||
insDEPCOMEN;75120;23391;422;0.018041127;2.669503799;-1.669503799
|
||||
insDEPCOMEN;75110;28336;491;0.017327781;2.56395164;-1.56395164
|
||||
insDEPCOMEN;75102;19124;292;0.015268772;2.259284889;-1.259284889
|
||||
insDEPCOMEN;75103;14002;144;0.010284245;1.521735947;-0.521735947
|
||||
insDEPCOMEN;75112;23538;238;0.010111309;1.496147047;-0.496147047
|
||||
insDEPCOMEN;75119;18558;185;0.009968747;1.475052368;-0.475052368
|
||||
insDEPCOMEN;75109;30187;288;0.009540531;1.411690247;-0.411690247
|
||||
insDEPCOMEN;75111;32950;296;0.008983308;1.329239301;-0.329239301
|
||||
insDEPCOMEN;75101;16952;132;0.007786692;1.15217877;-0.15217877
|
||||
insDEPCOMEN;75118;26179;197;0.007525116;1.113473932;-0.113473932
|
||||
insDEPCOMEN;75114;21520;154;0.007156134;1.058876561;-0.058876561
|
||||
insDEPCOMEN;75108;66310;446;0.006725984;0.995228288;0.004771712
|
||||
insDEPCOMEN;75117;41679;278;0.006670026;0.986948262;0.013051738
|
||||
insDEPCOMEN;75115;36833;223;0.006054353;0.895848666;0.104151334
|
||||
insDEPCOMEN;75113;19497;113;0.005795763;0.857585705;0.142414295
|
||||
insDEPCOMEN;75104;10380;51;0.004913295;0.72700886;0.27299114
|
||||
insDEPCOMEN;75105;14528;71;0.004887115;0.723135028;0.276864972
|
||||
insDEPCOMEN;75116;48424;220;0.004543202;0.672247044;0.327752956
|
||||
insDEPCOMEN;75106;16345;72;0.004405017;0.651800145;0.348199855
|
||||
insDEPCOMEN;75107;18645;59;0.003164387;0.468227056;0.531772944
|
||||
insDEPCOMEN,3;974;61141;402;0.006574966;0.972882512;0.027117488
|
||||
insDEPCOMEN,3;972;42850;261;0.006091015;0.901273418;0.098726582
|
||||
insDEPCOMEN,3;971;63190;307;0.004858364;0.718880828;0.281119172
|
||||
insDEPCOMEN,3;973;13285;63;0.00474219;0.701690944;0.298309056
|
||||
insCJ,2;54;1046180;26431;0.025264295;3.738299821;-2.738299821
|
||||
insCJ,2;55;116455;1676;0.014391825;2.129525393;-1.129525393
|
||||
insCJ,2;13;332350;4569;0.013747555;2.034194255;-1.034194255
|
||||
insCJ,2;56;6079;81;0.01332456;1.971604606;-0.971604606
|
||||
insCJ,2;57;68076;864;0.012691698;1.8779614;-0.8779614
|
||||
insCJ,2;12;437093;5064;0.011585635;1.714299878;-0.714299878
|
||||
insCJ,2;11;197912;2096;0.010590566;1.567061711;-0.567061711
|
||||
insCJ,2;82;5102;51;0.00999608;1.479097048;-0.479097048
|
||||
insCJ,2;31;11814;115;0.009734214;1.440349288;-0.440349288
|
||||
insCJ,2;53;1525;13;0.00852459;1.261364073;-0.261364073
|
||||
insCJ,2;52;38818;186;0.004791592;0.709000819;0.290999181
|
||||
insCJ,2;51;517;1;0.001934236;0.286204465;0.713795535
|
||||
insCJ,2;92;417094;658;0.001577582;0.233431198;0.766568802
|
||||
insCJ,2;62;10141;12;0.001183315;0.175092447;0.824907553
|
||||
insCJ,2;17;40919;39;0.000953102;0.141028389;0.858971611
|
||||
insCJ,2;16;558658;471;0.000843092;0.124750367;0.875249633
|
||||
insCJ,2;65;1134849;828;0.000729612;0.107959088;0.892040912
|
||||
insCJ,2;32;26976;19;0.00070433;0.104218063;0.895781937
|
||||
insCJ,2;29;24080;14;0.000581395;0.086027738;0.913972262
|
||||
insCJ,2;84;8634;5;0.000579106;0.085688967;0.914311033
|
||||
insCJ,2;63;20101;6;0.000298493;0.044167268;0.955832732
|
||||
insCJ,2;19;511880;129;0.000252012;0.037289666;0.962710334
|
||||
insCJ,2;15;577704;133;0.000230222;0.034065378;0.965934622
|
||||
insCJ,2;18;497265;107;0.000215177;0.03183925;0.96816075
|
||||
insCJ,2;22;29402;3;0.000102034;0.015097719;0.984902281
|
||||
insCJ,2;21;24477;1;4.08547E-05;0.006045173;0.993954827
|
||||
insCJ,2;10;1;0;0;0;1
|
||||
insCJ,2;14;6117;0;0;0;1
|
||||
insCJ,2;23;7434;0;0;0;1
|
||||
insCJ,2;27;527;0;0;0;1
|
||||
insCJ,2;41;874;0;0;0;1
|
||||
insCJ,2;61;17;0;0;0;1
|
||||
insCJ,2;64;178;0;0;0;1
|
||||
insCJ,2;69;2;0;0;0;1
|
||||
insCJ,2;71;2984;0;0;0;1
|
||||
insCJ,2;72;36821;0;0;0;1
|
||||
insCJ,2;73;91862;0;0;0;1
|
||||
insCJ,2;74;2566;0;0;0;1
|
||||
insCJ,2;81;1202;0;0;0;1
|
||||
insCJ,2;83;4849;0;0;0;1
|
||||
insCJ,2;91;145682;0;0;0;1
|
||||
insCJ,2;93;461;0;0;0;1
|
||||
insCJ,2;99;1571;0;0;0;1
|
||||
ageDirigeant;0;4092989;11244;0.002747137;0.406487512;0.593512488
|
||||
ageDirigeant;1;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;2;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;3;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;4;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;5;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;6;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;7;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;8;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;9;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;10;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;11;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;12;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;13;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;14;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;15;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;16;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;17;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;18;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;19;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;20;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;21;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;22;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;23;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;24;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;25;7915;339;0.042830069;6.337467242;-5.337467242
|
||||
ageDirigeant;26;51311;1744;0.033988813;5.029246825;-4.029246825
|
||||
ageDirigeant;27;51311;1744;0.033988813;5.029246825;-4.029246825
|
||||
ageDirigeant;28;51311;1744;0.033988813;5.029246825;-4.029246825
|
||||
ageDirigeant;29;51311;1744;0.033988813;5.029246825;-4.029246825
|
||||
ageDirigeant;30;132700;3421;0.025779955;3.814600838;-2.814600838
|
||||
ageDirigeant;31;132700;3421;0.025779955;3.814600838;-2.814600838
|
||||
ageDirigeant;32;132700;3421;0.025779955;3.814600838;-2.814600838
|
||||
ageDirigeant;33;132700;3421;0.025779955;3.814600838;-2.814600838
|
||||
ageDirigeant;34;132700;3421;0.025779955;3.814600838;-2.814600838
|
||||
ageDirigeant;35;246272;4538;0.01842678;2.726568435;-1.726568435
|
||||
ageDirigeant;36;246272;4538;0.01842678;2.726568435;-1.726568435
|
||||
ageDirigeant;37;246272;4538;0.01842678;2.726568435;-1.726568435
|
||||
ageDirigeant;38;246272;4538;0.01842678;2.726568435;-1.726568435
|
||||
ageDirigeant;39;246272;4538;0.01842678;2.726568435;-1.726568435
|
||||
ageDirigeant;40;339245;5421;0.015979602;2.364465057;-1.364465057
|
||||
ageDirigeant;41;339245;5421;0.015979602;2.364465057;-1.364465057
|
||||
ageDirigeant;42;339245;5421;0.015979602;2.364465057;-1.364465057
|
||||
ageDirigeant;43;339245;5421;0.015979602;2.364465057;-1.364465057
|
||||
ageDirigeant;44;339245;5421;0.015979602;2.364465057;-1.364465057
|
||||
ageDirigeant;45;367968;5217;0.014177863;2.097865945;-1.097865945
|
||||
ageDirigeant;46;367968;5217;0.014177863;2.097865945;-1.097865945
|
||||
ageDirigeant;47;367968;5217;0.014177863;2.097865945;-1.097865945
|
||||
ageDirigeant;48;367968;5217;0.014177863;2.097865945;-1.097865945
|
||||
ageDirigeant;49;367968;5217;0.014177863;2.097865945;-1.097865945
|
||||
ageDirigeant;50;375026;4591;0.012241818;1.811393744;-0.811393744
|
||||
ageDirigeant;51;375026;4591;0.012241818;1.811393744;-0.811393744
|
||||
ageDirigeant;52;375026;4591;0.012241818;1.811393744;-0.811393744
|
||||
ageDirigeant;53;375026;4591;0.012241818;1.811393744;-0.811393744
|
||||
ageDirigeant;54;375026;4591;0.012241818;1.811393744;-0.811393744
|
||||
ageDirigeant;55;377653;3778;0.010003892;1.480253045;-0.480253045
|
||||
ageDirigeant;56;377653;3778;0.010003892;1.480253045;-0.480253045
|
||||
ageDirigeant;57;377653;3778;0.010003892;1.480253045;-0.480253045
|
||||
ageDirigeant;58;377653;3778;0.010003892;1.480253045;-0.480253045
|
||||
ageDirigeant;59;377653;3778;0.010003892;1.480253045;-0.480253045
|
||||
ageDirigeant;60;232451;2003;0.00861687;1.275018479;-0.275018479
|
||||
ageDirigeant;61;232451;2003;0.00861687;1.275018479;-0.275018479
|
||||
ageDirigeant;62;232451;2003;0.00861687;1.275018479;-0.275018479
|
||||
ageDirigeant;63;232451;2003;0.00861687;1.275018479;-0.275018479
|
||||
ageDirigeant;64;232451;2003;0.00861687;1.275018479;-0.275018479
|
||||
ageDirigeant;65;100941;680;0.006736609;0.996800526;0.003199474
|
||||
ageDirigeant;66;100941;680;0.006736609;0.996800526;0.003199474
|
||||
ageDirigeant;67;100941;680;0.006736609;0.996800526;0.003199474
|
||||
ageDirigeant;68;100941;680;0.006736609;0.996800526;0.003199474
|
||||
ageDirigeant;69;100941;680;0.006736609;0.996800526;0.003199474
|
||||
ageDirigeant;70;55612;320;0.005754154;0.85142895;0.14857105
|
||||
ageDirigeant;71;55612;320;0.005754154;0.85142895;0.14857105
|
||||
ageDirigeant;72;55612;320;0.005754154;0.85142895;0.14857105
|
||||
ageDirigeant;73;55612;320;0.005754154;0.85142895;0.14857105
|
||||
ageDirigeant;74;55612;320;0.005754154;0.85142895;0.14857105
|
||||
ageDirigeant;75;33744;164;0.004860123;0.719141306;0.280858694
|
||||
ageDirigeant;76;33744;164;0.004860123;0.719141306;0.280858694
|
||||
ageDirigeant;77;33744;164;0.004860123;0.719141306;0.280858694
|
||||
ageDirigeant;78;33744;164;0.004860123;0.719141306;0.280858694
|
||||
ageDirigeant;79;33744;164;0.004860123;0.719141306;0.280858694
|
||||
ageDirigeant;80;19900;73;0.003668342;0.542796117;0.457203883
|
||||
ageDirigeant;81;19900;73;0.003668342;0.542796117;0.457203883
|
||||
ageDirigeant;82;19900;73;0.003668342;0.542796117;0.457203883
|
||||
ageDirigeant;83;19900;73;0.003668342;0.542796117;0.457203883
|
||||
ageDirigeant;84;19900;73;0.003668342;0.542796117;0.457203883
|
||||
ageDirigeant;*;13522;39;0.002884189;0.426766798;0.573233202
|
||||
ageEntreprise;0;398545;3931;0,009863378;1,45812286;-0.45812286
|
||||
ageEntreprise;1;363230;5849;0.016102745;2.380500904;-1.380500904
|
||||
ageEntreprise;2;336945;5474;0.016245975;2.401674887;-1.401674887
|
||||
ageEntreprise;3;320242;4323;0.013499166;1.995608689;-0.995608689
|
||||
ageEntreprise;4;311256;3186;0.010235947;1.513200512;-0.513200512
|
||||
ageEntreprise;5;286481;2597;0.009065174;1.340122706;-0.340122706
|
||||
ageEntreprise;6;271422;2131;0.007851243;1.16066488;-0.16066488
|
||||
ageEntreprise;7;249689;1696;0.00679245;1.004141411;-0.004141411
|
||||
ageEntreprise;8;299828;1471;0.004906146;0.725285383;0.274714617
|
||||
ageEntreprise;9;251098;1368;0.005448072;0.805399367;0.194600633
|
||||
ageEntreprise;10;224326;1088;0.004850084;0.716997635;0.283002365
|
||||
ageEntreprise;11;225543;1016;0.004504684;0.665936463;0.334063537
|
||||
ageEntreprise;12;219141;911;0.004157141;0.614558427;0.385441573
|
||||
ageEntreprise;13;227433;890;0.00391324;0.578502136;0.421497864
|
||||
ageEntreprise;14;228796;849;0.003710729;0.548564505;0.451435495
|
||||
ageEntreprise;15;203213;738;0.003631657;0.536875165;0.463124835
|
||||
ageEntreprise;16;195413;723;0.003699856;0.546957126;0.453042874
|
||||
ageEntreprise;17;156467;621;0.003968888;0.586728635;0.413271365
|
||||
ageEntreprise;18;136150;578;0.004245318;0.627593783;0.372406217
|
||||
ageEntreprise;19;120966;421;0.003480317;0.514502176;0.485497824
|
||||
ageEntreprise;20;110350;344;0.003117354;0.460844645;0.539155355
|
||||
ageEntreprise;21;108829;314;0.00288526;0.426533798;0.573466202
|
||||
ageEntreprise;22;92057;306;0.003324028;0.49139762;0.50860238
|
||||
ageEntreprise;23;94394;225;0.002383626;0.3523762;0.6476238
|
||||
ageEntreprise;24;61811;133;0.002151721;0.318093146;0.681906854
|
||||
ageEntreprise;25;86450;215;0.002486987;0.367656207;0.632343793
|
||||
ageEntreprise;26;79203;222;0.002802924;0.414361868;0.585638132
|
||||
ageEntreprise;27;41020;131;0.003193564;0.472110957;0.527889043
|
||||
ageEntreprise;28;37137;119;0.003204351;0.473705671;0.526294329
|
||||
ageEntreprise;29;30627;110;0.003591602;0.530953718;0.469046282
|
||||
ageEntreprise;30;27785;106;0.003815008;0.563980261;0.436019739
|
||||
ageEntreprise;31;27100;87;0.003210332;0.474589802;0.525410198
|
||||
ageEntreprise;32;26851;86;0.00320286;0.47348522;0.52651478
|
||||
ageEntreprise;33;21279;48;0.002255745;0.3334713;0.6665287
|
||||
ageEntreprise;34;17287;42;0.002429571;0.359168382;0.640831618
|
||||
ageEntreprise;35;20082;45;0.002240813;0.331263809;0.668736191
|
||||
ageEntreprise;36;24005;33;0.001374714;0.203226655;0.796773345
|
||||
ageEntreprise;37;10981;36;0.00327839;0.484650929;0.515349071
|
||||
ageEntreprise;38;14152;43;0.00303844;0.449178619;0.550821381
|
||||
ageEntreprise;39;17017;67;0.003937239;0.582049933;0.417950067
|
||||
ageEntreprise;40;31055;102;0.003284495;0.485553488;0.514446512
|
||||
ageEntreprise;41;15175;43;0.002833608;0.418897912;0.581102088
|
||||
ageEntreprise;42;6992;15;0.002145309;0.3171453;0.6828547
|
||||
ageEntreprise;43;6310;14;0.0022187;0.327994919;0.672005081
|
||||
ageEntreprise;44;7244;15;0.002070679;0.306112636;0.693887364
|
||||
ageEntreprise;45;5863;13;0.002217295;0.32778713;0.67221287
|
||||
ageEntreprise;46;7647;52;0.006800052;1.005265304;-0.005265304
|
||||
ageEntreprise;47;9466;55;0.005810268;0.858943563;0.141056437
|
||||
ageEntreprise;48;6119;35;0.005719889;0.845582587;0.154417413
|
||||
ageEntreprise;49;6031;41;0.006798209;1.004992841;-0.004992841
|
||||
ageEntreprise;50;4954;22;0.004440856;0.656500587;0.343499413
|
||||
ageEntreprise;51;12623;11;0.000871425;0.128824523;0.871175477
|
||||
ageEntreprise;*;353169;621;0.001758365;0.259942604;0.740057396
|
||||
insTEFEN;11;122483;2586;0.021113134;3.12406207;-2.12406207
|
||||
insTEFEN;2;348140;6830;0.019618544;2.902911041;-1.902911041
|
||||
insTEFEN;3;178988;3509;0.019604666;2.900857541;-1.900857541
|
||||
insTEFEN;12;77324;1239;0.016023486;2.370958447;-1.370958447
|
||||
insTEFEN;1;946071;14717;0.015555915;2.301773089;-1.301773089
|
||||
insTEFEN;21;22652;290;0.012802402;1.894342023;-0.894342023
|
||||
insTEFEN;22;11018;103;0.009348339;1.383252313;-0.383252313
|
||||
insTEFEN;31;2325;13;0.005591398;0.827346328;0.172653672
|
||||
insTEFEN;0;4729670;14264;0.003015855;0.446249188;0.553750812
|
||||
insTEFEN;32;4541;13;0.002862806;0.423602777;0.576397223
|
||||
insTEFEN;41;2251;6;0.002665482;0.394405265;0.605594735
|
||||
insTEFEN;51;492;1;0.00203252;0.300747375;0.699252625
|
||||
insTEFEN;42;1121;1;0.000892061;0.131996172;0.868003828
|
||||
insTEFEN;52;172;0;0;0;1
|
||||
insTEFEN;53;1;0;0;0;1
|
||||
insNBTOA;13;445;8;0.017977528;2.660093638;-1.660093638
|
||||
insNBTOA;2;199031;2816;0.01414855;2.093528483;-1.093528483
|
||||
insNBTOA;3;38973;413;0.01059708;1.56802565;-0.56802565
|
||||
insNBTOA;1;3755472;38870;0.01035023;1.531499858;-0.531499858
|
||||
insNBTOA;8;1595;15;0.009404389;1.391545849;-0.391545849
|
||||
insNBTOA;11;743;6;0.00807537;1.194894013;-0.194894013
|
||||
insNBTOA;4;14851;119;0.008012928;1.185654658;-0.185654658
|
||||
insNBTOA;7;2443;19;0.007777323;1.150792658;-0.150792658
|
||||
insNBTOA;20-25;949;7;0.007376185;1.091437261;-0.091437261
|
||||
insNBTOA;10;869;6;0.006904488;1.021641256;-0.021641256
|
||||
insNBTOA;5;7090;46;0.006488011;0.960016163;0.039983837
|
||||
insNBTOA;6;3905;24;0.006145967;0.909404611;0.090595389
|
||||
insNBTOA;9;1144;6;0.005244755;0.776054416;0.223945584
|
||||
insNBTOA;14;412;2;0.004854369;0.718289848;0.281710152
|
||||
insNBTOA;75-99;225;1;0.004444444;0.657634261;0.342365739
|
||||
insNBTOA;35-49;639;2;0.00312989;0.463122719;0.536877281
|
||||
insNBTOA;50-74;424;1;0.002358491;0.348980445;0.651019555
|
||||
insNBTOA;15-19;1445;3;0.002076125;0.307199395;0.692800605
|
||||
insNBTOA;12;626;1;0.001597444;0.236370142;0.763629858
|
||||
insNBTOA;26-34;793;1;0.001261034;0.186592319;0.813407681
|
||||
insNBTOA;0;2414681;1206;0.000499445;0.073901711;0.926098289
|
||||
insNBTOA;100-;494;0;0;0;1
|
||||
insTCA;2;21622;409;0.018915919;2.798369096;-1.798369096
|
||||
insTCA;3;28973;507;0.017499051;2.588761516;-1.588761516
|
||||
insTCA;1;20023;348;0.017380013;2.571151383;-1.571151383
|
||||
insTCA;4;15955;207;0.012973989;1.919336348;-0.919336348
|
||||
insTCA;5;10403;89;0.008555224;1.265636407;-0.265636407
|
||||
insTCA;6;7600;51;0.006710526;0.992736831;0.007263169
|
||||
insTCA;0;6337365;41952;0.006619786;0.979312956;0.020687044
|
||||
insTCA;7;2667;7;0.002624672;0.388286754;0.611713246
|
||||
insTCA;9;1314;2;0.00152207;0.225170857;0.774829143
|
||||
insTCA;8;1327;0;0;0;1
|
||||
insTCAEXPOR;3;5258;109;0.020730316;3.066785966;-2.066785966
|
||||
insTCAEXPOR;2;12013;215;0.017897278;2.647674141;-1.647674141
|
||||
insTCAEXPOR;1;10029;173;0.017249975;2.551913931;-1.551913931
|
||||
insTCAEXPOR;4;5589;88;0.015745214;2.329303684;-1.329303684
|
||||
insTCAEXPOR;0;6414360;42987;0.006701682;0.991428405;0.008571595
|
||||
insSEXE;M;2233981;9893;0.004428417;0.655262754;0.344737246
|
||||
insSEXE;F;923849;2714;0.002937710;0.434686146;0.565313854
|
||||
insSEXE;*;3289419;30965;0.009413516;1.392896465;-0.392896465
|
||||
insRECME;0;6445782;43572;0.006759769;1.000227591;-0.000227591
|
||||
insRECME;1;1467;0;0.000000000;0;1
|
||||
insMONOREG;1;78856;935;0.011857056;1.754461392;-0.754461392
|
||||
insMONOREG;2;6170828;41393;0.006707852;0.992545468;0.007454532
|
||||
insMONOREG;0;197565;1244;0.006296662;0.931702627;0.068297373
|
||||
insRPET;11;1205539;10949;0.009082245;1.343874119;-0.343874119
|
||||
insRPET;31;252996;2234;0.008830179;1.306576712;-0.306576712
|
||||
insRPET;41;170366;1448;0.008499348;1.25762463;-0.25762463
|
||||
insRPET;93;599741;4858;0.008100163;1.198558318;-0.198558318
|
||||
insRPET;42;155599;1173;0.007538609;1.1154667;-0.1154667
|
||||
insRPET;22;135577;972;0.007169358;1.060829637;-0.060829637
|
||||
insRPET;4;60943;402;0.006596328;0.976040016;0.023959984
|
||||
insRPET;24;214087;1391;0.006497359;0.961395827;0.038604173
|
||||
insRPET;23;131429;852;0.006482588;0.959210205;0.040789795
|
||||
insRPET;43;102313;659;0.006441019;0.953059456;0.046940544
|
||||
insRPET;94;36450;234;0.006419753;0.949912765;0.050087235
|
||||
insRPET;91;337251;2154;0.006386934;0.945056671;0.054943329
|
||||
insRPET;82;667354;4078;0.0061107;0.904183032;0.095816968
|
||||
insRPET;2;42948;261;0.006077117;0.899213798;0.100786202
|
||||
insRPET;72;377551;2184;0.005784649;0.855938198;0.144061802
|
||||
insRPET;26;164649;907;0.005508688;0.81510506;0.18489494
|
||||
insRPET;74;80672;443;0.005491372;0.812542903;0.187457097
|
||||
insRPET;21;136535;746;0.0054638;0.808463155;0.191536845
|
||||
insRPET;54;191379;972;0.005078927;0.751514532;0.248485468
|
||||
insRPET;73;335852;1699;0.005058776;0.748532806;0.251467194
|
||||
insRPET;52;315413;1595;0.005056862;0.748249607;0.251750393
|
||||
insRPET;83;150096;732;0.004876879;0.721618007;0.278381993
|
||||
insRPET;1;63134;307;0.004862673;0.719516021;0.280483979
|
||||
insRPET;3;13275;63;0.004745763;0.702217129;0.297782871
|
||||
insRPET;53;314133;1445;0.004599962;0.680643473;0.319356527
|
||||
insRPET;25;149961;678;0.004521176;0.668985593;0.331014407
|
||||
insRPET;99;41208;134;0.003251796;0.481159052;0.518840948
|
||||
insRPET;98;775;2;0.002580645;0.381850789;0.618149211
|
||||
insSINGT;43;23550;425;0.018046709;2.670330198;-1.670330198
|
||||
insSINGT;2;76142;1237;0.016245961;2.403877696;-1.403877696
|
||||
insSINGT;1;3885595;40481;0.010418224;1.541560768;-0.541560768
|
||||
insSINGT;40;13737;119;0.008662736;1.281805149;-0.281805149
|
||||
insSINGT;31;35843;96;0.002678347;0.396308903;0.603691097
|
||||
insSINGT;33;3315;8;0.002413273;0.357086476;0.642913524
|
||||
insSINGT;52;6565;10;0.001523229;0.225388741;0.774611259
|
||||
insSINGT;10;96382;127;0.001317673;0.194973117;0.805026883
|
||||
insSINGT;60;216663;228;0.001052326;0.155710193;0.844289807
|
||||
insSINGT;90;577496;260;0.00045022;0.066617958;0.933382042
|
||||
insSINGT;70;1298907;576;0.00044345;0.065616245;0.934383755
|
||||
insSINGT;34;24032;1;4.16112E-05;0.006157112;0.993842888
|
||||
insSINGT;80;149852;4;2.6693E-05;0.003949703;0.996050297
|
||||
insSINGT;0;1;;0;0;1
|
||||
insSINGT;30;5741;0;0;0;1
|
||||
insSINGT;42;33428;0;0;0;1
|
||||
insORDIN;1;3412206;41477;0.012155479;1.798618445;-0.798618445
|
||||
insORDIN;0;3035043;2095;0.00069027;0.102137713;0.897862287
|
||||
insMODET;3;2787;130;0.046645138;6.901974209;-5.901974209
|
||||
insMODET;1;991;19;0.019172553;2.836918732;-1.836918732
|
||||
insMODET;2;3347;45;0.013444876;1.989407496;-0.989407496
|
||||
insMODET;0;6440124;43378;0.006735585;0.996649019;0.003350981
|
||||
insAUXILT;1;26364;474;0.017979062;2.66032066;-1.66032066
|
||||
insAUXILT;0;6420872;43098;0.006712172;0.993184774;0.006815226
|
||||
insAUXILT;*;13;0;0;0;1
|
||||
insTCD;73;83653;867;0.010364243;1.533573253;-0.533573253
|
||||
insTCD;44;207816;2036;0.009797128;1.449658615;-0.449658615
|
||||
insTCD;52;189137;1814;0.009590931;1.419148149;-0.419148149
|
||||
insTCD;43;241634;2262;0.009361265;1.385164989;-0.385164989
|
||||
insTCD;62;114691;1056;0.009207348;1.362390251;-0.362390251
|
||||
insTCD;41;193192;1687;0.008732246;1.292090379;-0.292090379
|
||||
insTCD;51;286358;2499;0.008726838;1.291290286;-0.291290286
|
||||
insTCD;72;161502;1371;0.008489059;1.256106603;-0.256106603
|
||||
insTCD;80;520175;4329;0.008322199;1.231416755;-0.231416755
|
||||
insTCD;42;173427;1427;0.008228246;1.21751469;-0.21751469
|
||||
insTCD;61;258193;2063;0.007990147;1.182283729;-0.182283729
|
||||
insTCD;31;307323;2413;0.007851674;1.161794206;-0.161794206
|
||||
insTCD;32;256048;1919;0.007494688;1.108971884;-0.108971884
|
||||
insTCD;71;137763;984;0.007142702;1.056889189;-0.056889189
|
||||
insTCD;22;291665;2073;0.007107469;1.051675929;-0.051675929
|
||||
insTCD;21;317427;2113;0.006656649;0.984969043;0.015030957
|
||||
insTCD;18;197044;1301;0.006602586;0.976969555;0.023030445
|
||||
insTCD;17;257376;1549;0.006018432;0.890533619;0.109466381
|
||||
insTCD;15;199766;1128;0.005646607;0.83551543;0.16448457
|
||||
insTCD;16;172805;968;0.00560169;0.828869199;0.171130801
|
||||
insTCD;14;249738;1244;0.00498122;0.737059757;0.262940243
|
||||
insTCD;0;120431;578;0.004799429;0.71016047;0.28983953
|
||||
insTCD;13;342501;1623;0.004738672;0.701170482;0.298829518
|
||||
insTCD;12;272656;1158;0.00424711;0.628435122;0.371564878
|
||||
insTCD;11;245321;1022;0.00416597;0.616429079;0.383570921
|
||||
insTCD;8;125432;481;0.003834747;0.567418744;0.432581256
|
||||
insTCD;7;149718;535;0.003573385;0.528745536;0.471254464
|
||||
insTCD;6;81869;265;0.003236878;0.478953484;0.521046516
|
||||
insTCD;4;81356;256;0.003146664;0.465604668;0.534395332
|
||||
insTCD;5;84330;243;0.002881537;0.426374401;0.573625599
|
||||
insTCD;3;74476;200;0.002685429;0.397356756;0.602643244
|
||||
insTCD;2;43091;94;0.00218143;0.322781198;0.677218802
|
||||
insTCD;1;9335;14;0.001499732;0.221911936;0.778088064
|
||||
insNATURE;91;238972;6564;0.027467653;4.064325692;-3.064325692
|
||||
insNATURE;20;144873;3353;0.023144409;3.424625203;-2.424625203
|
||||
insNATURE;22;10828;119;0.010990026;1.626168944;-0.626168944
|
||||
insNATURE;93;160570;1367;0.008513421;1.259711389;-0.259711389
|
||||
insNATURE;21;185819;1501;0.008077753;1.195246614;-0.195246614
|
||||
insNATURE;92;83924;635;0.00756637;1.119578368;-0.119578368
|
||||
insNATURE;99;5621113;30028;0.005342003;0.790443877;0.209556123
|
||||
insNATURE;23;1135;5;0.004405286;0.651840126;0.348159874
|
||||
insNATURE;*;15;0;0;0;1
|
||||
insORIGINE;3;296615;3962;0.013357382;1.976461277;-0.976461277
|
||||
insORIGINE;7;112298;1480;0.01317922;1.950098922;-0.950098922
|
||||
insORIGINE;2;907819;9870;0.010872211;1.608736195;-0.608736195
|
||||
insORIGINE;5;54475;462;0.008480955;1.254907414;-0.254907414
|
||||
insORIGINE;6;1914;11;0.005747126;0.85038913;0.14961087
|
||||
insORIGINE;1;4776418;27127;0.005679361;0.840361968;0.159638032
|
||||
insORIGINE;8;90133;230;0.002551785;0.377581718;0.622418282
|
||||
insORIGINE;0;173492;370;0.002132663;0.315565284;0.684434716
|
||||
insORIGINE;4;34085;60;0.001760305;0.260468315;0.739531685
|
||||
insTU;8;1084479;9960;0.009184134;1.358955201;-0.358955201
|
||||
insTU;7;1259040;10827;0.008599409;1.272434856;-0.272434856
|
||||
insTU;5;399066;3189;0.007991159;1.182433539;-0.182433539
|
||||
insTU;6;378843;2890;0.00762849;1.128770171;-0.128770171
|
||||
insTU;4;410877;2959;0.007201669;1.065614405;-0.065614405
|
||||
insTU;3;331773;2090;0.006299488;0.93212079;0.06787921
|
||||
insTU;2;343704;2076;0.006040081;0.893736945;0.106263055
|
||||
insTU;1;375638;2186;0.005819433;0.861088098;0.138911902
|
||||
insTU;0;1863829;7395;0.003967639;0.587082401;0.412917599
|
|
@ -1,194 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CLASS soundex2
|
||||
* soundex2 French version
|
||||
* based on the algorithm described here : http://sqlpro.developpez.com/cours/soundex/ by Frédéric BROUARD
|
||||
*
|
||||
* author Johan Barbier <barbier_johan@hotmail.com>
|
||||
*/
|
||||
class soundex2 {
|
||||
|
||||
/**
|
||||
* public sString
|
||||
* main string we work on
|
||||
*/
|
||||
var $sString = '';
|
||||
|
||||
/**
|
||||
* vowels replacement array
|
||||
*/
|
||||
var $aReplaceVoy1 = array (
|
||||
'E' => 'A',
|
||||
'I' => 'A',
|
||||
'O' => 'A',
|
||||
'U' => 'A'
|
||||
);
|
||||
|
||||
/**
|
||||
* consonnants replacement array
|
||||
*/
|
||||
var $aReplaceGrp1 = array (
|
||||
'GUI' => 'KI',
|
||||
'GUE' => 'KE',
|
||||
'GA' => 'KA',
|
||||
'GO' => 'KO',
|
||||
'GU' => 'K',
|
||||
'CA' => 'KA',
|
||||
'CO' => 'KO',
|
||||
'CU' => 'KU',
|
||||
'Q' => 'K',
|
||||
'CC' => 'K',
|
||||
'CK' => 'K'
|
||||
);
|
||||
|
||||
/**
|
||||
* other replacement array
|
||||
*/
|
||||
var $aReplaceGrp2 = array (
|
||||
'ASA' => 'AZA',
|
||||
'KN' => 'NN',
|
||||
'PF' => 'FF',
|
||||
'PH' => 'FF',
|
||||
'SCH' => 'SSS'
|
||||
);
|
||||
|
||||
/**
|
||||
* endings replacement array
|
||||
*/
|
||||
var $aEnd = array (
|
||||
'A',
|
||||
'T',
|
||||
'D',
|
||||
'S'
|
||||
);
|
||||
|
||||
/**
|
||||
* public function build
|
||||
* core function of the class, go through the whole process
|
||||
* @Param string sString : the string we want to check
|
||||
*/
|
||||
function build ($sString) {
|
||||
/**
|
||||
* let's check it's a real string...
|
||||
*/
|
||||
if (is_string ($sString) && !empty ($sString)) {
|
||||
$this -> sString = $sString;
|
||||
} else {
|
||||
$this -> sString = '';
|
||||
//trigger_error ('Parameter string must not be empty', E_USER_ERROR);
|
||||
}
|
||||
/**
|
||||
* remove starting and ending spaces
|
||||
*/
|
||||
$this -> sString = trim ($this -> sString);
|
||||
/**
|
||||
* remove special french characters
|
||||
*/
|
||||
$this -> trimAccent ();
|
||||
/**
|
||||
* string to upper case
|
||||
*/
|
||||
$this -> sString = strtoupper ($this -> sString );
|
||||
/**
|
||||
* let's remove every space in the string
|
||||
*/
|
||||
$this -> sString = str_replace (' ', '', $this -> sString);
|
||||
/**
|
||||
* let's remove every '-' in the string
|
||||
*/
|
||||
$this -> sString = str_replace ('-', '', $this -> sString);
|
||||
/**
|
||||
* let's process through the first replacement array
|
||||
*/
|
||||
$this -> arrReplace ($this -> aReplaceGrp1);
|
||||
/**
|
||||
* let's process through th vowels replacement
|
||||
*/
|
||||
$sChar = substr ($this -> sString, 0, 1);
|
||||
$this -> sString = substr ($this -> sString, 1, strlen ($this -> sString) - 1);
|
||||
$this -> arrReplace ($this -> aReplaceVoy1);
|
||||
$this -> sString = $sChar.$this -> sString;
|
||||
/**
|
||||
* let's process through the second replacement array
|
||||
*/
|
||||
$this -> arrReplace ($this -> aReplaceGrp2, true);
|
||||
/**
|
||||
* let's remove every 'H' but those prededed by a 'C' or an 'S'
|
||||
*/
|
||||
$this -> sString = preg_replace ('/(?<![CS])H/', '', $this -> sString);
|
||||
/**
|
||||
* let's remove every 'Y' but those preceded by an 'A'
|
||||
*/
|
||||
$this -> sString = preg_replace ('/(?<!A)Y/', '', $this -> sString);
|
||||
/**
|
||||
* remove endings in aEnd
|
||||
*/
|
||||
$length = strlen ($this -> sString) - 1;
|
||||
if (in_array ($this -> sString{$length}, $this -> aEnd)) {
|
||||
$this -> sString = substr ($this -> sString, 0, $length);
|
||||
}
|
||||
/**
|
||||
* let's remove every 'A', but the one at the beginning of the string, if any.
|
||||
*/
|
||||
$sChar = '';
|
||||
if ($this -> sString{0} === 'A') {
|
||||
$sChar = 'A';
|
||||
}
|
||||
$this -> sString = str_replace ('A', '', $this -> sString);
|
||||
$this -> sString = $sChar.$this -> sString;
|
||||
/**
|
||||
* let's have only 1 occurence of each letter
|
||||
*/
|
||||
$this -> sString = preg_replace( '/(.)\1/', '$1', $this -> sString );
|
||||
/**
|
||||
* let's have the final code : a 4 letters string
|
||||
*/
|
||||
$this -> getFinal ();
|
||||
}
|
||||
|
||||
/**
|
||||
* private function getFinal
|
||||
* gets the first 4 letters, pads the string with white space if the string length < 4
|
||||
*/
|
||||
function getFinal () {
|
||||
if (strlen ($this -> sString) < 4) {
|
||||
$this -> sString = str_pad ($this -> sString, 4, ' ', STR_PAD_RIGHT);
|
||||
} else {
|
||||
$this -> sString = substr ($this -> sString, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* private function trimAccent
|
||||
* remove every special French letters
|
||||
*/
|
||||
function trimAccent () {
|
||||
$this -> sString = htmlentities(strtolower($this -> sString ));
|
||||
$this -> sString = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $this -> sString );
|
||||
$this -> sString = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($this -> sString ));
|
||||
$this -> sString = trim($this -> sString , "-");
|
||||
}
|
||||
|
||||
/**
|
||||
* private function arrReplace
|
||||
* replacement method, given an array
|
||||
* @Param array tab : the replacement array to be used
|
||||
* @Param bool pref : if false, just replace keys by values; if true, do the same but only with prefix
|
||||
*/
|
||||
function arrReplace ($tab, $pref = false) {
|
||||
$fromRep = array_keys ($tab);
|
||||
$toRep = array_values ($tab);
|
||||
if (false === $pref) {
|
||||
$this -> sString = str_replace ($fromRep, $toRep, $this -> sString);
|
||||
} else {
|
||||
foreach ($fromRep as $clef => $val) {
|
||||
$length = strlen ($val);
|
||||
if (substr ($this -> sString, 0, $length) === $val) {
|
||||
$this -> sString = substr_replace ($this -> sString, $toRep[$clef], 0, $length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -1,374 +0,0 @@
|
||||
<?
|
||||
|
||||
define ('BEFORE', 0);
|
||||
define ('AFTER', 1);
|
||||
define ('BOTH', 2);
|
||||
|
||||
function trimAccent ($strWithAccent) {
|
||||
$strWithAccent = htmlentities(strtolower($strWithAccent ));
|
||||
$strWithAccent = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $strWithAccent );
|
||||
$strWithAccent = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($strWithAccent ));
|
||||
$strWithAccent = trim($strWithAccent , "-");
|
||||
return $strWithAccent;
|
||||
}
|
||||
|
||||
//function SRSaufVoyelle ($strIn, $mot1, $mot2) {
|
||||
function str_replace_except_voy($mot1, $mot2, $strIn, $rule=0) {
|
||||
$Voyelle=array('a','e','i','o','u','y', '1', '2', '3', '4');
|
||||
if ($mot1==$mot2) return $strIn;
|
||||
if (strpos($mot2,$mot1)===false)
|
||||
{
|
||||
//foreach ($Voyelle as $k => $voy)
|
||||
$posMot1=strpos($strIn, $mot1);
|
||||
while ($posMot1!==false) {
|
||||
$lettreAV=$strIn[$posMot1-1];
|
||||
$lettreAP=$strIn[$posMot1+strlen($mot1)];
|
||||
//echo "Lettre AV=$lettreAV<br/>";
|
||||
//echo "Lettre AP=$lettreAP<br/>";
|
||||
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
|
||||
( $rule==1 && !in_array($lettreAP, $Voyelle) ) ||
|
||||
( $rule==2 && !in_array($lettreAV, $Voyelle) && !in_array($lettreAP, $Voyelle) ))
|
||||
$strIn=substr($strIn,0,$posMot1) . $mot2 . substr($strIn,$posMot1+strlen($mot1),strlen($strIn));
|
||||
//echo "Le Mot devient : $strIn<br/>";
|
||||
$posMot1=strpos($strIn, $mot1, $posMot1+strlen($mot1));
|
||||
}
|
||||
return $strIn;
|
||||
}
|
||||
//echo "Erreur : $mot2 contient $mot1 !<br>";
|
||||
return $strIn;
|
||||
}
|
||||
|
||||
/** Retourne le phonex d'un mot
|
||||
**/
|
||||
function phonex($strIn) {
|
||||
if ($strIn=='') return 0.0;
|
||||
$tabSonAIA=array('aina', 'eina', 'aima', 'eima');
|
||||
$tabSonAIE=array('ainr', 'eine', 'aime', 'eime');
|
||||
$tabSonAII=array('aini', 'eini', 'aimi', 'eimi');
|
||||
$tabSonAIO=array('aino', 'eino', 'aimo', 'eimo');
|
||||
$tabSonAIU=array('ainu', 'einu', 'aimu', 'eimu');
|
||||
$tabCarPhon=array('1', '2', '3', '4', '5', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z');
|
||||
|
||||
/** On traite tout en minuscule **/
|
||||
$strIn=strtolower($strIn);
|
||||
/** On remplace les 'Y' par des 'I' **/
|
||||
$strIn=str_replace('y', 'i', $strIn);
|
||||
/** On supprime les accents **/
|
||||
$strIn=trimAccent($strIn);
|
||||
/** On retire les 'H' muets sauf ceux précédés par 'C' ou 'S' **/
|
||||
$strIn = preg_replace ('/(?<![CS])H/', '', $strIn);
|
||||
/** On remplace les 'PH' par des 'F' **/
|
||||
$strIn=str_replace('ph', 'f', $strIn);
|
||||
/** On remplace les 'G' par des 'K' devant AN AM AIN AIM **/
|
||||
$strIn=str_replace('gan', 'kan', $strIn);
|
||||
$strIn=str_replace('gain', 'kain', $strIn);
|
||||
$strIn=str_replace('gam', 'kam4', $strIn);
|
||||
$strIn=str_replace('gaim', 'kaim', $strIn);
|
||||
/** On remplace le son AI **/
|
||||
for ($i=0; $i>4; $i++) {
|
||||
$strIn=str_replace($tabSonAIA[$i], 'yna', $strIn);
|
||||
$strIn=str_replace($tabSonAIE[$i], 'yne', $strIn);
|
||||
$strIn=str_replace($tabSonAII[$i], 'yni', $strIn);
|
||||
$strIn=str_replace($tabSonAIO[$i], 'yno', $strIn);
|
||||
$strIn=str_replace($tabSonAIU[$i], 'ynu', $strIn);
|
||||
}
|
||||
/** Remplacement des groupes de 3 lettres **/
|
||||
$strIn=str_replace('eau', 'o', $strIn);
|
||||
$strIn=str_replace('oua', '2', $strIn);
|
||||
$strIn=str_replace('ein', '4', $strIn);
|
||||
$strIn=str_replace('ain', '4', $strIn);
|
||||
/** Remplacement du son 'é' **/
|
||||
$strIn=str_replace('ai', 'y', $strIn);
|
||||
$strIn=str_replace('ei', 'y', $strIn);
|
||||
$strIn=str_replace('er', 'yr', $strIn);
|
||||
$strIn=str_replace('ess', 'yss', $strIn);
|
||||
$strIn=str_replace('et', 'yt', $strIn);
|
||||
$strIn=str_replace('ez', 'yz', $strIn);
|
||||
/** Remplacement des groupes de 2 lettres sauf si voyelle ou son (1 à 4) AVANT **/
|
||||
$strIn=str_replace_except_voy('an', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('am', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('en', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('em', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BEFORE);
|
||||
/** Remplacement du son 'SCH' **/
|
||||
$strIn=str_replace('sch', '5', $strIn);
|
||||
/** Remplacement du 'S' sauf si voyelle ou son (1 à 4) avant ou après **/
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BOTH);
|
||||
/** Remplacement de groupe de 2 lettres diverses **/
|
||||
$strIn=str_replace('oe', 'e', $strIn);
|
||||
$strIn=str_replace('eu', 'e', $strIn);
|
||||
$strIn=str_replace('au', 'o', $strIn);
|
||||
$strIn=str_replace('oi', '2', $strIn);
|
||||
$strIn=str_replace('oy', '2', $strIn);
|
||||
$strIn=str_replace('ou', '3', $strIn);
|
||||
$strIn=str_replace('ch', '5', $strIn);
|
||||
$strIn=str_replace('sh', '5', $strIn);
|
||||
$strIn=str_replace('ss', 's', $strIn);
|
||||
$strIn=str_replace('sc', 's', $strIn);
|
||||
/** Remplacement du 'C' par 'S' s'il est suivi d'un 'E' ou d'un 'I' **/
|
||||
$strIn=str_replace('ce', 'se', $strIn);
|
||||
$strIn=str_replace('ci', 'si', $strIn);
|
||||
/** Remplacement divers **/
|
||||
$strIn=str_replace('c', 'k', $strIn);
|
||||
$strIn=str_replace('q', 'k', $strIn);
|
||||
$strIn=str_replace('qu', 'k', $strIn);
|
||||
|
||||
$strIn=str_replace('ga', 'ka', $strIn);
|
||||
$strIn=str_replace('go', 'ko', $strIn);
|
||||
$strIn=str_replace('gu', 'ku', $strIn);
|
||||
$strIn=str_replace('gy', 'ky', $strIn);
|
||||
$strIn=str_replace('g2', 'k2', $strIn);
|
||||
$strIn=str_replace('g1', 'k1', $strIn);
|
||||
$strIn=str_replace('g3', 'k3', $strIn);
|
||||
|
||||
$strIn=str_replace('a', 'o', $strIn);
|
||||
$strIn=str_replace('d', 't', $strIn);
|
||||
$strIn=str_replace('p', 't', $strIn);
|
||||
$strIn=str_replace('j', 'g', $strIn);
|
||||
$strIn=str_replace('b', 'f', $strIn);
|
||||
$strIn=str_replace('v', 'f', $strIn);
|
||||
$strIn=str_replace('m', 'n', $strIn);
|
||||
|
||||
/** Supression des lettres dupliquées **/
|
||||
$let=$strIn[0];
|
||||
$strIn2=$let;
|
||||
for ($i=1; $i<strlen($strIn); $i++)
|
||||
{ if ($strIn==$let)
|
||||
continue;
|
||||
else {
|
||||
$let=$strIn[$i];
|
||||
$strIn2.=$strIn[$i];
|
||||
}
|
||||
}
|
||||
$strIn=$strIn2;
|
||||
|
||||
/** Supression des terminaisons **/
|
||||
$strIn2=substr($strIn,-1);
|
||||
if ($strIn2=='t' || $strIn2=='k' || $strIn2=='s' || $strIn2=='z')
|
||||
$strIn=substr($strIn,0,-1);
|
||||
|
||||
/** Supression des caractères non autorisés **/
|
||||
$j=10;
|
||||
$sout=array();
|
||||
for ($i=0; $i<strlen($strIn); $i++)
|
||||
{
|
||||
if ($j<1) break;
|
||||
for ($k=0; $k<22; $k++)
|
||||
{
|
||||
if ($strIn[$i]==$tabCarPhon[$k])
|
||||
{
|
||||
$sout[$j]=$k;
|
||||
$j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
print_r($tabCarPhon);
|
||||
|
||||
/** Couversion en flottant **/
|
||||
$result=0.0;
|
||||
for ($j=10; $j>0; $j--)
|
||||
$result+=$sout[$j]*pow($j-1,10);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* CLASS soundex2
|
||||
* soundex2 French version
|
||||
* based on the algorithm described here : http://sqlpro.developpez.com/cours/soundex/ by Frédéric BROUARD
|
||||
*
|
||||
* author Johan Barbier <barbier_johan@hotmail.com>
|
||||
*/
|
||||
class csoundex2 {
|
||||
|
||||
/**
|
||||
* public sString
|
||||
* main string we work on
|
||||
*/
|
||||
var $sString = '';
|
||||
|
||||
/**
|
||||
* vowels replacement array
|
||||
*/
|
||||
var $aReplaceVoy1 = array (
|
||||
'E' => 'A',
|
||||
'I' => 'A',
|
||||
'O' => 'A',
|
||||
'U' => 'A'
|
||||
);
|
||||
|
||||
/**
|
||||
* consonnants replacement array
|
||||
*/
|
||||
var $aReplaceGrp1 = array (
|
||||
'GUI' => 'KI',
|
||||
'GUE' => 'KE',
|
||||
'GA' => 'KA',
|
||||
'GO' => 'KO',
|
||||
'GU' => 'K',
|
||||
'CA' => 'KA',
|
||||
'CO' => 'KO',
|
||||
'CU' => 'KU',
|
||||
'Q' => 'K',
|
||||
'CC' => 'K',
|
||||
'CK' => 'K'
|
||||
);
|
||||
|
||||
/**
|
||||
* other replacement array
|
||||
*/
|
||||
var $aReplaceGrp2 = array (
|
||||
'ASA' => 'AZA',
|
||||
'KN' => 'NN',
|
||||
'PF' => 'FF',
|
||||
'PH' => 'FF',
|
||||
'SCH' => 'SSS'
|
||||
);
|
||||
|
||||
/**
|
||||
* endings replacement array
|
||||
*/
|
||||
var $aEnd = array (
|
||||
'A',
|
||||
'T',
|
||||
'D',
|
||||
'S'
|
||||
);
|
||||
|
||||
/**
|
||||
* public function build
|
||||
* core function of the class, go through the whole process
|
||||
* @Param string sString : the string we want to check
|
||||
*/
|
||||
function build ($sString) {
|
||||
/**
|
||||
* let's check it's a real string...
|
||||
*/
|
||||
if (is_string ($sString) && !empty ($sString)) {
|
||||
$this -> sString = $sString;
|
||||
} else {
|
||||
trigger_error ('Parameter string must not be empty', E_USER_ERROR);
|
||||
}
|
||||
/**
|
||||
* remove starting and ending spaces
|
||||
*/
|
||||
$this -> sString = trim ($this -> sString);
|
||||
/**
|
||||
* remove special french characters
|
||||
*/
|
||||
$this -> trimAccent ();
|
||||
/**
|
||||
* string to upper case
|
||||
*/
|
||||
$this -> sString = strtoupper ($this -> sString );
|
||||
/**
|
||||
* let's remove every space in the string
|
||||
*/
|
||||
$this -> sString = str_replace (' ', '', $this -> sString);
|
||||
/**
|
||||
* let's remove every '-' in the string
|
||||
*/
|
||||
$this -> sString = str_replace ('-', '', $this -> sString);
|
||||
/**
|
||||
* let's process through the first replacement array
|
||||
*/
|
||||
$this -> arrReplace ($this -> aReplaceGrp1);
|
||||
/**
|
||||
* let's process through th vowels replacement
|
||||
*/
|
||||
$sChar = substr ($this -> sString, 0, 1);
|
||||
$this -> sString = substr ($this -> sString, 1, strlen ($this -> sString) - 1);
|
||||
$this -> arrReplace ($this -> aReplaceVoy1);
|
||||
$this -> sString = $sChar.$this -> sString;
|
||||
/**
|
||||
* let's process through the second replacement array
|
||||
*/
|
||||
$this -> arrReplace ($this -> aReplaceGrp2, true);
|
||||
/**
|
||||
* let's remove every 'H' but those prededed by a 'C' or an 'S'
|
||||
*/
|
||||
$this -> sString = preg_replace ('/(?<![CS])H/', '', $this -> sString);
|
||||
/**
|
||||
* let's remove every 'Y' but those preceded by an 'A'
|
||||
*/
|
||||
$this -> sString = preg_replace ('/(?<!A)Y/', '', $this -> sString);
|
||||
/**
|
||||
* remove endings in aEnd
|
||||
*/
|
||||
$length = strlen ($this -> sString) - 1;
|
||||
if (in_array ($this -> sString{$length}, $this -> aEnd)) {
|
||||
$this -> sString = substr ($this -> sString, 0, $length);
|
||||
}
|
||||
/**
|
||||
* let's remove every 'A', but the one at the beginning of the string, if any.
|
||||
*/
|
||||
$sChar = '';
|
||||
if ($this -> sString{0} === 'A') {
|
||||
$sChar = 'A';
|
||||
}
|
||||
$this -> sString = str_replace ('A', '', $this -> sString);
|
||||
$this -> sString = $sChar.$this -> sString;
|
||||
/**
|
||||
* let's have only 1 occurence of each letter
|
||||
*/
|
||||
$this -> sString = preg_replace( '/(.)\1/', '$1', $this -> sString );
|
||||
/**
|
||||
* let's have the final code : a 4 letters string
|
||||
*/
|
||||
$this -> getFinal ();
|
||||
}
|
||||
|
||||
/**
|
||||
* private function getFinal
|
||||
* gets the first 4 letters, pads the string with white space if the string length < 4
|
||||
*/
|
||||
function getFinal () {
|
||||
if (strlen ($this -> sString) < 4) {
|
||||
$this -> sString = str_pad ($this -> sString, 4, ' ', STR_PAD_RIGHT);
|
||||
} else {
|
||||
$this -> sString = substr ($this -> sString, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* private function trimAccent
|
||||
* remove every special French letters
|
||||
*/
|
||||
function trimAccent () {
|
||||
$this -> sString = htmlentities(strtolower($this -> sString ));
|
||||
$this -> sString = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml|grave);/", "$1", $this -> sString );
|
||||
$this -> sString = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($this -> sString ));
|
||||
$this -> sString = trim($this -> sString , "-");
|
||||
}
|
||||
|
||||
/**
|
||||
* private function arrReplace
|
||||
* replacement method, given an array
|
||||
* @Param array tab : the replacement array to be used
|
||||
* @Param bool pref : if false, just replace keys by values; if true, do the same but only with prefix
|
||||
*/
|
||||
function arrReplace ($tab, $pref = false) {
|
||||
$fromRep = array_keys ($tab);
|
||||
$toRep = array_values ($tab);
|
||||
if (false === $pref) {
|
||||
$this -> sString = str_replace ($fromRep, $toRep, $this -> sString);
|
||||
} else {
|
||||
foreach ($fromRep as $clef => $val) {
|
||||
$length = strlen ($val);
|
||||
if (substr ($this -> sString, 0, $length) === $val) {
|
||||
$this -> sString = substr_replace ($this -> sString, $toRep[$clef], 0, $length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function soundex2($str) {
|
||||
$soundex2 = new csoundex2();
|
||||
|
||||
$soundex2 -> build ($str);
|
||||
return $soundex2 -> sString;
|
||||
}
|
||||
|
||||
?>
|
@ -1,73 +0,0 @@
|
||||
<?
|
||||
/** TimeStamp Unix
|
||||
** Si $onlyMiliSec=true, retourne juste les milisec du timestamp
|
||||
**/
|
||||
function microtime_float($onlyMiliSec=false) {
|
||||
list($usec, $sec) = explode(' ', microtime());
|
||||
if (!$onlyMiliSec)
|
||||
return ((float)$usec + (float)$sec);
|
||||
else
|
||||
return $usec;
|
||||
}
|
||||
|
||||
|
||||
/** Fait une pause entre 0 et 15 secondes par défaut
|
||||
**/
|
||||
function randsleep($min_sec=0, $max_sec=15) {
|
||||
sleep(rand($min_sec, $max_sec));
|
||||
}
|
||||
|
||||
/**************Fonctions de dates/heures ****/
|
||||
global $tabMois;
|
||||
$tabMois=array( 1=>'Janvier',
|
||||
2=>'Février',
|
||||
3=>'Mars',
|
||||
4=>'Avril',
|
||||
5=>'Mai',
|
||||
6=>'Juin',
|
||||
7=>'Juillet',
|
||||
8=>'Août',
|
||||
9=>'Septembre',
|
||||
10=>'Octobre',
|
||||
11=>'Novembre',
|
||||
12=>'Décembre');
|
||||
|
||||
function getLibelleMois($numMois) {
|
||||
global $tabMois;
|
||||
if ($numMois>0 && $numMois<13)
|
||||
return $tabMois[$numMois];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function getNumMois($strMois) {
|
||||
global $tabMois;
|
||||
$mois=array_search(ucfirst(strtolower($strMois)), $tabMois);
|
||||
return $mois;
|
||||
}
|
||||
|
||||
function dateT($formatIN, $formatOUT, $date) {
|
||||
switch ($formatIN) {
|
||||
case 'd M Y': $tmp=explode(' ', $date); $d=$tmp[0]; $m=getNumMois($tmp[1]); $Y=$tmp[2]; break;
|
||||
case 'Ymd': $d=substr($date,6,2); $m=substr($date,4,2); $Y=substr($date,0,4); break;
|
||||
case 'Y-m-d': $d=substr($date,8,2); $m=substr($date,5,2); $Y=substr($date,0,4); break;
|
||||
case 'd/m/Y': $d=substr($date,0,2); $m=substr($date,3,2); $Y=substr($date,6,4); break;
|
||||
default: return $date;
|
||||
}
|
||||
|
||||
if ($m*1>0 && $m*1<10) $m='0'.($m*1);
|
||||
if ($d*1>0 && $d*1<10) $d='0'.($d*1);
|
||||
|
||||
switch ($formatOUT) {
|
||||
case 'd/m/Y': return $d.'/'.$m.'/'.$Y; break;
|
||||
case 'Y': return $Y; break;
|
||||
case 'm': return $m; break;
|
||||
case 'd': return $d; break;
|
||||
case 'Ym': return $Y.$m; break;
|
||||
case 'Ymd': return $Y.$m.$d; break;
|
||||
case 'Y-m-d': return $Y.'-'.$m.'-'.$d; break;
|
||||
case 'Y/m/d': return $Y.'/'.$m.'/'.$d; break;
|
||||
default: return $date;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,54 +0,0 @@
|
||||
<?
|
||||
|
||||
/** Test de la validité du siren demandé */
|
||||
function valideSiren($siren, $nic='', $erreur=false) {
|
||||
|
||||
$lenSIREN=strlen($siren);
|
||||
if (!valideData($siren, 9, 9,'N')) //Siren non précisé ou incorrect.
|
||||
return $erreur;
|
||||
else
|
||||
{
|
||||
if (!isset($nic) || trim($nic)=='')
|
||||
{
|
||||
$somme=0;
|
||||
for ($i=0; $i<=8; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($siren,$i,1);
|
||||
|
||||
for ($i=1; $i<=7; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($siren,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
}
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))
|
||||
{ // Le Siren est faux
|
||||
if (substr($siren,0,3)!='200') // Les siren débutant par 200 sont toujours valides (sirens provisoires de la BDF?!)
|
||||
return $erreur;
|
||||
}
|
||||
} else {
|
||||
if (!valideData($nic,1,5,'N')) // Nic de format incorrect.
|
||||
return $erreur;
|
||||
|
||||
$SIRET=$siren.$nic;
|
||||
$somme=0;
|
||||
for ($i=0; $i<=12; $i+=2)
|
||||
{ // Traitement PAIR
|
||||
$var_tmp=(string)(2*((integer)substr($SIRET,$i,1)));
|
||||
$som_tmp=0;
|
||||
for($j=0;$j<strlen($var_tmp);$j++)
|
||||
$som_tmp+=(integer)substr($var_tmp,$j,1);
|
||||
$somme+=$som_tmp;
|
||||
}
|
||||
for ($i=1; $i<=13; $i+=2) // Traitement IMPAIR
|
||||
$somme+=(integer)substr($SIRET,$i,1);
|
||||
|
||||
if ((integer)($somme/10)!=($somme/10))// Le Siret est faux
|
||||
return $erreur;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
@ -1,101 +0,0 @@
|
||||
<?
|
||||
//define('FWK_PATH', 'C:\\wamp\\www\\framework\\');
|
||||
define('FWK_PATH', realpath(dirname(__FILE__) . '/'));
|
||||
include_once(realpath(FWK_PATH.'/common/mysql.php'));
|
||||
include_once(realpath(FWK_PATH.'/common/strings.php') );
|
||||
|
||||
define ('REP_TEMP', '/tmp/');
|
||||
// Environnement : DEV ou PRD
|
||||
define ('ENV', 'DEV');
|
||||
|
||||
define ('EOL', "\n");
|
||||
|
||||
/** TimeStamp Unix
|
||||
** Si $onlyMiliSec=true, retourne juste les milisec du timestamp
|
||||
**/
|
||||
function microtime_float($onlyMiliSec=false) {
|
||||
list($usec, $sec) = explode(' ', microtime());
|
||||
if (!$onlyMiliSec)
|
||||
return ((float)$usec + (float)$sec);
|
||||
else
|
||||
return $usec;
|
||||
}
|
||||
|
||||
/** Fait une pause aléatoire entre 0 et 15 secondes par défaut
|
||||
**/
|
||||
function randsleep($min_sec=0, $max_sec=15) {
|
||||
sleep(rand($min_sec, $max_sec));
|
||||
}
|
||||
|
||||
|
||||
/** V�rification que la variable demand� respecte bien les r�gles pass�es en param�tres
|
||||
* @param mixed Variable � tester
|
||||
* @param int Longueur minimum en caract�re de la variable
|
||||
* @param int Longueur mximum
|
||||
* @param char(1) Type de variable <b>A</b>:Alphanum�rique / <b>N</b>:Num�rique
|
||||
* @param mixed Message textuel d'erreur � afficher en cas d'erreur ou false
|
||||
* @return mixed true, false ou Message d'erreur pass� en param�tre
|
||||
*/
|
||||
function valideData($variable, $taille_min, $taille_max, $type_variable, $erreur=false){
|
||||
if ( strlen((string)$variable) < $taille_min )
|
||||
return $erreur;
|
||||
|
||||
if ( strlen((string)$variable) > $taille_max )
|
||||
return $erreur;
|
||||
|
||||
if ( $type_variable == 'A' )
|
||||
if ( is_string($variable) == true )
|
||||
return true;
|
||||
else
|
||||
return $erreur;
|
||||
|
||||
elseif ( $type_variable == 'N')
|
||||
{
|
||||
for ($i=0; $i < strlen((string)$variable); $i++)
|
||||
{
|
||||
$car = substr((string)$variable,$i,1);
|
||||
if ($car<'0' || $car>'9')
|
||||
return $erreur;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return $erreur;
|
||||
}
|
||||
|
||||
function adapteOCtets($size) {
|
||||
$kb = 1024; // Kilobyte
|
||||
$mb = 1024 * $kb; // Megabyte
|
||||
$gb = 1024 * $mb; // Gigabyte
|
||||
$tb = 1024 * $gb; // Terabyte
|
||||
if($size==0) return '0';
|
||||
else if($size < $kb) return $size.'o';
|
||||
else if($size < $mb) return round($size/$kb,2).'ko';
|
||||
else if($size < $gb) return round($size/$mb,2).'Mo';
|
||||
else if($size < $tb) return round($size/$gb,2).'Go';
|
||||
else return round($size/$tb,2).'To';
|
||||
}
|
||||
|
||||
/**
|
||||
** Enregistrer une information dans la log
|
||||
**
|
||||
** @param string $debugLevel E=Error, W=Warning, N=Notice, I=Info, D=Debug
|
||||
** @param string $message Message d'erreur à inscrire dans la log
|
||||
** @param integer $line __LINE__
|
||||
** @param string $file __FILE__
|
||||
** @param string $function __FUNCTION__
|
||||
** @param string $class __CLASS___
|
||||
**/
|
||||
function debugLog($debugLevel, $message, $line, $file, $function, $class) {
|
||||
if (!file_exists(realpath(dirname(__FILE__) . '/../debug.log'))) {
|
||||
$fp=fopen(realpath(dirname(__FILE__) . '/../debug.log'), 'a');
|
||||
fwrite($fp, 'Date/Heure;Niveau;Script;Login;Password;Adresse IP;Action SOAP;Ligne;Fichier;Fonction;Classe;Domaine;POST DATA;Message'.EOL);
|
||||
} else
|
||||
$fp=fopen(realpath(dirname(__FILE__) . '/../debug.log'), 'a');
|
||||
fwrite($fp, date('Y/m/d-H:i:s') .';'. $debugLevel .';'. $_SERVER['PHP_SELF'] .';'. $_SERVER['PHP_AUTH_USER'] .';'. $_SERVER['PHP_AUTH_PW'] .';'.
|
||||
$_SERVER['REMOTE_ADDR'] .';'. $_SERVER['HTTP_SOAPACTION'] .';'.$line.';'. $file.';'. $function.';'. $class .';'.
|
||||
gethostbyaddr($_SERVER['REMOTE_ADDR']) .';'. $HTTP_RAW_POST_DATA .';'. $message . EOL);
|
||||
fclose($fp);
|
||||
if ($debugLevel=='E') die($message);
|
||||
}
|
||||
?>
|
@ -1,67 +0,0 @@
|
||||
<?
|
||||
class Session {
|
||||
|
||||
function Session() {}
|
||||
|
||||
/** Création d'une session **/
|
||||
function creerSession($user, $password) {
|
||||
$password=md5($password);
|
||||
$sql="SELECT login, nom, prenom, etat FROM utilisateurs WHERE login='$user' AND password='$password' LIMIT 0,1";
|
||||
//echo $sql;
|
||||
//echo $password;
|
||||
$db=new DB();
|
||||
$db->query($sql);
|
||||
$ret=$db->num_rows();
|
||||
$db->next_record();
|
||||
$_SESSION['connected']=true;
|
||||
$_SESSION['mon_login']=$user;
|
||||
$_SESSION['mon_nom']=$db->f('nom');
|
||||
$_SESSION['mon_prenom']=$db->f('prenom');
|
||||
$_SESSION['mon_email']=$db->f('login');
|
||||
Session::majSession($user);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function majSession($user, $page='') {
|
||||
if ($_SESSION['connected']==true) {
|
||||
$db=new DB();
|
||||
$sql="SELECT lastAction FROM sessions WHERE login='$user' LIMIT 0,1";
|
||||
$db->query($sql);
|
||||
if ($db->num_rows()>0)
|
||||
$db->query("UPDATE sessions SET lastAction='".DATETIME_LOG."', page='$page' WHERE login='".$user."'");
|
||||
else
|
||||
$db->query("INSERT INTO sessions (login, lastAction, page) VALUES ('$user', '".DATETIME_LOG."', '$page');");
|
||||
return $ret;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
function existeSession($user) {
|
||||
if ($_SESSION['connected']) {
|
||||
Session::existeSession($user);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function supprSession($user) {
|
||||
if ($_SESSION['connected']) {
|
||||
$_SESSION['connected']=false;
|
||||
$_SESSION['mon_login']='';
|
||||
$_SESSION['mon_nom']='';
|
||||
$_SESSION['mon_prenom']='';
|
||||
$_SESSION['mon_email']='';
|
||||
Session::majSession($user);
|
||||
$db=new DB();
|
||||
$sql="DELETE FROM sessions WHERE login='$user' LIMIT 1";
|
||||
$db->query($sql);
|
||||
session_destroy();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -1,50 +0,0 @@
|
||||
<?
|
||||
class Session {
|
||||
|
||||
function Session() {}
|
||||
|
||||
/** Création d'une session **/
|
||||
function creerSession($user, $password) {
|
||||
$password=md5($password);
|
||||
$_SESSION['connected']=true;
|
||||
$_SESSION['mon_login']=$user;
|
||||
$_SESSION['mon_nom']='ricois';
|
||||
$_SESSION['mon_prenom']='michael';
|
||||
$_SESSION['mon_email']='mricois@scores-decisions.com';
|
||||
Session::majSession($user);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function majSession($user, $page='') {
|
||||
if ($_SESSION['connected']==true) {
|
||||
return $ret; //return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
function existeSession($user) {
|
||||
if ($_SESSION['connected']) {
|
||||
Session::existeSession($user);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function supprSession($user) {
|
||||
if ($_SESSION['connected']) {
|
||||
$_SESSION['connected']=false;
|
||||
$_SESSION['mon_login']='';
|
||||
$_SESSION['mon_nom']='';
|
||||
$_SESSION['mon_prenom']='';
|
||||
$_SESSION['mon_email']='';
|
||||
Session::majSession($user);
|
||||
session_destroy();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
|
||||
?>
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Cache - Gère le cache de la page et des différents fichiers
|
||||
* @package Cache
|
||||
* @author Michael RICOIS
|
||||
* @copyright Scores&Decisions
|
||||
*/
|
||||
|
||||
class Cache {
|
||||
|
||||
public $content = '';
|
||||
public $length = '';
|
||||
public $forceStart = FALSE;
|
||||
public $fileName = '';
|
||||
public $path = '';
|
||||
public $disable = FALSE;
|
||||
|
||||
private $maxTime = 6; //heures max en cache
|
||||
private $CacheRefreshHours = 16; //Raffraichir les pages après xx heures
|
||||
|
||||
function __construct(){
|
||||
$this->path = realpath(dirname(__FILE__).'/../cache/');
|
||||
}
|
||||
|
||||
function startCapture($fileName){
|
||||
global $firephp;
|
||||
$fileName = str_replace('.php','',$fileName);
|
||||
$this->fileName = $this->path .'/'. $fileName;
|
||||
if (!$this->disable){
|
||||
if(!$this->isInCache() || $this->forceStart){
|
||||
$firephp->info('Le fichier n\'est pas en cache');
|
||||
ob_start();
|
||||
return TRUE;
|
||||
}else{
|
||||
$firephp->info('Le fichier est en cache');
|
||||
return FALSE;
|
||||
}
|
||||
}else{
|
||||
$this->delete(); //On supprime le fichier en cache
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
function stopCapture(){
|
||||
if (!$this->disable){
|
||||
if(!$this->isInCache() || $this->forceStart){
|
||||
$this->content = ob_get_contents();
|
||||
$this->length = ob_get_length();
|
||||
ob_end_flush();
|
||||
$this->content.='<!-- Page fourni par le cache -->';
|
||||
$this->create();
|
||||
}
|
||||
}else{
|
||||
//On supprime les fichiers précédement crée pour qu'il soit généré la prochaine fois
|
||||
$this->delete();
|
||||
}
|
||||
}
|
||||
|
||||
function isInCache(){
|
||||
global $firephp;
|
||||
if(file_exists($this->fileName) && !$this->timeOver())
|
||||
return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
function timeOver(){
|
||||
global $firephp;
|
||||
$dateFile = filemtime($this->fileName);
|
||||
$now= mktime(date('G'), date('i'), date('s'), date("m") , date("d"), date("Y"));
|
||||
$maxTime = mktime(date('G',$dateFile)+$this->maxTime, date('i',$dateFile), date('s',$dateFile), date("m",$dateFile), date("d",$dateFile), date("Y",$dateFile));
|
||||
$refreshHour = mktime($this->CacheRefreshHours, 0, 0, date("m"), date("d"), date("Y"));
|
||||
|
||||
$firephp->log(date('G:i:s - d/m/Y',$dateFile), 'CACHE : dateFile ');
|
||||
$firephp->log(date('G:i:s - d/m/Y',$now), 'CACHE : now ');
|
||||
$firephp->log(date('G:i:s - d/m/Y',$maxTime), 'CACHE : MaxTime');
|
||||
$firephp->log(date('G:i:s - d/m/Y',$refreshHour), 'CACHE : RefreshHour ');
|
||||
|
||||
if( ($now>$maxTime) ||
|
||||
($dateFile<$refreshHour && $now>$refreshHour) )
|
||||
return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
function delete(){
|
||||
if(file_exists($this->fileName)){
|
||||
unlink($this->fileName);
|
||||
}
|
||||
}
|
||||
|
||||
function displayCache(){
|
||||
if(file_exists($this->fileName)){
|
||||
return file_get_contents($this->fileName);
|
||||
}else{
|
||||
return 'Erreur';
|
||||
}
|
||||
}
|
||||
|
||||
function create(){
|
||||
//Retrait <script>...</script>
|
||||
preg_replace('@<script[^>]*?>.*?</script>@si', '', $this->content);
|
||||
if( !file_put_contents($this->fileName, $this->content))
|
||||
{
|
||||
//TODO : Gestion des erreurs
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
|
||||
?>
|
@ -1,266 +0,0 @@
|
||||
<?php
|
||||
$tabFoncDir=array( 'ADM'=>'Administrateur',
|
||||
'ANC'=>'Ancien dirigeant',
|
||||
'ASS'=>'Associé',
|
||||
'COA'=>'Co-associé',
|
||||
'COC'=>'Co-commissaire aux comptes',
|
||||
'COG'=>'Co-gérant',
|
||||
'COM'=>'Commissaire au comptes',
|
||||
'CON'=>'Controleur de gestion',
|
||||
'COS'=>'Commissaire aux comptes suppléants',
|
||||
'DID'=>'Directeur Général Délégué',
|
||||
'DIR'=>'Directeur',
|
||||
'FON'=>'Fondé de pouvoir',
|
||||
'GER'=>'Gérant',
|
||||
'GRT'=>'Gérant',
|
||||
'GTE'=>'Gérante',
|
||||
'MEM'=>'Membre du conseil d\'administration ou de surveillance',
|
||||
'PCS'=>'Président du conseil de surveillance',
|
||||
'PDG'=>'Président directeur général',
|
||||
'PRD'=>'Président du directoire',
|
||||
'PRE'=>'Président du conseil d\'administration',
|
||||
'REP'=>'Représentant au conseil d\'administration',
|
||||
'RES'=>'Responsable en FRANCE',
|
||||
'VIC'=>'Vice-président conseil d\'administration ou desurveillance',
|
||||
'PP'=>'Personne Physique',
|
||||
'PPE'=>'Personne ayant pouvoir d\'engager la société',
|
||||
);
|
||||
|
||||
$tabSiege = array(0=>'établissement secondaire',
|
||||
1=>'établissement siège',
|
||||
);
|
||||
|
||||
$tabSaisonalite=array( 0=>'Activité permanente',
|
||||
1=>'Activité saisonnière',);
|
||||
|
||||
$tabAuxiliarite=array(0=>'productif',
|
||||
1=>'auxiliaire (exerce une activité de service pour le compte de l\'entreprise)',
|
||||
9=>'non siège inscrit au répertoire des métiers');
|
||||
|
||||
$tabMODE=array(0=>'Activité simple',
|
||||
1=>'montage et installation d\'équipements industriels',
|
||||
2=>'maintenance et réparation d\'équipements industriels',
|
||||
3=>'conception et commercialisation d\équipements fabriqués par des sous-traitants');
|
||||
|
||||
$tabTypeVoie = array (
|
||||
'AL'=>'Allée',
|
||||
'ALL'=>'Allée',
|
||||
'AV'=>'Avenue',
|
||||
'AVE'=>'Avenue',
|
||||
'AVN'=>'Avenue',
|
||||
'BD'=>'Boulevard',
|
||||
'BLD'=>'Boulevard',
|
||||
'CAR'=>'Carrefour',
|
||||
'CC'=>'Chemin communal',
|
||||
'CD'=>'Chemin départemental',
|
||||
'C'=>'Cours',
|
||||
'CRS'=>'Cours',
|
||||
'CH'=>'Chemin',
|
||||
'CHE'=>'Chemin',
|
||||
'CHS'=>'Chaussée',
|
||||
'CHA'=>'Chaussée',
|
||||
'CI'=>'Cité',
|
||||
'CIT'=>'Cité',
|
||||
'COR'=>'Corniche',
|
||||
'CR'=>'Chemin rural',
|
||||
'DSC'=>'Descente',
|
||||
'DOM'=>'Domaine',
|
||||
'ECA'=>'Ecart',
|
||||
'ESP'=>'Esplanade',
|
||||
'FG'=>'Faubourg',
|
||||
'FBG'=>'Faubourg',
|
||||
'GR'=>'Grande rue',
|
||||
'HM'=>'Hameau',
|
||||
'HLE'=>'Halle',
|
||||
'IMP'=>'Impasse',
|
||||
'LD'=>'Lieu dit',
|
||||
'L D'=>'Lieu dit',
|
||||
'LDT'=>'Lieu dit',
|
||||
'LOT'=>'Lotissement',
|
||||
'MAR'=>'Marché',
|
||||
'MTE'=>'Montée',
|
||||
'MON'=>'Montée',
|
||||
'N'=>'Route Nationale',
|
||||
'PRV'=>'Parvis',
|
||||
'PAS'=>'Passage',
|
||||
'PL'=>'Place',
|
||||
'PLC'=>'Place',
|
||||
'PLA'=>'Place',
|
||||
'PCE'=>'Place',
|
||||
'PLN'=>'Plaine',
|
||||
'PLT'=>'Plateau',
|
||||
'QUA'=>'Quartier',
|
||||
'QRT'=>'Quartier',
|
||||
'QUT'=>'Quartier',
|
||||
'Q'=>'Quai',
|
||||
'QU'=>'Quai',
|
||||
'R'=>'Rue',
|
||||
'RUE'=>'Rue',
|
||||
'RES'=>'Résidence',
|
||||
'ROC'=>'Rocade',
|
||||
'RP'=>'Rond Point',
|
||||
'RPT'=>'Rond Point',
|
||||
'RT'=>'Route',
|
||||
'RTE'=>'Route',
|
||||
'SEN'=>'Sente / Sentier',
|
||||
'SQ'=>'Square',
|
||||
'SQU'=>'Square',
|
||||
'TRA'=>'Traverse',
|
||||
'TP'=>'Terre-plein',
|
||||
'VLA'=>'Villa',
|
||||
'VC'=>'Voie communale',
|
||||
'ZA'=>'Zone d\'activités', // Rajouté car trouvé
|
||||
'ZAC'=>'Zone d\'activités et de commerce', // Rajouté car trouvé
|
||||
'ZAE'=>'Zone d\'activités', // Rajouté car trouvé
|
||||
'ZI'=>'Zone industrielle'); // Rajouté car trouvé
|
||||
|
||||
/**Nature d'établissements*/
|
||||
$tabNature = array( '20'=>'Petit magasin (moins de 300m²)',
|
||||
'21'=>'Magasin (de 300m² à 400m²)',
|
||||
'22'=>'Grande surface (de 400 à 2500m²)',
|
||||
'23'=>'Très grande surface (plus de 2500m²)',
|
||||
'91'=>'Base d\'activité sur chantiers',
|
||||
'92'=>'Base d\'activité sur marchés',
|
||||
'93'=>'Base d\'activité en clientèle',
|
||||
'99'=>'Autre');
|
||||
|
||||
/**Régions du code officiel géographique*/
|
||||
$tabRegion = array( '1'=>'Guadeloupe',
|
||||
'2'=>'Martinique',
|
||||
'3'=>'Guyane',
|
||||
'4'=>'Réunion',
|
||||
'11'=>'Ile-de-France',
|
||||
'21'=>'Champagne-Ardenne',
|
||||
'22'=>'Picardie',
|
||||
'23'=>'Haute-Normandie',
|
||||
'24'=>'Centre',
|
||||
'25'=>'Basse-Normandie',
|
||||
'26'=>'Bourgogne',
|
||||
'31'=>'Nord-Pas-de-Calais',
|
||||
'41'=>'Lorraine',
|
||||
'42'=>'Alsace',
|
||||
'43'=>'Franche-Comté',
|
||||
'52'=>'Pays de la Loire',
|
||||
'53'=>'Bretagne',
|
||||
'54'=>'Poitou-Charentes',
|
||||
'72'=>'Aquitaine',
|
||||
'73'=>'Midi-Pyrénées',
|
||||
'74'=>'Limousin',
|
||||
'82'=>'Rhône-Alpes',
|
||||
'83'=>'Auvergne',
|
||||
'91'=>'Languedoc-Roussillon',
|
||||
'93'=>'Provence Alpes Côte d Azur',
|
||||
'94'=>'Corse',
|
||||
'98'=>'Territoire d outre-mer (TOM)',
|
||||
'99'=>'Etranger');
|
||||
|
||||
/**Tranches de Chiffre d'Affaires INSEE*/
|
||||
$tabTCA = array('0'=>'inconnu',
|
||||
'1'=>'moins de 150.000 €',
|
||||
'2'=>'entre 150.000 et 750.000 €',
|
||||
'3'=>'entre 750.000 et 1,5 millions d\'Euro',
|
||||
'4'=>'entre 1,5 et 7,5 millions d\'Euro',
|
||||
'5'=>'entre 7,5 et 15 millions d\'Euro',
|
||||
'6'=>'entre 15 et 30,5 millions d\'Euro',
|
||||
'7'=>'entre 30,5 et 75 millions d\'Euro',
|
||||
'8'=>'entre 75 et 150 millions d\'Euro',
|
||||
'9'=>'plus de 150 millions d\'Euro');
|
||||
$tabTCAX = array('0'=>'rien',
|
||||
'1'=>'moins de 5%',
|
||||
'2'=>'entre 5 et 25%',
|
||||
'3'=>'entre 25 et 50%',
|
||||
'4'=>'plus de 50%');
|
||||
|
||||
/**Tranche d'habitants de commune détaillée*/
|
||||
$tabTCD=array( '1'=>'moins de 50 habitants',
|
||||
'2'=>'de 50 à 99 habitants',
|
||||
'3'=>'de 100 à 149 habitants',
|
||||
'4'=>'de 150 à 199 habitants',
|
||||
'5'=>'de 200 à 249 habitants',
|
||||
'6'=>'de 250 à 299 habitants',
|
||||
'7'=>'de 300 à 399 habitants',
|
||||
'8'=>'de 400 à 499 habitants',
|
||||
'11'=>'de 500 à 699 habitants',
|
||||
'12'=>'de 700 à 999 habitants',
|
||||
'13'=>'de 1000 à 1499 habitants',
|
||||
'14'=>'de 1500 à 1999 habitants',
|
||||
'15'=>'de 2000 à 2499 habitants',
|
||||
'16'=>'de 2500 à 2999 habitants',
|
||||
'17'=>'de 3000 à 3999 habitants',
|
||||
'18'=>'de 4000 à 4999 habitants',
|
||||
'21'=>'de 5 000 à 6 999 habitants',
|
||||
'22'=>'de 7 000 à 9 999 habitants',
|
||||
'31'=>'de 10 000 à 14 999 habitants',
|
||||
'32'=>'de 15 000 à 19 999 habitants',
|
||||
'41'=>'de 20 000 à 24 999 habitants',
|
||||
'42'=>'de 25 000 à 29 999 habitants',
|
||||
'43'=>'de 30 000 à 39 999 habitants',
|
||||
'44'=>'de 40 000 à 49 999 habitants',
|
||||
'51'=>'de 50 000 à 69 999 habitants',
|
||||
'52'=>'de 70 000 à 99 999 habitants',
|
||||
'61'=>'de 100 000 à 149 999 habitants',
|
||||
'62'=>'de 150 000 à 199 999 habitants',
|
||||
'71'=>'de 200 000 à 299 999 habitants',
|
||||
'72'=>'de 300 000 à 499 999 habitants',
|
||||
'73'=>'de 500 000 à 1 499 999 habitants',
|
||||
'80'=>'plus de 1 500 000 habitants');
|
||||
|
||||
/**Taille des unités urbaines*/
|
||||
$tabTU=array( '0'=>'commune rurale',
|
||||
'1'=>'unité urbaine de moins de 5 000 habitants',
|
||||
'2'=>'unité urbaine de 5 000 à 9 999 habitants',
|
||||
'3'=>'unité urbaine de 10 000 à 19 999 habitants',
|
||||
'4'=>'unité urbaine de 20 000 à 49 999 habitants',
|
||||
'5'=>'unité urbaine de 50 000 à 99 999 habitants',
|
||||
'6'=>'unité urbaine de 100 000 à 199 999 habitants',
|
||||
'7'=>'unité urbaine de 200 000 à 1 999 999 habitants',
|
||||
'8'=>'agglomération de Paris',
|
||||
);
|
||||
/**Tranches d'effectifs INSEE*/
|
||||
$tabEffectif=array('0'=>'0 salarié',
|
||||
'1'=>'de 1 à 2 salarié(s)',
|
||||
'2'=>'de 3 à 5 salariés',
|
||||
'3'=>'de 6 à 9 salariés',
|
||||
'11'=>'de 10 à 19 salariés',
|
||||
'12'=>'de 20 à 49 salariés',
|
||||
'21'=>'de 50 à 99 salariés',
|
||||
'22'=>'de 100 à 199 salariés',
|
||||
'31'=>'de 200 à 249 salariés',
|
||||
'32'=>'de 250 à 499 salariés',
|
||||
'41'=>'de 500 à 999 salariés',
|
||||
'42'=>'de 1000 à 1999 salariés',
|
||||
'51'=>'de 2000 à 4999 salariés',
|
||||
'52'=>'plus de 5000 salariés');
|
||||
|
||||
/**Libellé des singularités INSEE*/
|
||||
$tabSingularite=array('1'=>'Propriétaire Exploitant direct',
|
||||
'2'=>'Locataire Gérant',
|
||||
'10'=>'Loueur de fonds',
|
||||
'30'=>'Unité singulière de première espèce: avocats assocés, stations services sous mandat..',
|
||||
'31'=>'Associé d\'exploitation en commun; ce groupe comprend notamment: associé de société de fait, associé d\'indivision',
|
||||
'33'=>'Employeur non exploitant: prestataire de personnel, gérant mandataire',
|
||||
'34'=>'Membre d\'une société civile professionnelle',
|
||||
'40'=>'Siège d\'une unité SIREN de droit privé sans activité',
|
||||
'41'=>'Siège d\'un organisme public sans activité',
|
||||
'42'=>'Siège d\'un établissement public local non doté de l\'autonomie comptable: une partie des centres communaux d\'action sociale, une partie des caisses des écoles',
|
||||
'43'=>'Sièges de domiciliation',
|
||||
'52'=>'Sans domicile fixe',
|
||||
'60'=>'Activité occasionnelle ou accessoire: Expert auprès des tribunaux, médecin, infirmier, pharmacien remplçant, avocat stagiaire, sportif amateur',
|
||||
'70'=>'Activité en location (autre que le fond de commerce): Exploitant de terrain de camping, location de garage ou parking, locations de meublés, location de terres agricoles',
|
||||
'80'=>'Gestion immobilière de biens propres: syndicats de copropriétaires',
|
||||
'90'=>'Unité singulière de seconde espèce: établissement d\'une entreprise installée à Monaco, siège à l\'etranger de sociétés, associé gérant de sociétés');
|
||||
|
||||
/**Libellé des origines de création INSEE*/
|
||||
$tabOrigine=array( '0'=>'non renseigné',
|
||||
' '=>'non renseigné',
|
||||
''=>'non renseigné',
|
||||
'1'=>'Création pure',
|
||||
'2'=>'Réinstallation après transfert',
|
||||
'3'=>'Achat',
|
||||
'4'=>'Donation',
|
||||
'5'=>'Reprise au conjoint ou apport reçu',
|
||||
'6'=>'Reprise à un locataire gérant',
|
||||
'7'=>'Prise en location-gérance',
|
||||
'8'=>'Autre modalité d\'acquisition auprés d\'une autre unité SIREN');
|
||||
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
|
||||
?>
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Bootstrap Doctrine.php, register autoloader specify
|
||||
* configuration attributes and load models.
|
||||
*/
|
||||
require_once 'Doctrine.php';
|
||||
spl_autoload_register(array('Doctrine', 'autoload'));
|
||||
$manager = Doctrine_Manager::getInstance();
|
||||
$manager->setAttribute( Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE );
|
||||
$manager->setAttribute( Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, TRUE );
|
||||
$manager->setAttribute( Doctrine::ATTR_USE_NATIVE_ENUM, TRUE );
|
||||
/*
|
||||
$manager->setCollate('utf8_unicode_ci');
|
||||
$manager->setCharset('utf8');
|
||||
*/
|
||||
$graydonConn = Doctrine_Manager::connection('mysql://'.MYSQL_USER.':'.MYSQL_PASS.'@'.MYSQL_HOST.'/graydon', 'graydon');
|
||||
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/graydon');
|
||||
$intersudConn = Doctrine_Manager::connection('mysql://'.MYSQL_USER.':'.MYSQL_PASS.'@'.MYSQL_HOST.'/intersud', 'intersud');
|
||||
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/intersud');
|
||||
$sdv1Conn = Doctrine_Manager::connection('mysql://'.MYSQL_USER.':'.MYSQL_PASS.'@'.MYSQL_HOST.'/sdv1', 'sdv1');
|
||||
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/sdv1');
|
||||
/*
|
||||
$connection->setCollate('utf8_unicode_ci');
|
||||
$connection->setCharset('utf8');
|
||||
*/
|
||||
function setDbConn($name){
|
||||
global $manager;
|
||||
$currentName = $manager->getCurrentConnection()->getName();
|
||||
$currentConn = $manager->getCurrentConnection();
|
||||
if($currentName != $name){
|
||||
//$manager->closeConnection($currentConn);
|
||||
$manager->setCurrentConnection($name);
|
||||
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/'.$name);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,180 +0,0 @@
|
||||
<?php
|
||||
// Include XML_Serializer
|
||||
require_once('XML/Serializer.php');
|
||||
/**
|
||||
* Export - Gère les différents format d'exportation
|
||||
* @package export
|
||||
* @author Michael RICOIS
|
||||
* @copyright Scores&Decisions
|
||||
*/
|
||||
class ExportXML {
|
||||
public $fileName = '';
|
||||
public $path = '';
|
||||
public $rootName = 'root';
|
||||
public $defaultTagName = 'element';
|
||||
public $records = array();
|
||||
public $encoding = 'UTF-8';
|
||||
public $serializer_options = array();
|
||||
public $content = '';
|
||||
|
||||
function __construct() {
|
||||
$this->path = realpath(dirname(__FILE__).'/../cache/');
|
||||
}
|
||||
|
||||
function setXMLOptions(){
|
||||
// An array of serializer options
|
||||
$this->serializer_options = array (
|
||||
'addDecl' => TRUE,
|
||||
'encoding' => $this->encoding,
|
||||
'indent' => ' ',
|
||||
'rootName' => $this->rootName,
|
||||
'defaultTagName' => $this->defaultTagName,
|
||||
);
|
||||
}
|
||||
|
||||
function serialize(){
|
||||
$this->setXMLOptions();
|
||||
// Instantiate the serializer with the options
|
||||
$Serializer = &new XML_Serializer($this->serializer_options);
|
||||
// Serialize the data structure
|
||||
$status = $Serializer->serialize($this->records);
|
||||
// Check whether serialization worked
|
||||
if (PEAR::isError($status)) {
|
||||
//$status->getMessage()
|
||||
}
|
||||
$this->content = $Serializer->getSerializedData();
|
||||
}
|
||||
|
||||
function writeXML($fileName){
|
||||
$fileName = str_replace('.php','',$fileName);
|
||||
$this->fileName = $this->path .'/'. $fileName . '.xml';
|
||||
$this->serialize();
|
||||
if( !file_put_contents($this->fileName, $this->content))
|
||||
{
|
||||
//TODO : Gestion des erreurs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ExportCSV {
|
||||
|
||||
public $fileName = '';
|
||||
public $path = '';
|
||||
public $encoding = 'UTF-8';
|
||||
public $delimiter = ';';
|
||||
public $records = array();
|
||||
|
||||
function __construct() {
|
||||
$this->path = realpath(dirname(__FILE__).'/../cache/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ecrit un fichier csv à partir d'un tableau.
|
||||
* @param string $fileName
|
||||
* @param array $records
|
||||
* @param string $delimiter
|
||||
* @return void
|
||||
*/
|
||||
function writeCSV($fileName)
|
||||
{
|
||||
$fileName = str_replace('.php','',$fileName);
|
||||
$this->fileName = $this->path .'/'. $fileName . '.csv';
|
||||
|
||||
//Ouverture du fichier
|
||||
$fp = fopen($this->fileName, 'w');
|
||||
//On attribue le header
|
||||
$newRecords=array();
|
||||
$this->array_flatten($this->records[0],$newRecords);
|
||||
$headerKeys = array_keys($newRecords);
|
||||
if ($fp != FALSE){
|
||||
//Header du fichier csv
|
||||
fputcsv($fp, $headerKeys, $this->delimiter);
|
||||
}
|
||||
foreach( $this->records as $record ){
|
||||
$newRecords=array();
|
||||
$this->array_flatten($record,$newRecords);
|
||||
$values = array_values($newRecords);
|
||||
if ($fp != FALSE){
|
||||
//Contenu du fichier
|
||||
fputcsv($fp, $values, $this->delimiter);
|
||||
}else{
|
||||
//Erreur
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
function array_flatten($array, &$newArray = Array(), $prefix='', $delimiter='|') {
|
||||
foreach ($array as $key => $child) {
|
||||
if (is_array($child)) {
|
||||
$newPrefix = $prefix.$key.$delimiter;
|
||||
$newArray =& $this->array_flatten($child, $newArray ,$newPrefix, $delimiter);
|
||||
} else {
|
||||
$newArray[$prefix.$key] = $child;
|
||||
}
|
||||
}
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class tabExport {
|
||||
|
||||
public $tab = array();
|
||||
public $notdisplay = array();
|
||||
public $title = array();
|
||||
public $type = array();
|
||||
|
||||
public $convert = array();
|
||||
|
||||
function __construct() {}
|
||||
|
||||
function convertTable(){
|
||||
$this->convert = $this->rArray($this->tab);
|
||||
return $this->convert;
|
||||
}
|
||||
|
||||
function rArray($array) {
|
||||
foreach ($array as $key => $child) {
|
||||
if (is_array($child)) {
|
||||
if(!in_array($key, $this->notdisplay, TRUE)){
|
||||
$newArray[$this->renameKey($key)] = $this->rArray($child);
|
||||
}
|
||||
}else{
|
||||
if(!in_array($key, $this->notdisplay, TRUE)){
|
||||
$newArray[$this->renameKey($key)] = $this->convertValue($key, $child);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
function renameKey($key){
|
||||
$newKey = $key;
|
||||
if(array_key_exists($key, $this->title)){
|
||||
$newKey = $this->title[$key];
|
||||
}
|
||||
return $newKey;
|
||||
}
|
||||
|
||||
function convertValue($key, $value){
|
||||
if(array_key_exists($key, $this->type)){
|
||||
switch($this->type[$key]){
|
||||
case 'date':
|
||||
//Test des différents formats de value
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
class ExportPDF {
|
||||
|
||||
function __construct(){}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,168 +0,0 @@
|
||||
[Default]
|
||||
Consolidated
|
||||
|
||||
Weeks
|
||||
Currency
|
||||
Date
|
||||
|
||||
Accruals
|
||||
Accumulated_Depreciation
|
||||
Advanced_Pay_On_Stock
|
||||
Auditors Remuneration
|
||||
Auditors_Fees
|
||||
Bank_Loans
|
||||
Bank_loans
|
||||
Bank_Overdraft
|
||||
Borrowing_Ratio
|
||||
Capital_Employed
|
||||
Cash
|
||||
Cash(I)
|
||||
Cost_of_goods_sold
|
||||
Creditors_Days
|
||||
Creditors_Days_(D.P.O)
|
||||
Current_Ratio
|
||||
Days_Purchases_Outstanding
|
||||
Debtors_Days
|
||||
Debtors_Days_(D.S.O)
|
||||
DECLARED_INCOME
|
||||
Deferred_Taxation
|
||||
Depreciation
|
||||
Directors Remuneration
|
||||
Directors_Emoluments
|
||||
Dividends_Payable
|
||||
Due_From_Group
|
||||
Due_To_Directors
|
||||
Due_To_Group
|
||||
Equity
|
||||
Equity_Gearing
|
||||
Export
|
||||
Extaordinary_Items
|
||||
Financial_Assets
|
||||
Finished_Goods
|
||||
Fixed_Assets
|
||||
Gross_Profit
|
||||
Gross_Profit/Sales
|
||||
Growth
|
||||
Increase in Cash
|
||||
Intangible_Assets
|
||||
Intangible_Assets(I)
|
||||
Interest_Payable
|
||||
Intermediate_assets
|
||||
Intermediate_assets(I)
|
||||
Investments/Long Term Ass.
|
||||
Issued_Capital_+_Reserves
|
||||
Issued_Share_Capital
|
||||
Issued_Share_Capital(I)
|
||||
Liquid Assets
|
||||
Long Term Debt(>12 Months)
|
||||
Long_Term_Debt/T.N.W
|
||||
Long_Term_Loans
|
||||
Minority_Interests(I)
|
||||
Misc_Current_Assets
|
||||
Net Cashflow from Oper.
|
||||
Net Working Capital
|
||||
Net_Assets/(Liabilities)
|
||||
Non_Trading_Income
|
||||
Non-Audit_Fees
|
||||
Number of Employees
|
||||
Number of Years Trading
|
||||
Operating_Profit
|
||||
Other Deferred Liabs
|
||||
Other_Current_Assets
|
||||
Other_Current_Assets(I)
|
||||
Other_Finance
|
||||
Other_Liabilities
|
||||
Other_Liabs(I)
|
||||
Other_Short_Term_Liabilities
|
||||
Other_Tangible_Fixed
|
||||
Pre_Tax_Profit
|
||||
Pre_Tax_Profit(I)
|
||||
Pre_Tax_Profit_Margin
|
||||
Prepaid_Expenses
|
||||
Pretax_Profit_Margin
|
||||
Profit per Employee
|
||||
Profit_After_Tax
|
||||
Profit_and_Loss_account
|
||||
Profit_and_Loss_account(I)
|
||||
Profit_before_Tax
|
||||
PROFITS
|
||||
Quick_Ratio
|
||||
Raw_Materials_+_Supplies
|
||||
Received_Payments
|
||||
Reserve_For_Pensions
|
||||
Results_of_Ordinary_Operations
|
||||
Ret._Shareholders_Funds
|
||||
Retained_Profits
|
||||
Retained_Profits(I)
|
||||
Return_on_Assets
|
||||
Return_on_Capital
|
||||
Return_on_Investment
|
||||
Revaluation_Res(I)
|
||||
Revaluation_Reserves
|
||||
Rtn_on_Shareholders_Funds
|
||||
Sales per Employee
|
||||
Sales
|
||||
Sales(I)
|
||||
Share_Cap_+_Sundry_Res
|
||||
Share_Cap_+_Sundry_Res(I)
|
||||
Share_Capital_+_Res(I)
|
||||
Share_Capital_+_Reserves
|
||||
Share_Capital_+_Sundry_Reserves
|
||||
Shareholders_Funds
|
||||
Shareholders_Funds(I)
|
||||
Short_Term_Loans
|
||||
Start_Up_Reserves
|
||||
Stock_Turnover
|
||||
Stocks
|
||||
Stocks(I)
|
||||
Subordinate_Loans
|
||||
Sundry_Res(I)
|
||||
Sundry_Reserves
|
||||
T.N.W/Total_Assets
|
||||
Tangible Net Worth(T.N.W)
|
||||
Tangible_Assets
|
||||
Tangible_Assets(I)
|
||||
Taxation
|
||||
Tot_Current_Assets(I)
|
||||
Tot_Current_Liabs(I)
|
||||
Tot_Fixed_Assets(I)
|
||||
Tot_Long_Term_Liabs(I)
|
||||
Total_Assets
|
||||
Total_Current_Assets
|
||||
Total_Current_Liabilities
|
||||
Total_Fixed_Assets
|
||||
Total_Liabilities
|
||||
Total_Long_Term_Liabs
|
||||
Trade_creditors
|
||||
Trade_debtors
|
||||
Trade_debtors(I)
|
||||
Trading_Profit
|
||||
TURNOVER/SALES
|
||||
UK_sales
|
||||
W.I.P/Inventory_Days
|
||||
Wages_and_Salaries
|
||||
Work_In_Progress
|
||||
Working_Capital
|
||||
Working_Capital/Sales
|
||||
Cost_of_Goods_Sold
|
||||
Trade_Creditors
|
||||
Total_Lon_Term_Liabs
|
||||
Return_on_Total_Assets
|
||||
Debt/Equity_Ratio
|
||||
Sales_Per_Employee
|
||||
Return_on_Equity
|
||||
Risk_Margin
|
||||
Working Capital/Sales
|
||||
Stock/Turnover
|
||||
Equity/Assets
|
||||
Interest_Coverage
|
||||
Solvency_Margin
|
||||
|
||||
Balance_Sheet
|
||||
Balance_Sheet_(Interims)
|
||||
Financial_Comparison
|
||||
Key_Credit_Ratios
|
||||
Profit_and_Loss
|
||||
Profit_and_Loss_(Interims)
|
||||
Summary
|
||||
Text
|
@ -1,18 +0,0 @@
|
||||
EntireAddress
|
||||
Building
|
||||
Street
|
||||
Town
|
||||
City
|
||||
County
|
||||
PostCode
|
||||
Country
|
||||
|
||||
Associate
|
||||
Bank
|
||||
Branch>
|
||||
Home
|
||||
Main
|
||||
Previous Trading
|
||||
Registered
|
||||
Trading
|
||||
Enquiry
|
@ -1,59 +0,0 @@
|
||||
Average_Monthly_Credit
|
||||
Closing
|
||||
Credit_Limit
|
||||
Creditors Days (D.P.O)
|
||||
Database_Score
|
||||
Days_of_Credit
|
||||
Issued_Capital
|
||||
Issued_Number
|
||||
Net Income
|
||||
No_Of_Shares
|
||||
Nominal_Capital
|
||||
Nominal_Number
|
||||
Number_of_Shareholders
|
||||
Number_Of_Shares
|
||||
Number_Outstanding
|
||||
Number_Partially_Satisfied
|
||||
Number_Partially_Satisfied_12
|
||||
Number_Partially_Satisfied_24
|
||||
Number_Registered
|
||||
Number_Registered_12
|
||||
Number_Registered_24
|
||||
Number_Satisfied
|
||||
Number_Satisfied_12
|
||||
Number_Satisfied_24
|
||||
Odds_Financial_Stress_Next_12_Months
|
||||
Opening
|
||||
Percentage_At_And_Above_Score
|
||||
Percentage_Faced_Financial_Stress
|
||||
Percentage_Of_Shares
|
||||
Quantity
|
||||
Rate
|
||||
Sales
|
||||
Sample_Size
|
||||
Time_Since_Latest_Mortgage
|
||||
Total Equity
|
||||
Total_Count
|
||||
Value
|
||||
VAT
|
||||
Working Capital
|
||||
Leverage Percentage
|
||||
Quick Ratio Percentage
|
||||
Total Fixed Assets
|
||||
Gearing Percentage
|
||||
Capital_Stock
|
||||
Payment Trend
|
||||
Company
|
||||
Size
|
||||
Industry
|
||||
Order_Number
|
||||
Currency_Rate
|
||||
Answer_Limit
|
||||
|
||||
|
||||
N/A
|
||||
*Null
|
||||
Actual
|
||||
Days
|
||||
Percentage
|
||||
Ratio
|
@ -1,2 +0,0 @@
|
||||
Bank_Identification
|
||||
Bank_Sort_Code
|
@ -1,11 +0,0 @@
|
||||
[default]
|
||||
Buyers_Number = Buyers_Number
|
||||
Chamber_Of_Commerce = Chambre de commerce
|
||||
SIREN_Number = SIREN
|
||||
Unique_Company_Number = Unique_Company_Number
|
||||
National2 = Identifiant National 2
|
||||
VAT = Numéro TVA intra-comunautaire
|
||||
Internal = Identifiant interne
|
||||
National1 = Identifiant National 1
|
||||
Web_Address = Adresse Web
|
||||
Fiscal_Code = Code Fiscal
|
@ -1,247 +0,0 @@
|
||||
<?php
|
||||
|
||||
//Contient les Numéros d'identifiant
|
||||
function dIdentifiant($tab){
|
||||
$tab = $tab['Company']['Subject'][0]['CompanyId'];
|
||||
print '<table>';
|
||||
foreach($tab as $identifiant => $value){
|
||||
printRow($identifiant, $value);
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
//Contient l'identité de l'entreprise
|
||||
function dIdentite($tab){
|
||||
print '<table>';
|
||||
//Affichage raison sociale
|
||||
if($tab['Company']['Subject'][0]['Name']){ printRow('Raison Sociale', $tab['Company']['Subject'][0]['Name']); }
|
||||
//Affichage autres noms
|
||||
if($tab['Name']['Trade']){ printRow('Enseigne', $tab['Name']['Trade']); }
|
||||
//Affichage Forme légale
|
||||
foreach($tab['LegalForm'] as $name => $forme){
|
||||
switch($name){
|
||||
case "Current" :
|
||||
printRow('Forme légale', $forme);
|
||||
break;
|
||||
case "Previous" :
|
||||
printRow('Forme légale précédente', $forme);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Afficage date
|
||||
if($tab['Company']['Subject'][0]['Date']['Age_of_Company']){ printRow('Date de Création', $tab['Company']['Subject'][0]['Date']['Age_of_Company']); }
|
||||
|
||||
//Affichage adresses
|
||||
$typeAddress = array('Registered', 'Trading', 'Previous Trading');
|
||||
$oldAddress = '';
|
||||
foreach($typeAddress as $address){
|
||||
$currentAddress = $tab['Address'][$address]['EntireAddress'];
|
||||
if($oldAddress != $currentAddress && $tab['Address'][$address]['EntireAddress']){
|
||||
switch($address){
|
||||
case "Registered" :
|
||||
printRow('Adresse', $currentAddress);
|
||||
break;
|
||||
case "Trading" :
|
||||
printRow('Adresse commerciale', $currentAddress);
|
||||
break;
|
||||
case "Previous Trading" :
|
||||
printRow('Adresse commerciale précédente', $currentAddress);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$oldAddress = $currentAddress;
|
||||
}
|
||||
//Affichage Communication
|
||||
if($tab['Communication']){
|
||||
foreach($tab['Communication'] as $name => $value){
|
||||
switch($name){
|
||||
case "Telephone" :
|
||||
printRow('Téléphone', $value);
|
||||
break;
|
||||
case "Fax" :
|
||||
printRow('Fax', $value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
//Contient l'activité
|
||||
function dActivite($tab){
|
||||
print '<table>';
|
||||
//Code NACE
|
||||
if($tab['Taxonomy']){
|
||||
$activite = '';
|
||||
foreach($tab['Taxonomy'] as $item){
|
||||
if($item['Type'] == 'Nace'){
|
||||
$activite.= $item['Code'].' - '.$item['Value'].'<br/>';
|
||||
}
|
||||
}
|
||||
if($activite) printRow('Activité', $activite);
|
||||
}
|
||||
if($tab['Text']['Activities']){
|
||||
$text = '';
|
||||
foreach($tab['Text']['Activities'] as $item){
|
||||
$text.= $item.'<br/>';
|
||||
}
|
||||
printRow('', '<b><u>Informations complémentaires:</u></b><br/>'.$text);
|
||||
}
|
||||
//Effectif
|
||||
if($tab['Employees']['Staff_Employed']){
|
||||
printRow('Effectif', $tab['Employees']['Staff_Employed']);
|
||||
}
|
||||
//Capital
|
||||
if($tab['ShareCapitalSummary']['ShareCapital']){
|
||||
foreach($tab['ShareCapitalSummary']['ShareCapital'] as $item){
|
||||
foreach($item['Amount'] as $name => $value){
|
||||
printRow($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Chiffre d'affaire
|
||||
|
||||
|
||||
//Principaux dirigeants
|
||||
if($tab['DirectorsDetail']){
|
||||
$text = '';
|
||||
foreach($tab['DirectorsDetail'] as $item){
|
||||
$text.= formatName($item['Name']);
|
||||
$text.= ' ('.$item['Type'].')';
|
||||
$text.= '<br/>';
|
||||
}
|
||||
printRow('Principaux dirigeants', $text);
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
function dCredit($tab){
|
||||
print '<table>';
|
||||
if($tab['CreditRating']){
|
||||
if($tab['CreditRating']['Credit_Score']){
|
||||
printRow('Score actuel', $tab['CreditRating']['Credit_Score']['Value']);
|
||||
}
|
||||
if($tab['CreditRating']['Previous_Credit_Score']){
|
||||
printRow('Score précédent', $tab['CreditRating']['Previous_Credit_Score']['Value']);
|
||||
}
|
||||
if($tab['CreditRating']['Credit_Score']['Text']['Credit_Score_Description']){
|
||||
printRow('', '<b><u>Description :</u></b><br/>'.$tab['CreditRating']['Credit_Score']['Text']['Credit_Score_Description']);
|
||||
}
|
||||
if($tab['CreditRating']['Credit_Score']['Text']['Credit_Score_Explanation']){
|
||||
printRow('', '<b><u>Explication :</u></b><br/>'.$tab['CreditRating']['Credit_Score']['Text']['Credit_Score_Explanation']);
|
||||
}
|
||||
if($tab['CreditRating']['Maximum_Credit_Guide']){
|
||||
$value = $tab['CreditRating']['Maximum_Credit_Guide']['Value'];
|
||||
$value.= ' '.$tab['CreditRating']['Maximum_Credit_Guide']['Currency'];
|
||||
printRow('Credit maximum (Guide)', $value);
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
function dResume($tab){
|
||||
print '<table id="resume">';
|
||||
/*
|
||||
Trade Morality
|
||||
Payments
|
||||
Leverage Percentage
|
||||
Quick Ratio Percentage
|
||||
Issued Capital
|
||||
Nominal Capital
|
||||
Net Sales
|
||||
Sales
|
||||
Net Income
|
||||
Total Equity
|
||||
Total Fixed Assets
|
||||
Stocks
|
||||
Summary
|
||||
*/
|
||||
if($tab['FinancialSummary']['Text']){
|
||||
foreach($tab['FinancialSummary']['Text'] as $name => $value){
|
||||
printRow($name, $value);
|
||||
}
|
||||
}
|
||||
if($tab['FinancialSummary']['Date']){
|
||||
foreach($tab['FinancialSummary']['Date'] as $name => $value){
|
||||
printRow($name, $value);
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
function dLiens($tab){
|
||||
global $firephp;
|
||||
print '<table>';
|
||||
$oldKey = '';
|
||||
foreach($tab['Company'] as $kCompany => $company){
|
||||
if($kCompany != 'Subject'){
|
||||
$text = '';
|
||||
foreach($company as $detail){
|
||||
$text.= $detail['Name'];
|
||||
if($detail['Address']['Main']['EntireAddress']) $text.= ' (<i>'.$detail['Address']['Main']['EntireAddress'].'</i>)<br/>';
|
||||
if($detail['Address']['Branch']['EntireAddress']) $text.= ' (<i>'.$detail['Address']['Branch']['EntireAddress'].'</i>)<br/>';
|
||||
$text.='<br/>';
|
||||
}
|
||||
printRow($kCompany, $text);
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
function dBilans($tab){
|
||||
|
||||
if($tab['AccountItem']){
|
||||
foreach($tab['AccountItem'] as $kAccount => $account){
|
||||
print '<div class="bilans">'.$kAccount.'</div>';
|
||||
print '<span class="bilans"> The following figures are shown in units of '.$account['Units'].'</span>';
|
||||
//Entête du tableau
|
||||
print '<table class="bilans">';
|
||||
print '<thead><tr>';
|
||||
print '<th> </th>';
|
||||
foreach($account['AccountingPeriod'] as $index => $period){
|
||||
print '<th class="right">'.$period['Date'].'</th>';
|
||||
}
|
||||
print '</tr></thead>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>Currency</td>';
|
||||
foreach($account['AccountingPeriod'] as $index => $period){
|
||||
print '<td class="right">'.$period['Currency'].'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
//Contenu du tableau
|
||||
foreach($account['AccountElement'] as $intitule => $values){
|
||||
print '<tr>';
|
||||
print '<td>'.$intitule.'</td>';
|
||||
foreach($values as $value){
|
||||
print '<td class="right">'.$value.'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function formatName($name){
|
||||
if(is_array($name)){
|
||||
if($name['Family']){ $text.= $name['Family']; }
|
||||
if($name['Christian']){ $text.= ' '.$name['Christian']; }
|
||||
}else{
|
||||
$text = $name;
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
function printRow($title, $value){
|
||||
print '<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">'.$title.'</td>
|
||||
<td width="350" class="StyleInfoData">'.$value.'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
@ -1,600 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Fonctions utiles pour l'utilisation du webservice graydon
|
||||
*
|
||||
*/
|
||||
|
||||
function parseReport($type){
|
||||
$doc = new DOMDocument;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
$doc->loadxml($xml);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parcours le contenu du rapport en XML
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
function parseReportXML($xml){
|
||||
global $firephp;
|
||||
$tabReport = array();
|
||||
global $xpath;
|
||||
$query = '/GraydonUKCompanySchema/CompanyReportPage/CompanyReport';
|
||||
$report = $xpath->query($query);
|
||||
|
||||
//Liste des elements à parser
|
||||
$elements = array( 'Company', 'Name', 'Address', 'Communication', 'Country', 'Credit_Rating',
|
||||
'Date', 'DirectorsDetail', 'Employees', 'Financial_Summary', 'Legal_Form',
|
||||
'Share_CapitalSummary', 'Taxonomy', 'FreeText', 'AccountItem'
|
||||
);
|
||||
foreach($elements as $elementName){
|
||||
//Pour chaque element, nouvelle requete xpath
|
||||
$queryElement = $query.'/'.$elementName;
|
||||
switch($elementName){
|
||||
case "Company" :
|
||||
$tabReport['Company'] = pxmlCompany($queryElement);
|
||||
break;
|
||||
case "Name" :
|
||||
$name = pxmlName($queryElement);
|
||||
if ($name) $tabReport['Name'] = $name;
|
||||
break;
|
||||
case "Address" :
|
||||
$tabReport['Address'] = pxmlAddress($queryElement);
|
||||
break;
|
||||
case "Communication":
|
||||
$tabReport['Communication'] = pxmlCommunication($queryElement);
|
||||
break;
|
||||
case "Country" :
|
||||
$country = pxmlCountry($queryElement);
|
||||
if($country) $tabReport['Country'] = $country;
|
||||
break;
|
||||
case "Credit_Rating" :
|
||||
$creditRating = pxmlCreditRating($queryElement);
|
||||
if($creditRating) $tabReport['CreditRating'] = $creditRating;
|
||||
break;
|
||||
case "Date" :
|
||||
$tabReport['Date'] = pxmlDate($queryElement);
|
||||
break;
|
||||
case "DirectorsDetail" :
|
||||
$directorsdetail = pxmlDirectorsDetail($queryElement);
|
||||
if($directorsdetail){ $tabReport['DirectorsDetail'] = $directorsdetail; }
|
||||
break;
|
||||
case "Employees" :
|
||||
$employees = pxmlEmployees($queryElement);
|
||||
if($employees) $tabReport['Employees'] = $employees;
|
||||
break;
|
||||
case "Financial_Summary" :
|
||||
$financialsummary = pxmlFinancialSummary($queryElement);
|
||||
if($financialsummary) $tabReport['FinancialSummary'] = $financialsummary;
|
||||
break;
|
||||
case "Legal_Form" :
|
||||
$legalform = pxmlLegalForm($queryElement);
|
||||
if($legalform) $tabReport['LegalForm'] = $legalform;
|
||||
break;
|
||||
case "Share_CapitalSummary";
|
||||
$sharecapitalsummary = pxmlShareCapitalSummary($queryElement);
|
||||
if($sharecapitalsummary) $tabReport['ShareCapitalSummary'] = $sharecapitalsummary;
|
||||
break;
|
||||
case "Taxonomy" :
|
||||
$taxonomy = pxmlTaxonomy($queryElement);
|
||||
if($taxonomy) $tabReport['Taxonomy'] = $taxonomy;
|
||||
break;
|
||||
case "FreeText" :
|
||||
$freetext = pxmlFreeText($queryElement);
|
||||
if($freetext) $tabReport['Text'] = $freetext;
|
||||
break;
|
||||
case "AccountItem";
|
||||
$AccountItem = pxmlAccountItem($queryElement);
|
||||
if($AccountItem) $tabReport['AccountItem'] = $AccountItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $tabReport;
|
||||
}
|
||||
|
||||
function pxmlCompany($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tabCompany = array();
|
||||
$items = $xpath->query($query);
|
||||
$countCompany = 0;
|
||||
$oldType ='';
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type!=$oldType){$countCompany = 0;}
|
||||
//Name
|
||||
$name = $item->getElementsByTagName("Name")->item(0)->nodeValue;
|
||||
$tabCompany[$type][$countCompany]['Name'] = $item->getElementsByTagName("Name")->item(0)->nodeValue;
|
||||
//CompanyId
|
||||
$tabCompanyId = pxmlCompanyId($query.'[@Type="'.$type.'"]/CompanyId');
|
||||
if($tabCompanyId){ $tabCompany[$type][$countCompany]['CompanyId'] = $tabCompanyId;}
|
||||
//Country
|
||||
//@TODO
|
||||
//Address
|
||||
$tabAddress = pxmlAddress($query.'[@Type="'.$type.'"]['.($countCompany+1).']/Address');
|
||||
if($tabAddress){ $tabCompany[$type][$countCompany]['Address'] = $tabAddress;}
|
||||
//Amount
|
||||
//@TODO
|
||||
//FreeText
|
||||
//@TODO
|
||||
//Date
|
||||
$tabDate = pxmlDate($query.'[@Type="'.$type.'"]/Date');
|
||||
if($tabDate){ $tabCompany[$type][$countCompany]['Date'] = $tabDate;}
|
||||
|
||||
$oldType = $type;
|
||||
$countCompany++;
|
||||
}
|
||||
return $tabCompany;
|
||||
}
|
||||
|
||||
function pxmlCompanyId($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tabCompanyId = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
$tabCompanyId[$type] = $item->nodeValue;
|
||||
}
|
||||
return $tabCompanyId;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlDate($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tabDate = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
$format = $item->getAttribute('Format');
|
||||
$value = $item->nodeValue;
|
||||
|
||||
//Formattage de la date
|
||||
switch($format){
|
||||
case "CCYY":
|
||||
$date = $value;
|
||||
break;
|
||||
case "CCYYMMDD":
|
||||
$date = substr($value,6,2).'/'.substr($value,4,2).'/'.substr($value,0,4);
|
||||
break;
|
||||
case "DD":
|
||||
$date = $value;
|
||||
break;
|
||||
case "DDMM":
|
||||
$date = $value;
|
||||
break;
|
||||
case "DDMMCCYY":
|
||||
$date = $value;
|
||||
break;
|
||||
case "MM":
|
||||
$timestamp = mktime(0, 0, 0, date("m")-$value, 1, date("Y"));
|
||||
$date = date('m/Y',$timestamp);
|
||||
break;
|
||||
case "MMCCYY":
|
||||
$date = $value;
|
||||
break;
|
||||
case "MMDDCCYY":
|
||||
$date = substr($value,2,2).'/'.substr($value,0,2).'/'.substr($value,4,4);
|
||||
break;
|
||||
case "DD/MM/CCYY":
|
||||
$date = $value;
|
||||
break;
|
||||
default:
|
||||
$date = $value;
|
||||
}
|
||||
$tabDate[$type] = $date;
|
||||
}
|
||||
return $tabDate;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlName($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tabName = array();
|
||||
$items = $xpath->query($query);
|
||||
$countName = 0;
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type !='' ){ $index = $type; }else{$index = $countName;}
|
||||
$tabName[$index] = $item->nodeValue;
|
||||
$countName++;
|
||||
}
|
||||
return $tabName;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlAddress($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tabAddress = array();
|
||||
$items = $xpath->query($query);
|
||||
$countAddress = 0;
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type !='' ){ $index = $type; }else{$index = $countAddress;}
|
||||
//Liste des elements à parser
|
||||
$elements = array('EntireAddress', 'Building', 'Street', 'Town', 'City', 'County', 'PostCode', 'Country');
|
||||
foreach($elements as $elementName){
|
||||
if($emelmentName == 'Country'){
|
||||
|
||||
}else{
|
||||
$value = $item->getElementsByTagName($elementName)->item(0)->nodeValue;
|
||||
if ($value) { $tabAddress[$index][$elementName] = $value; }
|
||||
}
|
||||
}
|
||||
$countAddress++;
|
||||
}
|
||||
return $tabAddress;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlCommunication($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tabCommunication = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type != '' ){
|
||||
$tabCommunication[$type] = $item->nodeValue;
|
||||
}
|
||||
}
|
||||
return $tabCommunication;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlCountry($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tabCountry = array();
|
||||
$items = $xpath->query($query);
|
||||
$countCountry = 0;
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type !='' ){ $tabName[$countCountry]['Type'] = $type; }
|
||||
$dialcode = $item->getAttribute('DialCode');
|
||||
if($dialcode !='' ){ $tabName[$countCountry]['DialCode'] = $dialcode; }
|
||||
$isocode = $item->getAttribute('ISOCode');
|
||||
if($isocode !='' ){ $tabName[$countCountry]['ISOCode'] = $isocode; }
|
||||
$tabName[$countCountry]['Value'] = $item->nodeValue;
|
||||
$countCountry++;
|
||||
}
|
||||
return $tabCountry;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlCreditRating($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
$count = 0;
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
//Get type of Credit Rating
|
||||
$type = $item->getAttribute('Type');
|
||||
$units = $item->getAttribute('Units');
|
||||
if($units !='' ){ $tab[$type]['Units'] = $units; }
|
||||
switch($type){
|
||||
case "Credit_Score" :
|
||||
$tab[$type]['Value'] = $item->firstChild->nodeValue;
|
||||
$freetextList = $item->getElementsByTagName('FreeText');
|
||||
foreach ($freetextList as $freetext){
|
||||
$tab[$type]['Text'][$freetext->getAttribute('Type')] = $freetext->nodeValue;
|
||||
}
|
||||
break;
|
||||
case "Previous_Credit_Score" :
|
||||
$tab[$type]['Value'] = $item->firstChild->nodeValue;
|
||||
$freetextList = $item->getElementsByTagName('FreeText');
|
||||
foreach ($freetextList as $freetext){
|
||||
$tab[$type]['Text'][$freetext->getAttribute('Type')] = $freetext->nodeValue;
|
||||
}
|
||||
break;
|
||||
case "Maximum_Credit_Guide" :
|
||||
$amount = $item->getElementsByTagName('Amount')->item(0)->nodeValue;
|
||||
$tab[$type]['Currency']= $item->getElementsByTagName('Currency')->item(0)->nodeValue;
|
||||
$tab[$type]['Value'] = $amount;
|
||||
$freetextList = $item->getElementsByTagName('FreeText');
|
||||
foreach ($freetextList as $freetext){
|
||||
$tab[$type]['Text'][$freetext->getAttribute('Type')] = $freetext->nodeValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlDirectorsDetail($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
foreach ($items as $item) {
|
||||
//Traitement des attributs
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type !='' ){ $tab[$count]['Type'] = $type; }
|
||||
$title = $item->getAttribute('Title');
|
||||
if($title !='' ){ $tab[$count]['Title'] = $title; }
|
||||
$nationality = $item->getAttribute('Nationality');
|
||||
if($nationality !='' ){ $tab[$count]['Nationality'] = $nationality; }
|
||||
//Traitement des éléments
|
||||
$name = pxmlName($query.'['.($count+1).']/Name');
|
||||
if ($name) $tab[$count]['Name'] = $name;
|
||||
$address = pxmlAddress($query.'['.($count+1).']/Address');
|
||||
if ($address) $tab[$count]['Address'] = $address;
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlEmployees($query){
|
||||
global $xpath;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
$count = 0;
|
||||
if($items->length>0){
|
||||
foreach ($items as $item) {
|
||||
//Traitement des attributs
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type !='' ){ $index = $type; }else{ $index = $count; }
|
||||
$tab[$index] = $item->nodeValue;
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlFinancialSummary($query){
|
||||
global $xpath;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
$elements = array('FreeText', 'Amount', 'Date');
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
foreach($elements as $elementName){
|
||||
switch($elementName){
|
||||
case 'FreeText':
|
||||
$freetextList = $item->getElementsByTagName('FreeText');
|
||||
foreach ($freetextList as $freetext){
|
||||
$tab['Text'][$freetext->getAttribute('Type')] = $freetext->nodeValue;
|
||||
}
|
||||
break;
|
||||
case 'Amount':
|
||||
$amount = $item->getElementsByTagName('Amount')->item(0)->nodeValue;
|
||||
$tab['Amount']['Currency']= $item->getElementsByTagName('Currency')->item(0)->nodeValue;
|
||||
$tab['Amount']['Value'] = $amount;
|
||||
break;
|
||||
case 'Date':
|
||||
$date = pxmlDate($query.'/Date');
|
||||
if($date) $tab['Date'] = $date;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function pxmlLegalForm($query){
|
||||
global $xpath;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type !='' ){ $index = $type; }else{ $index = $count; }
|
||||
$tab[$index] = $item->nodeValue;
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function pxmlShareCapitalSummary($query){
|
||||
global $xpath;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
foreach ($items as $item){
|
||||
//FreeText
|
||||
$freetextList = $item->getElementsByTagName('FreeText');
|
||||
foreach ($freetextList as $freetext){
|
||||
$tab['Text'][$freetext->getAttribute('Type')] = $freetext->nodeValue;
|
||||
}
|
||||
//ShareCapital
|
||||
$sharecapitalList = $item->getElementsByTagName('Share_Capital');
|
||||
$countShareCapital = 0;
|
||||
foreach ($sharecapitalList as $sharecapital){
|
||||
//Amount
|
||||
$type = $sharecapital->getElementsByTagName('Amount')->item(0)->getAttribute('Type');
|
||||
$tab['ShareCapital'][$countShareCapital]['Amount'][$type] = $sharecapital->getElementsByTagName('Amount')->item(0)->nodeValue;
|
||||
//Currency
|
||||
$tab['ShareCapital'][$countShareCapital]['Currency'] = $sharecapital->getElementsByTagName('Currency')->item(0)->nodeValue;
|
||||
$tab['ShareCapital'][$countShareCapital]['FreeText'] = $sharecapital->getElementsByTagName('FreeText')->item(0)->nodeValue;
|
||||
$countShareCapital++;
|
||||
}
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlTaxonomy($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
foreach ($items as $item){
|
||||
$value = $item->nodeValue;
|
||||
if($value){ $tab[$count]['Value'] = $value;}
|
||||
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type !='' ){ $tab[$count]['Type'] = $type;}
|
||||
|
||||
$code = $item->getAttribute('Code');
|
||||
if($code !='' ){ $tab[$count]['Code'] = $code;}
|
||||
|
||||
$item = $item->getAttribute('Item');
|
||||
if($item !='' ){ $tab[$count]['Item'] = $item;}
|
||||
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlFreeText($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
$oldType = '';
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
if($type != $oldType){ $count = 0; }
|
||||
$value = $item->nodeValue;
|
||||
if($value){ $tab[$type][$count] = $value;}
|
||||
|
||||
$oldType = $type;
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlAccountItem($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
|
||||
//Pour chaque AccountItem
|
||||
//Lire chaque AccountPeriod
|
||||
//Pour chaque AccountPeriod
|
||||
//Classer les AccoutElement
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
$units = $item->getAttribute('Units');
|
||||
$tab[$type]['Units'] = $units;
|
||||
$tab[$type]['AccountingPeriod'] = pxmlAccountingPeriod($query.'[@Type="'.$type.'"]/AccountingPeriod');
|
||||
$tab[$type]['AccountElement'] = pxmlAccountElement($query.'[@Type="'.$type.'"]/AccountElement');
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlAccountingPeriod($query){
|
||||
global $xpath;
|
||||
global $firephp;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
foreach ($items as $AccountingPeriod){
|
||||
$item = $AccountingPeriod->getAttribute('Item');
|
||||
//@todo : Intégrer avec la fonction de parsing de la date
|
||||
$date = $AccountingPeriod->getElementsByTagName('Date')->item(0)->nodeValue;
|
||||
$currency = $AccountingPeriod->getElementsByTagName('Currency')->item(0)->nodeValue;
|
||||
$tab[$item]['Date'] = $date;
|
||||
$tab[$item]['Currency'] = $currency;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlAccountElement($query){
|
||||
global $xpath;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
foreach ($items as $item){
|
||||
$type = $item->getAttribute('Type');
|
||||
$tab[$type] = pxmlAmount($query.'[@Type="'.$type.'"]/Amount');
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function pxmlAmount($query){
|
||||
global $xpath;
|
||||
$tab = array();
|
||||
$items = $xpath->query($query);
|
||||
if($items->length>0){
|
||||
$count = 0;
|
||||
foreach ($items as $item){
|
||||
$indexItem = $item->getAttribute('Item');
|
||||
if($indexItem){ $index = $indexItem; }
|
||||
$amount = $item->nodeValue;
|
||||
$tab[$index] = $amount;
|
||||
$count++;
|
||||
}
|
||||
return $tab;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function parseReportHTML(){}
|
||||
|
||||
function parseReportDOC(){}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Graydon Error - Gère les erreurs renvoyé par le webservice graydon
|
||||
* @package GraydonError
|
||||
* @author Michael RICOIS
|
||||
* @copyright Scores&Decisions
|
||||
*/
|
||||
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
|
||||
/**
|
||||
* Recupère les erreurs SOAP et les traite.
|
||||
* @param string $lastRequest
|
||||
* @param string $lastResponse
|
||||
* @param array $fault
|
||||
* @param bool $debug
|
||||
* @return string
|
||||
*/
|
||||
function graydon_processSoapFault($clientSoap, $fault, $tabInfo, $debug = FALSE){
|
||||
|
||||
$message = 'Request : '. htmlspecialchars($clientSoap->__getLastRequest()) . '<br/><br/>' .
|
||||
'Response : '. htmlspecialchars($clientSoap->__getLastResponse()) . '<br/><br/>';
|
||||
|
||||
$message.= '<br/>';
|
||||
$message.= 'Informations de debug : <br/>';
|
||||
$message.= '<pre>';
|
||||
$message.= 'REQUEST : '.print_r($_REQUEST,true).'<br/><br/>';
|
||||
$message.= 'SERVER : '.print_r($_REQUEST,true).'<br/><br/>';
|
||||
$message.= 'SESSION : '.print_r($_SESSION,true).'<br/><br/>';
|
||||
$message.= 'ENV : '.print_r($_ENV,true).'<br/><br/>';
|
||||
$message.= 'tabInfo : '.print_r($tabInfo,true).'<br/><br/>';
|
||||
$message.= '</pre>';
|
||||
|
||||
if($debug == TRUE){
|
||||
print '<pre>';
|
||||
print $message;
|
||||
print '</pre>';
|
||||
}else{
|
||||
graydon_mailSoapFault($message);
|
||||
$message = graydon_messageSoapFault();
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Affiche un message d'erreur sympatique pour le client.
|
||||
* @return string
|
||||
*/
|
||||
function graydon_messageSoapFault(){
|
||||
(defined('ERROR_SOAP')) ? ($message = ERROR_SOAP) : ($message = "Une erreur est survenue lors de votre requête") ;
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoi de l'erreur Soap par mail.
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
function graydon_mailSoapFault($message){
|
||||
$mail = new PHPMailer();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Serveur SD-13408";
|
||||
$mail->Host = "mail.scores-decisions.com";
|
||||
$mail->Mailer = "smtp";
|
||||
$mail->Subject = "Erreur SOAP - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||
$body = $message;
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
if(!$mail->Send()) {
|
||||
logSoapFault($mail->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction qui enregistre les messages d'erreur dans un log.
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
function graydon_logSoapFault($message){
|
||||
echo $message;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function graydon_error($code, $text){
|
||||
|
||||
$tabError = array(
|
||||
0 => array( "Code" => "CWS0112", "Text" => "Country or Countries specified not valid" ),
|
||||
1 => array( "Code" => "CWS0113", "Text" => "Country is not enabled for matchByIdentifier" ),
|
||||
2 => array( "Code" => "CWS5000", "Text" => "No match results found for subject company" ),
|
||||
);
|
||||
|
||||
$returnError = FALSE;
|
||||
foreach($tabError as $error){
|
||||
if($code == $error['Code']){
|
||||
$returnError = $error;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $returnError;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'log.php';
|
||||
|
||||
define('GRAYDON_LOGFILE',PATH_LOGS.'graydon-requetes.log');
|
||||
|
||||
/**
|
||||
* Enregistre chaque appel de méthode graydon
|
||||
*
|
||||
* @param string $login
|
||||
* Login de l'utilisateur
|
||||
* @param string $page
|
||||
* Nom de la page
|
||||
* @param string $requete
|
||||
* Requête Graydon effectué
|
||||
* @param string $transactionIdentifier
|
||||
* Identifiant de transaction Graydon
|
||||
* @param string $sessionIdentifier
|
||||
* Identifiant de session Graydon
|
||||
* @return void
|
||||
*/
|
||||
function graydonRequeteLog($login, $page, $requete, $transactionIdentifier, $sessionIdentifier){
|
||||
$tabData = array( "Date" => date('Y/m/d H:i:s'),
|
||||
"Login" => $login,
|
||||
"Page" => $page,
|
||||
"Requete" => $requete,
|
||||
"TransactionIdentifier" => $transactionIdentifier,
|
||||
"SessionIdentifier" => $sessionIdentifier,
|
||||
);
|
||||
writeLog(GRAYDON_LOGFILE, $tabData, ';');
|
||||
}
|
||||
|
||||
?>
|
@ -1,126 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Graydon Webservice
|
||||
http://graydon.co.uk/GraydonDataService/
|
||||
https://www.webservices.graydon.co.uk/CompanyData_webservice/services/SOAPPort/wsdl/GraydonCompanyData.wsdl
|
||||
|
||||
//=> Recherche
|
||||
getCompanyMatchesByIdentifier
|
||||
Get a match for a company by using the appropriate identifier for the country being matched in.
|
||||
Specify the 'Country' parameter within the 'CompanyMatches_Parameters', also supply the 'CompanyIdentifier'
|
||||
parameter.
|
||||
Determine which identifier should be supplied by using the 'getCompanyMatchIdentifiers' operation beforehand,
|
||||
this response with the identifier type used to search in the desired country.
|
||||
Determine which search method is available and which of these is the best using the 'getCompanyMatchMethods',
|
||||
the response will give you an array of available match methods. The response is a single 'Company' element
|
||||
within the 'CompanyMatches' element, this has all the information on the matched company held in many elements.
|
||||
If no companies are found to match the given search criteria a 'graydonComanyData_Fault' is thrown containing
|
||||
appropriate error information.
|
||||
|
||||
getCompanyMatchesByKeyword
|
||||
Get a list of matches for a company by using the a company name keyword and city/postcode for the country
|
||||
being matched in.
|
||||
Specify the 'Country' parameter within the 'CompanyMatches_Parameters', also supply the 'Keyword', 'City'
|
||||
and 'PostCode' parameter (Last two elements are optional). Determine which identifier should be
|
||||
suDetermine which search method is available and which of these is the best using the
|
||||
'getCompanyMatchMethods', the response will give you an array of available match methods.
|
||||
The response is an array of 'Company' elements within the 'CompanyMatches' element, this has all the
|
||||
information on the matched company held in many elements. If no companies are found to match the given
|
||||
search criteria a 'graydonComanyData_Fault' is thrown containing appropriate error information.
|
||||
|
||||
getCompanyMatchesByName
|
||||
Get a list of matches for a company by using the company name and city for the country being matched in.
|
||||
Specify the 'Country' parameter within the 'CompanyMatches_Parameters', also supply the 'Name', 'City'
|
||||
parameter (The last element is optional). Determine which search method is available and which of these
|
||||
is the best using the 'getCompanyMatchMethods', the response will give you an array of available match
|
||||
methods. The response is an array of 'Company' elements within the 'CompanyMatches' element, this has
|
||||
all the information on the matched company held in many elements. If no companies are found to match
|
||||
the given search criteria a 'graydonComanyData_Fault' is thrown containing appropriate error information.
|
||||
|
||||
getCompanyMatchesByPostCode
|
||||
Get a list of matches for a company by using the company's postcode for the country being matched in.
|
||||
Specify the 'Country' parameter within the 'CompanyMatches_Parameters', also supply the 'Name', 'City'
|
||||
parameter (The last element is optional).
|
||||
Determine which search method is available and which of these is the best using the 'getCompanyMatchMethods',
|
||||
the response will give you an array of available match methods. The response is an array of 'Company'
|
||||
elements within the 'CompanyMatches' element, this has all the information on the matched company held in many
|
||||
elements. If no companies are found to match the given search criteria a 'graydonComanyData_Fault' is thrown
|
||||
containing appropriate error information.
|
||||
|
||||
getCompanyMatchIdentifiers
|
||||
Get a list of company identifiers for a single or all country. Provide the 'Country' parameter to request
|
||||
identifiers for a single country. Use this to determine which type of identifier can be used with the
|
||||
'getCompanyMatchesByIdentifier' method. The response contains an array of 'CompanyMatchIdentifier', each
|
||||
containing the related 'Country' and the 'CompanyIdentifier' element holding the 'Type' for that country.
|
||||
|
||||
getCompanyMatchMethods
|
||||
Get the available matching methods for a single or all countries.
|
||||
Provide the 'Country' parameter if you want methods for a single country and not all.
|
||||
This helps determine the best search method to implement per country and the availability
|
||||
of additional search criteria such as 'City'. The response is a single or array
|
||||
of 'CompanyMatchMethods' each contains the related country and an array of
|
||||
available 'MatchMethod' elements. The order of the 'MatchMethods' elements determines
|
||||
order of preference for searching in that country.
|
||||
|
||||
getCompanyProducts
|
||||
Get the list of products and their availability for a subject company.
|
||||
Provide the 'CompanyMatchIdentifier' parameter (This is provided on each company match).
|
||||
The subject company should be identified via a matching operation prior to this operations use.
|
||||
|
||||
|
||||
checkOrders
|
||||
|
||||
|
||||
placeOrder
|
||||
|
||||
|
||||
getCompanyReport
|
||||
|
||||
|
||||
getCountryAvailability
|
||||
Get the availability of products and services for a single or all countries.
|
||||
Provide the 'Country' parameter when a single country is desired.
|
||||
The response contains a single or multiple 'CountryAndProduct' elements which inturn contains
|
||||
the 'Country' and multiple 'Product' elements with the relevant details.
|
||||
|
||||
getCountryStylesheets
|
||||
|
||||
|
||||
getDemoCompanies -->
|
||||
Get the demonstration companies available for a single or all countries.
|
||||
Provide the 'Country' parameter when a single country is desired.
|
||||
The response contains a single or multiple 'Company' elements which icontains the relevant
|
||||
details for the demonstration company.
|
||||
|
||||
ping
|
||||
|
||||
User profile: SESS38R7
|
||||
Customer no.: 32790
|
||||
Password : E88MSU4
|
||||
|
||||
https://www.webservices.graydon.co.uk
|
||||
|
||||
*/
|
||||
|
||||
ini_set('soap.wsdl_cache_enabled', 0);
|
||||
//define('GRAYDON_WSDL' ,'https://www.webservices.graydon.co.uk/CompanyData_webservice/services/SOAPPort/wsdl/GraydonCompanyData.wsdl');
|
||||
define('GRAYDON_WSDL', realpath(dirname(__FILE__)).'/GraydonCompanyData.wsdl');
|
||||
define('USER_PROFILE','SESS38R7');
|
||||
define('PASSWORD','E88MSU4');
|
||||
|
||||
require_once realpath(dirname(__FILE__)).'/wsfunctions.php';
|
||||
|
||||
$options = array('trace' => 1);
|
||||
//$options = array('trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
// SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS
|
||||
// Create a soap client
|
||||
$graydon = new SoapClient(GRAYDON_WSDL, $options);
|
||||
// Create the authentication parameters object
|
||||
$authentication = new StdClass();
|
||||
// Initialise the authentication parameters
|
||||
$authentication->PartnerUserId = USER_PROFILE;
|
||||
$authentication->PartnerPassword = PASSWORD;
|
||||
$authentication->PartnerClientId = '';
|
||||
$authentication->SessionID = '';
|
||||
|
||||
?>
|
@ -1,128 +0,0 @@
|
||||
<?php
|
||||
$tabPays = array(
|
||||
"Algeria" => array( "display"=> "Algeria"),
|
||||
"Angola" => array( "display"=> "Angola"),
|
||||
"Argentina" => array( "display"=> "Argentina"),
|
||||
"Australia" => array( "display"=> "Australia"),
|
||||
"Austria" => array( "display"=> "Austria"),
|
||||
"Azerbaijan" => array( "display"=> "Azerbaijan"),
|
||||
"Bahamas" => array( "display"=> "Bahamas"),
|
||||
"Bahrain" => array( "display"=> "Bahrain"),
|
||||
"Bangladesh" => array( "display"=> "Bangladesh"),
|
||||
"Belgium" => array( "display"=> "Belgium"),
|
||||
"Belize" => array( "display"=> "Belize"),
|
||||
"Benin" => array( "display"=> "Benin"),
|
||||
"Bermuda" => array( "display"=> "Bermuda"),
|
||||
"Bolivia" => array( "display"=> "Bolivia"),
|
||||
"Botswana" => array( "display"=> "Botswana"),
|
||||
"Brazil" => array( "display"=> "Brazil"),
|
||||
"British Virgin Islands" => array( "display"=> "British Virgin Islands"),
|
||||
"Bulgaria" => array( "display"=> "Bulgaria"),
|
||||
"Cambodia" => array( "display"=> "Cambodia"),
|
||||
"Cameroon" => array( "display"=> "Cameroon"),
|
||||
"Canada" => array( "display"=> "Canada"),
|
||||
"Chile" => array( "display"=> "Chile"),
|
||||
"China" => array( "display"=> "China"),
|
||||
"Colombia" => array( "display"=> "Colombia"),
|
||||
"Congo Republic" => array( "display"=> "Congo Republic"),
|
||||
"Costa Rica" => array( "display"=> "Costa Rica"),
|
||||
"Croatia" => array( "display"=> "Croatia"),
|
||||
"Cyprus" => array( "display"=> "Cyprus"),
|
||||
"Czech Republic" => array( "display"=> "Czech Republic"),
|
||||
"Denmark" => array( "display"=> "Denmark"),
|
||||
"Dominican Republic" => array( "display"=> "Dominican Republic"),
|
||||
"Ecuador" => array( "display"=> "Ecuador"),
|
||||
"Egypt" => array( "display"=> "Egypt"),
|
||||
"El Salvador" => array( "display"=> "El Salvador"),
|
||||
"Estonia" => array( "display"=> "Estonia"),
|
||||
"Ethiopia" => array( "display"=> "Ethiopia"),
|
||||
"Finland" => array( "display"=> "Finland"),
|
||||
"France" => array( "display"=> "France"),
|
||||
"Gabon" => array( "display"=> "Gabon"),
|
||||
"Germany" => array( "display"=> "Germany"),
|
||||
"Ghana" => array( "display"=> "Ghana"),
|
||||
"Gibraltar" => array( "display"=> "Gibraltar"),
|
||||
"Greece" => array( "display"=> "Greece"),
|
||||
"Guadeloupe" => array( "display"=> "Guadeloupe"),
|
||||
"Guatemala" => array( "display"=> "Guatemala"),
|
||||
"Honduras" => array( "display"=> "Honduras"),
|
||||
"Hong Kong" => array( "display"=> "Hong Kong"),
|
||||
"Hungary" => array( "display"=> "Hungary"),
|
||||
"Iceland" => array( "display"=> "Iceland"),
|
||||
"India" => array( "display"=> "India"),
|
||||
"Indonesia" => array( "display"=> "Indonesia"),
|
||||
"Iran" => array( "display"=> "Iran"),
|
||||
"Irish Republic" => array( "display"=> "Irish Republic"),
|
||||
"Israel" => array( "display"=> "Israel"),
|
||||
"Italy" => array( "display"=> "Italy"),
|
||||
"Ivory Coast" => array( "display"=> "Ivory Coast"),
|
||||
"Jamaica" => array( "display"=> "Jamaica"),
|
||||
"Japan" => array( "display"=> "Japan"),
|
||||
"Jordan" => array( "display"=> "Jordan"),
|
||||
"Kenya" => array( "display"=> "Kenya"),
|
||||
"Kuwait" => array( "display"=> "Kenya"),
|
||||
"Kyrgyzstan" => array( "display"=> "Kyrgyzstan"),
|
||||
"Latvia" => array( "display"=> "Latvia"),
|
||||
"Lebanon" => array( "display"=> "Lebanon"),
|
||||
"Liberia" => array( "display"=> "Liberia"),
|
||||
"Libya" => array( "display"=> "Libya"),
|
||||
"Liechtenstein" => array( "display"=> "Liechtenstein"),
|
||||
"Lithuania" => array( "display"=> "Lithuania"),
|
||||
"Luxembourg" => array( "display"=> "Luxembourg"),
|
||||
"Madagascar" => array( "display"=> "Madagascar"),
|
||||
"Malaysia" => array( "display"=> "Malaysia"),
|
||||
"Malta" => array( "display"=> "Malta"),
|
||||
"Mauritius" => array( "display"=> "Mauritius"),
|
||||
"Mexico" => array( "display"=> "Mexico"),
|
||||
"Monaco" => array( "display"=> "Monaco"),
|
||||
"Morocco" => array( "display"=> "Morocco"),
|
||||
"Namibia" => array( "display"=> "Namibia"),
|
||||
"Netherlands" => array( "display"=> "Netherlands"),
|
||||
"New Zealand" => array( "display"=> "New Zealand"),
|
||||
"Nicaragua" => array( "display"=> "Nicaragua"),
|
||||
"Nigeria" => array( "display"=> "Nigeria"),
|
||||
"Norway" => array( "display"=> "Norway"),
|
||||
"Oman" => array( "display"=> "Oman"),
|
||||
"Pakistan" => array( "display"=> "Pakistan"),
|
||||
"Panama" => array( "display"=> "Panama"),
|
||||
"Paraguay" => array( "display"=> "Paraguay"),
|
||||
"Peru" => array( "display"=> "Peru"),
|
||||
"Philippines" => array( "display"=> "Philippines"),
|
||||
"Poland" => array( "display"=> "Poland"),
|
||||
"Portugal" => array( "display"=> "Portugal"),
|
||||
"Puerto Rico" => array( "display"=> "Puerto Rico"),
|
||||
"Qatar" => array( "display"=> "Qatar"),
|
||||
"Romania" => array( "display"=> "Romania"),
|
||||
"Russia" => array( "display"=> "Russia"),
|
||||
"Saudi Arabia" => array( "display"=> "Saudi Arabia"),
|
||||
"Senegal" => array( "display"=> "Senegal"),
|
||||
"Serbia And Montenegro" => array( "display"=> "Serbia And Montenegro"),
|
||||
"Seychelles" => array( "display"=> "Seychelles"),
|
||||
"Singapore" => array( "display"=> "Singapore"),
|
||||
"Slovakia" => array( "display"=> "Slovakia"),
|
||||
"Slovenia" => array( "display"=> "Slovenia"),
|
||||
"South Africa" => array( "display"=> "South Africa"),
|
||||
"South Korea" => array( "display"=> "South Korea"),
|
||||
"Spain" => array( "display"=> "Spain"),
|
||||
"Sri Lanka" => array( "display"=> "Sri Lanka"),
|
||||
"Sweden" => array( "display"=> "Sweden"),
|
||||
"Switzerland" => array( "display"=> "Switzerland"),
|
||||
"Syria" => array( "display"=> "Syria"),
|
||||
"Taiwan" => array( "display"=> "Taiwan"),
|
||||
"Thailand" => array( "display"=> "Thailand"),
|
||||
"Trinidad And Tobago" => array( "display"=> "Trinidad And Tobago"),
|
||||
"Tunisia" => array( "display"=> "Tunisia"),
|
||||
"Turkey" => array( "display"=> "Turkey"),
|
||||
"Uganda" => array( "display"=> "Uganda"),
|
||||
"Ukraine" => array( "display"=> "Ukraine"),
|
||||
"United Arab Emirates" => array( "display"=> "United Arab Emirates"),
|
||||
"United Kingdom" => array( "display"=> "United Kingdom"),
|
||||
"Uruguay" => array( "display"=> "Uruguay"),
|
||||
"USA" => array( "display"=> "USA"),
|
||||
"Venezuela" => array( "display"=> "Venezuela"),
|
||||
"Vietnam" => array( "display"=> "Vietnam"),
|
||||
"Yemen" => array( "display"=> "Yemen"),
|
||||
"Zimbabwe" => array( "display"=> "Zimbabwe"),
|
||||
);
|
||||
|
||||
?>
|
@ -1,374 +0,0 @@
|
||||
[Immediate]
|
||||
Algeria = 125
|
||||
Angola = 125
|
||||
Argentina = "-"
|
||||
Australia = "-"
|
||||
Austria = 65
|
||||
Azerbaijan = "-"
|
||||
Bahamas = 125
|
||||
Bahrain = 125
|
||||
Bangladesh = "-"
|
||||
Belgium = 65
|
||||
Belize = "-"
|
||||
Benin = 125
|
||||
Bermuda = 125
|
||||
Bolivia = "-"
|
||||
Botswana = 125
|
||||
Brazil = "-"
|
||||
British Virgin Islands = 125
|
||||
Bulgaria = 65
|
||||
Cambodia = "-"
|
||||
Cameroon = 125
|
||||
Canada = 65
|
||||
Chile = "-"
|
||||
China = 95
|
||||
Colombia = "-"
|
||||
Congo Republic = "125"
|
||||
Costa Rica = "-"
|
||||
Croatia = 65
|
||||
Cyprus = "-"
|
||||
Czech Republic = 65
|
||||
Denmark = 125
|
||||
Dominican Republic = 125
|
||||
Ecuador = "-"
|
||||
Egypt = 125
|
||||
El Salvador = "-"
|
||||
Estonia = 95
|
||||
Ethiopia = 125
|
||||
Finland = "-"
|
||||
France = 65
|
||||
Gabon = 125
|
||||
Germany = 65
|
||||
Ghana = 125
|
||||
Gibraltar = "-"
|
||||
Greece = 65
|
||||
Guadeloupe = 125
|
||||
Guatemala = "-"
|
||||
Honduras = "-"
|
||||
Hong Kong = "-"
|
||||
Hungary = 65
|
||||
Iceland = "-"
|
||||
India = "-"
|
||||
Indonesia = "-"
|
||||
Iran = 125
|
||||
Irish Republic = 65
|
||||
Israel = "-"
|
||||
Italy = 65
|
||||
Ivory Coast = 125
|
||||
Jamaica = 125
|
||||
Japan = 95
|
||||
Jordan = 125
|
||||
Kenya = 125
|
||||
Kuwait = 125
|
||||
Kyrgyzstan = "-"
|
||||
Latvia = 95
|
||||
Lebanon = 125
|
||||
Liberia = 125
|
||||
Libya = 125
|
||||
Liechtenstein = "-"
|
||||
Lithuania = 95
|
||||
Luxembourg = "-"
|
||||
Madagascar = 125
|
||||
Malaysia = "-"
|
||||
Malta = "-"
|
||||
Mauritius = "-"
|
||||
Mexico = "-"
|
||||
Monaco = "-"
|
||||
Morocco = 125
|
||||
Namibia = 125
|
||||
Netherlands = 65
|
||||
New Zealand = "-"
|
||||
Nicaragua = "-"
|
||||
Nigeria = 125
|
||||
Norway = "-"
|
||||
Oman = "-"
|
||||
Pakistan = "-"
|
||||
Panama = "-"
|
||||
Paraguay = "-"
|
||||
Peru = "-"
|
||||
Philippines = "-"
|
||||
Poland = 65
|
||||
Portugal = 65
|
||||
Puerto Rico = 125
|
||||
Qatar = 125
|
||||
Romania = 65
|
||||
Russia = 95
|
||||
Saudi Arabia = 125
|
||||
Senegal = 125
|
||||
Serbia And Montenegro = "-"
|
||||
Seychelles = "-"
|
||||
Singapore = "-"
|
||||
Slovakia = 65
|
||||
Slovenia = 65
|
||||
South Africa = "-"
|
||||
South Korea = "-"
|
||||
Spain = 65
|
||||
Sri Lanka = "-"
|
||||
Sweden = 65
|
||||
Switzerland = 65
|
||||
Syria = 125
|
||||
Taiwan = "-"
|
||||
Thailand = "-"
|
||||
Trinidad And Tobago = "-"
|
||||
Tunisia = 125
|
||||
Turkey = 125
|
||||
Uganda = 125
|
||||
Ukraine = 95
|
||||
United Arab Emirates = 125
|
||||
United Kingdom = 65
|
||||
Uruguay = "-"
|
||||
USA = 65
|
||||
Venezuela = "-"
|
||||
Vietnam = "-"
|
||||
Yemen = 125
|
||||
Zimbabwe = 125
|
||||
|
||||
[Normal]
|
||||
Algeria = 155
|
||||
Angola = 155
|
||||
Argentina = 95
|
||||
Australia = 95
|
||||
Austria = 95
|
||||
Azerbaijan = 155
|
||||
Bahamas = 155
|
||||
Bahrain = 155
|
||||
Bangladesh = 155
|
||||
Belgium = 95
|
||||
Belize = 95
|
||||
Benin = 155
|
||||
Bermuda = 155
|
||||
Bolivia = 95
|
||||
Botswana = 155
|
||||
Brazil = 95
|
||||
British Virgin Islands = 155
|
||||
Bulgaria = 95
|
||||
Cambodia = 155
|
||||
Cameroon = 155
|
||||
Canada = 95
|
||||
Chile = 95
|
||||
China = 155
|
||||
Colombia = 95
|
||||
Congo Republic = 155
|
||||
Costa Rica = 95
|
||||
Croatia = 95
|
||||
Cyprus = 95
|
||||
Czech Republic = 95
|
||||
Denmark = 95
|
||||
Dominican Republic = 155
|
||||
Ecuador = 95
|
||||
Egypt = 155
|
||||
El Salvador = 95
|
||||
Estonia = 155
|
||||
Ethiopia = 155
|
||||
Finland = 95
|
||||
France = 95
|
||||
Gabon = 155
|
||||
Germany = 95
|
||||
Ghana = 155
|
||||
Gibraltar = 95
|
||||
Greece = 95
|
||||
Guadeloupe = 155
|
||||
Guatemala = 95
|
||||
Honduras = 95
|
||||
Hong Kong = 95
|
||||
Hungary = 95
|
||||
Iceland = 95
|
||||
India = 95
|
||||
Indonesia = 95
|
||||
Iran = 155
|
||||
Irish Republic = 95
|
||||
Israel = 95
|
||||
Italy = 95
|
||||
Ivory Coast = 155
|
||||
Jamaica = 155
|
||||
Japan = 155
|
||||
Jordan = 155
|
||||
Kenya = 155
|
||||
Kuwait = 155
|
||||
Kyrgyzstan = 155
|
||||
Latvia = 155
|
||||
Lebanon = 155
|
||||
Liberia = 155
|
||||
Libya = 155
|
||||
Liechtenstein = 95
|
||||
Lithuania = 155
|
||||
Luxembourg = 95
|
||||
Madagascar = 155
|
||||
Malaysia = 155
|
||||
Malta = 95
|
||||
Mauritius = 95
|
||||
Mexico = 95
|
||||
Monaco = 95
|
||||
Morocco = 155
|
||||
Namibia = 155
|
||||
Netherlands = 95
|
||||
New Zealand = 95
|
||||
Nicaragua = 95
|
||||
Nigeria = 155
|
||||
Norway = 95
|
||||
Oman = 155
|
||||
Pakistan = 155
|
||||
Panama = 95
|
||||
Paraguay = 95
|
||||
Peru = 95
|
||||
Philippines = 155
|
||||
Poland = 95
|
||||
Portugal = 95
|
||||
Puerto Rico = 155
|
||||
Qatar = 155
|
||||
Romania = 95
|
||||
Russia = 155
|
||||
Saudi Arabia = 155
|
||||
Senegal = 155
|
||||
Serbia And Montenegro = 95
|
||||
Seychelles = 155
|
||||
Singapore = 155
|
||||
Slovakia = 95
|
||||
Slovenia = 95
|
||||
South Africa = 95
|
||||
South Korea = 155
|
||||
Spain = 95
|
||||
Sri Lanka = 155
|
||||
Sweden = 95
|
||||
Switzerland = 95
|
||||
Syria = 155
|
||||
Taiwan = 155
|
||||
Thailand = 155
|
||||
Trinidad And Tobago = 155
|
||||
Tunisia = 155
|
||||
Turkey = 155
|
||||
Uganda = 155
|
||||
Ukraine = 155
|
||||
United Arab Emirates = 155
|
||||
United Kingdom = 95
|
||||
Uruguay = 95
|
||||
USA = 95
|
||||
Venezuela = 95
|
||||
Vietnam = 155
|
||||
Yemen = 155
|
||||
Zimbabwe = 155
|
||||
|
||||
[Superflash]
|
||||
Algeria = 230
|
||||
Angola = 230
|
||||
Argentina = 230
|
||||
Australia = 230
|
||||
Austria = 155
|
||||
Azerbaijan = 230
|
||||
Bahamas = 230
|
||||
Bahrain = 230
|
||||
Bangladesh = 230
|
||||
Belgium = 155
|
||||
Belize = 230
|
||||
Benin = 230
|
||||
Bermuda = 230
|
||||
Bolivia = 230
|
||||
Botswana = 230
|
||||
Brazil = 230
|
||||
British Virgin Islands = 230
|
||||
Bulgaria = 155
|
||||
Cambodia = 230
|
||||
Cameroon = 230
|
||||
Canada = 155
|
||||
Chile = 230
|
||||
China = 230
|
||||
Colombia = 230
|
||||
Congo Republic = 230
|
||||
Costa Rica = 230
|
||||
Croatia = 155
|
||||
Cyprus = 155
|
||||
Czech Republic = 155
|
||||
Denmark = 155
|
||||
Dominican Republic = 230
|
||||
Ecuador = 230
|
||||
Egypt = 230
|
||||
El Salvador = 230
|
||||
Estonia = 230
|
||||
Ethiopia = 230
|
||||
Finland = 155
|
||||
France = 155
|
||||
Gabon = 230
|
||||
Germany = 155
|
||||
Ghana = 230
|
||||
Gibraltar = 155
|
||||
Greece = 155
|
||||
Guadeloupe = 230
|
||||
Guatemala = 230
|
||||
Honduras = 230
|
||||
Hong Kong = 230
|
||||
Hungary = 155
|
||||
Iceland = 155
|
||||
India = 155
|
||||
Indonesia = 230
|
||||
Iran = 230
|
||||
Irish Republic = 155
|
||||
Israel = 155
|
||||
Italy = 155
|
||||
Ivory Coast = 230
|
||||
Jamaica = 230
|
||||
Japan = 230
|
||||
Jordan = 230
|
||||
Kenya = 230
|
||||
Kuwait = 230
|
||||
Kyrgyzstan = 230
|
||||
Latvia = 230
|
||||
Lebanon = 230
|
||||
Liberia = 230
|
||||
Libya = 230
|
||||
Liechtenstein = 155
|
||||
Lithuania = 230
|
||||
Luxembourg = 155
|
||||
Madagascar = 230
|
||||
Malaysia = 230
|
||||
Malta = 155
|
||||
Mauritius = 230
|
||||
Mexico = 230
|
||||
Monaco = 155
|
||||
Morocco = 230
|
||||
Namibia = 230
|
||||
Netherlands = 155
|
||||
New Zealand = 230
|
||||
Nicaragua = 230
|
||||
Nigeria = 230
|
||||
Norway = 155
|
||||
Oman = 230
|
||||
Pakistan = 230
|
||||
Panama = 230
|
||||
Paraguay = 230
|
||||
Peru = 230
|
||||
Philippines = 230
|
||||
Poland = 155
|
||||
Portugal = 155
|
||||
Puerto Rico = 230
|
||||
Qatar = 230
|
||||
Romania = 155
|
||||
Russia = 230
|
||||
Saudi Arabia = 230
|
||||
Senegal = 230
|
||||
Serbia And Montenegro = 155
|
||||
Seychelles = 230
|
||||
Singapore = 230
|
||||
Slovakia = 155
|
||||
Slovenia = 155
|
||||
South Africa = 230
|
||||
South Korea = 230
|
||||
Spain = 155
|
||||
Sri Lanka = 230
|
||||
Sweden = 155
|
||||
Switzerland = 155
|
||||
Syria = 230
|
||||
Taiwan = 230
|
||||
Thailand = 230
|
||||
Trinidad And Tobago = 230
|
||||
Tunisia = 230
|
||||
Turkey = 230
|
||||
Uganda = 230
|
||||
Ukraine = 230
|
||||
United Arab Emirates = 230
|
||||
United Kingdom = 155
|
||||
Uruguay = 230
|
||||
USA = 155
|
||||
Venezuela = 230
|
||||
Vietnam = 230
|
||||
Yemen = 230
|
||||
Zimbabwe = 230
|
@ -1,746 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Retourne les identifiants disponible.
|
||||
* @param string $pays
|
||||
* Le pays Graydon
|
||||
* @return string
|
||||
* .
|
||||
*/
|
||||
function getCompanyMatchIdentifiers($pays){
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
$firephp->info('Méthode getCompanyMatchIdentifiers');
|
||||
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Matchidentifiers')
|
||||
->where('country = ?', $pays);
|
||||
|
||||
$matchidentifiers = new Matchidentifiers();
|
||||
$matchidentifiers = $q->fetchOne();
|
||||
|
||||
/** Recup des types d'identifiants pour le pays **/
|
||||
if($matchidentifiers == FALSE){
|
||||
//Récupération des intitulés identifiant
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->Country = $pays;
|
||||
$firephp->log($request,'REQUETE CompanyMatchIdentifier');
|
||||
try
|
||||
{
|
||||
$result = $graydon->getCompanyMatchIdentifiers($request);
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchIdentifiers', $transactionIdentifier, $sessionID);
|
||||
//Log de la requete dans la bdd
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyMatchIdentifiers';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
$count = count($result->CompanyMatchIdentifiers);
|
||||
if ($count>1){
|
||||
$tabIdentifiers = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier->CompanyIdentifier;
|
||||
}elseif($count==1){
|
||||
$tabIdentifiers[] = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier->CompanyIdentifier;
|
||||
}
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchidentifiers = new Matchidentifiers();
|
||||
$matchidentifiers->country = $pays;
|
||||
$matchidentifiers->identifiers = serialize($tabIdentifiers);
|
||||
$matchidentifiers->replace();
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)!=FALSE){
|
||||
if($code=='CWS0112'){
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchidentifiers = new Matchidentifiers();
|
||||
$matchidentifiers->country = $pays;
|
||||
$matchidentifiers->identifiers = serialize('noidentifiers');
|
||||
$matchidentifiers->replace();
|
||||
$tabIdentifiers = 'noidentifiers';
|
||||
}
|
||||
}else{
|
||||
$tabIdentifiers = graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$firephp->info('tabIdentifiers pris dans la bdd');
|
||||
$tabIdentifiers = unserialize($matchidentifiers->identifiers);
|
||||
}
|
||||
return $tabIdentifiers;
|
||||
}
|
||||
|
||||
|
||||
function getCompanyProducts($identifier){
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Companyproducts')
|
||||
->where('identifiers = ?', $identifier);
|
||||
|
||||
$companyproducts = new Companyproducts();
|
||||
$companyproducts = $q->fetchOne();
|
||||
$firephp->log($companyproducts->updated_at,'date');
|
||||
$now = mktime(date('G'), date('i'), date('s'), date("m") , date("d"), date("Y"));
|
||||
if($companyproducts == FALSE){
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->CompanyMatchIdentifier = $identifier;
|
||||
try {
|
||||
// Make a request on the web service
|
||||
$result = $graydon->getCompanyProducts($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyProducts', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Log de la requete dans la bdd
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyProducts';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
|
||||
$firephp->log($result,'result');
|
||||
|
||||
//Sauvegarde dans la bdd
|
||||
$companyproducts = new Companyproducts();
|
||||
$companyproducts->identifiers = $identifier;
|
||||
$companyproducts->company = serialize($result->Company);
|
||||
$companyproducts->products = serialize($result->Products);
|
||||
$companyproducts->replace();
|
||||
|
||||
//Extraction
|
||||
$company = $result->Company;
|
||||
$products = $result->Products->Product;
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)==FALSE){
|
||||
graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$company = unserialize($companyproducts->company);
|
||||
$products = unserialize($companyproducts->products);
|
||||
$products = $products->Product;
|
||||
}
|
||||
|
||||
return array('Company' => $company, 'Products' => $products);
|
||||
}
|
||||
|
||||
|
||||
function getCompanyMatches($pays){
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
// Create the request parameters
|
||||
$request = new StdClass();
|
||||
// Initialise the request object
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
|
||||
// Create a new country parameters object
|
||||
$company = new StdClass();
|
||||
// Initialise the country object
|
||||
$company->Country = $pays;
|
||||
$company->ClientReference = '';
|
||||
|
||||
$request->CompanyMatches_Parameters = $company;
|
||||
|
||||
if($_REQUEST['method'] == 'keyword'){
|
||||
$request->Keyword = $_REQUEST['frmRecherche']['Keywords'];
|
||||
$request->City = isset($_REQUEST['frmRecherche']['City']) ? $_REQUEST['frmRecherche']['City'] : '' ;
|
||||
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
||||
}elseif($_REQUEST['method'] == 'identifier'){
|
||||
$request->Identifier = $_REQUEST['frmRecherche']['Identifier'];
|
||||
}elseif($_REQUEST['method'] == 'name'){
|
||||
$request->Name = $_REQUEST['frmRecherche']['Name'];
|
||||
$request->City = isset($_REQUEST['frmRecherche']['City']) ? $_REQUEST['frmRecherche']['City'] : '' ;
|
||||
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
||||
}elseif($_REQUEST['method'] == 'postcode'){
|
||||
$request->PostCode = isset($_REQUEST['frmRecherche']['PostCode']) ? $_REQUEST['frmRecherche']['PostCode'] : '' ;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Make a request on the webservice
|
||||
if($_REQUEST['method'] == 'keyword'){
|
||||
$result = $graydon->getCompanyMatchesByKeyword($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByKeyword', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Log de la requete dans la bdd
|
||||
setDbConn('graydon');
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyMatchesByKeyword';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = 'normal';
|
||||
$log->save();
|
||||
|
||||
}elseif($_REQUEST['method'] == 'identifier'){
|
||||
$result = $graydon->getCompanyMatchesByIdentifier($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByIdentifier', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Log de la requete dans la bdd
|
||||
setDbConn('graydon');
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyMatchByIdentifier';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = 'normal';
|
||||
$log->save();
|
||||
|
||||
}elseif($_REQUEST['method'] == 'name'){
|
||||
$result = $graydon->getCompanyMatchesByName($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByName', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Log de la requete dans la bdd
|
||||
setDbConn('graydon');
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyMatchesByName';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = 'normal';
|
||||
$log->save();
|
||||
|
||||
}elseif($_REQUEST['method'] == 'postcode'){
|
||||
$result = $graydon->getCompanyMatchesByPostCode($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyMatchesByPostCode', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Log de la requete dans la bdd
|
||||
setDbConn('graydon');
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyMatchesByPostCode';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = 'normal';
|
||||
$log->save();
|
||||
|
||||
}
|
||||
|
||||
$_SESSION['graydon']['SessionID'] = $result->Service_Log->SessionID;
|
||||
$_SESSION['graydon']['TransactionIdentifier'] = $result->Service_Log->TransactionIdentifier;
|
||||
|
||||
return $result;
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
if(isset($fault->faultstring) && $fault->faultcode = 'HTTP'){
|
||||
print '<br/>Le service partenaire n\'est pas disponible.';
|
||||
}else{
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
$error = graydon_error($code, $text);
|
||||
if($error==FALSE){
|
||||
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
}elseif($error['Code'] == 'CWS5000'){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getCountryAvailability($pays){
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Countryavailability')
|
||||
->where('country = ?', $pays);
|
||||
|
||||
$countryavailability = new Countryavailability();
|
||||
$countryavailability = $q->fetchOne();
|
||||
if($countryavailability == FALSE){
|
||||
// Create the request parameters
|
||||
$request = new StdClass();
|
||||
// Initialise the request object
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->Country = $pays;
|
||||
try
|
||||
{
|
||||
$result = $graydon->getCountryAvailability($request);
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog( $_SESSION['tabInfo']['login'], $page, 'getCountryAvailability', $transactionIdentifier, $sessionID);
|
||||
//Log de la requete dans la bdd
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCountryAvailability';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
|
||||
$count = count($result->CountryAvailablity->CountryAndProduct->Products->Product);
|
||||
if ($count>1){
|
||||
$availability = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
||||
}elseif($count==1){
|
||||
$availability[] = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
||||
}
|
||||
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$countryavailability = new Countryavailability();
|
||||
$countryavailability->country = $pays;
|
||||
$countryavailability->availability = serialize($availability);
|
||||
$countryavailability->replace();
|
||||
|
||||
}catch(SoapFault $fault){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)==FALSE){
|
||||
$availability = graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
}else{
|
||||
$availability = FALSE;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$availability = unserialize($countryavailability->availability);
|
||||
}
|
||||
return $availability;
|
||||
}
|
||||
|
||||
|
||||
function getCompanyMatchMethods($pays){
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Matchmethods')
|
||||
->where('country = ?', $pays);
|
||||
|
||||
$matchmethods = new Matchmethods();
|
||||
$matchmethods = $q->fetchOne();
|
||||
|
||||
if($matchmethods == FALSE){
|
||||
// Create the request parameters
|
||||
$request = new StdClass();
|
||||
// Initialise the request object
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->Country = $pays;
|
||||
try
|
||||
{
|
||||
$result = $graydon->getCompanyMatchMethods($request);
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
graydonRequeteLog( $_SESSION['tabInfo']['login'], $page, 'getCompanyMatchMethods', $transactionIdentifier, $sessionID);
|
||||
//Log de la requete dans la bdd
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyMatchMethods';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
$count = count($result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod);
|
||||
if ($count>1){
|
||||
$methods = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
||||
}elseif($count==1){
|
||||
$methods[] = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
||||
}
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchmethods = new Matchmethods();
|
||||
$matchmethods->country = $pays;
|
||||
$matchmethods->methods = serialize($methods);
|
||||
$matchmethods->replace();
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)!=FALSE){
|
||||
if($code=='CWS0112'){
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchmethods = new Matchmethods();
|
||||
$matchmethods->country = $pays;
|
||||
$matchmethods->methods = serialize('nomethods');
|
||||
$matchmethods->replace();
|
||||
$methods = 'nomethods';
|
||||
}
|
||||
}else{
|
||||
$methods = graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$methods = unserialize($matchmethods->methods);
|
||||
}
|
||||
return $methods;
|
||||
}
|
||||
|
||||
|
||||
function getIdentite($companyProductIdentifier, $file){
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
||||
$request->CompanyProductIdentifier = $CompanyProductIdentifier;
|
||||
$request->PartnerData = '';
|
||||
try
|
||||
{
|
||||
$placeOrderResult = $graydon->placeOrder($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $placeOrderResult->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $placeOrderResult->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'placeOrder', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Log de la requete dans la bdd
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'placeOrder';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
|
||||
//Optention du prix du service
|
||||
$prix = Doctrine_Query::create($conn)
|
||||
->select('p.immediate')
|
||||
->from('Price p')
|
||||
->leftJoin('p.Country c')
|
||||
->where('c.graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
|
||||
//Enregistrement des commandes dans la bdd
|
||||
$commandes = new Commandes();
|
||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||
$commandes->prix = $prix->immediate;
|
||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
||||
$commandes->companyproductidentifier = $CompanyProductIdentifier;
|
||||
$commandes->sessionid = $sessionID;
|
||||
$commandes->transactionidentifier = $transactionIdentifier;
|
||||
$commandes->user = $_SESSION['tabInfo']['login'];
|
||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||
|
||||
$country = Doctrine_Query::create()
|
||||
->from('Country')
|
||||
->where('graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
|
||||
$commandes->Country = $country;
|
||||
|
||||
$commandes->save();
|
||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||
$commandes_id = $commandes->id;
|
||||
|
||||
//Pas d'enregistrement des détails de la commande car elle est immédiate
|
||||
|
||||
//Envoi d'un mail pour le passage de la commande
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Commandes International";
|
||||
$mail->Host = "mail.scores-decisions.com";
|
||||
$mail->Mailer = "smtp";
|
||||
$mail->Subject = "[International] - (Date :".date("d")."/".date("m")."/".date("Y").") - Commandes";
|
||||
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'];
|
||||
$body .= "";
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)==FALSE){
|
||||
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
exit;
|
||||
}else{
|
||||
return false;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//On vérifie l'état de le demande
|
||||
if (isset($placeOrderResult) && $placeOrderResult->OrderStatus->OrderState == 'Completed'){
|
||||
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->LanguageCode = 'E'; //Spécifier la langue du rapport
|
||||
$request->OrderReference = $placeOrderResult->OrderStatus->OrderReference;
|
||||
$request->MimeType = 'xml';
|
||||
|
||||
try
|
||||
{
|
||||
$reportResult = $graydon->getCompanyReport($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $reportResult->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $reportResult->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'getCompanyReport', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Enregistrement dans la bdd
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'getCompanyReport';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
|
||||
$firephp->log($reportResult,'reportResult');
|
||||
$xml = $reportResult->ReportXML->any;
|
||||
|
||||
//Enregistrement du fichier xml
|
||||
file_put_contents($file, $xml);
|
||||
|
||||
//Mise en cache dans la bdd
|
||||
$report = new Report();
|
||||
$report->identifier = $identifier;
|
||||
$report->name = $_SESSION['graydon']['name'];
|
||||
$report->content = $xml;
|
||||
$report->format = 'xml';
|
||||
$report->order_id = $commandes_id;
|
||||
$report->save();
|
||||
|
||||
return $xml;
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)==FALSE){
|
||||
return graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
exit;
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setEnquete($pays){
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
$serviceSpeed = strtolower($_REQUEST['InfoEnq']['Servicespeed']);
|
||||
//Optention du prix du service
|
||||
$prix = Doctrine_Query::create($conn)
|
||||
->select('p.'.$serviceSpeed)
|
||||
->from('Price p')
|
||||
->leftJoin('p.Country c')
|
||||
->where('c.graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
|
||||
//Sauvegarde des infos dans la base avant le passage de la commande
|
||||
$commandes = new Commandes();
|
||||
//$commandes->reference = '';
|
||||
$commandes->servicespeed = $serviceSpeed;
|
||||
$commandes->prix = $prix->$serviceSpeed;
|
||||
//$commandes->orderstate = '';
|
||||
//$commandes->dateordered =
|
||||
//$commandes->datecompleted =
|
||||
//$commandes->datedue =
|
||||
//$commandes->companyproductidentifier = ;
|
||||
//$commandes->sessionid = $sessionID;
|
||||
//$commandes->transactionidentifier = $transactionIdentifier;
|
||||
$commandes->user = $_SESSION['tabInfo']['login'];
|
||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||
|
||||
$commandes->Country = $pays;
|
||||
|
||||
$commandes->save();
|
||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||
$commandes_id = $commandes->id;
|
||||
|
||||
//Enregistrement des détails de la commande
|
||||
$commandesDetail = new CommandesDetail();
|
||||
$commandesDetail->dIdentite = $_REQUEST['InfoUser']['Identite'];
|
||||
$commandesDetail->dTelephone = $_REQUEST['InfoUser']['Tel'];
|
||||
$commandesDetail->dEmail = $_REQUEST['InfoUser']['Email'];
|
||||
$commandesDetail->dFax = $_REQUEST['InfoUser']['Fax'];
|
||||
$commandesDetail->eLanguageCode = 'E';
|
||||
$commandesDetail->eName = $_REQUEST['InfoEnq']['Name'];
|
||||
$commandesDetail->eIdentifiers = serialize($_REQUEST['InfoEnq']['Identifiers']);
|
||||
$commandesDetail->eAdresse = $_REQUEST['InfoEnq']['Adresse'];
|
||||
$commandesDetail->eTelephone = $_REQUEST['InfoEnq']['Telephone'];
|
||||
$commandesDetail->ePays = $_REQUEST['InfoEnq']['Pays'];
|
||||
$commandesDetail->eCreditOpinionCurrency = 'EUR';
|
||||
//$commandesDetail->eCreditOpinionPeriod = '';
|
||||
$commandesDetail->eBankers = $_REQUEST['InfoEnq']['Bankers'];
|
||||
$commandesDetail->eAttentionOf = $_REQUEST['InfoEnq']['AttentionOf'];
|
||||
$commandesDetail->eSpecialRemarks = $_REQUEST['InfoEnq']['SpecialRemarks'];
|
||||
$commandesDetail->commandes_id = $commandes_id;
|
||||
$commandesDetail->save();
|
||||
|
||||
//Passage de la commande chez graydon
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
if(!isset($_REQUEST['pidentifier'])){
|
||||
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
||||
$request->Order->LanguageCode = 'F';
|
||||
$request->Order->Name = $_REQUEST['InfoEnq']['Name'];
|
||||
$request->Order->ServiceSpeed = $_REQUEST['InfoEnq']['Servicespeed'];
|
||||
$request->Order->Country = $_REQUEST['InfoEnq']['Pays'];
|
||||
$request->Order->Address->EntireAddress = $_REQUEST['InfoEnq']['Adresse'];
|
||||
|
||||
if (count($_REQUEST['InfoEnq']['Identifiers'])>1){
|
||||
$count = 0;
|
||||
foreach($_REQUEST['InfoEnq']['Identifiers'] as $key => $value){
|
||||
$request->Order->CompanyIdentifier[$count]->Identifier = $value;
|
||||
$request->Order->CompanyIdentifier[$count]->Type = $key;
|
||||
$count++;
|
||||
}
|
||||
}else{
|
||||
foreach($_REQUEST['InfoEnq']['Identifiers'] as $key => $value){
|
||||
$request->Order->CompanyIdentifier->Identifier = $value;
|
||||
$request->Order->CompanyIdentifier->Type = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$request->Order->AttentionOf = $_REQUEST['InfoEnq']['AttentionOf'];
|
||||
$request->Order->Bankers = $_REQUEST['InfoEnq']['Bankers'];
|
||||
$request->Order->SpecialRemarks = $_REQUEST['InfoEnq']['SpecialRemarks'];
|
||||
$request->Order->Telephone = $_REQUEST['InfoEnq']['Telephone'];
|
||||
}else{
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
||||
$request->CompanyProductIdentifier = $_REQUEST['pidentifier'];
|
||||
$request->PartnerData = '';
|
||||
}
|
||||
$requet->PartnerData = '';
|
||||
try
|
||||
{
|
||||
$placeOrderResult = $graydon->placeOrder($request);
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $placeOrderResult->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $placeOrderResult->Service_Log->SessionID;
|
||||
graydonRequeteLog($_SESSION['tabInfo']['login'], $page, 'placeOrder', $transactionIdentifier, $sessionID);
|
||||
|
||||
//Log de la requete dans la bdd
|
||||
$log = new Requetelog();
|
||||
$log->login = $_SESSION['tabInfo']['login'];
|
||||
$log->action = 'placeOrder';
|
||||
$log->request = serialize($request);
|
||||
$log->transactionIdentifier = $transactionIdentifier;
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
|
||||
//Enregistrement des commandes dans la bdd
|
||||
$commandes = new Commandes();
|
||||
$commandes->assignIdentifier($commandes_id);
|
||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||
$commandes->prix = $prix->$serviceSpeed;
|
||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
||||
$commandes->companyproductidentifier = '';
|
||||
$commandes->sessionid = $sessionID;
|
||||
$commandes->transactionidentifier = $transactionIdentifier;
|
||||
$commandes->user = $_SESSION['tabInfo']['login'];
|
||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||
$commandes->Country = $country;
|
||||
$commandes->save();
|
||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||
$commandes_id = $commandes->id;
|
||||
|
||||
//Enregistrement des détails de la commande
|
||||
//Déjà fait avant le passage de la commande chez graydon
|
||||
|
||||
//Envoi d'un mail pour le passage de la commande
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Commandes International";
|
||||
$mail->Host = "mail.scores-decisions.com";
|
||||
$mail->Mailer = "smtp";
|
||||
$mail->Subject = "[International] - Commande - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'].", ref : ".$commandes->reference;
|
||||
$body .= " ";
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
|
||||
$commandeOk = TRUE;
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)==FALSE){
|
||||
graydon_processSoapFault($graydon,$fault,$_SESSION['tabInfo']);
|
||||
}
|
||||
//Envoi d'un mail pour le passage de la commande en erreur
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Commandes International";
|
||||
$mail->Host = "mail.scores-decisions.com";
|
||||
$mail->Mailer = "smtp";
|
||||
$mail->Subject = "[International] - Commande Erreur - (Date :".date("d")."/".date("m")."/".date("Y").")";
|
||||
$body = "Commande effectué par ".$_SESSION['tabInfo']['login'].", identifiant : ".$commandes_id;
|
||||
$body .= " ";
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
|
||||
$commandeOk = FALSE;
|
||||
}
|
||||
|
||||
if($commandeOk === FALSE){ return $commandes_id; }
|
||||
else{ return $commandeOK; }
|
||||
}
|
||||
?>
|
@ -1,165 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
Binary file not shown.
@ -1,339 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>FAQ</title>
|
||||
<link type="text/css" rel="stylesheet" href="fpdf.css">
|
||||
<style type="text/css">
|
||||
ul {list-style-type:none; margin:0; padding:0}
|
||||
ul#answers li {margin-top:1.8em}
|
||||
.question {font-weight:bold; color:#900000}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>FAQ</h1>
|
||||
<ul>
|
||||
<li><b>1.</b> <a href='#q1'>What's exactly the license of FPDF? Are there any usage restrictions?</a></li>
|
||||
<li><b>2.</b> <a href='#q2'>When I try to create a PDF, a lot of weird characters show on the screen. Why?</a></li>
|
||||
<li><b>3.</b> <a href='#q3'>I try to generate a PDF and IE displays a blank page. What happens?</a></li>
|
||||
<li><b>4.</b> <a href='#q4'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</a></li>
|
||||
<li><b>5.</b> <a href='#q5'>I try to display a variable in the Header method but nothing prints.</a></li>
|
||||
<li><b>6.</b> <a href='#q6'>I defined the Header and Footer methods in my PDF class but nothing appears.</a></li>
|
||||
<li><b>7.</b> <a href='#q7'>Accented characters are replaced by some strange characters like é.</a></li>
|
||||
<li><b>8.</b> <a href='#q8'>I try to display the Euro symbol but it doesn't work.</a></li>
|
||||
<li><b>9.</b> <a href='#q9'>I get the following error when I try to generate a PDF: Some data has already been output, can't send PDF file</a></li>
|
||||
<li><b>10.</b> <a href='#q10'>I draw a frame with very precise dimensions, but when printed I notice some differences.</a></li>
|
||||
<li><b>11.</b> <a href='#q11'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</a></li>
|
||||
<li><b>12.</b> <a href='#q12'>How can I put a background in my PDF?</a></li>
|
||||
<li><b>13.</b> <a href='#q13'>How can I set a specific header or footer on the first page?</a></li>
|
||||
<li><b>14.</b> <a href='#q14'>I'd like to use extensions provided by different scripts. How can I combine them?</a></li>
|
||||
<li><b>15.</b> <a href='#q15'>How can I send the PDF by email?</a></li>
|
||||
<li><b>16.</b> <a href='#q16'>What's the limit of the file sizes I can generate with FPDF?</a></li>
|
||||
<li><b>17.</b> <a href='#q17'>Can I modify a PDF with FPDF?</a></li>
|
||||
<li><b>18.</b> <a href='#q18'>I'd like to make a search engine in PHP and index PDF files. Can I do it with FPDF?</a></li>
|
||||
<li><b>19.</b> <a href='#q19'>Can I convert an HTML page to PDF with FPDF?</a></li>
|
||||
<li><b>20.</b> <a href='#q20'>Can I concatenate PDF files with FPDF?</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id='answers'>
|
||||
<li id='q1'>
|
||||
<p><b>1.</b> <span class='question'>What's exactly the license of FPDF? Are there any usage restrictions?</span></p>
|
||||
FPDF is released under a permissive license: there is no usage restriction. You may embed it
|
||||
freely in your application (commercial or not), with or without modifications.
|
||||
</li>
|
||||
|
||||
<li id='q2'>
|
||||
<p><b>2.</b> <span class='question'>When I try to create a PDF, a lot of weird characters show on the screen. Why?</span></p>
|
||||
These "weird" characters are in fact the actual content of your PDF. This behavior is a bug of
|
||||
IE6. When it first receives an HTML page, then a PDF from the same URL, it displays it directly
|
||||
without launching Acrobat. This happens frequently during the development stage: on the least
|
||||
script error, an HTML page is sent, and after correction, the PDF arrives.
|
||||
<br>
|
||||
To solve the problem, simply quit and restart IE. You can also go to another URL and come
|
||||
back.
|
||||
<br>
|
||||
To avoid this kind of inconvenience during the development, you can generate the PDF directly
|
||||
to a file and open it through the explorer.
|
||||
</li>
|
||||
|
||||
<li id='q3'>
|
||||
<p><b>3.</b> <span class='question'>I try to generate a PDF and IE displays a blank page. What happens?</span></p>
|
||||
First of all, check that you send nothing to the browser after the PDF (not even a space or a
|
||||
carriage return). You can put an exit statement just after the call to the Output() method to
|
||||
be sure. If it still doesn't work, it means you're a victim of the "blank page syndrome". IE
|
||||
used in conjunction with the Acrobat plug-in suffers from many bugs. To avoid these problems
|
||||
in a reliable manner, two main techniques exist:
|
||||
<br>
|
||||
<br>
|
||||
- Disable the plug-in and use Acrobat as a helper application. To do this, launch Acrobat, go
|
||||
to the Edit menu, Preferences, Internet, and uncheck "Display PDF in browser". Then, the next
|
||||
time you load a PDF in IE, it displays the dialog box "Open it" or "Save it to disk". Uncheck
|
||||
the option "Always ask before opening this type of file" and choose Open. From now on, PDF files
|
||||
will open automatically in an external Acrobat window.
|
||||
<br>
|
||||
The drawback of the method is that you need to alter the client configuration, which you can do
|
||||
in an intranet environment but not for the Internet.
|
||||
<br>
|
||||
<br>
|
||||
- Use a redirection technique. It consists in generating the PDF in a temporary file on the server
|
||||
and redirect the client to it. For example, at the end of the script, you can put the following:
|
||||
<div class="doc-source">
|
||||
<pre><code>//Determine a temporary file name in the current directory
|
||||
$file = basename(tempnam('.', 'tmp'));
|
||||
rename($file, $file.'.pdf');
|
||||
$file .= '.pdf';
|
||||
//Save PDF to file
|
||||
$pdf->Output($file, 'F');
|
||||
//Redirect
|
||||
header('Location: '.$file);</code></pre>
|
||||
</div>
|
||||
This method turns the dynamic PDF into a static one and avoids all troubles. But you have to do
|
||||
some cleaning in order to delete the temporary files. For example:
|
||||
<div class="doc-source">
|
||||
<pre><code>function CleanFiles($dir)
|
||||
{
|
||||
//Delete temporary files
|
||||
$t = time();
|
||||
$h = opendir($dir);
|
||||
while($file=readdir($h))
|
||||
{
|
||||
if(substr($file,0,3)=='tmp' and substr($file,-4)=='.pdf')
|
||||
{
|
||||
$path = $dir.'/'.$file;
|
||||
if($t-filemtime($path)>3600)
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
closedir($h);
|
||||
}</code></pre>
|
||||
</div>
|
||||
This function deletes all files of the form tmp*.pdf older than an hour in the specified
|
||||
directory. You may call it where you want, for example in the script which generates the PDF.
|
||||
</li>
|
||||
|
||||
<li id='q4'>
|
||||
<p><b>4.</b> <span class='question'>I can't make line breaks work. I put \n in the string printed by MultiCell but it doesn't work.</span></p>
|
||||
You have to enclose your string with double quotes, not single ones.
|
||||
</li>
|
||||
|
||||
<li id='q5'>
|
||||
<p><b>5.</b> <span class='question'>I try to display a variable in the Header method but nothing prints.</span></p>
|
||||
You have to use the <code>global</code> keyword to access global variables, for example:
|
||||
<div class="doc-source">
|
||||
<pre><code>function Header()
|
||||
{
|
||||
global $title;
|
||||
|
||||
$this->SetFont('Arial', 'B', 15);
|
||||
$this->Cell(0, 10, $title, 1, 1, 'C');
|
||||
}
|
||||
|
||||
$title = 'My title';</code></pre>
|
||||
</div>
|
||||
Alternatively, you can use an object property:
|
||||
<div class="doc-source">
|
||||
<pre><code>function Header()
|
||||
{
|
||||
$this->SetFont('Arial', 'B', 15);
|
||||
$this->Cell(0, 10, $this->title, 1, 1, 'C');
|
||||
}
|
||||
|
||||
$pdf->title = 'My title';</code></pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li id='q6'>
|
||||
<p><b>6.</b> <span class='question'>I defined the Header and Footer methods in my PDF class but nothing appears.</span></p>
|
||||
You have to create an object from the PDF class, not FPDF:
|
||||
<div class="doc-source">
|
||||
<pre><code>$pdf = new PDF();</code></pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li id='q7'>
|
||||
<p><b>7.</b> <span class='question'>Accented characters are replaced by some strange characters like é.</span></p>
|
||||
Don't use UTF-8 encoding. Standard FPDF fonts use ISO-8859-1 or Windows-1252.
|
||||
It is possible to perform a conversion to ISO-8859-1 with utf8_decode():
|
||||
<div class="doc-source">
|
||||
<pre><code>$str = utf8_decode($str);</code></pre>
|
||||
</div>
|
||||
But some characters such as Euro won't be translated correctly. If the iconv extension is available, the
|
||||
right way to do it is the following:
|
||||
<div class="doc-source">
|
||||
<pre><code>$str = iconv('UTF-8', 'windows-1252', $str);</code></pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li id='q8'>
|
||||
<p><b>8.</b> <span class='question'>I try to display the Euro symbol but it doesn't work.</span></p>
|
||||
The standard fonts have the Euro character at position 128. You can define a constant like this
|
||||
for convenience:
|
||||
<div class="doc-source">
|
||||
<pre><code>define('EURO', chr(128));</code></pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li id='q9'>
|
||||
<p><b>9.</b> <span class='question'>I get the following error when I try to generate a PDF: Some data has already been output, can't send PDF file</span></p>
|
||||
You must send nothing to the browser except the PDF itself: no HTML, no space, no carriage return.
|
||||
You may have this other message just before:<br>
|
||||
<br>
|
||||
<b>Warning:</b> Cannot modify header information - headers already sent by (output started at script.php:X)<br>
|
||||
<br>
|
||||
It means that script.php outputs something at line X. Go to this line and fix it.
|
||||
In case the warning doesn't show, add this at the very beginning of your script:
|
||||
<div class="doc-source">
|
||||
<pre><code>ob_end_clean();</code></pre>
|
||||
</div>
|
||||
If you still don't see it, disable zlib.output_compression in your php.ini.
|
||||
</li>
|
||||
|
||||
<li id='q10'>
|
||||
<p><b>10.</b> <span class='question'>I draw a frame with very precise dimensions, but when printed I notice some differences.</span></p>
|
||||
To respect dimensions, select "None" for the Page Scaling setting instead of "Shrink to Printable Area" in the print dialog box.
|
||||
</li>
|
||||
|
||||
<li id='q11'>
|
||||
<p><b>11.</b> <span class='question'>I'd like to use the whole surface of the page, but when printed I always have some margins. How can I get rid of them?</span></p>
|
||||
Printers have physical margins (different depending on the models); it is therefore impossible to remove
|
||||
them and print on the whole surface of the paper.
|
||||
</li>
|
||||
|
||||
<li id='q12'>
|
||||
<p><b>12.</b> <span class='question'>How can I put a background in my PDF?</span></p>
|
||||
For a picture, call Image() in the Header() method, before any other output. To set a background color, use Rect().
|
||||
</li>
|
||||
|
||||
<li id='q13'>
|
||||
<p><b>13.</b> <span class='question'>How can I set a specific header or footer on the first page?</span></p>
|
||||
Simply test the page number:
|
||||
<div class="doc-source">
|
||||
<pre><code>function Header()
|
||||
{
|
||||
if($this->PageNo()==1)
|
||||
{
|
||||
//First page
|
||||
...
|
||||
}
|
||||
else
|
||||
{
|
||||
//Other pages
|
||||
...
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li id='q14'>
|
||||
<p><b>14.</b> <span class='question'>I'd like to use extensions provided by different scripts. How can I combine them?</span></p>
|
||||
Use an inheritance chain. If you have two classes, say A in a.php:
|
||||
<div class="doc-source">
|
||||
<pre><code>require('fpdf.php');
|
||||
|
||||
class A extends FPDF
|
||||
{
|
||||
...
|
||||
}</code></pre>
|
||||
</div>
|
||||
and B in b.php:
|
||||
<div class="doc-source">
|
||||
<pre><code>require('fpdf.php');
|
||||
|
||||
class B extends FPDF
|
||||
{
|
||||
...
|
||||
}</code></pre>
|
||||
</div>
|
||||
then make B extend A:
|
||||
<div class="doc-source">
|
||||
<pre><code>require('a.php');
|
||||
|
||||
class B extends A
|
||||
{
|
||||
...
|
||||
}</code></pre>
|
||||
</div>
|
||||
and make your own class extend B:
|
||||
<div class="doc-source">
|
||||
<pre><code>require('b.php');
|
||||
|
||||
class PDF extends B
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
$pdf = new PDF();</code></pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li id='q15'>
|
||||
<p><b>15.</b> <span class='question'>How can I send the PDF by email?</span></p>
|
||||
As any other file, but an easy way is to use <a href="http://phpmailer.codeworxtech.com">PHPMailer</a> and
|
||||
its in-memory attachment:
|
||||
<div class="doc-source">
|
||||
<pre><code>$mail = new PHPMailer();
|
||||
...
|
||||
$doc = $pdf->Output('', 'S');
|
||||
$mail->AddStringAttachment($doc, 'doc.pdf', 'base64', 'application/pdf');
|
||||
$mail->Send();</code></pre>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li id='q16'>
|
||||
<p><b>16.</b> <span class='question'>What's the limit of the file sizes I can generate with FPDF?</span></p>
|
||||
There is no particular limit. There are some constraints, however:
|
||||
<br>
|
||||
<br>
|
||||
- The maximum memory size allocated to PHP scripts is usually 8MB. For very big documents,
|
||||
especially with images, this limit may be reached (the file being built into memory). The
|
||||
parameter is configured in the php.ini file.
|
||||
<br>
|
||||
<br>
|
||||
- The maximum execution time allocated defaults to 30 seconds. This limit can of course be easily
|
||||
reached. It is configured in php.ini and may be altered dynamically with set_time_limit().
|
||||
<br>
|
||||
<br>
|
||||
- Browsers generally have a 5 minute time-out. If you send the PDF directly to the browser and
|
||||
reach the limit, it will be lost. It is therefore advised for very big documents to
|
||||
generate them in a file, and to send some data to the browser from time to time (with a call
|
||||
to flush() to force the output). When the document is finished, you can send a redirection to
|
||||
it or create a link.
|
||||
<br>
|
||||
Remark: even if the browser times out, the script may continue to run on the server.
|
||||
</li>
|
||||
|
||||
<li id='q17'>
|
||||
<p><b>17.</b> <span class='question'>Can I modify a PDF with FPDF?</span></p>
|
||||
It is possible to import pages from an existing PDF document thanks to the FPDI extension:<br>
|
||||
<br>
|
||||
<a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/" target="_blank">http://www.setasign.de/products/pdf-php-solutions/fpdi/</a><br>
|
||||
<br>
|
||||
You can then add some content to them.
|
||||
</li>
|
||||
|
||||
<li id='q18'>
|
||||
<p><b>18.</b> <span class='question'>I'd like to make a search engine in PHP and index PDF files. Can I do it with FPDF?</span></p>
|
||||
No. But a GPL C utility does exist, pdftotext, which is able to extract the textual content from
|
||||
a PDF. It is provided with the Xpdf package:<br>
|
||||
<br>
|
||||
<a href="http://www.foolabs.com/xpdf/" target="_blank">http://www.foolabs.com/xpdf/</a>
|
||||
</li>
|
||||
|
||||
<li id='q19'>
|
||||
<p><b>19.</b> <span class='question'>Can I convert an HTML page to PDF with FPDF?</span></p>
|
||||
Not real-world pages. But a GPL C utility does exist, htmldoc, which allows to do it and gives good results:<br>
|
||||
<br>
|
||||
<a href="http://www.htmldoc.org" target="_blank">http://www.htmldoc.org</a>
|
||||
</li>
|
||||
|
||||
<li id='q20'>
|
||||
<p><b>20.</b> <span class='question'>Can I concatenate PDF files with FPDF?</span></p>
|
||||
Not directly, but it is possible to use <a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/demos/concatenate-fake/" target="_blank">FPDI</a>
|
||||
to perform this task. Some free command-line tools also exist:<br>
|
||||
<br>
|
||||
<a href="http://thierry.schmit.free.fr/spip/spip.php?article15&lang=en" target="_blank">mbtPdfAsm</a><br>
|
||||
<a href="http://www.accesspdf.com/pdftk/" target="_blank">pdftk</a>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
@ -1,63 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>AcceptPageBreak</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>AcceptPageBreak</h1>
|
||||
<code><b>boolean</b> AcceptPageBreak()</code>
|
||||
<h2>Description</h2>
|
||||
Whenever a page break condition is met, the method is called, and the break is issued or not
|
||||
depending on the returned value. The default implementation returns a value according to the
|
||||
mode selected by SetAutoPageBreak().
|
||||
<br>
|
||||
This method is called automatically and should not be called directly by the application.
|
||||
<h2>Example</h2>
|
||||
The method is overriden in an inherited class in order to obtain a 3 column layout:
|
||||
<div class="doc-source">
|
||||
<pre><code>class PDF extends FPDF
|
||||
{
|
||||
var $col=0;
|
||||
|
||||
function SetCol($col)
|
||||
{
|
||||
//Move position to a column
|
||||
$this->col=$col;
|
||||
$x=10+$col*65;
|
||||
$this->SetLeftMargin($x);
|
||||
$this->SetX($x);
|
||||
}
|
||||
|
||||
function AcceptPageBreak()
|
||||
{
|
||||
if($this->col<2)
|
||||
{
|
||||
//Go to next column
|
||||
$this->SetCol($this->col+1);
|
||||
$this->SetY(10);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Go back to first column and issue page break
|
||||
$this->SetCol(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdf=new PDF();
|
||||
$pdf->AddPage();
|
||||
$pdf->SetFont('Arial','',12);
|
||||
for($i=1;$i<=300;$i++)
|
||||
$pdf->Cell(0,5,"Line $i",0,1);
|
||||
$pdf->Output();</code></pre>
|
||||
</div>
|
||||
<h2>See also</h2>
|
||||
<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,55 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>AddFont</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>AddFont</h1>
|
||||
<code>AddFont(<b>string</b> family [, <b>string</b> style [, <b>string</b> file]])</code>
|
||||
<h2>Description</h2>
|
||||
Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font
|
||||
definition file first with the makefont.php utility.
|
||||
<br>
|
||||
The definition file (and the font file itself when embedding) must be present in the font directory.
|
||||
If it is not found, the error "Could not include font definition file" is generated.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>family</code></dt>
|
||||
<dd>
|
||||
Font family. The name can be chosen arbitrarily. If it is a standard family name, it will
|
||||
override the corresponding font.
|
||||
</dd>
|
||||
<dt><code>style</code></dt>
|
||||
<dd>
|
||||
Font style. Possible values are (case insensitive):
|
||||
<ul>
|
||||
<li>empty string: regular</li>
|
||||
<li><code>B</code>: bold</li>
|
||||
<li><code>I</code>: italic</li>
|
||||
<li><code>BI</code> or <code>IB</code>: bold italic</li>
|
||||
</ul>
|
||||
The default value is regular.
|
||||
</dd>
|
||||
<dt><code>file</code></dt>
|
||||
<dd>
|
||||
The font definition file.
|
||||
<br>
|
||||
By default, the name is built from the family and style, in lower case with no space.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>Example</h2>
|
||||
<div class="doc-source">
|
||||
<pre><code>$pdf->AddFont('Comic','I');</code></pre>
|
||||
</div>
|
||||
is equivalent to:
|
||||
<div class="doc-source">
|
||||
<pre><code>$pdf->AddFont('Comic','I','comici.php');</code></pre>
|
||||
</div>
|
||||
<h2>See also</h2>
|
||||
<a href="setfont.htm">SetFont()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>AddLink</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>AddLink</h1>
|
||||
<code><b>int</b> AddLink()</code>
|
||||
<h2>Description</h2>
|
||||
Creates a new internal link and returns its identifier. An internal link is a clickable area
|
||||
which directs to another place within the document.
|
||||
<br>
|
||||
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is
|
||||
defined with SetLink().
|
||||
<h2>See also</h2>
|
||||
<a href="cell.htm">Cell()</a>,
|
||||
<a href="write.htm">Write()</a>,
|
||||
<a href="image.htm">Image()</a>,
|
||||
<a href="link.htm">Link()</a>,
|
||||
<a href="setlink.htm">SetLink()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,56 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>AddPage</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>AddPage</h1>
|
||||
<code>AddPage([<b>string</b> orientation ,[ <b>mixed</b> format]])</code>
|
||||
<h2>Description</h2>
|
||||
Adds a new page to the document. If a page is already present, the Footer() method is called
|
||||
first to output the footer. Then the page is added, the current position set to the top-left
|
||||
corner according to the left and top margins, and Header() is called to display the header.
|
||||
<br>
|
||||
The font which was set before calling is automatically restored. There is no need to call
|
||||
SetFont() again if you want to continue with the same font. The same is true for colors and
|
||||
line width.
|
||||
<br>
|
||||
The origin of the coordinate system is at the top-left corner and increasing ordinates go
|
||||
downwards.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>orientation</code></dt>
|
||||
<dd>
|
||||
Page orientation. Possible values are (case insensitive):
|
||||
<ul>
|
||||
<li><code>P</code> or <code>Portrait</code></li>
|
||||
<li><code>L</code> or <code>Landscape</code></li>
|
||||
</ul>
|
||||
The default value is the one passed to the constructor.
|
||||
</dd>
|
||||
<dt><code>format</code></dt>
|
||||
<dd>
|
||||
Page format. It can be either one of the following values (case insensitive):
|
||||
<ul>
|
||||
<li><code>A3</code></li>
|
||||
<li><code>A4</code></li>
|
||||
<li><code>A5</code></li>
|
||||
<li><code>Letter</code></li>
|
||||
<li><code>Legal</code></li>
|
||||
</ul>
|
||||
or an array containing the width and the height (expressed in user unit).<br>
|
||||
<br>
|
||||
The default value is the one passed to the constructor.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="fpdf.htm">FPDF()</a>,
|
||||
<a href="header.htm">Header()</a>,
|
||||
<a href="footer.htm">Footer()</a>,
|
||||
<a href="setmargins.htm">SetMargins()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,45 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>AliasNbPages</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>AliasNbPages</h1>
|
||||
<code>AliasNbPages([<b>string</b> alias])</code>
|
||||
<h2>Description</h2>
|
||||
Defines an alias for the total number of pages. It will be substituted as the document is
|
||||
closed.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>alias</code></dt>
|
||||
<dd>
|
||||
The alias. Default value: <code>{nb}</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>Example</h2>
|
||||
<div class="doc-source">
|
||||
<pre><code>class PDF extends FPDF
|
||||
{
|
||||
function Footer()
|
||||
{
|
||||
//Go to 1.5 cm from bottom
|
||||
$this->SetY(-15);
|
||||
//Select Arial italic 8
|
||||
$this->SetFont('Arial','I',8);
|
||||
//Print current and total page numbers
|
||||
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
|
||||
}
|
||||
}
|
||||
|
||||
$pdf=new PDF();
|
||||
$pdf->AliasNbPages();</code></pre>
|
||||
</div>
|
||||
<h2>See also</h2>
|
||||
<a href="pageno.htm">PageNo()</a>,
|
||||
<a href="footer.htm">Footer()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,104 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Cell</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Cell</h1>
|
||||
<code>Cell(<b>float</b> w [, <b>float</b> h [, <b>string</b> txt [, <b>mixed</b> border [, <b>int</b> ln [, <b>string</b> align [, <b>boolean</b> fill [, <b>mixed</b> link]]]]]]])</code>
|
||||
<h2>Description</h2>
|
||||
Prints a cell (rectangular area) with optional borders, background color and character string.
|
||||
The upper-left corner of the cell corresponds to the current position. The text can be aligned
|
||||
or centered. After the call, the current position moves to the right or to the next line. It is
|
||||
possible to put a link on the text.
|
||||
<br>
|
||||
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is
|
||||
done before outputting.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>w</code></dt>
|
||||
<dd>
|
||||
Cell width. If <code>0</code>, the cell extends up to the right margin.
|
||||
</dd>
|
||||
<dt><code>h</code></dt>
|
||||
<dd>
|
||||
Cell height.
|
||||
Default value: <code>0</code>.
|
||||
</dd>
|
||||
<dt><code>txt</code></dt>
|
||||
<dd>
|
||||
String to print.
|
||||
Default value: empty string.
|
||||
</dd>
|
||||
<dt><code>border</code></dt>
|
||||
<dd>
|
||||
Indicates if borders must be drawn around the cell. The value can be either a number:
|
||||
<ul>
|
||||
<li><code>0</code>: no border</li>
|
||||
<li><code>1</code>: frame</li>
|
||||
</ul>
|
||||
or a string containing some or all of the following characters (in any order):
|
||||
<ul>
|
||||
<li><code>L</code>: left</li>
|
||||
<li><code>T</code>: top</li>
|
||||
<li><code>R</code>: right</li>
|
||||
<li><code>B</code>: bottom</li>
|
||||
</ul>
|
||||
Default value: <code>0</code>.
|
||||
</dd>
|
||||
<dt><code>ln</code></dt>
|
||||
<dd>
|
||||
Indicates where the current position should go after the call. Possible values are:
|
||||
<ul>
|
||||
<li><code>0</code>: to the right</li>
|
||||
<li><code>1</code>: to the beginning of the next line</li>
|
||||
<li><code>2</code>: below</li>
|
||||
</ul>
|
||||
Putting <code>1</code> is equivalent to putting <code>0</code> and calling Ln() just after.
|
||||
Default value: <code>0</code>.
|
||||
</dd>
|
||||
<dt><code>align</code></dt>
|
||||
<dd>
|
||||
Allows to center or align the text. Possible values are:
|
||||
<ul>
|
||||
<li><code>L</code> or empty string: left align (default value)</li>
|
||||
<li><code>C</code>: center</li>
|
||||
<li><code>R</code>: right align</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt><code>fill</code></dt>
|
||||
<dd>
|
||||
Indicates if the cell background must be painted (<code>true</code>) or transparent (<code>false</code>).
|
||||
Default value: <code>false</code>.
|
||||
</dd>
|
||||
<dt><code>link</code></dt>
|
||||
<dd>
|
||||
URL or identifier returned by AddLink().
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>Example</h2>
|
||||
<div class="doc-source">
|
||||
<pre><code>//Set font
|
||||
$pdf->SetFont('Arial','B',16);
|
||||
//Move to 8 cm to the right
|
||||
$pdf->Cell(80);
|
||||
//Centered text in a framed 20*10 mm cell and line break
|
||||
$pdf->Cell(20,10,'Title',1,1,'C');</code></pre>
|
||||
</div>
|
||||
<h2>See also</h2>
|
||||
<a href="setfont.htm">SetFont()</a>,
|
||||
<a href="setdrawcolor.htm">SetDrawColor()</a>,
|
||||
<a href="setfillcolor.htm">SetFillColor()</a>,
|
||||
<a href="settextcolor.htm">SetTextColor()</a>,
|
||||
<a href="setlinewidth.htm">SetLineWidth()</a>,
|
||||
<a href="addlink.htm">AddLink()</a>,
|
||||
<a href="ln.htm">Ln()</a>,
|
||||
<a href="multicell.htm">MultiCell()</a>,
|
||||
<a href="write.htm">Write()</a>,
|
||||
<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Close</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Close</h1>
|
||||
<code>Close()</code>
|
||||
<h2>Description</h2>
|
||||
Terminates the PDF document. It is not necessary to call this method explicitly because Output()
|
||||
does it automatically.
|
||||
<br>
|
||||
If the document contains no page, AddPage() is called to prevent from getting an invalid document.
|
||||
<h2>See also</h2>
|
||||
<a href="output.htm">Output()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Error</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Error</h1>
|
||||
<code>Error(<b>string</b> msg)</code>
|
||||
<h2>Description</h2>
|
||||
This method is automatically called in case of fatal error; it simply outputs the message
|
||||
and halts the execution. An inherited class may override it to customize the error handling
|
||||
but should always halt the script, or the resulting document would probably be invalid.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>msg</code></dt>
|
||||
<dd>
|
||||
The error message.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,35 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Footer</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Footer</h1>
|
||||
<code>Footer()</code>
|
||||
<h2>Description</h2>
|
||||
This method is used to render the page footer. It is automatically called by AddPage() and
|
||||
Close() and should not be called directly by the application. The implementation in FPDF is
|
||||
empty, so you have to subclass it and override the method if you want a specific processing.
|
||||
<h2>Example</h2>
|
||||
<div class="doc-source">
|
||||
<pre><code>class PDF extends FPDF
|
||||
{
|
||||
function Footer()
|
||||
{
|
||||
//Go to 1.5 cm from bottom
|
||||
$this->SetY(-15);
|
||||
//Select Arial italic 8
|
||||
$this->SetFont('Arial','I',8);
|
||||
//Print centered page number
|
||||
$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
<h2>See also</h2>
|
||||
<a href="header.htm">Header()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,63 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>FPDF</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>FPDF</h1>
|
||||
<code>FPDF([<b>string</b> orientation [, <b>string</b> unit [, <b>mixed</b> format]]])</code>
|
||||
<h2>Description</h2>
|
||||
This is the class constructor. It allows to set up the page format, the orientation and the
|
||||
unit of measure used in all methods (except for font sizes).
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>orientation</code></dt>
|
||||
<dd>
|
||||
Default page orientation. Possible values are (case insensitive):
|
||||
<ul>
|
||||
<li><code>P</code> or <code>Portrait</code></li>
|
||||
<li><code>L</code> or <code>Landscape</code></li>
|
||||
</ul>
|
||||
Default value is <code>P</code>.
|
||||
</dd>
|
||||
<dt><code>unit</code></dt>
|
||||
<dd>
|
||||
User unit. Possible values are:
|
||||
<ul>
|
||||
<li><code>pt</code>: point</li>
|
||||
<li><code>mm</code>: millimeter</li>
|
||||
<li><code>cm</code>: centimeter</li>
|
||||
<li><code>in</code>: inch</li>
|
||||
</ul>
|
||||
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This
|
||||
is a very common unit in typography; font sizes are expressed in that unit.
|
||||
<br>
|
||||
<br>
|
||||
Default value is <code>mm</code>.
|
||||
</dd>
|
||||
<dt><code>format</code></dt>
|
||||
<dd>
|
||||
The format used for pages. It can be either one of the following values (case insensitive):
|
||||
<ul>
|
||||
<li><code>A3</code></li>
|
||||
<li><code>A4</code></li>
|
||||
<li><code>A5</code></li>
|
||||
<li><code>Letter</code></li>
|
||||
<li><code>Legal</code></li>
|
||||
</ul>
|
||||
or an array containing the width and the height (expressed in the unit given by <code>unit</code>).<br>
|
||||
<br>
|
||||
Default value is <code>A4</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>Example</h2>
|
||||
Example with a custom 100x150 mm page format:
|
||||
<div class="doc-source">
|
||||
<pre><code>$pdf = new FPDF('P', 'mm', array(100,150));</code></pre>
|
||||
</div>
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>GetStringWidth</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>GetStringWidth</h1>
|
||||
<code><b>float</b> GetStringWidth(<b>string</b> s)</code>
|
||||
<h2>Description</h2>
|
||||
Returns the length of a string in user unit. A font must be selected.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>s</code></dt>
|
||||
<dd>
|
||||
The string whose length is to be computed.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>GetX</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>GetX</h1>
|
||||
<code><b>float</b> GetX()</code>
|
||||
<h2>Description</h2>
|
||||
Returns the abscissa of the current position.
|
||||
<h2>See also</h2>
|
||||
<a href="setx.htm">SetX()</a>,
|
||||
<a href="gety.htm">GetY()</a>,
|
||||
<a href="sety.htm">SetY()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>GetY</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>GetY</h1>
|
||||
<code><b>float</b> GetY()</code>
|
||||
<h2>Description</h2>
|
||||
Returns the ordinate of the current position.
|
||||
<h2>See also</h2>
|
||||
<a href="sety.htm">SetY()</a>,
|
||||
<a href="getx.htm">GetX()</a>,
|
||||
<a href="setx.htm">SetX()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,37 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Header</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Header</h1>
|
||||
<code>Header()</code>
|
||||
<h2>Description</h2>
|
||||
This method is used to render the page header. It is automatically called by AddPage() and
|
||||
should not be called directly by the application. The implementation in FPDF is empty, so
|
||||
you have to subclass it and override the method if you want a specific processing.
|
||||
<h2>Example</h2>
|
||||
<div class="doc-source">
|
||||
<pre><code>class PDF extends FPDF
|
||||
{
|
||||
function Header()
|
||||
{
|
||||
//Select Arial bold 15
|
||||
$this->SetFont('Arial','B',15);
|
||||
//Move to the right
|
||||
$this->Cell(80);
|
||||
//Framed title
|
||||
$this->Cell(30,10,'Title',1,0,'C');
|
||||
//Line break
|
||||
$this->Ln(20);
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
<h2>See also</h2>
|
||||
<a href="footer.htm">Footer()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,86 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Image</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Image</h1>
|
||||
<code>Image(<b>string</b> file [, <b>float</b> x [, <b>float</b> y [, <b>float</b> w [, <b>float</b> h [, <b>string</b> type [, <b>mixed</b> link]]]]]])</code>
|
||||
<h2>Description</h2>
|
||||
Puts an image. The size it will take on the page can be specified in different ways:
|
||||
<ul>
|
||||
<li>explicit width and height (expressed in user unit)</li>
|
||||
<li>one explicit dimension, the other being calculated automatically in order to keep the original proportions</li>
|
||||
<li>no explicit dimension, in which case the image is put at 72 dpi</li>
|
||||
</ul>
|
||||
Supported formats are JPEG, PNG and GIF. The GD extension is required for GIF.
|
||||
<br>
|
||||
<br>
|
||||
For JPEGs, all flavors are allowed:
|
||||
<ul>
|
||||
<li>gray scales</li>
|
||||
<li>true colors (24 bits)</li>
|
||||
<li>CMYK (32 bits)</li>
|
||||
</ul>
|
||||
For PNGs, are allowed:
|
||||
<ul>
|
||||
<li>gray scales on at most 8 bits (256 levels)</li>
|
||||
<li>indexed colors</li>
|
||||
<li>true colors (24 bits)</li>
|
||||
</ul>
|
||||
but are not supported:
|
||||
<ul>
|
||||
<li>Interlacing</li>
|
||||
<li>Alpha channel</li>
|
||||
</ul>
|
||||
For GIFs: in case of an animated GIF, only the first frame is used.<br>
|
||||
<br>
|
||||
If a transparent color is defined, it is taken into account.<br>
|
||||
<br>
|
||||
The format can be specified explicitly or inferred from the file extension.<br>
|
||||
It is possible to put a link on the image.<br>
|
||||
<br>
|
||||
Remark: if an image is used several times, only one copy is embedded in the file.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>file</code></dt>
|
||||
<dd>
|
||||
Path or URL of the image.
|
||||
</dd>
|
||||
<dt><code>x</code></dt>
|
||||
<dd>
|
||||
Abscissa of the upper-left corner. If not specified or equal to <code>null</code>, the current abscissa
|
||||
is used.
|
||||
</dd>
|
||||
<dt><code>y</code></dt>
|
||||
<dd>
|
||||
Ordinate of the upper-left corner. If not specified or equal to <code>null</code>, the current ordinate
|
||||
is used; moreover, a page break is triggered first if necessary (in case automatic page breaking is enabled)
|
||||
and, after the call, the current ordinate is moved to the bottom of the image.
|
||||
</dd>
|
||||
<dt><code>w</code></dt>
|
||||
<dd>
|
||||
Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
|
||||
</dd>
|
||||
<dt><code>h</code></dt>
|
||||
<dd>
|
||||
Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
|
||||
</dd>
|
||||
<dt><code>type</code></dt>
|
||||
<dd>
|
||||
Image format. Possible values are (case insensitive): <code>JPG</code>, <code>JPEG</code>, <code>PNG</code> and <code>GIF</code>.
|
||||
If not specified, the type is inferred from the file extension.
|
||||
</dd>
|
||||
<dt><code>link</code></dt>
|
||||
<dd>
|
||||
URL or identifier returned by AddLink().
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="addlink.htm">AddLink()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,57 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>FPDF 1.6 Reference Manual</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>FPDF 1.6 Reference Manual</h1>
|
||||
<a href="acceptpagebreak.htm">AcceptPageBreak</a> - accept or not automatic page break<br>
|
||||
<a href="addfont.htm">AddFont</a> - add a new font<br>
|
||||
<a href="addlink.htm">AddLink</a> - create an internal link<br>
|
||||
<a href="addpage.htm">AddPage</a> - add a new page<br>
|
||||
<a href="aliasnbpages.htm">AliasNbPages</a> - define an alias for number of pages<br>
|
||||
<a href="cell.htm">Cell</a> - print a cell<br>
|
||||
<a href="close.htm">Close</a> - terminate the document<br>
|
||||
<a href="error.htm">Error</a> - fatal error<br>
|
||||
<a href="footer.htm">Footer</a> - page footer<br>
|
||||
<a href="fpdf.htm">FPDF</a> - constructor<br>
|
||||
<a href="getstringwidth.htm">GetStringWidth</a> - compute string length<br>
|
||||
<a href="getx.htm">GetX</a> - get current x position<br>
|
||||
<a href="gety.htm">GetY</a> - get current y position<br>
|
||||
<a href="header.htm">Header</a> - page header<br>
|
||||
<a href="image.htm">Image</a> - output an image<br>
|
||||
<a href="line.htm">Line</a> - draw a line<br>
|
||||
<a href="link.htm">Link</a> - put a link<br>
|
||||
<a href="ln.htm">Ln</a> - line break<br>
|
||||
<a href="multicell.htm">MultiCell</a> - print text with line breaks<br>
|
||||
<a href="output.htm">Output</a> - save or send the document<br>
|
||||
<a href="pageno.htm">PageNo</a> - page number<br>
|
||||
<a href="rect.htm">Rect</a> - draw a rectangle<br>
|
||||
<a href="setauthor.htm">SetAuthor</a> - set the document author<br>
|
||||
<a href="setautopagebreak.htm">SetAutoPageBreak</a> - set the automatic page breaking mode<br>
|
||||
<a href="setcompression.htm">SetCompression</a> - turn compression on or off<br>
|
||||
<a href="setcreator.htm">SetCreator</a> - set document creator<br>
|
||||
<a href="setdisplaymode.htm">SetDisplayMode</a> - set display mode<br>
|
||||
<a href="setdrawcolor.htm">SetDrawColor</a> - set drawing color<br>
|
||||
<a href="setfillcolor.htm">SetFillColor</a> - set filling color<br>
|
||||
<a href="setfont.htm">SetFont</a> - set font<br>
|
||||
<a href="setfontsize.htm">SetFontSize</a> - set font size<br>
|
||||
<a href="setkeywords.htm">SetKeywords</a> - associate keywords with document<br>
|
||||
<a href="setleftmargin.htm">SetLeftMargin</a> - set left margin<br>
|
||||
<a href="setlinewidth.htm">SetLineWidth</a> - set line width<br>
|
||||
<a href="setlink.htm">SetLink</a> - set internal link destination<br>
|
||||
<a href="setmargins.htm">SetMargins</a> - set margins<br>
|
||||
<a href="setrightmargin.htm">SetRightMargin</a> - set right margin<br>
|
||||
<a href="setsubject.htm">SetSubject</a> - set document subject<br>
|
||||
<a href="settextcolor.htm">SetTextColor</a> - set text color<br>
|
||||
<a href="settitle.htm">SetTitle</a> - set document title<br>
|
||||
<a href="settopmargin.htm">SetTopMargin</a> - set top margin<br>
|
||||
<a href="setx.htm">SetX</a> - set current x position<br>
|
||||
<a href="setxy.htm">SetXY</a> - set current x and y positions<br>
|
||||
<a href="sety.htm">SetY</a> - set current y position<br>
|
||||
<a href="text.htm">Text</a> - print a string<br>
|
||||
<a href="write.htm">Write</a> - print flowing text<br>
|
||||
</body>
|
||||
</html>
|
@ -1,38 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Line</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Line</h1>
|
||||
<code>Line(<b>float</b> x1, <b>float</b> y1, <b>float</b> x2, <b>float</b> y2)</code>
|
||||
<h2>Description</h2>
|
||||
Draws a line between two points.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>x1</code></dt>
|
||||
<dd>
|
||||
Abscissa of first point.
|
||||
</dd>
|
||||
<dt><code>y1</code></dt>
|
||||
<dd>
|
||||
Ordinate of first point.
|
||||
</dd>
|
||||
<dt><code>x2</code></dt>
|
||||
<dd>
|
||||
Abscissa of second point.
|
||||
</dd>
|
||||
<dt><code>y2</code></dt>
|
||||
<dd>
|
||||
Ordinate of second point.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setlinewidth.htm">SetLineWidth()</a>,
|
||||
<a href="setdrawcolor.htm">SetDrawColor()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,46 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Link</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Link</h1>
|
||||
<code>Link(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h, <b>mixed</b> link)</code>
|
||||
<h2>Description</h2>
|
||||
Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(),
|
||||
Write() or Image(), but this method can be useful for instance to define a clickable area inside
|
||||
an image.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>x</code></dt>
|
||||
<dd>
|
||||
Abscissa of the upper-left corner of the rectangle.
|
||||
</dd>
|
||||
<dt><code>y</code></dt>
|
||||
<dd>
|
||||
Ordinate of the upper-left corner of the rectangle.
|
||||
</dd>
|
||||
<dt><code>w</code></dt>
|
||||
<dd>
|
||||
Width of the rectangle.
|
||||
</dd>
|
||||
<dt><code>h</code></dt>
|
||||
<dd>
|
||||
Height of the rectangle.
|
||||
</dd>
|
||||
<dt><code>link</code></dt>
|
||||
<dd>
|
||||
URL or identifier returned by AddLink().
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="addlink.htm">AddLink()</a>,
|
||||
<a href="cell.htm">Cell()</a>,
|
||||
<a href="write.htm">Write()</a>,
|
||||
<a href="image.htm">Image()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,28 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Ln</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ln</h1>
|
||||
<code>Ln([<b>float</b> h])</code>
|
||||
<h2>Description</h2>
|
||||
Performs a line break. The current abscissa goes back to the left margin and the ordinate
|
||||
increases by the amount passed in parameter.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>h</code></dt>
|
||||
<dd>
|
||||
The height of the break.
|
||||
<br>
|
||||
By default, the value equals the height of the last printed cell.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="cell.htm">Cell()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,76 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>MultiCell</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>MultiCell</h1>
|
||||
<code>MultiCell(<b>float</b> w, <b>float</b> h, <b>string</b> txt [, <b>mixed</b> border [, <b>string</b> align [, <b>boolean</b> fill]]])</code>
|
||||
<h2>Description</h2>
|
||||
This method allows printing text with line breaks. They can be automatic (as soon as the
|
||||
text reaches the right border of the cell) or explicit (via the \n character). As many cells
|
||||
as necessary are output, one below the other.
|
||||
<br>
|
||||
Text can be aligned, centered or justified. The cell block can be framed and the background
|
||||
painted.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>w</code></dt>
|
||||
<dd>
|
||||
Width of cells. If <code>0</code>, they extend up to the right margin of the page.
|
||||
</dd>
|
||||
<dt><code>h</code></dt>
|
||||
<dd>
|
||||
Height of cells.
|
||||
</dd>
|
||||
<dt><code>txt</code></dt>
|
||||
<dd>
|
||||
String to print.
|
||||
</dd>
|
||||
<dt><code>border</code></dt>
|
||||
<dd>
|
||||
Indicates if borders must be drawn around the cell block. The value can be either a number:
|
||||
<ul>
|
||||
<li><code>0</code>: no border</li>
|
||||
<li><code>1</code>: frame</li>
|
||||
</ul>
|
||||
or a string containing some or all of the following characters (in any order):
|
||||
<ul>
|
||||
<li><code>L</code>: left</li>
|
||||
<li><code>T</code>: top</li>
|
||||
<li><code>R</code>: right</li>
|
||||
<li><code>B</code>: bottom</li>
|
||||
</ul>
|
||||
Default value: <code>0</code>.
|
||||
</dd>
|
||||
<dt><code>align</code></dt>
|
||||
<dd>
|
||||
Sets the text alignment. Possible values are:
|
||||
<ul>
|
||||
<li><code>L</code>: left alignment</li>
|
||||
<li><code>C</code>: center</li>
|
||||
<li><code>R</code>: right alignment</li>
|
||||
<li><code>J</code>: justification (default value)</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt><code>fill</code></dt>
|
||||
<dd>
|
||||
Indicates if the cell background must be painted (<code>true</code>) or transparent (<code>false</code>).
|
||||
Default value: <code>false</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setfont.htm">SetFont()</a>,
|
||||
<a href="setdrawcolor.htm">SetDrawColor()</a>,
|
||||
<a href="setfillcolor.htm">SetFillColor()</a>,
|
||||
<a href="settextcolor.htm">SetTextColor()</a>,
|
||||
<a href="setlinewidth.htm">SetLineWidth()</a>,
|
||||
<a href="cell.htm">Cell()</a>,
|
||||
<a href="write.htm">Write()</a>,
|
||||
<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,42 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Output</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Output</h1>
|
||||
<code><b>string</b> Output([<b>string</b> name, <b>string</b> dest])</code>
|
||||
<h2>Description</h2>
|
||||
Send the document to a given destination: browser, file or string. In the case of browser, the
|
||||
plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
|
||||
<br>
|
||||
The method first calls Close() if necessary to terminate the document.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>name</code></dt>
|
||||
<dd>
|
||||
The name of the file. If not specified, the document will be sent to the browser
|
||||
(destination <code>I</code>) with the name <code>doc.pdf</code>.
|
||||
</dd>
|
||||
<dt><code>dest</code></dt>
|
||||
<dd>
|
||||
Destination where to send the document. It can take one of the following values:
|
||||
<ul>
|
||||
<li><code>I</code>: send the file inline to the browser. The plug-in is used if available.
|
||||
The name given by <code>name</code> is used when one selects the "Save as" option on the
|
||||
link generating the PDF.</li>
|
||||
<li><code>D</code>: send to the browser and force a file download with the name given by
|
||||
<code>name</code>.</li>
|
||||
<li><code>F</code>: save to a local file with the name given by <code>name</code> (may include a path).</li>
|
||||
<li><code>S</code>: return the document as a string. <code>name</code> is ignored.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="close.htm">Close()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,18 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>PageNo</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>PageNo</h1>
|
||||
<code><b>int</b> PageNo()</code>
|
||||
<h2>Description</h2>
|
||||
Returns the current page number.
|
||||
<h2>See also</h2>
|
||||
<a href="aliasnbpages.htm">AliasNbPages()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,48 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Rect</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Rect</h1>
|
||||
<code>Rect(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h [, <b>string</b> style])</code>
|
||||
<h2>Description</h2>
|
||||
Outputs a rectangle. It can be drawn (border only), filled (with no border) or both.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>x</code></dt>
|
||||
<dd>
|
||||
Abscissa of upper-left corner.
|
||||
</dd>
|
||||
<dt><code>y</code></dt>
|
||||
<dd>
|
||||
Ordinate of upper-left corner.
|
||||
</dd>
|
||||
<dt><code>w</code></dt>
|
||||
<dd>
|
||||
Width.
|
||||
</dd>
|
||||
<dt><code>h</code></dt>
|
||||
<dd>
|
||||
Height.
|
||||
</dd>
|
||||
<dt><code>style</code></dt>
|
||||
<dd>
|
||||
Style of rendering. Possible values are:
|
||||
<ul>
|
||||
<li><code>D</code> or empty string: draw. This is the default value.</li>
|
||||
<li><code>F</code>: fill</li>
|
||||
<li><code>DF</code> or <code>FD</code>: draw and fill</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setlinewidth.htm">SetLineWidth()</a>,
|
||||
<a href="setdrawcolor.htm">SetDrawColor()</a>,
|
||||
<a href="setfillcolor.htm">SetFillColor()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetAuthor</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetAuthor</h1>
|
||||
<code>SetAuthor(<b>string</b> author [, <b>boolean</b> isUTF8])</code>
|
||||
<h2>Description</h2>
|
||||
Defines the author of the document.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>author</code></dt>
|
||||
<dd>
|
||||
The name of the author.
|
||||
</dd>
|
||||
<dt><code>isUTF8</code></dt>
|
||||
<dd>
|
||||
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
|
||||
Default value: <code>false</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setcreator.htm">SetCreator()</a>,
|
||||
<a href="setkeywords.htm">SetKeywords()</a>,
|
||||
<a href="setsubject.htm">SetSubject()</a>,
|
||||
<a href="settitle.htm">SetTitle()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetAutoPageBreak</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetAutoPageBreak</h1>
|
||||
<code>SetAutoPageBreak(<b>boolean</b> auto [, <b>float</b> margin])</code>
|
||||
<h2>Description</h2>
|
||||
Enables or disables the automatic page breaking mode. When enabling, the second parameter is
|
||||
the distance from the bottom of the page that defines the triggering limit. By default, the
|
||||
mode is on and the margin is 2 cm.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>auto</code></dt>
|
||||
<dd>
|
||||
Boolean indicating if mode should be on or off.
|
||||
</dd>
|
||||
<dt><code>margin</code></dt>
|
||||
<dd>
|
||||
Distance from the bottom of the page.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="cell.htm">Cell()</a>,
|
||||
<a href="multicell.htm">MultiCell()</a>,
|
||||
<a href="acceptpagebreak.htm">AcceptPageBreak()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,31 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetCompression</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetCompression</h1>
|
||||
<code>SetCompression(<b>boolean</b> compress)</code>
|
||||
<h2>Description</h2>
|
||||
Activates or deactivates page compression. When activated, the internal representation of
|
||||
each page is compressed, which leads to a compression ratio of about 2 for the resulting
|
||||
document.
|
||||
<br>
|
||||
Compression is on by default.
|
||||
<br>
|
||||
<br>
|
||||
<strong>Note:</strong> the Zlib extension is required for this feature. If not present, compression
|
||||
will be turned off.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>compress</code></dt>
|
||||
<dd>
|
||||
Boolean indicating if compression must be enabled.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,34 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetCreator</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetCreator</h1>
|
||||
<code>SetCreator(<b>string</b> creator [, <b>boolean</b> isUTF8])</code>
|
||||
<h2>Description</h2>
|
||||
Defines the creator of the document. This is typically the name of the application that
|
||||
generates the PDF.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>creator</code></dt>
|
||||
<dd>
|
||||
The name of the creator.
|
||||
</dd>
|
||||
<dt><code>isUTF8</code></dt>
|
||||
<dd>
|
||||
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
|
||||
Default value: <code>false</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setauthor.htm">SetAuthor()</a>,
|
||||
<a href="setkeywords.htm">SetKeywords()</a>,
|
||||
<a href="setsubject.htm">SetSubject()</a>,
|
||||
<a href="settitle.htm">SetTitle()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,47 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetDisplayMode</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetDisplayMode</h1>
|
||||
<code>SetDisplayMode(<b>mixed</b> zoom [, <b>string</b> layout])</code>
|
||||
<h2>Description</h2>
|
||||
Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be
|
||||
displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a
|
||||
specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat).
|
||||
The page layout can be specified too: single at once, continuous display, two columns or viewer
|
||||
default.
|
||||
<br>
|
||||
By default, documents use the full width mode with continuous display.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>zoom</code></dt>
|
||||
<dd>
|
||||
The zoom to use. It can be one of the following string values:
|
||||
<ul>
|
||||
<li><code>fullpage</code>: displays the entire page on screen</li>
|
||||
<li><code>fullwidth</code>: uses maximum width of window</li>
|
||||
<li><code>real</code>: uses real size (equivalent to 100% zoom)</li>
|
||||
<li><code>default</code>: uses viewer default mode</li>
|
||||
</ul>
|
||||
or a number indicating the zooming factor to use.
|
||||
</dd>
|
||||
<dt><code>layout</code></dt>
|
||||
<dd>
|
||||
The page layout. Possible values are:
|
||||
<ul>
|
||||
<li><code>single</code>: displays one page at once</li>
|
||||
<li><code>continuous</code>: displays pages continuously</li>
|
||||
<li><code>two</code>: displays two pages on two columns</li>
|
||||
<li><code>default</code>: uses viewer default mode</li>
|
||||
</ul>
|
||||
Default value is <code>continuous</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,41 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetDrawColor</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetDrawColor</h1>
|
||||
<code>SetDrawColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
|
||||
<h2>Description</h2>
|
||||
Defines the color used for all drawing operations (lines, rectangles and cell borders). It
|
||||
can be expressed in RGB components or gray scale. The method can be called before the first
|
||||
page is created and the value is retained from page to page.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>r</code></dt>
|
||||
<dd>
|
||||
If <code>g</code> et <code>b</code> are given, red component; if not, indicates the gray level.
|
||||
Value between 0 and 255.
|
||||
</dd>
|
||||
<dt><code>g</code></dt>
|
||||
<dd>
|
||||
Green component (between 0 and 255).
|
||||
</dd>
|
||||
<dt><code>b</code></dt>
|
||||
<dd>
|
||||
Blue component (between 0 and 255).
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setfillcolor.htm">SetFillColor()</a>,
|
||||
<a href="settextcolor.htm">SetTextColor()</a>,
|
||||
<a href="line.htm">Line()</a>,
|
||||
<a href="rect.htm">Rect()</a>,
|
||||
<a href="cell.htm">Cell()</a>,
|
||||
<a href="multicell.htm">MultiCell()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetFillColor</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetFillColor</h1>
|
||||
<code>SetFillColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
|
||||
<h2>Description</h2>
|
||||
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
|
||||
It can be expressed in RGB components or gray scale. The method can be called before the first
|
||||
page is created and the value is retained from page to page.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>r</code></dt>
|
||||
<dd>
|
||||
If <code>g</code> and <code>b</code> are given, red component; if not, indicates the gray level.
|
||||
Value between 0 and 255.
|
||||
</dd>
|
||||
<dt><code>g</code></dt>
|
||||
<dd>
|
||||
Green component (between 0 and 255).
|
||||
</dd>
|
||||
<dt><code>b</code></dt>
|
||||
<dd>
|
||||
Blue component (between 0 and 255).
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setdrawcolor.htm">SetDrawColor()</a>,
|
||||
<a href="settextcolor.htm">SetTextColor()</a>,
|
||||
<a href="rect.htm">Rect()</a>,
|
||||
<a href="cell.htm">Cell()</a>,
|
||||
<a href="multicell.htm">MultiCell()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,92 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetFont</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetFont</h1>
|
||||
<code>SetFont(<b>string</b> family [, <b>string</b> style [, <b>float</b> size]])</code>
|
||||
<h2>Description</h2>
|
||||
Sets the font used to print character strings. It is mandatory to call this method
|
||||
at least once before printing text or the resulting document would not be valid.
|
||||
<br>
|
||||
The font can be either a standard one or a font added via the AddFont() method. Standard fonts
|
||||
use Windows encoding cp1252 (Western Europe).
|
||||
<br>
|
||||
The method can be called before the first page is created and the font is retained from page
|
||||
to page.
|
||||
<br>
|
||||
If you just wish to change the current font size, it is simpler to call SetFontSize().
|
||||
<br>
|
||||
<br>
|
||||
<strong>Note:</strong> the font metric files must be accessible. They are searched successively in:
|
||||
<ul>
|
||||
<li>The directory defined by the <code>FPDF_FONTPATH</code> constant (if this constant is defined)</li>
|
||||
<li>The <code>font</code> directory located in the directory containing <code>fpdf.php</code> (if it exists)</li>
|
||||
<li>The directories accessible through <code>include()</code></li>
|
||||
</ul>
|
||||
Example defining <code>FPDF_FONTPATH</code> (note the mandatory trailing slash):
|
||||
<div class="doc-source">
|
||||
<pre><code>define('FPDF_FONTPATH','/home/www/font/');
|
||||
require('fpdf.php');</code></pre>
|
||||
</div>
|
||||
If the file corresponding to the requested font is not found, the error "Could not include
|
||||
font metric file" is issued.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>family</code></dt>
|
||||
<dd>
|
||||
Family font. It can be either a name defined by AddFont() or one of the standard families (case
|
||||
insensitive):
|
||||
<ul>
|
||||
<li><code>Courier</code> (fixed-width)</li>
|
||||
<li><code>Helvetica</code> or <code>Arial</code> (synonymous; sans serif)</li>
|
||||
<li><code>Times</code> (serif)</li>
|
||||
<li><code>Symbol</code> (symbolic)</li>
|
||||
<li><code>ZapfDingbats</code> (symbolic)</li>
|
||||
</ul>
|
||||
It is also possible to pass an empty string. In that case, the current family is retained.
|
||||
</dd>
|
||||
<dt><code>style</code></dt>
|
||||
<dd>
|
||||
Font style. Possible values are (case insensitive):
|
||||
<ul>
|
||||
<li>empty string: regular</li>
|
||||
<li><code>B</code>: bold</li>
|
||||
<li><code>I</code>: italic</li>
|
||||
<li><code>U</code>: underline</li>
|
||||
</ul>
|
||||
or any combination. The default value is regular.
|
||||
Bold and italic styles do not apply to <code>Symbol</code> and <code>ZapfDingbats</code>.
|
||||
</dd>
|
||||
<dt><code>size</code></dt>
|
||||
<dd>
|
||||
Font size in points.
|
||||
<br>
|
||||
The default value is the current size. If no size has been specified since the beginning of
|
||||
the document, the value taken is 12.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>Example</h2>
|
||||
<div class="doc-source">
|
||||
<pre><code>//Times regular 12
|
||||
$pdf->SetFont('Times');
|
||||
//Arial bold 14
|
||||
$pdf->SetFont('Arial','B',14);
|
||||
//Removes bold
|
||||
$pdf->SetFont('');
|
||||
//Times bold, italic and underlined 14
|
||||
$pdf->SetFont('Times','BIU');</code></pre>
|
||||
</div>
|
||||
<h2>See also</h2>
|
||||
<a href="addfont.htm">AddFont()</a>,
|
||||
<a href="setfontsize.htm">SetFontSize()</a>,
|
||||
<a href="cell.htm">Cell()</a>,
|
||||
<a href="multicell.htm">MultiCell()</a>,
|
||||
<a href="write.htm">Write()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>SetFontSize</title>
|
||||
<link type="text/css" rel="stylesheet" href="../fpdf.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>SetFontSize</h1>
|
||||
<code>SetFontSize(<b>float</b> size)</code>
|
||||
<h2>Description</h2>
|
||||
Defines the size of the current font.
|
||||
<h2>Parameters</h2>
|
||||
<dl class="param">
|
||||
<dt><code>size</code></dt>
|
||||
<dd>
|
||||
The size (in points).
|
||||
</dd>
|
||||
</dl>
|
||||
<h2>See also</h2>
|
||||
<a href="setfont.htm">SetFont()</a>.
|
||||
<hr style="margin-top:1.5em">
|
||||
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user