From c03a7821f4a7d478d7220e7f8f0f277fded35cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 20 Feb 2023 12:47:29 +0100 Subject: [PATCH] Proxy support based on DW's main configuration --- DokuPDF.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DokuPDF.class.php b/DokuPDF.class.php index f0ac03f2..b2cd9f0c 100644 --- a/DokuPDF.class.php +++ b/DokuPDF.class.php @@ -50,12 +50,26 @@ function __construct($pagesize = 'A4', $orientation = 'portrait', $fontsize = 11 } + $proxy = $proxyAuth = null; + if (isset($conf['proxy']['host'])) { + $proxy = "http"; + if ($conf['proxy']['ssl'] ?? false) { + $proxy .= "s"; + } + $proxy .= "://" . $conf['proxy']['host'] . ":" . ($conf['proxy']['port'] ?? 3128); + if (isset($conf['proxy']['user']) && isset($conf['proxy']['pass'])) { + $proxyAuth = urlencode($conf['proxy']['user']) . "@" . urlencode($conf['proxy']['pass']); + } + } + // we're always UTF-8 parent::__construct( array( 'mode' => $mode, 'format' => $format, 'default_font_size' => $fontsize, + 'curlProxy' => $proxy, + 'curlProxyAuth' => $proxyAuth, 'ImageProcessorClass' => DokuImageProcessorDecorator::class, 'tempDir' => _MPDF_TEMP_PATH //$conf['tmpdir'] . '/tmp/dwpdf' )