[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] hrm/inc class.uiuser.inc.php
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] hrm/inc class.uiuser.inc.php |
Date: |
Fri, 30 Jun 2006 11:07:02 +0000 |
CVSROOT: /sources/phpgroupware
Module name: hrm
Changes by: Sigurd Nes <sigurdne> 06/06/30 11:07:02
Modified files:
inc : class.uiuser.inc.php
Log message:
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/hrm/inc/class.uiuser.inc.php?cvsroot=phpgroupware&r1=1.21&r2=1.22
Patches:
Index: class.uiuser.inc.php
===================================================================
RCS file: /sources/phpgroupware/hrm/inc/class.uiuser.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- class.uiuser.inc.php 30 Jun 2006 09:02:56 -0000 1.21
+++ class.uiuser.inc.php 30 Jun 2006 11:07:02 -0000 1.22
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage user
- * @version $Id: class.uiuser.inc.php,v 1.21 2006/06/30 09:02:56
sigurdne Exp $
+ * @version $Id: class.uiuser.inc.php,v 1.22 2006/06/30 11:07:02
sigurdne Exp $
*/
/**
@@ -983,7 +983,7 @@
unset($content);
}
-
+/*
$document= $pdf->ezOutput();
$size=strlen($document);
@@ -991,5 +991,54 @@
$browser->content_header('receipt.pdf','application/pdf',$size);
echo $document;
+*/
+
+ $pdfcode= $pdf->ezOutput();
+
+ // $dir = './pdf_files';
+ $dir = PHPGW_APP_INC . '/..';
+ $dir = $dir . SEP . 'pdf_files';
+
+ //save the file
+ if (!file_exists($dir)){
+ mkdir ($dir,0777);
+ }
+
+ $fname = tempnam($dir.SEP,'PDF_').'.pdf';
+
+ $fp = fopen($fname,'w');
+ fwrite($fp,$pdfcode);
+ fclose($fp);
+
+ $fname = 'hrm/pdf_files/'. basename($fname);
+ echo '<html>
+ <head>
+ <SCRIPT LANGUAGE="JavaScript"><!--
+ function go_now () { window.location.href =
"'.$fname.'"; }
+ //--></SCRIPT>
+ </head>
+ <body onLoad="go_now()"; >
+ <a href="'.$fname.'">click here</a> if you are not
re-directed.
+ </body>
+ </html>
+ ';
+
+ // also have a look through the directory, and remove
the files that are older than a week
+ if ($d = @opendir($dir))
+ {
+ while (($file = readdir($d)) !== false)
+ {
+ 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)
+ {
+ unlink($dir.'/'.$file);
+ }
+ }
+ }
+ closedir($d);
+ }
}
}