Merge pull request #32856 from vdegrandpre/32855-calendrier-externe-local

Adding global variables to have more flexibility on external calendar location
This commit is contained in:
Laurent Destailleur 2025-02-05 00:13:48 +01:00 committed by GitHub
commit b5ec082794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,8 @@
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Vincent de Grandpré <vincent@de-grandpre.quebec>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -96,7 +97,16 @@ class ICal
$file_text = '';
//$tmpresult = getURLContent($file, 'GET', '', 1, [], ['http', 'https'], 2, 0); // To test with any URL
$tmpresult = getURLContent($file, 'GET');
$localip = 0;
$sslverify = -1;
if (getDolGlobalString('AGENDA_EXT_CALENDAR_IP_MODE')) {
$localip = intval(getDolGlobalString('AGENDA_EXT_CALENDAR_IP_MODE'));
}
if (getDolGlobalString('AGENDA_EXT_CALENDAR_SSLVERIFY_MODE')) {
$sslverify = intval(getDolGlobalString('AGENDA_EXT_CALENDAR_SSLVERIFY_MODE'));
}
// See documentation of getURLContent function for $localip and $sslverify possible values
$tmpresult = getURLContent($file, 'GET', '', 1, [], ['http', 'https'], $localip, $sslverify);
if ($tmpresult['http_code'] != 200) {
$file_text = null;
$this->error = 'Error: '.$tmpresult['http_code'].' '.$tmpresult['content'];