Use file_get_contents().
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 18:48:51 +0000 (11:48 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 18:48:51 +0000 (11:48 -0700)
framework/Mime/lib/Horde/Mime/Viewer/enscript.php
framework/Mime/lib/Horde/Mime/Viewer/msexcel.php

index c2c060c..c63132d 100644 (file)
@@ -75,9 +75,7 @@ class Horde_Mime_Viewer_enscript extends Horde_Mime_Viewer_source
         $tmpin = Horde::getTempFile('enscriptin');
 
         /* Write the contents of our buffer to the temporary input file. */
-        $fh = fopen($tmpin, 'wb');
-        fwrite($fh, $this->_mimepart->getContents());
-        fclose($fh);
+        file_put_contents($tmpin, $this->_mimepart->getContents());
 
         /* Execute the enscript command. */
         $lang = escapeshellarg($this->_typeToLang($this->_mimepart->getType()));
index ad1f29f..654bb52 100644 (file)
@@ -41,9 +41,7 @@ class Horde_Mime_Viewer_msexcel extends Horde_Mime_Viewer_Driver
         $data = '';
         $tmp_xls = Horde::getTempFile('horde_msexcel');
 
-        $fh = fopen($tmp_xls, 'w');
-        fwrite($fh, $this->_mimepart->getContents());
-        fclose($fh);
+        file_put_contents($tmp_xls, $this->_mimepart->getContents());
 
         $fh = popen($this->_conf['location'] . " -nh $tmp_xls 2>&1", 'r');
         while (($rc = fgets($fh, 8192))) {