diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/classes/exportdocument | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/classes/exportdocument')
| -rw-r--r-- | lib/classes/exportdocument/ExportDocument.php (renamed from lib/classes/exportdocument/ExportDocument.interface.php) | 0 | ||||
| -rw-r--r-- | lib/classes/exportdocument/ExportPDF.php (renamed from lib/classes/exportdocument/ExportPDF.class.php) | 7 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/classes/exportdocument/ExportDocument.interface.php b/lib/classes/exportdocument/ExportDocument.php index 27aaee2..27aaee2 100644 --- a/lib/classes/exportdocument/ExportDocument.interface.php +++ b/lib/classes/exportdocument/ExportDocument.php diff --git a/lib/classes/exportdocument/ExportPDF.class.php b/lib/classes/exportdocument/ExportPDF.php index 8645f5b..f676c45 100644 --- a/lib/classes/exportdocument/ExportPDF.class.php +++ b/lib/classes/exportdocument/ExportPDF.php @@ -1,7 +1,7 @@ <?php # Lifter010: TODO /** - * ExportPDF.class.php - create and export or save a pdf with simple HTML-Data + * ExportPDF.php - create and export or save a pdf with simple HTML-Data * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -115,12 +115,15 @@ class ExportPDF extends TCPDF implements ExportDocument // Fetch headers from url, handle possible redirects do { $headers = get_headers($url, true, get_default_http_stream_context($url)); + if (!$headers) { + break; + } list(, $status) = explode(' ', $headers[0]); $url = $headers['Location'] ?? $headers['location'] ?? $url; } while (in_array($status, [300, 301, 302, 303, 305, 307])); - $status = $status ?: 404; + $status = $status ?? 404; // Replace image with link on error (and not internal), otherwise return sainitized // url |
