From e897a6b7498b51ba359311917c96c193085641d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Thu, 27 Apr 2006 21:25:56 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20T=E9l=E9chargement=20fichiers=20joints?= =?UTF-8?q?=20aux=20actions=20corrig=E9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/action/document.php | 2 +- htdocs/document.php | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index dbff9a6b210..299bdd74c5c 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -228,7 +228,7 @@ if ($_GET["id"] > 0) $var=!$var; print '<tr '.$bc[$var].'>'; print '<td>'; - echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=ationscomm&file='.$act->id.'/'.urlencode($file).'">'.$file.'</a>'; + echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=actions&file='.$act->id.'/'.urlencode($file).'">'.$file.'</a>'; print "</td>\n"; print '<td align="right">'.filesize($upload_dir.'/'.$file). ' bytes</td>'; print '<td align="center">'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).'</td>'; diff --git a/htdocs/document.php b/htdocs/document.php index 63a73b73bad..b6a9e21bf71 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -40,10 +40,13 @@ $original_file = urldecode($_GET["file"]); $modulepart = urldecode($_GET["modulepart"]); // D�fini type et attachment $type = urldecode($_GET["type"]); $attachment = true; -if (eregi('\.html',$original_file)) { $type='text/html'; $attachment = false; } -if (eregi('\.csv',$original_file)) { $type='text/csv'; $attachment = true; } -if (eregi('\.pdf',$original_file)) { $type='application/pdf'; $attachment = true; } -if (eregi('\.xls',$original_file)) { $type='application/x-msexcel'; $attachment = true; } +if (eregi('\.html',$original_file)) { $type='text/html'; $attachment = false; } +if (eregi('\.csv',$original_file)) { $type='text/csv'; $attachment = true; } +if (eregi('\.pdf',$original_file)) { $type='application/pdf'; $attachment = true; } +if (eregi('\.xls',$original_file)) { $type='application/x-msexcel'; $attachment = true; } +if (eregi('\.jpg',$original_file)) { $type='image/jpeg'; $attachment = true; } +if (eregi('\.png',$original_file)) { $type='image/jpeg'; $attachment = true; } +if (eregi('\.tiff',$original_file)) { $type='image/tiff'; $attachment = true; } //Suppression de la chaine de caract�re ../ dans $original_file $original_file = str_replace("../","/", "$original_file"); @@ -184,16 +187,15 @@ if ($modulepart) $original_file=$conf->telephonie->dir_output.'/'.$original_file; } - // Wrapping pour les actions - if ($modulepart == 'actionscomm') + if ($modulepart == 'actions') { $user->getrights('commercial'); //if ($user->rights->commercial->lire) // Ce droit n'existe pas encore //{ $accessallowed=1; //} - $original_file=$conf->commercial->dir_output.'/'.$original_file; + $original_file=$conf->actionscomm->dir_output.'/'.$original_file; } // Wrapping pour les produits et services @@ -238,9 +240,10 @@ if (! $accessallowed) // Ouvre et renvoi fichier clearstatcache(); - $filename = basename($original_file); +dolibarr_syslog("document.php download $original_file $filename content-type=$type"); + if (! file_exists($original_file)) { dolibarr_print_error(0,$langs->trans("FileDoesNotExist",$original_file)); @@ -249,7 +252,6 @@ if (! file_exists($original_file)) // Les drois sont ok et fichier trouv�, on l'envoie -dolibarr_syslog("document.php download $filename content-type=$type"); if ($type) header('Content-type: '.$type); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); -- GitLab