647 lines
14 KiB
PHP
647 lines
14 KiB
PHP
<?php
|
||
|
||
define('BDF_HOST','http://protectel.scrypto.fr');
|
||
define('BDF_PAGE','/iBDF/RequeteLanceur.php');
|
||
define('BDF_FILETIME', 8);
|
||
|
||
require_once 'common/curl.php';
|
||
|
||
function bdf_loadpage($url)
|
||
{
|
||
global $firephp;
|
||
$firephp->log($url, 'url');
|
||
$page = getUrl($url, '', '', '', false, '', '',15);
|
||
//Fichier non disponible
|
||
if($page['code']==408 || $page['code']==400){
|
||
$output = false;
|
||
//Ecriture du fichier sur le serveur en local
|
||
}else{
|
||
$body = $page['body'];
|
||
$output = $body;
|
||
}
|
||
|
||
$firephp->log($output, 'content');
|
||
|
||
$output = bdf_removeblock($output);
|
||
$output = removeTag('html', $output, true, false);
|
||
$output = removeTag('head', $output, true, false);
|
||
$output = removeTag('body', $output, true, false);
|
||
$output = removeTag('meta', $output, false, false);
|
||
$output = removeTag('title', $output, true, true);
|
||
|
||
$output = changeLinkToLowerCase($output);
|
||
$output = bdf_lien_siren($output);
|
||
|
||
return $output;
|
||
}
|
||
|
||
function bdf_removeblock($content)
|
||
{
|
||
|
||
$output = $content;
|
||
/*
|
||
* Image shim.gif
|
||
* Module 27, 28, 29, 30
|
||
* Module 38
|
||
*/
|
||
$output = str_replace('<img xmlns:msxsl="urn:schemas-microsoft-com:xslt" src="/FIBEN/Images/Commun/shim.gif" width="780" height="18">','',$output);
|
||
$output = str_replace('<img src="/FIBEN/Images/Commun/shim.gif" width="780" height="18">', '', $output);
|
||
|
||
/*
|
||
* Image mise en suivi
|
||
* Module 27
|
||
* Module 28
|
||
* Module 51
|
||
*/
|
||
$output = str_replace('<a href="#nullepart" onclick="requestAlert(this);"><img src="/FIBEN/Images/risque/aide.gif" width="18" height="20" name="aid1" border="0" title="Mise sous suivi" alt="Mise sous suivi"></a>', '', $output);
|
||
$output = str_replace('<a href="#nullepart" onclick="requestAlert(this);"><img src="/FIBEN/Images/Solvabilite/aide.gif" width="18" height="20" name="aid1" border="0" title="Mise sous suivi" alt="Mise sous suivi"></a>', '', $output);
|
||
$output = str_replace('<a href="#nullepart" onclick="requestAlert(this);"><img src="/FIBEN/Images/environnement/aide.gif" width="18" height="20" name="aid1" border="0" title="Mise sous suivi" alt="Mise sous suivi"></a>', '', $output);
|
||
|
||
/*
|
||
* Imprimer
|
||
* Module 27
|
||
* Module 28
|
||
* Module 51
|
||
*
|
||
*/
|
||
$output = str_replace('<a href="#" onClick="window.print()"><img src="/FIBEN/images/risque/imprimer.gif" width="20" height="20" name="Aide" border="0" title="Imprimer" alt="Imprimer" align="right"></a>', '', $output);
|
||
$output = str_replace('<a href="#" onClick="window.print()"><img src="/FIBEN/images/Solvabilite/imprimer.gif" width="20" height="20" name="Aide" border="0" title="Imprimer" alt="Imprimer" align="right"></a>', '', $output);
|
||
$output = str_replace('<a href="#" onClick="window.print()"><img src="/FIBEN/images/environnement/imprimer.gif" width="20" height="20" name="Aide" border="0" title="Imprimer" alt="Imprimer" align="right"></a>', '', $output);
|
||
|
||
return $output;
|
||
}
|
||
|
||
function removeTag($balise, $content, $endOfTag = true, $removeContent = true)
|
||
{
|
||
if( $endOfTag )
|
||
{
|
||
if( $removeContent)
|
||
$output = preg_replace(
|
||
'@<'.$balise.'[^>]*?>.*?</'.$balise.'>@si',
|
||
'',
|
||
$content
|
||
);
|
||
else
|
||
$output = preg_replace(
|
||
array('@<'.$balise.'[^>]*?>@', '@</'.$balise.'>@'),
|
||
'',
|
||
$content
|
||
);
|
||
}
|
||
else
|
||
{
|
||
$output = preg_replace(
|
||
'@<'.$balise.'[^>]*?>@',
|
||
'',
|
||
$content
|
||
);
|
||
}
|
||
return $output;
|
||
}
|
||
|
||
function changeLinkToLowerCase($content)
|
||
{
|
||
global $firephp;
|
||
//$pattern = "/\< *[img][^\>]*[href] *= *[\"\']{0,1}([^\"\'\ >]*)/i";
|
||
$pattern = '/(\<img[^>].*?>)/ie';
|
||
$replace = "strtolower('\\1')";
|
||
$content = preg_replace($pattern,$replace,$content);
|
||
|
||
$pattern = '/(\<script[^>].*?>)/ie';
|
||
$replace = "strtolower('\\1')";
|
||
$content = preg_replace($pattern,$replace,$content);
|
||
|
||
$pattern = '/(\<link[^>].*?>)/ie';
|
||
$replace = "strtolower('\\1')";
|
||
$content = preg_replace($pattern,$replace,$content);
|
||
|
||
$pattern = '/(\<table[^>].*?>)/ie';
|
||
$replace = "strtolower('\\1')";
|
||
$content = preg_replace($pattern,$replace,$content);
|
||
|
||
$pattern = '/(\<a[^>].*?>)/ie';
|
||
$replace = "strtolower('\\1')";
|
||
$content = preg_replace($pattern,$replace,$content);
|
||
|
||
$content = stripslashes($content);
|
||
//$firephp->log($content, 'content');
|
||
|
||
return $content;
|
||
}
|
||
|
||
function bdf_lien_module($id, $service = 'fiben', $req = '', $rech = array() )
|
||
{
|
||
global $firephp;
|
||
$firephp->log($req,'req');
|
||
|
||
$func_module = 'bdf_modules_'.$service;
|
||
$modules = $func_module();
|
||
$params = array();
|
||
$firephp->log($rech, 'rech');
|
||
if(is_array($rech) && count($rech)>0){
|
||
foreach($rech as $key => $val)
|
||
{
|
||
${$key} = $val;
|
||
}
|
||
}
|
||
|
||
//Param<61>tres URL
|
||
foreach($modules[$id]['params'] as $mparams => $fparams)
|
||
{
|
||
$addParams = array();
|
||
//Param<61>tres de chaque fonction
|
||
$func_params = array();
|
||
if(is_array($fparams)){
|
||
foreach($fparams as $fparam)
|
||
{
|
||
$firephp->log(${$fparam},$fparam);
|
||
$func_params[] = ${$fparam};
|
||
}
|
||
}
|
||
|
||
//$firephp->log($mparams, 'mparams');
|
||
//$firephp->log($func_params, 'func_params');
|
||
|
||
$addParams = call_user_func_array('bdf_param_'.$mparams, $func_params);
|
||
//Rassemblement de tout les param<61>tres
|
||
$params = array_merge($params, $addParams);
|
||
}
|
||
//Param<61>tres sous format URL
|
||
$output = '';
|
||
foreach($params as $key => $value)
|
||
{
|
||
if(!empty($output)) $output.= '&';
|
||
$output.= $key.'='.$value;
|
||
}
|
||
$firephp->log($output, 'output');
|
||
return BDF_HOST.BDF_PAGE.'?'.$output;
|
||
}
|
||
|
||
function bdf_lien_siren($content)
|
||
{
|
||
global $firephp;
|
||
$pattern = '/<a[^>]*?class=\"(.*)\"[^>]*?>([0-9]{3} [0-9]{3} [0-9]{3})<\/a>/';
|
||
$replace = '<a class="\\1" href="./?page=identite&siret=\\2">\\2</a>';
|
||
/*
|
||
$nbmatches = preg_match_all($pattern, $content, $matches);
|
||
$firephp->log($nbmatches, 'LIEN NB');
|
||
$firephp->log($matches, 'LIEN SIREN');
|
||
*/
|
||
$content = preg_replace($pattern,$replace,$content);
|
||
$content = stripslashes($content);
|
||
return $content;
|
||
}
|
||
|
||
function bdf_lien_clebdf()
|
||
{
|
||
//D<>tection des clebdf
|
||
|
||
//Remplacement du lien
|
||
}
|
||
|
||
function bdf_lien_plusinfos()
|
||
{
|
||
|
||
|
||
|
||
}
|
||
|
||
function bdf_param_banque()
|
||
{
|
||
return array(
|
||
'Etablissement' => '12345',
|
||
'Guichet' => '00001',
|
||
);
|
||
}
|
||
|
||
function bdf_param_utilisateur()
|
||
{
|
||
return array(
|
||
'Utilisateur' => 'Dupont', //$_SESSION['tabInfo']['login']
|
||
'MDP' => '', //$_SESSION['tabInfo']['password']
|
||
);
|
||
}
|
||
|
||
function bdf_param_profil()
|
||
{
|
||
return array(
|
||
'Profil' => 'Agence',
|
||
);
|
||
}
|
||
|
||
function bdf_param_service($service = 'FIBEN')
|
||
{
|
||
return array(
|
||
'Service' => strtoupper($service),
|
||
);
|
||
}
|
||
|
||
function bdf_param_req($req)
|
||
{
|
||
global $firephp;
|
||
$firephp->log($req, 'req');
|
||
return array(
|
||
'Req' => $req,
|
||
);
|
||
}
|
||
|
||
function bdf_param_typeop($id)
|
||
{
|
||
return array(
|
||
'TypeOp' => $id,
|
||
);
|
||
}
|
||
|
||
function bdf_param_denom($denom)
|
||
{
|
||
return array(
|
||
'Denom' => $denom,
|
||
);
|
||
}
|
||
|
||
function bdf_param_type($type)
|
||
{
|
||
return array(
|
||
'Type' => $type,
|
||
);
|
||
}
|
||
|
||
function bdf_param_code($code)
|
||
{
|
||
return array(
|
||
'Code' => $code,
|
||
);
|
||
}
|
||
|
||
function bdf_param_rechet($rechet)
|
||
{
|
||
if(empty($rechet)) $output = 'N';
|
||
else $output = 'O';
|
||
|
||
return array(
|
||
'RechEt' => $output,
|
||
);
|
||
}
|
||
|
||
function bdf_param_ape($ape)
|
||
{
|
||
return array(
|
||
'APE' => $ape,
|
||
);
|
||
}
|
||
|
||
function bdf_modules_fiben()
|
||
{
|
||
return array(
|
||
'27' => array(
|
||
'titre' => 'Panorama',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'28'=> array(
|
||
'titre' => 'Concours Bancaires',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'29'=> array(
|
||
'titre' => 'Impay<61>s',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'30'=> array(
|
||
'titre' => 'Concours Bancaires gpe',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'37'=> array(
|
||
'titre' => 'Cotation',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'38'=> array(
|
||
'titre' => 'Score',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'40'=> array(
|
||
'titre' => 'Relations Bancaires',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'41'=> array(
|
||
'titre' => 'Etablissement secondaires',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'45'=> array(
|
||
'titre' => 'Jugements',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'51'=> array(
|
||
'titre' => 'Dirigeants',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'52'=> array(
|
||
'titre' => 'Capital',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req') ,
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'54'=> array(
|
||
'titre' => 'Participation',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'56'=> array(
|
||
'titre' => 'Fonction De Direction',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'57'=> array(
|
||
'titre' => 'Orga liens financiers',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'58'=> array(
|
||
'titre' => 'Orga liens de direction',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'60'=> array(
|
||
'titre' => 'Bilan Synth<74>tique',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'62'=> array(
|
||
'titre' => 'SIG',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'63'=> array(
|
||
'titre' => 'Tableaux des flux',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'64'=> array(
|
||
'titre' => 'Ratios',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'66'=> array(
|
||
'titre' => 'Chiffres Consolid<69>s',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'67'=> array(
|
||
'titre' => 'Comptes Consolid<69>s',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'68'=> array(
|
||
'titre' => 'Dossier Comptable',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'69'=> array(
|
||
'titre' => 'Liasse Fiscale',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'70'=> array(
|
||
'titre' => 'El<45>ments de risque',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'72'=> array(
|
||
'titre' => 'Diagnostic Synth<74>tique',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'DE'=> array(
|
||
'titre' => 'Dossier D<>couverte',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'07'=> array(
|
||
'titre' => 'Recherche',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array(),
|
||
'typeop' => array('id'),
|
||
'denom' => array('denom'),
|
||
'type' => array('type'),
|
||
'code' => array('code'),
|
||
'rechet' => array('rechet'),
|
||
'ape' => array('ape'),
|
||
),
|
||
'liste' => false,
|
||
),
|
||
|
||
);
|
||
}
|
||
|
||
|
||
function bdf_modules_fcc()
|
||
{
|
||
return array(
|
||
'G'=> array(
|
||
'titre' => 'FCC Simplifi<66>',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array('service'),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
'D'=> array(
|
||
'titre' => 'FCC D<>taill<6C>',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array('service'),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
);
|
||
|
||
}
|
||
|
||
function bdf_modules_ficp()
|
||
{
|
||
return array(
|
||
'G'=> array(
|
||
'titre' => 'FICP',
|
||
'params' => array(
|
||
'banque' => array(),
|
||
'utilisateur' => array(),
|
||
'profil' => array(),
|
||
'service' => array('service'),
|
||
'req' => array('req'),
|
||
'typeop' => array('id')
|
||
),
|
||
),
|
||
);
|
||
} |