mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Fix: Data in memory must always be encoded in utf8. PHP files functions need ISO, so we convert data just before and after using them.
This commit is contained in:
@@ -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>';
|
||||
|
||||
@@ -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<6C>e suppl<70>mentaire
|
||||
print "<tr $bc[$var]><td>Propal d<EFBFBD>taill<EFBFBD>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";
|
||||
|
||||
@@ -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<6C>e suppl<70>mentaire
|
||||
print "<tr $bc[$var]><td>Commande d<EFBFBD>taill<EFBFBD>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";
|
||||
|
||||
@@ -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<EFBFBD>taill<EFBFBD>e suppl<EFBFBD>mentaire
|
||||
if (file_exists($filedetail)) // facture detaillee supplementaire
|
||||
{
|
||||
print "<tr $bc[$var]><td>Facture d<>taill<6C>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>';
|
||||
}
|
||||
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
/**
|
||||
\file htdocs/fichinter/apercu.php
|
||||
\ingroup fichinter
|
||||
\brief Page de l'onglet aper<65>u d'une fiche d'intervention
|
||||
\brief Page de l'onglet aper<65>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<65>us
|
||||
// Chemin vers png aper<65>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<6C>e suppl<70>mentaire
|
||||
print "<tr $bc[$var]><td>Fiche d'intervention d<>taill<6C>e</td>";
|
||||
if (file_exists($filedetail)) { // fichinter d<>taill<6C>e suppl<70>mentaire
|
||||
print "<tr $bc[$var]><td>Fiche d'intervention d<>taill<6C>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<75>e
|
||||
// Intervention non trouv<75>e
|
||||
print $langs->trans("ErrorFichinterNotFound",$_GET["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
// Si fichier png PDF d'1 page trouv<75>
|
||||
// Si fichier png PDF d'1 page trouv<75>
|
||||
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<75>
|
||||
// Si fichier png PDF de plus d'1 page trouv<75>
|
||||
elseif (file_exists($fileimagebis))
|
||||
{
|
||||
$multiple = $relativepathimage . ".";
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<4F>bo <marc@ocebo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Oc<4F>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<69> de le cr<63>er
|
||||
* \brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilit<69> de le cr<63>er
|
||||
* \version $Id$
|
||||
*/
|
||||
include_once("./inc.php");
|
||||
@@ -151,7 +151,7 @@ if ($memmaxorig != '')
|
||||
}
|
||||
|
||||
|
||||
// Si fichier pr<EFBFBD>sent et lisible et renseign<EFBFBD>
|
||||
// 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<6C>, on peut upgrader
|
||||
// Deja install<6C>, on peut upgrader
|
||||
// \todo Test if database ok
|
||||
$allowupgrade=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si non on le cr<63>e
|
||||
// Si non on le cr<63>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<63><72>
|
||||
// Si fichier absent et n'a pu etre cr<63><72>
|
||||
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<70>sent mais ne peut etre modifi<66>
|
||||
// Si fichier pr<70>sent mais ne peut etre modifi<66>
|
||||
if (!is_writable($conffile))
|
||||
{
|
||||
if ($confexists)
|
||||
@@ -227,7 +227,7 @@ else
|
||||
|
||||
$allowinstall=0;
|
||||
}
|
||||
// Si fichier pr<70>sent et peut etre modifi<66>
|
||||
// Si fichier pr<70>sent et peut etre modifi<66>
|
||||
else
|
||||
{
|
||||
if ($confexists)
|
||||
@@ -246,7 +246,7 @@ else
|
||||
}
|
||||
print "<br />\n";
|
||||
|
||||
// Si prerequis ok, on affiche le bouton pour passer <20> l'<27>tape suivante
|
||||
// Si prerequis ok, on affiche le bouton pour passer <20> l'<27>tape suivante
|
||||
if ($checksok)
|
||||
{
|
||||
$ok=0;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user