Fix #305 -- use properly random filenames when generating "print" output.
This commit is contained in:
parent
9ad4a5fe4e
commit
ec2657fc6e
1
CHANGES
1
CHANGES
|
@ -18,6 +18,7 @@ For further information about Photo Organizer, see its web site at:
|
|||
[misc] Add UI elements for tweaking all configured image sizes.
|
||||
[fix] Better handle non-UTF8-encoded image metadata [#423]
|
||||
[fix] Auto-importing embedded RAW previews as the 'master' works. [#421]
|
||||
[fix] Use proper random filenames when generating "print" files. [#305]
|
||||
|
||||
2.37-rc2 (October 13, 2009)
|
||||
|
||||
|
|
|
@ -81,12 +81,10 @@ $query = "
|
|||
|
||||
$photos_in_spooler = pg_query($database, $query);
|
||||
|
||||
$print_id = pg_fetch_row(pg_query($database, "select nextval('print_id_sequence')"));
|
||||
$file_name = $tmp_volume_path . "/po.slide." . $print_id[0];
|
||||
$file_name = tempnam($tmp_volume_path, "po");
|
||||
$file = fopen($file_name, "w");
|
||||
|
||||
$file = fopen($file_name . ".ps", "w");
|
||||
|
||||
$tmp_ps_title = 'Print Job #' . $print_id[0];
|
||||
$tmp_ps_title = 'Photo Organizer Print Job';
|
||||
$tmp_ps_for_username = $po_user['last_name'] . ", " . $po_user['first_name'];
|
||||
$php_version = $po_version;
|
||||
$sql_version = pg_fetch_row(pg_query($database, "select major, minor, variation from version"));
|
||||
|
@ -346,18 +344,19 @@ fclose($file);
|
|||
site_epilog($database);
|
||||
|
||||
if ($output_format == "pdf") {
|
||||
system("$sys_ps2pdf ". escapeshellarg($file_name .".ps") ." ". escapeshellarg($file_name .".pdf"));
|
||||
unlink($file_name . ".ps");
|
||||
$pdf_name = tempnam($tmp_volume_path, "po");
|
||||
system("$sys_ps2pdf ". escapeshellarg($file_name) ." ". escapeshellarg($pdf_name));
|
||||
unlink($file_name);
|
||||
$file_name = $pdf_name;
|
||||
}
|
||||
|
||||
$outputfile = $file_name . "." . $output_format;
|
||||
$file = fopen($outputfile , "rb");
|
||||
$file = fopen($file_name , "rb");
|
||||
if ($file == false) {
|
||||
header("HTTP/1.1 404 Not found");
|
||||
exit();
|
||||
}
|
||||
|
||||
$stats = stat($outputfile);
|
||||
$stats = stat($file_name);
|
||||
|
||||
header("Content-Length: $stats[7]");
|
||||
header("Content-Type: application/$output_format");
|
||||
|
@ -370,6 +369,6 @@ while (!feof($file)) {
|
|||
|
||||
exit();
|
||||
fclose($file);
|
||||
unlink($outputfile);
|
||||
unlink($file_name);
|
||||
|
||||
?>
|
||||
|
|
|
@ -51,6 +51,9 @@ ALTER TABLE photo_version DROP COLUMN original_image_name;
|
|||
ALTER TABLE photo_version RENAME COLUMN original_image_name_b TO original_image_name;
|
||||
ALTER TABLE photo_version ALTER COLUMN original_image_name SET NOT NULL;
|
||||
|
||||
-- Drop the print_id sequence
|
||||
DROP SEQUENCE print_id_sequence;
|
||||
|
||||
-- version update
|
||||
update version set identifier=3, description='2.37 Development release',
|
||||
major=2, minor=37, variation='C';
|
||||
|
|
Loading…
Reference in New Issue