No special chars in filename

This commit is contained in:
Laurent Destailleur 2008-10-25 21:18:53 +00:00
parent 5f55cb864e
commit dbae510665
64 changed files with 167 additions and 153 deletions

View File

@ -24,14 +24,19 @@
\version $Id$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
/** \class ChargeSociales /** \class ChargeSociales
\brief Classe permettant la gestion des paiements des charges \brief Classe permettant la gestion des paiements des charges
La tva collectée n'est calculée que sur les factures payées. La tva collectée n'est calculée que sur les factures payées.
*/ */
class ChargeSociales class ChargeSociales extends CommonObject
{ {
var $db; var $db;
var $error;
var $element='rowid';
var $table_element='chargesociales';
var $id; var $id;
var $date_ech; var $date_ech;

View File

@ -71,7 +71,7 @@ if ( $_POST["sendit"] && $conf->upload )
/* /*
* Creation répertoire si n'existe pas * Creation répertoire si n'existe pas
*/ */
$upload_dir = $conf->actions->dir_output.'/'.sanitize_string($objectid); $upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@ -95,7 +95,7 @@ if ( $_POST["sendit"] && $conf->upload )
*/ */
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$upload_dir = $conf->actions->dir_output.'/'.sanitize_string($objectid); $upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
} }
@ -113,7 +113,7 @@ if ($objectid > 0)
$act = new ActionComm($db); $act = new ActionComm($db);
if ($act->fetch($objectid)) if ($act->fetch($objectid))
{ {
$upload_dir = $conf->actions->dir_output.'/'.sanitize_string($objectid); $upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid);
$res=$act->societe->fetch($act->societe->id); $res=$act->societe->fetch($act->societe->id);
$res=$act->author->fetch(); // Le paramètre est le login, hors seul l'id est chargé. $res=$act->author->fetch(); // Le paramètre est le login, hors seul l'id est chargé.

View File

@ -457,8 +457,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
if ($obj->dp < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); if ($obj->dp < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td width="16" align="center" class="nobordernopadding">'; print '<td width="16" align="center" class="nobordernopadding">';
$filename=sanitize_string($obj->ref); $filename=sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($obj->ref); $filedir=$conf->propal->dir_output . '/' . sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$obj->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$obj->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@ -532,8 +532,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td width="16" align="center" class="nobordernopadding">'; print '<td width="16" align="center" class="nobordernopadding">';
$filename=sanitize_string($objp->ref); $filename=sanitizeFileName($objp->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref); $filedir=$conf->propal->dir_output . '/' . sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -359,7 +359,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
$propal= new Propal($db); $propal= new Propal($db);
if ( $propal->fetch($_POST['propalid']) ) if ( $propal->fetch($_POST['propalid']) )
{ {
$propalref = sanitize_string($propal->ref); $propalref = sanitizeFileName($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))
@ -1687,7 +1687,7 @@ if ($_GET['propalid'] > 0)
// Send // Send
if ($propal->statut == 1 && $user->rights->propale->envoyer) if ($propal->statut == 1 && $user->rights->propale->envoyer)
{ {
$propref = sanitize_string($propal->ref); $propref = sanitizeFileName($propal->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))
{ {
@ -1745,8 +1745,8 @@ if ($_GET['propalid'] > 0)
/* /*
* Documents generes * Documents generes
*/ */
$filename=sanitize_string($propal->ref); $filename=sanitizeFileName($propal->ref);
$filedir=$conf->propal->dir_output . "/" . sanitize_string($propal->ref); $filedir=$conf->propal->dir_output . "/" . sanitizeFileName($propal->ref);
$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id; $urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
$genallowed=$user->rights->propale->creer; $genallowed=$user->rights->propale->creer;
$delallowed=$user->rights->propale->supprimer; $delallowed=$user->rights->propale->supprimer;
@ -1806,7 +1806,7 @@ if ($_GET['propalid'] > 0)
*/ */
if ($_GET['action'] == 'presend') if ($_GET['action'] == 'presend')
{ {
$ref = sanitize_string($propal->ref); $ref = sanitizeFileName($propal->ref);
$file = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf';
print '<br>'; print '<br>';
@ -2003,8 +2003,8 @@ else
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($objp->ref); $filename=sanitizeFileName($objp->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref); $filedir=$conf->propal->dir_output . '/' . sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);

View File

@ -133,7 +133,7 @@ if ($_GET["propalid"] > 0)
/* /*
* Documents * Documents
*/ */
$propalref = sanitize_string($propal->ref); $propalref = sanitizeFileName($propal->ref);
$dir_output = $conf->propal->dir_output . "/"; $dir_output = $conf->propal->dir_output . "/";
$filepath = $dir_output . $propalref . "/"; $filepath = $dir_output . $propalref . "/";
$file = $filepath . $propalref . ".pdf"; $file = $filepath . $propalref . ".pdf";

View File

@ -72,7 +72,7 @@ if ($_POST["sendit"] && $conf->upload)
if ($propal->fetch($propalid)) if ($propal->fetch($propalid))
{ {
$upload_dir = $conf->propal->dir_output . "/" . sanitize_string($propal->ref); $upload_dir = $conf->propal->dir_output . "/" . sanitizeFileName($propal->ref);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@ -100,7 +100,7 @@ if ($action=='delete')
$propalid=$_GET["id"]; $propalid=$_GET["id"];
if ($propal->fetch($propalid)) if ($propal->fetch($propalid))
{ {
$upload_dir = $conf->propal->dir_output . "/" . sanitize_string($propal->ref); $upload_dir = $conf->propal->dir_output . "/" . sanitizeFileName($propal->ref);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@ -119,7 +119,7 @@ if ($propalid > 0)
$propal = new Propal($db); $propal = new Propal($db);
if ($propal->fetch($propalid)) if ($propal->fetch($propalid))
{ {
$upload_dir = $conf->propal->dir_output.'/'.sanitize_string($propal->ref); $upload_dir = $conf->propal->dir_output.'/'.sanitizeFileName($propal->ref);
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($propal->socid); $societe->fetch($propal->socid);

View File

@ -135,7 +135,7 @@ if ($_GET["id"] > 0) {
/* /*
* Documents * Documents
*/ */
$commanderef = sanitize_string($commande->ref); $commanderef = sanitizeFileName($commande->ref);
$dir_output = $conf->commande->dir_output . "/"; $dir_output = $conf->commande->dir_output . "/";
$filepath = $dir_output . $commanderef . "/"; $filepath = $dir_output . $commanderef . "/";
$file = $filepath . $commanderef . ".pdf"; $file = $filepath . $commanderef . ".pdf";

View File

@ -248,7 +248,7 @@ class Commande extends CommonObject
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
if (eregi('^\(PROV', $this->ref)) if (eregi('^\(PROV', $this->ref))
{ {
$comref = sanitize_string($this->ref); $comref = sanitizeFileName($this->ref);
if ($conf->commande->dir_output) if ($conf->commande->dir_output)
{ {
$dir = $conf->commande->dir_output . "/" . $comref ; $dir = $conf->commande->dir_output . "/" . $comref ;
@ -1752,7 +1752,7 @@ class Commande extends CommonObject
} }
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$comref = sanitize_string($this->ref); $comref = sanitizeFileName($this->ref);
if ($conf->commande->dir_output) if ($conf->commande->dir_output)
{ {
$dir = $conf->commande->dir_output . "/" . $comref ; $dir = $conf->commande->dir_output . "/" . $comref ;

View File

@ -74,7 +74,7 @@ if (!$commande->fetch($id)) {
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && $conf->upload) if ($_POST["sendit"] && $conf->upload)
{ {
$upload_dir = $conf->commande->dir_output . "/" . sanitize_string($commande->ref); $upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@ -96,7 +96,7 @@ if ($_POST["sendit"] && $conf->upload)
// Delete // Delete
if ($action=='delete') if ($action=='delete')
{ {
$upload_dir = $conf->commande->dir_output . "/" . sanitize_string($commande->ref); $upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@ -110,7 +110,7 @@ if ($id > 0)
{ {
llxHeader(); llxHeader();
$upload_dir = $conf->commande->dir_output.'/'.sanitize_string($commande->ref); $upload_dir = $conf->commande->dir_output.'/'.sanitizeFileName($commande->ref);
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($commande->socid); $societe->fetch($commande->socid);

View File

@ -676,7 +676,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
$result=$commande->fetch($_POST['orderid']); $result=$commande->fetch($_POST['orderid']);
if ($result) if ($result)
{ {
$ref = sanitize_string($commande->ref); $ref = sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (is_readable($file)) if (is_readable($file))
@ -1876,7 +1876,7 @@ else
{ {
if ($user->rights->commande->envoyer) if ($user->rights->commande->envoyer)
{ {
$comref = sanitize_string($commande->ref); $comref = sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf'; $file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
if (file_exists($file)) if (file_exists($file))
{ {
@ -1979,7 +1979,7 @@ else
* Documents generes * Documents generes
* *
*/ */
$comref = sanitize_string($commande->ref); $comref = sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref.'/'.$comref.'.pdf'; $relativepath = $comref.'/'.$comref.'.pdf';
$filedir = $conf->commande->dir_output . '/' . $comref; $filedir = $conf->commande->dir_output . '/' . $comref;
@ -2046,7 +2046,7 @@ else
*/ */
if ($_GET['action'] == 'presend') if ($_GET['action'] == 'presend')
{ {
$ref = sanitize_string($commande->ref); $ref = sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
print '<br>'; print '<br>';

View File

@ -147,8 +147,8 @@ if ( $db->query($sql) )
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($obj->ref); $filename=sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref); $filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@ -210,8 +210,8 @@ if ( $db->query($sql) )
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($obj->ref); $filename=sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref); $filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@ -276,8 +276,8 @@ if ($resql)
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($obj->ref); $filename=sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref); $filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -208,8 +208,8 @@ if ($resql)
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($objp->ref); $filename=sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($objp->ref); $filedir=$conf->commande->dir_output . '/' . sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -507,7 +507,7 @@ class CommonObject
{ {
if (! $this->table_element) if (! $this->table_element)
{ {
dolibarr_syslog("CommonObject::load_previous_next was called on objet with property table_element not defined",LOG_ERR); dolibarr_syslog("CommonObject::load_previous_next was called on objet with property table_element not defined", LOG_ERR);
return -1; return -1;
} }

View File

@ -42,7 +42,7 @@ if ($_POST["action"] == 'add')
// Creation compte // Creation compte
$account = new Account($db,0); $account = new Account($db,0);
$account->ref = sanitize_string(trim($_POST["ref"])); $account->ref = sanitizeFileName(trim($_POST["ref"]));
$account->label = trim($_POST["label"]); $account->label = trim($_POST["label"]);
$account->courant = $_POST["type"]; $account->courant = $_POST["type"];
$account->clos = $_POST["clos"]; $account->clos = $_POST["clos"];

View File

@ -503,7 +503,7 @@ if ($_GET["id"] > 0)
* Documents générés * Documents générés
* *
*/ */
$comref = sanitize_string($commande->ref); $comref = sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref.'/'.$comref.'.pdf'; $relativepath = $comref.'/'.$comref.'.pdf';
$filedir = $conf->commande->dir_output . '/' . $comref; $filedir = $conf->commande->dir_output . '/' . $comref;

View File

@ -146,8 +146,8 @@ if ($resql)
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($objp->ref); $filename=sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($objp->ref); $filedir=$conf->commande->dir_output . '/' . sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -422,7 +422,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
/* /*
* Documents générés * Documents générés
*/ */
$filename=sanitize_string($don->id); $filename=sanitizeFileName($don->id);
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2); $filedir=$conf->don->dir_output . '/' . get_exdir($filename,2);
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id; $urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id;
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer); // $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);

View File

@ -1069,7 +1069,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
$result=$fac->fetch($_POST['facid']); $result=$fac->fetch($_POST['facid']);
if ($result) if ($result)
{ {
$ref = sanitize_string($fac->ref); $ref = sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (is_readable($file)) if (is_readable($file))
@ -2996,8 +2996,8 @@ else
/* /*
* Documents générés * Documents générés
*/ */
$filename=sanitize_string($fac->ref); $filename=sanitizeFileName($fac->ref);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref); $filedir=$conf->facture->dir_output . '/' . sanitizeFileName($fac->ref);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
$genallowed=$user->rights->facture->creer; $genallowed=$user->rights->facture->creer;
$delallowed=$user->rights->facture->supprimer; $delallowed=$user->rights->facture->supprimer;
@ -3132,7 +3132,7 @@ else
*/ */
if ($_GET['action'] == 'presend') if ($_GET['action'] == 'presend')
{ {
$ref = sanitize_string($fac->ref); $ref = sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
// Construit PDF si non existant // Construit PDF si non existant
@ -3198,7 +3198,7 @@ else
if ($_GET['action'] == 'prerelance') if ($_GET['action'] == 'prerelance')
{ {
$ref = sanitize_string($fac->ref); $ref = sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
// Construit PDF si non existant // Construit PDF si non existant
@ -3442,8 +3442,8 @@ else
print '</td>'; print '</td>';
} }
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($objp->facnumber); $filename=sanitizeFileName($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber); $filedir=$conf->facture->dir_output . '/' . sanitizeFileName($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
print '</td>'; print '</td>';

View File

@ -129,7 +129,7 @@ if ($_GET["facid"] > 0)
/* /*
* Documents * Documents
*/ */
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($fac->ref);
$dir_output = $conf->facture->dir_output . "/"; $dir_output = $conf->facture->dir_output . "/";
$filepath = $dir_output . $facref . "/"; $filepath = $dir_output . $facref . "/";
$file = $filepath . $facref . ".pdf"; $file = $filepath . $facref . ".pdf";

View File

@ -73,7 +73,7 @@ if ($_POST["sendit"] && $conf->upload)
$facture = new Facture($db); $facture = new Facture($db);
if ($facture->fetch($facid)) if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output . "/" . sanitize_string($facture->ref); $upload_dir = $conf->facture->dir_output . "/" . sanitizeFileName($facture->ref);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@ -101,7 +101,7 @@ if ($action=='delete')
$facid=$_GET["id"]; $facid=$_GET["id"];
if ($facture->fetch($facid)) if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output . "/" . sanitize_string($facture->ref); $upload_dir = $conf->facture->dir_output . "/" . sanitizeFileName($facture->ref);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@ -119,7 +119,7 @@ if ($facid > 0)
$facture = new Facture($db); $facture = new Facture($db);
if ($facture->fetch($facid)) if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output.'/'.sanitize_string($facture->ref); $upload_dir = $conf->facture->dir_output.'/'.sanitizeFileName($facture->ref);
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($facture->socid); $societe->fetch($facture->socid);

View File

@ -92,8 +92,8 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
create_exdir($diroutputpdf); create_exdir($diroutputpdf);
// enregistre le fichier pdf concatene // enregistre le fichier pdf concatene
$filename=sanitize_string(strtolower($langs->transnoentities("Unpayed"))); $filename=sanitizeFileName(strtolower($langs->transnoentities("Unpayed")));
if ($option=='late') $filename.='_'.sanitize_string(strtolower($langs->transnoentities("Late"))); if ($option=='late') $filename.='_'.sanitizeFileName(strtolower($langs->transnoentities("Late")));
if ($pagecount) if ($pagecount)
{ {
$file=$diroutputpdf.'/'.$filename.'_'.dolibarr_print_date(mktime(),'dayhourlog').'.pdf'; $file=$diroutputpdf.'/'.$filename.'_'.dolibarr_print_date(mktime(),'dayhourlog').'.pdf';
@ -316,8 +316,8 @@ if ($result)
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($objp->facnumber); $filename=sanitizeFileName($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber); $filedir=$conf->facture->dir_output . '/' . sanitizeFileName($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);

View File

@ -519,8 +519,8 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($obj->ref); $filename=sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitize_string($obj->ref); $filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@ -614,8 +614,8 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late")); if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($obj->facnumber); $filename=sanitizeFileName($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . sanitizeFileName($obj->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -488,8 +488,8 @@ if ($_GET["propalid"] > 0)
/* /*
* Documents g<EFBFBD>n<EFBFBD>r<EFBFBD>s * Documents g<EFBFBD>n<EFBFBD>r<EFBFBD>s
*/ */
$filename=sanitize_string($propal->ref); $filename=sanitizeFileName($propal->ref);
$filedir=$conf->propal->dir_output . "/" . sanitize_string($propal->ref); $filedir=$conf->propal->dir_output . "/" . sanitizeFileName($propal->ref);
$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id; $urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
$genallowed=0; $genallowed=0;
$delallowed=0; $delallowed=0;
@ -758,8 +758,8 @@ else
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($objp->ref); $filename=sanitizeFileName($objp->ref);
$filedir=$conf->propal->dir_output . '/' . sanitize_string($objp->ref); $filedir=$conf->propal->dir_output . '/' . sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);

View File

@ -85,8 +85,8 @@ $db->close();
$output = $v->getVCard(); $output = $v->getVCard();
$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
$filenameurlencoded = sanitize_string(urlencode($filename)); $filenameurlencoded = sanitizeFileName(urlencode($filename));
//$filename = sanitize_string($filename); //$filename = sanitizeFileName($filename);
Header("Content-Disposition: attachment; filename=\"$filename\""); Header("Content-Disposition: attachment; filename=\"$filename\"");
Header("Content-Length: ".strlen($output)); Header("Content-Length: ".strlen($output));

View File

@ -63,7 +63,7 @@ $pagenext = $page + 1;
$contrat = new Contrat($db); $contrat = new Contrat($db);
$contrat->fetch($_GET["id"]); $contrat->fetch($_GET["id"]);
$upload_dir = $conf->contrat->dir_output.'/'.sanitize_string($contrat->ref); $upload_dir = $conf->contrat->dir_output.'/'.sanitizeFileName($contrat->ref);
$modulepart='contract'; $modulepart='contract';

View File

@ -75,7 +75,7 @@ class EcmDirectory // extends CommonObject
$now=time(); $now=time();
// Clean parameters // Clean parameters
$this->label=sanitize_string($this->label); $this->label=sanitizeFileName($this->label);
$this->fk_parent=trim($this->fk_parent); $this->fk_parent=trim($this->fk_parent);
$this->description=trim($this->description); $this->description=trim($this->description);
if (! $this->cachenbofdoc) $this->cachenbofdoc=0; if (! $this->cachenbofdoc) $this->cachenbofdoc=0;
@ -422,7 +422,7 @@ class EcmDirectory // extends CommonObject
if ($cursorindex >= 0) if ($cursorindex >= 0)
{ {
// Path is label sanitized (no space and no special char) and concatenated // Path is label sanitized (no space and no special char) and concatenated
$ret=sanitize_string($this->cats[$cursorindex]['label']).'/'.$ret; $ret=sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
$idtosearch=$this->cats[$cursorindex]['id_mere']; $idtosearch=$this->cats[$cursorindex]['id_mere'];
$i++; $i++;

View File

@ -84,8 +84,8 @@ class Expedition extends CommonObject
$this->user = $user; $this->user = $user;
$this->expedition_method = sanitize_string($this->expedition_method); $this->expedition_method = sanitizeFileName($this->expedition_method);
$this->tracking_number = sanitize_string($this->tracking_number); $this->tracking_number = sanitizeFileName($this->tracking_number);
$this->db->begin(); $this->db->begin();
@ -386,7 +386,7 @@ class Expedition extends CommonObject
} }
// On efface le répertoire de pdf provisoire // On efface le répertoire de pdf provisoire
$expeditionref = sanitize_string($provref); $expeditionref = sanitizeFileName($provref);
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$dir = $conf->expedition->dir_output . "/" . $expeditionref; $dir = $conf->expedition->dir_output . "/" . $expeditionref;
@ -517,7 +517,7 @@ class Expedition extends CommonObject
$this->db->commit(); $this->db->commit();
// On efface le répertoire de pdf provisoire // On efface le répertoire de pdf provisoire
$expref = sanitize_string($this->ref); $expref = sanitizeFileName($this->ref);
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$dir = $conf->expedition->dir_output . "/" . $expref ; $dir = $conf->expedition->dir_output . "/" . $expref ;

View File

@ -736,7 +736,7 @@ else
*/ */
if ($conf->expedition_bon->enabled) if ($conf->expedition_bon->enabled)
{ {
$expeditionref = sanitize_string($expedition->ref); $expeditionref = sanitizeFileName($expedition->ref);
$filedir = $conf->expedition_bon->dir_output . "/" .$expeditionref; $filedir = $conf->expedition_bon->dir_output . "/" .$expeditionref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$expedition->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$expedition->id;

View File

@ -1114,8 +1114,8 @@ class Facture extends CommonObject
{ {
// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref) // On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
// afin de ne pas perdre les fichiers attachés // afin de ne pas perdre les fichiers attachés
$facref = sanitize_string($this->ref); $facref = sanitizeFileName($this->ref);
$snumfa = sanitize_string($numfa); $snumfa = sanitizeFileName($numfa);
$dirsource = $conf->facture->dir_output.'/'.$facref; $dirsource = $conf->facture->dir_output.'/'.$facref;
$dirdest = $conf->facture->dir_output.'/'.$snumfa; $dirdest = $conf->facture->dir_output.'/'.$snumfa;
if (file_exists($dirsource)) if (file_exists($dirsource))

View File

@ -109,7 +109,7 @@ if ($_GET["id"] > 0) {
/* /*
* Documents * Documents
*/ */
$fichinterref = sanitize_string($fichinter->ref); $fichinterref = sanitizeFileName($fichinter->ref);
$dir_output = $conf->fichinter->dir_output . "/"; $dir_output = $conf->fichinter->dir_output . "/";
$filepath = $dir_output . $fichinterref . "/"; $filepath = $dir_output . $fichinterref . "/";
$file = $filepath . $fichinterref . ".pdf"; $file = $filepath . $fichinterref . ".pdf";

View File

@ -888,9 +888,9 @@ elseif ($_GET["id"] > 0)
print '<table width="100%"><tr><td width="50%" valign="top">'; print '<table width="100%"><tr><td width="50%" valign="top">';
/* /*
* Documents g<EFBFBD>n<EFBFBD>r<EFBFBD>s * Built documents
*/ */
$filename=sanitize_string($fichinter->ref); $filename=sanitizeFileName($fichinter->ref);
$filedir=$conf->fichinter->dir_output . "/".$fichinter->ref; $filedir=$conf->fichinter->dir_output . "/".$fichinter->ref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id; $urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id;
$genallowed=$user->rights->ficheinter->creer; $genallowed=$user->rights->ficheinter->creer;

View File

@ -461,7 +461,7 @@ class Fichinter extends CommonObject
{ {
// Remove directory with files // Remove directory with files
$fichinterref = sanitize_string($this->ref); $fichinterref = sanitizeFileName($this->ref);
if ($conf->fichinter->dir_output) if ($conf->fichinter->dir_output)
{ {
$dir = $conf->fichinter->dir_output . "/" . $fichinterref ; $dir = $conf->fichinter->dir_output . "/" . $fichinterref ;

View File

@ -973,7 +973,7 @@ if ($id > 0)
* Documents generes * Documents generes
* *
*/ */
$comfournref = sanitize_string($commande->ref); $comfournref = sanitizeFileName($commande->ref);
$file = $conf->fournisseur->commande->dir_output . '/' . $comfournref . '/' . $comfournref . '.pdf'; $file = $conf->fournisseur->commande->dir_output . '/' . $comfournref . '/' . $comfournref . '.pdf';
$relativepath = $comfournref.'/'.$comfournref.'.pdf'; $relativepath = $comfournref.'/'.$comfournref.'.pdf';
$filedir = $conf->fournisseur->commande->dir_output . '/' . $comfournref; $filedir = $conf->fournisseur->commande->dir_output . '/' . $comfournref;

View File

@ -212,7 +212,7 @@ function supplier_order_delete_preview($db, $propalid)
if ($conf->fournisseur->commande->dir_output) if ($conf->fournisseur->commande->dir_output)
{ {
$comfournref = sanitize_string($comfourn->ref); $comfournref = sanitizeFileName($comfourn->ref);
$dir = $conf->commande->dir_output . "/" . $comfournref ; $dir = $conf->commande->dir_output . "/" . $comfournref ;
$file = $dir . "/" . $comfournref . ".pdf.png"; $file = $dir . "/" . $comfournref . ".pdf.png";

View File

@ -142,7 +142,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
} }
else else
{ {
$comref = sanitize_string($com->ref); $comref = sanitizeFileName($com->ref);
$dir = $conf->fournisseur->commande->dir_output . "/" . $comref; $dir = $conf->fournisseur->commande->dir_output . "/" . $comref;
$file = $dir . "/" . $comref . ".pdf"; $file = $dir . "/" . $comref . ".pdf";
} }

View File

@ -2991,7 +2991,8 @@ class Form
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL * \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
* \param morehtml Code html supplementaire a afficher avant barre nav * \param morehtml Code html supplementaire a afficher avant barre nav
* \param shownav Show Condition * \param shownav Show Condition
* \param fieldid Nom du champ a utiliser pour select next et previous * \param fieldid Nom du champ id a utiliser pour select next et previous
* \param fieldref Nom du champ ref a utiliser pour select next et previous
* \return string Portion HTML avec ref + boutons nav * \return string Portion HTML avec ref + boutons nav
*/ */
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref') function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref')

View File

@ -142,7 +142,7 @@ class FormFile
$forcenomultilang=0; $forcenomultilang=0;
} }
$filename = sanitize_string($filename); $filename = sanitizeFileName($filename);
$headershown=0; $headershown=0;
$i=0; $i=0;
@ -418,7 +418,7 @@ class FormFile
// Define relative path used to store the file // Define relative path used to store the file
if (! $relativepath) if (! $relativepath)
{ {
$relativepath=sanitize_string($object->ref).'/'; $relativepath=sanitizeFileName($object->ref).'/';
if ($modulepart == 'facture_fournisseur') $relativepath=get_exdir($object->id,2).$relativepath; if ($modulepart == 'facture_fournisseur') $relativepath=get_exdir($object->id,2).$relativepath;
} }

View File

@ -249,7 +249,7 @@ function commande_delete_preview($db, $commandeid, $commanderef='')
if ($conf->commande->dir_output) if ($conf->commande->dir_output)
{ {
$comref = sanitize_string($commanderef); $comref = sanitizeFileName($commanderef);
$dir = $conf->commande->dir_output . "/" . $comref ; $dir = $conf->commande->dir_output . "/" . $comref ;
$file = $dir . "/" . $comref . ".pdf.png"; $file = $dir . "/" . $comref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";

View File

@ -117,7 +117,7 @@ class pdf_edison extends ModelePDFCommandes
} }
else else
{ {
$comref = sanitize_string($com->ref); $comref = sanitizeFileName($com->ref);
$dir = $conf->commande->dir_output . "/" . $comref; $dir = $conf->commande->dir_output . "/" . $comref;
$file = $dir . "/" . $comref . ".pdf"; $file = $dir . "/" . $comref . ".pdf";
} }

View File

@ -140,7 +140,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
else else
{ {
$comref = sanitize_string($com->ref); $comref = sanitizeFileName($com->ref);
$dir = $conf->commande->dir_output . "/" . $comref; $dir = $conf->commande->dir_output . "/" . $comref;
$file = $dir . "/" . $comref . ".pdf"; $file = $dir . "/" . $comref . ".pdf";
} }

View File

@ -89,7 +89,7 @@ class html_cerfafr extends ModeleDon
} }
else else
{ {
$donref = sanitize_string($don->ref); $donref = sanitizeFileName($don->ref);
$dir = $conf->don->dir_output . "/" . get_exdir($donref,2); $dir = $conf->don->dir_output . "/" . get_exdir($donref,2);
$file = $dir . "/" . $donref . ".html"; $file = $dir . "/" . $donref . ".html";
} }

View File

@ -124,7 +124,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
} }
else else
{ {
$expref = sanitize_string($this->expe->ref); $expref = sanitizeFileName($this->expe->ref);
$dir = $conf->expedition_bon->dir_output . "/" . $expref; $dir = $conf->expedition_bon->dir_output . "/" . $expref;
$file = $dir . "/" . $expref . ".pdf"; $file = $dir . "/" . $expref . ".pdf";
} }

View File

@ -144,7 +144,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
} }
else else
{ {
$expref = sanitize_string($this->expe->ref); $expref = sanitizeFileName($this->expe->ref);
$dir = $conf->expedition_bon->dir_output . "/" . $expref; $dir = $conf->expedition_bon->dir_output . "/" . $expref;
$file = $dir . "/" . $expref . ".pdf"; $file = $dir . "/" . $expref . ".pdf";
} }

View File

@ -237,7 +237,7 @@ function facture_meta_create($db, $facid, $message="")
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref ; $dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".meta"; $file = $dir . "/" . $facref . ".meta";
@ -291,7 +291,7 @@ function facture_delete_preview($db, $facid)
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref ; $dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".pdf.png"; $file = $dir . "/" . $facref . ".pdf.png";

View File

@ -142,7 +142,7 @@ class pdf_crabe extends ModelePDFFactures
} }
else else
{ {
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref; $dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".pdf"; $file = $dir . "/" . $facref . ".pdf";
} }

View File

@ -122,7 +122,7 @@ class pdf_huitre extends ModelePDFFactures
} }
else else
{ {
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref; $dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".pdf"; $file = $dir . "/" . $facref . ".pdf";
} }

View File

@ -130,7 +130,7 @@ class pdf_oursin extends ModelePDFFactures
} }
else else
{ {
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref; $dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".pdf"; $file = $dir . "/" . $facref . ".pdf";
} }

View File

@ -234,7 +234,7 @@ function fichinter_delete_preview($db, $fichinterid, $fichinterref='')
if ($conf->fichinter->dir_output) if ($conf->fichinter->dir_output)
{ {
$fichinterref = sanitize_string($fichinterref); $fichinterref = sanitizeFileName($fichinterref);
$dir = $conf->fichinter->dir_output . "/" . $fichinterref ; $dir = $conf->fichinter->dir_output . "/" . $fichinterref ;
$file = $dir . "/" . $fichinterref . ".pdf.png"; $file = $dir . "/" . $fichinterref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";

View File

@ -107,7 +107,7 @@ class pdf_soleil extends ModelePDFFicheinter
} }
} }
$fichref = sanitize_string($fichinter->ref); $fichref = sanitizeFileName($fichinter->ref);
$dir = $conf->fichinter->dir_output; $dir = $conf->fichinter->dir_output;
if (! eregi('specimen',$fichref)) $dir.= "/" . $fichref; if (! eregi('specimen',$fichref)) $dir.= "/" . $fichref;
$file = $dir . "/" . $fichref . ".pdf"; $file = $dir . "/" . $fichref . ".pdf";

View File

@ -217,7 +217,7 @@ function delivery_order_delete_preview($db, $deliveryid)
if ($conf->livraison->dir_output) if ($conf->livraison->dir_output)
{ {
$deliveryref = sanitize_string($delivery->ref); $deliveryref = sanitizeFileName($delivery->ref);
$dir = $conf->livraison->dir_output . "/" . $deliveryref ; $dir = $conf->livraison->dir_output . "/" . $deliveryref ;
$file = $dir . "/" . $deliveryref . ".pdf.png"; $file = $dir . "/" . $deliveryref . ".pdf.png";

View File

@ -115,7 +115,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
} }
} }
$deliveryref = sanitize_string($delivery->ref); $deliveryref = sanitizeFileName($delivery->ref);
$dir = $conf->livraison_bon->dir_output; $dir = $conf->livraison_bon->dir_output;
if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref; if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
$file = $dir . "/" . $deliveryref . ".pdf"; $file = $dir . "/" . $deliveryref . ".pdf";

View File

@ -142,7 +142,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$nblignes = sizeof($delivery->lignes); $nblignes = sizeof($delivery->lignes);
$deliveryref = sanitize_string($delivery->ref); $deliveryref = sanitizeFileName($delivery->ref);
$dir = $conf->livraison_bon->dir_output; $dir = $conf->livraison_bon->dir_output;
if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref; if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
$file = $dir . "/" . $deliveryref . ".pdf"; $file = $dir . "/" . $deliveryref . ".pdf";

View File

@ -246,7 +246,7 @@ function propale_delete_preview($db, $propalid, $propalref='')
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
$propalref = sanitize_string($propalref); $propalref = sanitizeFileName($propalref);
$dir = $conf->propal->dir_output . "/" . $propalref ; $dir = $conf->propal->dir_output . "/" . $propalref ;
$file = $dir . "/" . $propalref . ".pdf.png"; $file = $dir . "/" . $propalref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";

View File

@ -140,7 +140,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
else else
{ {
$propref = sanitize_string($propale->ref); $propref = sanitizeFileName($propale->ref);
$dir = $conf->propal->dir_output . "/" . $propref; $dir = $conf->propal->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }

View File

@ -124,7 +124,7 @@ class pdf_propale_jaune extends ModelePDFPropales
} }
else else
{ {
$propref = sanitize_string($propale->ref); $propref = sanitizeFileName($propale->ref);
$dir = $conf->propal->dir_output . "/" . $propref; $dir = $conf->propal->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }

View File

@ -106,7 +106,7 @@ class InterfaceNotification
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 2; $action_notify = 2;
$ref = sanitize_string($object->ref); $ref = sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La facture '.$object->ref." a été validée.\n"; $mesg = 'La facture '.$object->ref." a été validée.\n";
@ -119,7 +119,7 @@ class InterfaceNotification
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 1; $action_notify = 1;
$ref = sanitize_string($object->ref); $ref = sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La fiche intervention '.$object->ref." a été validée.\n"; $mesg = 'La fiche intervention '.$object->ref." a été validée.\n";
@ -132,7 +132,7 @@ class InterfaceNotification
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 3; $action_notify = 3;
$ref = sanitize_string($object->ref); $ref = sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La commande fournisseur '.$object->ref." a été validée.\n"; $mesg = 'La commande fournisseur '.$object->ref." a été validée.\n";

View File

@ -75,29 +75,26 @@ function check_mail ($mail)
} }
/** /**
\brief Nettoie chaine de caractere iso des accents \brief Nettoie chaine de caractere des accents
\param str Chaine a nettoyer \param str Chaine a nettoyer
\return string Chaine nettoyee \return string Chaine nettoyee
*/ */
function unaccent_isostring($str) function unaccent_isostring($str)
{ {
$translation = array( if (utf8_check($str))
"\xE0" => "a", {
"\xE1" => "a", // TODO add utf8 convertion
"\xE2" => "a", $translationutf=array( );
"\xE8" => "e", return str_replace(array_keys($translationutf), array_values($translationutf), $str);
"\xE9" => "e", }
"\xEA" => "e", else
"\xEB" => "e", {
"\xEE" => "i", $translationiso=array( "\xE0" => "a", "\xE1" => "a", "\xE2" => "a",
"\xEF" => "i", "\xE8" => "e", "\xE9" => "e", "\xEA" => "e", "\xEB" => "e",
"\xF4" => "o", "\xEE" => "i", "\xEF" => "i",
"\xF6" => "o", "\xF4" => "o", "\xF6" => "o", "\xFB" => "u", "\xFC" => "u");
"\xFB" => "u", return str_replace(array_keys($translationiso), array_values($translationiso), $str);
"\xFC" => "u" }
);
return str_replace(array_keys($translation), array_values($translation), $str);
} }
/** /**
@ -116,6 +113,17 @@ function sanitize_string($str,$newstr='_')
return str_replace($forbidden_chars_to_underscore,$newstr,str_replace($forbidden_chars_to_remove,"",$str)); return str_replace($forbidden_chars_to_underscore,$newstr,str_replace($forbidden_chars_to_remove,"",$str));
} }
/**
* \brief Nettoie chaine de caractere de ces caracteres speciaux
* \remarks Fonction appelee par exemple pour definir un nom de fichier depuis un identifiant chaine libre
* \param str String to clean
* \param newstr String to replace bad chars by
* \return string String cleaned (a-zA-Z_)
*/
function sanitizeFileName($str,$newstr='_')
{
return sanitize_string(unaccent_isostring($str,$newstr));
}
/** /**
* \brief Returns text escaped for inclusion in javascript code * \brief Returns text escaped for inclusion in javascript code

View File

@ -565,7 +565,7 @@ else
* Documents generated * Documents generated
*/ */
$livraisonref = sanitize_string($livraison->ref); $livraisonref = sanitizeFileName($livraison->ref);
$filedir = $conf->livraison_bon->dir_output . '/' . $livraisonref; $filedir = $conf->livraison_bon->dir_output . '/' . $livraisonref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;

View File

@ -422,7 +422,7 @@ class Livraison extends CommonObject
} }
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$livraisonref = sanitize_string($this->ref); $livraisonref = sanitizeFileName($this->ref);
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$dir = $conf->livraison->dir_output . "/" . $livraisonref ; $dir = $conf->livraison->dir_output . "/" . $livraisonref ;
@ -561,7 +561,7 @@ class Livraison extends CommonObject
$this->db->commit(); $this->db->commit();
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$livref = sanitize_string($this->ref); $livref = sanitizeFileName($this->ref);
if ($conf->livraison->dir_output) if ($conf->livraison->dir_output)
{ {
$dir = $conf->livraison->dir_output . "/" . $livref ; $dir = $conf->livraison->dir_output . "/" . $livref ;

View File

@ -131,7 +131,7 @@ class Product extends CommonObject
*/ */
function check() function check()
{ {
$this->ref = sanitize_string(stripslashes($this->ref)); $this->ref = sanitizeFileName(stripslashes($this->ref));
$err = 0; $err = 0;
if (strlen(trim($this->ref)) == 0) if (strlen(trim($this->ref)) == 0)

View File

@ -68,7 +68,7 @@ if ($_GET['id'] || $_GET["ref"])
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]); if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
$upload_dir = $conf->produit->dir_output.'/'.sanitize_string($product->ref); $upload_dir = $conf->produit->dir_output.'/'.sanitizeFileName($product->ref);
} }
$modulepart='produit'; $modulepart='produit';

View File

@ -1418,7 +1418,7 @@ class Propal extends CommonObject
{ {
// On efface le r<>pertoire du pdf // On efface le r<>pertoire du pdf
$propalref = sanitize_string($this->ref); $propalref = sanitizeFileName($this->ref);
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
$dir = $conf->propal->dir_output . "/" . $propalref ; $dir = $conf->propal->dir_output . "/" . $propalref ;

View File

@ -23,18 +23,18 @@
*/ */
/** /**
\file htdocs/societe.class.php * \file htdocs/societe.class.php
\ingroup societe * \ingroup societe
\brief Fichier de la classe des societes * \brief Fichier de la classe des societes
\version $Id$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
/** /**
\class Societe * \class Societe
\brief Classe permettant la gestion des societes * \brief Classe permettant la gestion des societes
*/ */
class Societe extends CommonObject class Societe extends CommonObject
{ {
@ -336,7 +336,7 @@ class Societe extends CommonObject
$this->prefix_comm=trim($this->prefix_comm); $this->prefix_comm=trim($this->prefix_comm);
$this->tva_assuj=trim($this->tva_assuj); $this->tva_assuj=trim($this->tva_assuj);
$this->tva_intra=sanitize_string($this->tva_intra,''); $this->tva_intra=sanitizeFileName($this->tva_intra,'');
$this->capital=trim($this->capital); $this->capital=trim($this->capital);
if (strlen($this->capital) == 0) $this->capital = 0; if (strlen($this->capital) == 0) $this->capital = 0;

View File

@ -62,7 +62,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"]) )
{ {
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($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))
@ -497,7 +497,7 @@ if ($_GET["facid"] > 0)
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
*/ */
$facref = sanitize_string($fac->ref); $facref = sanitizeFileName($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";