From 23cd0178797d478e1b3e1cc15ca62b4187ae7e5c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Fri, 21 Dec 2007 00:36:06 +0000
Subject: [PATCH] Fix: Supprime erreurs du a open_basedir

---
 htdocs/lib/CMailFile.class.php | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php
index 66ec234aaa9..5897bda5ad5 100644
--- a/htdocs/lib/CMailFile.class.php
+++ b/htdocs/lib/CMailFile.class.php
@@ -254,13 +254,15 @@ class CMailFile
      */
     function send_to_file()
     {
-        $fp = fopen("/tmp/dolibarr_mail","w");
-        fputs($fp, $this->headers);
-        fputs($fp, $this->message);
-        fclose($fp);
+    	if (@is_writeable("/tmp"))	// Avoid fatal error on fopen with open_basedir
+    	{
+        	$fp = fopen("/tmp/dolibarr_mail","w");
+        	fputs($fp, $this->headers);
+        	fputs($fp, $this->message);
+        	fclose($fp);
+    	}
     }
 
-
     /**
             \brief		Creation des headers smtp
     */
-- 
GitLab