diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 44eb15e8ace71513fe6bd09fe956d10eb517b490..c689d0f35019380a2e6f40a4da1cb727e90bd894 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -27,6 +27,7 @@ */ require_once("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/action/rapport.pdf.php"); @@ -121,8 +122,8 @@ if ($resql) if (file_exists($file)) { print '<td align="center"><a href="'.DOL_URL_ROOT.'/document.php?page='.$page.'&file='.urlencode($relativepath).'&modulepart=actionsreport">'.img_pdf().'</a></td>'; - print '<td align="center">'.dol_print_date(filemtime($file),'dayhour').'</td>'; - print '<td align="center">'.filesize($file). ' '.$langs->trans("Bytes").'</td>'; + print '<td align="center">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>'; + print '<td align="center">'.dol_print_size(dol_filesize($file)).'</td>'; } else { print '<td> </td>'; diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index 9583c6852ab36929b17073f2594b0df085120684..afb33a55610e2f6f4486f14874ea53040abef3bc 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -158,17 +158,17 @@ if ($_GET["propalid"] > 0) print "<tr $bc[$var]><td>".$langs->trans("Propal")." PDF</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$propal->ref.'.pdf</a></td>'; - print '<td align="right">'.filesize($file). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($file),'dayhour').'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>'; print '</tr>'; // Si fichier detail PDF existe if (file_exists($filedetail)) { // propal d�taill�e suppl�mentaire - print "<tr $bc[$var]><td>Propal d�taill�e</td>"; + print "<tr $bc[$var]><td>Propal detaillee</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepathdetail).'">'.$propal->ref.'-detail.pdf</a></td>'; - print '<td align="right">'.filesize($filedetail). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($filedetail),'dayhour').'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>'; print '</tr>'; } print "</table>\n"; diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index 1f683eac1d3424b1741e51b21349a44aa5caecf1..c910c6f9e1edd70a77e5381e124bb2472201a078 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -153,17 +153,17 @@ if ($_GET["id"] > 0) { print "<tr $bc[$var]><td>".$langs->trans("Order")." PDF</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>'; - print '<td align="right">'.filesize($file). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($file),'dayhour').'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>'; print '</tr>'; // Si fichier detail PDF existe if (file_exists($filedetail)) { // commande d�taill�e suppl�mentaire - print "<tr $bc[$var]><td>Commande d�taill�e</td>"; + print "<tr $bc[$var]><td>Commande detaillee</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=commande&file='.urlencode($relativepathdetail).'">'.$commande->ref.'-detail.pdf</a></td>'; - print '<td align="right">'.filesize($filedetail). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($filedetail),'dayhour').'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>'; print '</tr>'; } print "</table>\n"; diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 3352f2bd390a5db61b49fd9f0402e2acc0864ea0..a892f162fc25d0486dffb7441395a1388e3e513d 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -163,18 +163,18 @@ if ($_GET["facid"] > 0) print "<tr $bc[$var]><td>".$langs->trans("Bill")." PDF</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepath).'">'.$fac->ref.'.pdf</a></td>'; - print '<td align="right">'.filesize($file). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($file),'dayhour').'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($file)). '</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>'; print '</tr>'; // Si fichier detail PDF existe - if (file_exists($filedetail)) // facture d�taill�e suppl�mentaire + if (file_exists($filedetail)) // facture detaillee supplementaire { print "<tr $bc[$var]><td>Facture d�taill�e</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$fac->ref.'-detail.pdf</a></td>'; - print '<td align="right">'.filesize($filedetail). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($filedetail),"%d %b %Y %H:%M:%S").'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>'; print '</tr>'; } diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 849ed02273b883becc57ce21e6836c2cae5b9c1a..621da00f1f087d60f9228fffe79c29f24cc6b4a5 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -171,8 +171,8 @@ if ($year) $tfile = $dir . '/'.$year.'/'.$file; $relativepath = $year.'/'.$file; print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>'; - print '<td align="right">'.filesize($tfile). ' '.$langs->trans("Bytes").'</td>'; - print '<td align="right">'.dol_print_date(filemtime($tfile),"dayhour").'</td></tr>'; + print '<td align="right">'.dol_print_size(dol_filesize($tfile)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($tfile),"dayhour").'</td></tr>'; } } print '</table>'; diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php index b1b3af01782a250fb6650121384f28d6e9a00bf1..f78e37b684498eee16da12d512cbebabd5aa48e5 100644 --- a/htdocs/ecm/docother.php +++ b/htdocs/ecm/docother.php @@ -125,8 +125,8 @@ if ($handle) if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { $filearray[$i]->name=$file; - $filearray[$i]->size=filesize($upload_dir."/".$file); - $filearray[$i]->date=filemtime($upload_dir."/".$file); + $filearray[$i]->size=dol_filesize($upload_dir."/".$file); + $filearray[$i]->date=dol_filemtime($upload_dir."/".$file); $totalsize+=$filearray[$i]->size; $i++; } diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php index 80035237ef97e48845177174c5f91f347926bbb9..d8e318aef0aea2dfa2608e2903eb884df7e817d2 100644 --- a/htdocs/fichinter/apercu.php +++ b/htdocs/fichinter/apercu.php @@ -24,7 +24,7 @@ /** \file htdocs/fichinter/apercu.php \ingroup fichinter - \brief Page de l'onglet aper�u d'une fiche d'intervention + \brief Page de l'onglet aper�u d'une fiche d'intervention \version $Revision$ */ @@ -107,7 +107,7 @@ if ($_GET["id"] > 0) { $relativepath = "${fichinterref}/${fichinterref}.pdf"; $relativepathdetail = "${fichinterref}/${fichinterref}-detail.pdf"; - // Chemin vers png aper�us + // Chemin vers png aper�us $relativepathimage = "${fichinterref}/${fichinterref}.pdf.png"; $fileimage = $file.".png"; // Si PDF d'1 page $fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page @@ -124,17 +124,17 @@ if ($_GET["id"] > 0) { print "<tr $bc[$var]><td>".$langs->trans("Intervention")." PDF</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepath).'">'.$fichinter->ref.'.pdf</a></td>'; - print '<td align="right">'.filesize($file). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($file),'dayhour').'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>'; print '</tr>'; // Si fichier detail PDF existe - if (file_exists($filedetail)) { // fichinter d�taill�e suppl�mentaire - print "<tr $bc[$var]><td>Fiche d'intervention d�taill�e</td>"; + if (file_exists($filedetail)) { // fichinter d�taill�e suppl�mentaire + print "<tr $bc[$var]><td>Fiche d'intervention d�taill�e</td>"; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepathdetail).'">'.$fichinter->ref.'-detail.pdf</a></td>'; - print '<td align="right">'.filesize($filedetail). ' bytes</td>'; - print '<td align="right">'.dol_print_date(filemtime($filedetail),'dayhour').'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>'; print '</tr>'; } print "</table>\n"; @@ -193,17 +193,17 @@ if ($_GET["id"] > 0) { dol_print_error($db); } } else { - // Intervention non trouv�e + // Intervention non trouv�e print $langs->trans("ErrorFichinterNotFound",$_GET["id"]); } } -// Si fichier png PDF d'1 page trouv� +// Si fichier png PDF d'1 page trouv� if (file_exists($fileimage)) { print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufichinter&file='.urlencode($relativepathimage).'">'; } -// Si fichier png PDF de plus d'1 page trouv� +// Si fichier png PDF de plus d'1 page trouv� elseif (file_exists($fileimagebis)) { $multiple = $relativepathimage . "."; diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php index a9085f32d3c627c63fee15db66b864b59387bfea..43bdb11974bd536b3c5808226d8311e84e615a81 100644 --- a/htdocs/html.formfile.class.php +++ b/htdocs/html.formfile.class.php @@ -376,9 +376,9 @@ class FormFile print '</a>'; if (!$iconPDF) print '</td>'; // Affiche taille fichier - if (!$iconPDF) print '<td align="right">'.dol_print_size(filesize($filedir."/".$file["name"])).'</td>'; + if (!$iconPDF) print '<td align="right">'.dol_print_size(dol_filesize($filedir."/".$file["name"])).'</td>'; // Affiche date fichier - if (!$iconPDF) print '<td align="right">'.dol_print_date(filemtime($filedir."/".$file["name"]),'dayhour').'</td>'; + if (!$iconPDF) print '<td align="right">'.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').'</td>'; if ($delallowed) { diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 299d51f0192e9bc3e1378695c4beb35095098d36..fe4edd12cb505022705f7321eb04f27149b9dceb 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -561,9 +561,9 @@ if ($step == 3 && $datatoimport) print '<td width="16">'.img_mime($file).'</td>'; print '<td>'.$file.'</td>'; // Affiche taille fichier - print '<td align="right">'.dol_print_size(filesize($newdir.'/'.$newfile)).'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($newdir.'/'.$newfile)).'</td>'; // Affiche date fichier - print '<td align="right">'.dol_print_date(filemtime($newdir.'/'.$newfile),'dayhour').'</td>'; + print '<td align="right">'.dol_print_date(dol_filemtime($newdir.'/'.$newfile),'dayhour').'</td>'; // Del button print '<td align="right"><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&step=3&format='.$format.'&modulepart='.$modulepart.'&file='.urlencode($relativepath); print '&urlsource='.urlencode($urlsource); @@ -621,6 +621,8 @@ if ($step == 4 && $datatoimport) $maxpos=max(sizeof($fieldssource),sizeof($fieldstarget)); + //var_dump($array_match_file_to_database); + // Is it a first time in page if (sizeof($array_match_file_to_database) == 0) { @@ -631,7 +633,7 @@ if ($step == 4 && $datatoimport) $pos=1; while ($pos <= sizeof($fieldssource)) { - if (sizeof($fieldssource) > 1 && $pos <= sizeof($fieldssource)) + if (sizeof($fieldssource) >= 1 && $pos <= sizeof($fieldssource)) { $posbis=1; foreach($fieldstarget as $key => $val) @@ -750,6 +752,7 @@ if ($step == 4 && $datatoimport) $fieldsplaced=array(); $valforsourcefieldnb=array(); + $listofkeys=array(); foreach($array_match_file_to_database as $key => $val) { $listofkeys[$key]=1; diff --git a/htdocs/includes/modules/import/import_csv.modules.php b/htdocs/includes/modules/import/import_csv.modules.php index 856ca4cc8bb694b711cc2651f771dfb626d556bd..83c878fa90ba3d27ea6009f631008e58900897c8 100644 --- a/htdocs/includes/modules/import/import_csv.modules.php +++ b/htdocs/includes/modules/import/import_csv.modules.php @@ -160,12 +160,12 @@ class ImportCsv extends ModeleImports function import_open_file($file) { global $langs; + $ret=1; dol_syslog("ImportCsv::open_file file=".$file); - $ret=1; - - $this->handle = fopen($file, "r"); + $newfile=utf8_check($file)?utf8_decode($file):$file; // fopen need ISO file name + $this->handle = fopen($newfile, "r"); if (! $this->handle) { $langs->load("errors"); diff --git a/htdocs/install/check.php b/htdocs/install/check.php index cb5847cffc00328e7ee1f74be77262bac1eafa85..74fe8a1fe83e14c812181138c5f082748f4a1d3e 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2005 Marc Barilley / Oc�bo <marc@ocebo.com> + * Copyright (C) 2005 Marc Barilley / Oc�bo <marc@ocebo.com> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * * This program is free software; you can redistribute it and/or modify @@ -22,7 +22,7 @@ /** * \file htdocs/install/check.php * \ingroup install - * \brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilit� de le cr�er + * \brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilit� de le cr�er * \version $Id$ */ include_once("./inc.php"); @@ -151,7 +151,7 @@ if ($memmaxorig != '') } -// Si fichier pr�sent et lisible et renseign� +// Si fichier present et lisible et renseigne clearstatcache(); if (is_readable($conffile) && filesize($conffile) > 8) { @@ -159,13 +159,13 @@ if (is_readable($conffile) && filesize($conffile) > 8) $confexists=1; include_once($conffile); - // Deja install�, on peut upgrader + // Deja install�, on peut upgrader // \todo Test if database ok $allowupgrade=1; } else { - // Si non on le cr�e + // Si non on le cr�e dolibarr_install_syslog("check: we try to creat conf file '$conffile'"); $confexists=0; @@ -196,7 +196,7 @@ else -// Si fichier absent et n'a pu etre cr�� +// Si fichier absent et n'a pu etre cr�� if (! file_exists($conffile)) { //print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated",$conffile); @@ -210,7 +210,7 @@ if (! file_exists($conffile)) } else { - // Si fichier pr�sent mais ne peut etre modifi� + // Si fichier pr�sent mais ne peut etre modifi� if (!is_writable($conffile)) { if ($confexists) @@ -227,7 +227,7 @@ else $allowinstall=0; } - // Si fichier pr�sent et peut etre modifi� + // Si fichier pr�sent et peut etre modifi� else { if ($confexists) @@ -246,7 +246,7 @@ else } print "<br />\n"; - // Si prerequis ok, on affiche le bouton pour passer � l'�tape suivante + // Si prerequis ok, on affiche le bouton pour passer � l'�tape suivante if ($checksok) { $ok=0; diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index ac71d17c1f8f3a6050d66a1a757aed62de2f1d75..dd3bb158983fd58c19989cc68d107a3255f77584 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -230,10 +230,10 @@ class CMailFile $mail->B3B = $this->alternative_boundary; $mail->XMailer = "Dolibarr version " . DOL_VERSION ." (using simplemail)"; - + // Add Errors-To $mail->ErrorsTo = $this->getValidAddress($errors_to,1); - + //Add Return-Path $mail->returnpath = $this->getValidAddress($errors_to,1); diff --git a/htdocs/lib/files.lib.php b/htdocs/lib/files.lib.php index 540a32eea7908f448e057484fc47068fdbeecebe..37698faf74ae7bcb397c88e9745a4800188774d0 100644 --- a/htdocs/lib/files.lib.php +++ b/htdocs/lib/files.lib.php @@ -253,7 +253,7 @@ function dol_count_nb_of_line($file) */ function dol_filesize($pathoffile) { - $newpathoffile=check_utf8($pathoffile)?utf8_decode($pathoffile):$pathoffile; + $newpathoffile=utf8_check($pathoffile)?utf8_decode($pathoffile):$pathoffile; return filesize($pathoffile); } @@ -263,10 +263,10 @@ function dol_filesize($pathoffile) * @param $pathoffile * @return timestamp Time of file */ -function dol_filetime($pathoffile) +function dol_filemtime($pathoffile) { - $newpathoffile=check_utf8($pathoffile)?utf8_decode($pathoffile):$pathoffile; - return filemtime($nrwpathoffile); + $newpathoffile=utf8_check($pathoffile)?utf8_decode($pathoffile):$pathoffile; + return filemtime($newpathoffile); } /** diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index ebbeb789d44c11f9301f4c214f60420636adc592..7633b9763c30388941388f4fb0cb6482a624163b 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -240,8 +240,8 @@ if ($socid > 0) echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=societe&type=application/binary&file='.urlencode($loc.'/'.$file).'">'.$file.'</a>'; print "</td>\n"; - print '<td align="right">'.filesize($courrier_dir."/".$file). ' '.$langs->trans("bytes").'</td>'; - print '<td align="center">'.dol_print_date(filemtime($courrier_dir."/".$file),"dayhour").'</td>'; + print '<td align="right">'.dol_print_size(dol_filesize($courrier_dir."/".$file)).'</td>'; + print '<td align="center">'.dol_print_date(dol_filemtime($courrier_dir."/".$file),'dayhour').'</td>'; print "</tr>\n"; } }