Qual: Utilisation de la fonction sanitize_string pour nettoyer les noms des fichiers générés des caractères spéciaux.
This commit is contained in:
parent
1335980da7
commit
506a5de072
@ -144,8 +144,7 @@ if ($_POST['action'] == 'send')
|
|||||||
$propal= new Propal($db);
|
$propal= new Propal($db);
|
||||||
if ( $propal->fetch($_POST['propalid']) )
|
if ( $propal->fetch($_POST['propalid']) )
|
||||||
{
|
{
|
||||||
$forbidden_chars=array('/','\\',':','*','?','"','<','>','|','[',']',',',';','=');
|
$propalref = sanitize_string($propal->ref);
|
||||||
$propalref = str_replace($forbidden_chars,'_',$propal->ref);
|
|
||||||
$file = $conf->propal->dir_output . '/' . $propalref . '/' . $propalref . '.pdf';
|
$file = $conf->propal->dir_output . '/' . $propalref . '/' . $propalref . '.pdf';
|
||||||
if (is_readable($file))
|
if (is_readable($file))
|
||||||
{
|
{
|
||||||
@ -811,8 +810,7 @@ if ($_GET['propalid'])
|
|||||||
{
|
{
|
||||||
if ($user->rights->propale->envoyer)
|
if ($user->rights->propale->envoyer)
|
||||||
{
|
{
|
||||||
$forbidden_chars=array('/','\\',':','*','?','"','<','>','|','[',']',',',';','=');
|
$propref = sanitize_string($obj->ref);
|
||||||
$propref = str_replace($forbidden_chars,'_',$obj->ref);
|
|
||||||
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
@ -856,8 +854,7 @@ if ($_GET['propalid'])
|
|||||||
print_titre($langs->trans('Documents'));
|
print_titre($langs->trans('Documents'));
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
$forbidden_chars=array('/','\\',':','*','?','"','<','>','|','[',']',',',';','=');
|
$propref = sanitize_string($propal->ref);
|
||||||
$propref = str_replace($forbidden_chars,'_',$propal->ref);
|
|
||||||
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
||||||
$relativepath = $propref.'/'.$propref.'.pdf';
|
$relativepath = $propref.'/'.$propref.'.pdf';
|
||||||
|
|
||||||
|
|||||||
@ -73,8 +73,7 @@ if ($propalid > 0)
|
|||||||
|
|
||||||
if ($propal->fetch($propalid))
|
if ($propal->fetch($propalid))
|
||||||
{
|
{
|
||||||
$forbidden_chars=array('/','\\',':','*','?','"','<','>','|','[',']',',',';','=');
|
$propref = sanitize_string($propal->ref);
|
||||||
$propref = str_replace($forbidden_chars, '_', $propal->ref);
|
|
||||||
$upload_dir = $conf->propal->dir_output.'/'.$propref;
|
$upload_dir = $conf->propal->dir_output.'/'.$propref;
|
||||||
if ( $error_msg )
|
if ( $error_msg )
|
||||||
{
|
{
|
||||||
|
|||||||
@ -354,8 +354,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
|
|||||||
$fac = new Facture($db,"",$_POST["facid"]);
|
$fac = new Facture($db,"",$_POST["facid"]);
|
||||||
if ( $fac->fetch($_POST["facid"]) )
|
if ( $fac->fetch($_POST["facid"]) )
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
||||||
|
|
||||||
if (is_readable($file))
|
if (is_readable($file))
|
||||||
@ -1325,8 +1324,7 @@ else
|
|||||||
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
|
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
||||||
$relativepath = "${facref}/${facref}.pdf";
|
$relativepath = "${facref}/${facref}.pdf";
|
||||||
|
|
||||||
|
|||||||
@ -147,8 +147,7 @@ if ($_GET["facid"] > 0)
|
|||||||
* Documents
|
* Documents
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
||||||
$filedetail = $conf->facture->dir_output . "/" . $facref . "/" . $facref . "-detail.pdf";
|
$filedetail = $conf->facture->dir_output . "/" . $facref . "/" . $facref . "-detail.pdf";
|
||||||
$relativepath = "${facref}/${facref}.pdf";
|
$relativepath = "${facref}/${facref}.pdf";
|
||||||
|
|||||||
@ -300,8 +300,7 @@ class FactureRec
|
|||||||
/*
|
/*
|
||||||
* Notify
|
* Notify
|
||||||
*/
|
*/
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($this->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$this->ref);
|
|
||||||
$filepdf = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
$filepdf = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -455,8 +455,7 @@ if ($_GET["propalid"])
|
|||||||
print_titre($langs->trans('Documents'));
|
print_titre($langs->trans('Documents'));
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
$forbidden_chars=array('/','\\',':','*','?','"','<','>','|','[',']',',',';','=');
|
$propref = sanitize_string($propal->ref);
|
||||||
$propref = str_replace($forbidden_chars,'_',$propal->ref);
|
|
||||||
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
||||||
$relativepath = $propref.'/'.$propref.'.pdf';
|
$relativepath = $propref.'/'.$propref.'.pdf';
|
||||||
|
|
||||||
|
|||||||
@ -782,8 +782,7 @@ class Facture
|
|||||||
/*
|
/*
|
||||||
* Notify
|
* Notify
|
||||||
*/
|
*/
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($this->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$this->ref);
|
|
||||||
$filepdf = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . ".pdf";
|
$filepdf = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . ".pdf";
|
||||||
|
|
||||||
$mesg = "La facture ".$this->ref." a été validée.\n";
|
$mesg = "La facture ".$this->ref." a été validée.\n";
|
||||||
|
|||||||
@ -155,8 +155,7 @@ function facture_meta_create($db, $facid, $message="")
|
|||||||
|
|
||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($forbidden_chars,"_",$fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref ;
|
$dir = $conf->facture->dir_output . "/" . $facref ;
|
||||||
$file = $dir . "/" . $facref . ".meta";
|
$file = $dir . "/" . $facref . ".meta";
|
||||||
|
|
||||||
|
|||||||
@ -60,8 +60,7 @@ class pdf_adytek extends ModelePDFFactures {
|
|||||||
$fac = new Facture($this->db,"",$facid);
|
$fac = new Facture($this->db,"",$facid);
|
||||||
$fac->fetch($facid);
|
$fac->fetch($facid);
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -57,8 +57,7 @@ class pdf_bernique extends ModelePDFFactures {
|
|||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref . "/" ;
|
$dir = $conf->facture->dir_output . "/" . $facref . "/" ;
|
||||||
$file = $dir . $facref . ".pdf";
|
$file = $dir . $facref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,7 @@ class pdf_bigorneau extends ModelePDFFactures {
|
|||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref . "/" ;
|
$dir = $conf->facture->dir_output . "/" . $facref . "/" ;
|
||||||
$file = $dir . $facref . ".pdf";
|
$file = $dir . $facref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -59,8 +59,7 @@ class pdf_bulot extends ModelePDFFactures {
|
|||||||
$fac = new Facture($this->db,"",$facid);
|
$fac = new Facture($this->db,"",$facid);
|
||||||
$fac->fetch($facid);
|
$fac->fetch($facid);
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -105,8 +105,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$fac = new Facture($this->db,"",$facid);
|
$fac = new Facture($this->db,"",$facid);
|
||||||
$fac->fetch($facid);
|
$fac->fetch($facid);
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -106,8 +106,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
$fac = new Facture($this->db,"",$facid);
|
$fac = new Facture($this->db,"",$facid);
|
||||||
$fac->fetch($facid);
|
$fac->fetch($facid);
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,7 @@ class pdf_tourteau extends ModelePDFFactures {
|
|||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$facref = sanitize_string($fac->ref);
|
||||||
$facref = str_replace($forbidden_chars,"_",$fac->ref);
|
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref . "/" ;
|
$dir = $conf->facture->dir_output . "/" . $facref . "/" ;
|
||||||
$file = $dir . $facref . ".pdf";
|
$file = $dir . $facref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -60,8 +60,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
$fich = new Fichinter($this->db,"",$id);
|
$fich = new Fichinter($this->db,"",$id);
|
||||||
if ($fich->fetch($id))
|
if ($fich->fetch($id))
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$fichref = sanitize_string($fich->ref);
|
||||||
$fichref = str_replace($forbidden_chars,"_",$fich->ref);
|
|
||||||
|
|
||||||
$dir = $conf->fichinter->dir_output . "/" . $fichref;
|
$dir = $conf->fichinter->dir_output . "/" . $fichref;
|
||||||
$file = $dir . "/" . $fichref . ".pdf";
|
$file = $dir . "/" . $fichref . ".pdf";
|
||||||
|
|||||||
@ -72,8 +72,7 @@ class pdf_propale_adytek extends ModelePDFPropales
|
|||||||
|
|
||||||
if ($conf->propal->dir_output)
|
if ($conf->propal->dir_output)
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$dir = $conf->propal->dir_output . "/" . $propref ;
|
$dir = $conf->propal->dir_output . "/" . $propref ;
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
@ -91,8 +90,7 @@ class pdf_propale_adytek extends ModelePDFPropales
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$file = $dir . "/" . $propref . ".pdf";
|
$file = $dir . "/" . $propref . ".pdf";
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
|
|||||||
@ -116,8 +116,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
$prop = new Propal($this->db,"",$id);
|
$prop = new Propal($this->db,"",$id);
|
||||||
$prop->fetch($id);
|
$prop->fetch($id);
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($prop->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$prop->ref);
|
|
||||||
$dir = $conf->propal->dir_output . "/" . $propref;
|
$dir = $conf->propal->dir_output . "/" . $propref;
|
||||||
$file = $dir . "/" . $propref . ".pdf";
|
$file = $dir . "/" . $propref . ".pdf";
|
||||||
|
|
||||||
|
|||||||
@ -72,8 +72,7 @@ class pdf_propale_bleu extends ModelePDFPropales
|
|||||||
|
|
||||||
if ($conf->propal->dir_output)
|
if ($conf->propal->dir_output)
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$dir = $conf->propal->dir_output . "/" . $propref ;
|
$dir = $conf->propal->dir_output . "/" . $propref ;
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
@ -91,8 +90,7 @@ class pdf_propale_bleu extends ModelePDFPropales
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$file = $dir . "/" . $propref . ".pdf";
|
$file = $dir . "/" . $propref . ".pdf";
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
|
|||||||
@ -72,8 +72,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
|
|
||||||
if ($conf->propal->dir_output)
|
if ($conf->propal->dir_output)
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$dir = $conf->propal->dir_output . "/" . $propref ;
|
$dir = $conf->propal->dir_output . "/" . $propref ;
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
@ -90,8 +89,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$file = $dir . "/" . $propref . ".pdf";
|
$file = $dir . "/" . $propref . ".pdf";
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
|
|||||||
@ -74,8 +74,7 @@ class pdf_propale_rouge extends ModelePDFPropales
|
|||||||
|
|
||||||
if ($conf->propal->dir_output)
|
if ($conf->propal->dir_output)
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$dir = $conf->propal->dir_output . "/" . $propref ;
|
$dir = $conf->propal->dir_output . "/" . $propref ;
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
@ -93,8 +92,7 @@ class pdf_propale_rouge extends ModelePDFPropales
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$file = $dir . "/" . $propref . ".pdf";
|
$file = $dir . "/" . $propref . ".pdf";
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
|
|||||||
@ -72,8 +72,7 @@ class pdf_propale_vert extends ModelePDFPropales
|
|||||||
|
|
||||||
if ($conf->propal->dir_output)
|
if ($conf->propal->dir_output)
|
||||||
{
|
{
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$dir = $conf->propal->dir_output . "/" . $propref ;
|
$dir = $conf->propal->dir_output . "/" . $propref ;
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
@ -90,8 +89,7 @@ class pdf_propale_vert extends ModelePDFPropales
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
$propref = sanitize_string($propale->ref);
|
||||||
$propref = str_replace($forbidden_chars,"_",$propale->ref);
|
|
||||||
$file = $dir . "/" . $propref . ".pdf";
|
$file = $dir . "/" . $propref . ".pdf";
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user