[svn] r5609 - trunk/tools/wascii
packagers at lists.rpmforge.net
packagers at lists.rpmforge.net
Fri Jul 13 16:40:54 CEST 2007
Author: dag
Date: 2007-07-13 16:40:53 +0200 (Fri, 13 Jul 2007)
New Revision: 5609
Modified:
trunk/tools/wascii/ChangeLog
trunk/tools/wascii/wascii.php
Log:
Clean up temporary files
Modified: trunk/tools/wascii/ChangeLog
===================================================================
--- trunk/tools/wascii/ChangeLog 2007-07-13 09:18:56 UTC (rev 5608)
+++ trunk/tools/wascii/ChangeLog 2007-07-13 14:40:53 UTC (rev 5609)
@@ -1,8 +1,11 @@
+* Fri Jul 13 Dag Wieers <dag at wieers.com>
+- Clean up temporary files
+
* Thu Jul 12 Dag Wieers <dag at wieers.com>
-- Added Content-Disposition header.
-- Replaced hardcoded /wascii/ by dynamic $apache_alias.
-- Don't use dirname for $apache_alias so it works with /wascii.php.
+- Added Content-Disposition header
+- Replaced hardcoded /wascii/ by dynamic $apache_alias
+- Don't use dirname for $apache_alias so it works with /wascii.php
* Wed Jul 11 Dag Wieers <dag at wieers.com>
-- Create .subversion on the fly.
-- Initial public release.
+- Create .subversion on the fly
+- Initial public release
Modified: trunk/tools/wascii/wascii.php
===================================================================
--- trunk/tools/wascii/wascii.php 2007-07-13 09:18:56 UTC (rev 5608)
+++ trunk/tools/wascii/wascii.php 2007-07-13 14:40:53 UTC (rev 5609)
@@ -8,12 +8,6 @@
$author = "Project Team";
$email = "project at domain dot com";
-ini_set("display_errors", "1");
-#ini_set("display_startup_errors", "1");
-ini_set("html_errors", "0");
-#ini_set("track_errors", "1");
-ini_set("log_errors", "0");
-ini_set("error_reporting", "E_ALL|E_PARSE|E_STRICT");
error_reporting(E_ALL|E_PARSE|E_STRICT|E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
### Apache alias
@@ -43,7 +37,7 @@
while (!mkdir($path, $mode));
return $path;
- }
+}
if (empty($_REQUEST['path'])) $_REQUEST['path'] = '';
if (empty($_REQUEST['to'])) $_REQUEST['to'] = 'html';
@@ -126,7 +120,7 @@
<?php
} elseif (is_file($path) and preg_match('/\.txt$/', $path)) {
if ($_REQUEST['to'] == 'pdf') {
- $tempdir = tempdir('/tmp', 'phpdoc');
+ $tempdir = tempdir('/tmp', 'wascii-');
$output = shell_exec("/usr/bin/a2x -f pdf --icons --icons-dir=../icons/ -d article -D $tempdir/ $path 2>&1");
$tempbase = basename($path, ".txt").".pdf";
$tempfile = "$tempdir/$tempbase";
@@ -134,12 +128,14 @@
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=\"$tempbase\"");
readfile($tempfile);
+ @unlink($tempfile);
} else {
print "Error: File could not be converted. Possibly syntax error.<br>\n";
print "<pre>$output</pre>";
}
+ @rmdir($tempdir);
} elseif ($_REQUEST['to'] == 'odt') {
- $tempdir = tempdir('/tmp', 'phpdoc');
+ $tempdir = tempdir('/tmp', 'wascii-');
$output = system("/usr/bin/a2x -f odt --icons --icons-dir=../icons/ -d article -D $tempdir/ $path 2>&1");
$tempbase = basename($path, ".txt").".odt";
$tempfile = "$tempdir/$tempbase";
@@ -147,10 +143,12 @@
header("Content-type: application/vnd.oasis.opendocument.text");
header("Content-Disposition: attachment; filename=\"$tempbase\"");
readfile($tempfile);
+ @unlink($tempfile);
} else {
print "Error: File could not be converted. Possibly syntax error.<br>\n";
print "<pre>$output</pre>";
}
+ @rmdir($tempdir);
} else {
passthru("asciidoc -b xhtml11 -a toc -a toclevels=2 -a icons -a iconsdir=$script_dir/icons/ -d article -o- $path");
}
More information about the svn-commits
mailing list