Follow version 2.9

This commit is contained in:
Michael RICOIS 2016-02-18 13:33:54 +00:00
commit f778e95e8b
6 changed files with 59 additions and 46 deletions

View File

@ -41,7 +41,7 @@ class FichierController extends Zend_Controller_Action
$content_type = 'application/pdf';
// --- Envoi du fichier sur la sortie standard
$modules = apache_get_modules();
$modules = array(); //apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header('X-Sendfile: ' . $file);
header('Content-Type: ' . $content_type);
@ -75,7 +75,7 @@ class FichierController extends Zend_Controller_Action
$file = $c->profil->path->shared . '/files/'.$file;
// --- Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
$modules = array(); //apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header('X-Sendfile: ' . $file);
header('Content-Type: ' . $content_type);
@ -106,7 +106,7 @@ class FichierController extends Zend_Controller_Action
$file = $c->profil->path->shared . '/files/'. $filename;
// --- Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
$modules = array(); //apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header('X-Sendfile: ' . $file);
header('Content-Type: ' . $content_type);
@ -137,7 +137,7 @@ class FichierController extends Zend_Controller_Action
$file = realpath($c->profil->path->shared).'/datafile/kbis/'.$filename;
// --- Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
$modules = array(); //apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header('X-Sendfile: ' . $file);
header('Content-Type: ' . $content_type);
@ -168,7 +168,7 @@ class FichierController extends Zend_Controller_Action
$file = $c->profil->path->shared . '/files/' . $filename;
// --- Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
$modules = array(); //apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header('X-Sendfile: ' . $file);
header('Content-Type: ' . $content_type);
@ -199,7 +199,7 @@ class FichierController extends Zend_Controller_Action
$file = $c->profil->path->shared . '/files/' .$filename;
// --- Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
$modules = array(); //apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header('X-Sendfile: ' . $file);
header('Content-Type: ' . $content_type);
@ -231,7 +231,7 @@ class FichierController extends Zend_Controller_Action
// --- Envoi du fichier sur la sortie standard
if ( file_exists($file) ) {
$modules = apache_get_modules();
$modules = array(); //apache_get_modules();
if (in_array('mod_xsendfile', $modules)) {
header('X-Sendfile: ' . $file);
header('Content-Type: ' . $content_type);

View File

@ -201,13 +201,18 @@ class SdMetier_Infogreffe_DocAC extends SdMetier_Infogreffe_Service
$num = $row->num_acte;
$options = $row->numGreffe . '-' . substr($row->numRC,0,2) . '-' . substr($row->numRC,2,1) . '-' . substr($row->numRC,3) . '-' . $row->num_depot;
$dir = $this->getFilePath($date);
if ( ! file_exists($this->config->storage->path . '/' . $dir) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
//Set filename
$filename = $this->getFilePath($date) . '/' . $this->getFileName($date, $num, $type, $options);
$filename = $dir . '/' . $this->getFileName($date, $num, $type, $options);
if ( $row->pdfLink != '' ) {
//Set the filename
$filename = $this->getFilePath($date) . '/' . $row->pdfLink;
$filename = $dir . '/' . $row->pdfLink;
//Check if filename exist
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
@ -355,11 +360,7 @@ class SdMetier_Infogreffe_DocAC extends SdMetier_Infogreffe_Service
*/
public function getFilePath($date)
{
$dir = 'actes/' . substr($date,0,4) . '/' . substr($date,5,2);
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
return $dir;
return 'actes/' . substr($date,0,4) . '/' . substr($date,5,2);
}
/**

View File

@ -220,13 +220,18 @@ class SdMetier_Infogreffe_DocBI extends SdMetier_Infogreffe_Service
$this->date_cloture = $row->date_cloture;
$this->type_comptes = $row->type_comptes;
$dir = $this->getFilePath($type, $dateCloture);
if ( ! file_exists($this->config->storage->path . '/' . $dir) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
//Set the filename
$filename = $this->getFilePath($type, $dateCloture) . '/' . $this->getFileName($type, $dateCloture);
$filename = $dir . '/' . $this->getFileName($type, $dateCloture);
if ($row->pdfLink != '') {
//Check if filename exist
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
if ( ! file_exists($this->config->storage->path . '/' . $filename) ) {
throw new Exception('File not found', self::INT);
}
@ -370,11 +375,7 @@ class SdMetier_Infogreffe_DocBI extends SdMetier_Infogreffe_Service
if ($type=='') {
$type = 'sociaux';
}
$dir = 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
return $dir;
return 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
}
/**

View File

@ -46,8 +46,13 @@ class SdMetier_Infogreffe_DocST extends SdMetier_Infogreffe_Service
$this->mode_diffusion = 'T';
$this->reference_client = 'T'.date('YmdHis');
$dir = $this->getFilePath($type, $dateCloture);
if ( ! file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
//Set the filename
$filename = $this->getFilePath($type, $dateCloture) . '/' . $this->getFileName($type, $dateCloture);
$filename = $dir . '/' . $this->getFileName($type, $dateCloture);
try {
$xml = $this->callRequest();
@ -115,11 +120,7 @@ class SdMetier_Infogreffe_DocST extends SdMetier_Infogreffe_Service
if ($type=='') {
$type = 'sociaux';
}
$dir = 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
}
return $dir;
return 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
}
/**

View File

@ -450,10 +450,15 @@ class Pieces extends Scores_Ws_Server
if ( !empty($pdf) ) {
$c = Zend_Registry::get('config');
$file = $c->profil->infogreffe->storage->path . '/' . $pdf;
$dest = $c->profil->path->shared . '/files/' . basename($file);
$file = null;
if ( file_exists($c->profil->infogreffe->storage->path . '/OCR/' . $pdf) ) {
$file = $c->profil->infogreffe->storage->path . '/OCR/' . $pdf;
} elseif ( file_exists($c->profil->infogreffe->storage->path . '/' . $pdf) ) {
$file = $c->profil->infogreffe->storage->path . '/' . $pdf;
}
$dest = $c->profil->path->shared . '/files/' . basename($file);
if ( file_exists($file) && copy($file, $dest)) {
if ( $file !== null && copy($file, $dest) ) {
$hostname = 'http://'.$_SERVER['SERVER_NAME'];
if ( $_SERVER['SERVER_PORT'] != '80' ) {
$hostname.= ':'.$_SERVER['SERVER_PORT'];
@ -625,10 +630,15 @@ class Pieces extends Scores_Ws_Server
if ( !empty($pdf) ) {
$c = Zend_Registry::get('config');
$file = $c->profil->infogreffe->storage->path . '/' . $pdf;
$file = null;
if ( file_exists($c->profil->infogreffe->storage->path . '/OCR/' . $pdf) ) {
$file = $c->profil->infogreffe->storage->path . '/OCR/' . $pdf;
} elseif ( file_exists($c->profil->infogreffe->storage->path . '/' . $pdf) ) {
$file = $c->profil->infogreffe->storage->path . '/' . $pdf;
}
$dest = $c->profil->path->shared . '/files/' . basename($file);
if ( file_exists($file) && copy($file, $dest)) {
if ( $file !== null && copy($file, $dest)) {
$hostname = 'http://'.$_SERVER['SERVER_NAME'];
if ( $_SERVER['SERVER_PORT'] != '80' ) {

View File

@ -6,8 +6,8 @@
** "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);
@ -22,7 +22,7 @@ function parse_response($this_response) {
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");}
@ -57,7 +57,7 @@ function getUrl($url, $strCookies='', $postData='', $referer='', $debug=false, $
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_CONNECTTIMEOUT, (int)$timeout);
@ -77,7 +77,7 @@ function receiveResponse($curlHandle,$xmldata)
$this->size += $this->length;
return $this->length;
}
}
*/
if (preg_match('/^https/i',$url))
@ -131,7 +131,7 @@ if ($nbRetry==0) {
$response=array('code' =>408, 'header' =>array('curl_errno'=>curl_errno($ch),'curl_error'=>curl_error($ch)), 'body' =>'Connexion impossible au site du partenaire/Timeout');
else
$response=array('code' =>400, 'header' =>array('curl_errno'=>curl_errno($ch),'curl_error'=>curl_error($ch)), 'body' =>'Erreur Curl : ' . curl_error($ch));
} else
} else
$response = parse_response($page);
} else {
$numTry=0;
@ -149,14 +149,14 @@ if ($nbRetry==0) {
}
}
if ($debug){
$url2=str_replace('http://', '', $url);
$url2=str_replace('/', '_', $url2);
$url2=str_replace('?', '(param)', $url2);
$url2=str_replace('&', '(et)', $url2);
$fp=fopen('/tmp/curl-'. date('Ymd-His') .'-'. microtime_float(true) .'-'. $url2 . '.html', 'a');
fwrite($fp, $url."\r\n");
fwrite($fp, $page);
@ -181,7 +181,7 @@ function getTextInHtml($pageHtml, $strToFind, $strDeb, $strEnd, $include_strDeb=
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);
@ -190,7 +190,7 @@ function getTextInHtml($pageHtml, $strToFind, $strDeb, $strEnd, $include_strDeb=
//$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;
@ -236,14 +236,14 @@ function getPdfInfo($f){
//echo '5'.EOL;
return false;
}
$tabInfo['pdfSize']=filesize($f);
$tabInfo['nbPages']=0+$nbPages;
//$tabInfo['debugBuffer']=$prev_buffer;
return $tabInfo;
}
function simpleWhois($domain, $tdl, $debug=false) {
// Fonction de traitement
// -----------------------------------------------
@ -254,7 +254,7 @@ function simpleWhois($domain, $tdl, $debug=false) {
// 4 => Erreur, il faut spécifier une chaine à rechercher (regexp)
// 5 => Erreur, la requête retournée était vide
// -----------------------------------------------
// Informations spécifiques aux extensions
$info = array(
'fr' => array(
@ -271,7 +271,7 @@ function simpleWhois($domain, $tdl, $debug=false) {
'regexp' => 'No[s]*match[s]*for'
),
);
// Initialisation de la sortie
$output = '';
// Initialisation de la requête