[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.pdf.inc.php
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.pdf.inc.php |
Date: |
Thu, 13 Jul 2006 11:40:45 +0000 |
CVSROOT: /sources/phpgwapi
Module name: phpgwapi
Changes by: Sigurd Nes <sigurdne> 06/07/13 11:40:45
Modified files:
inc : class.pdf.inc.php
Log message:
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.pdf.inc.php?cvsroot=phpgwapi&r1=1.3&r2=1.4
Patches:
Index: class.pdf.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.pdf.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- class.pdf.inc.php 3 Jul 2006 08:06:40 -0000 1.3
+++ class.pdf.inc.php 13 Jul 2006 11:40:45 -0000 1.4
@@ -7,7 +7,7 @@
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package Cpdf
- * @version $Id: class.pdf.inc.php,v 1.3 2006/07/03 08:06:40 sigurdne
Exp $
+ * @version $Id: class.pdf.inc.php,v 1.4 2006/07/13 11:40:45 sigurdne
Exp $
*/
/* Example
@@ -30,8 +30,6 @@
{
function print_pdf($document = '',$document_name = 'document')
{
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
-
$browser = CreateObject('phpgwapi.browser');
if($browser->BROWSER_AGENT != 'IE')
@@ -52,15 +50,14 @@
$fname = tempnam($dir.SEP,'PDF_').'.pdf';
- $fp = fopen($fname,'wb');
- fwrite($fp,$document);
- fclose($fp);
-
- if (!file_exists($fname))
+ if(!$fp = @fopen($fname,'wb'))
{
die('Directory for temporary pdf-files
is not writeable to the webserver - pleace notify the Administrator');
}
+ fwrite($fp,$document);
+ fclose($fp);
+
$fname = 'phpgwapi/inc/pdf/pdf_files/'.
basename($fname);
echo '<html>
<head>
@@ -82,10 +79,10 @@
if (substr($file,0,4)=="PDF_")
{
// then check to see if
this one is too old
- $ftime =
filemtime($dir.'/'.$file);
- if (time()-$ftime >
3600*24)
+ $ftime =
filemtime($dir.SEP.$file);
+ if (time()-$ftime >
3600*1) // one hour
{
-
unlink($dir.'/'.$file);
+
unlink($dir.SEP.$file);
}
}
}