2
0
forked from Wavyzz/dolibarr

Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2023-06-04 03:34:49 +02:00
6 changed files with 34 additions and 13 deletions

View File

@@ -92,7 +92,27 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC) && !emp
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://' && substr($link, 0, 7) != 'davs://') {
$link = 'http://'.$link;
}
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0);
// Parse $newUrl
$newUrlArray = parse_url($link);
// Check URL is external
if (!getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS')) {
if (!empty($newUrlArray['path']) && preg_match('/\.svg/i', $newUrlArray['path'])) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans('ErrorSVGFilesNotAllowedAsLinksWithout', 'MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS'), null, 'errors');
}
}
// Alow external links to svg ?
if (!getDolGlobalString('MAIN_ALLOW_LOCAL_LINKS_AS_EXTERNAL_LINKS')) {
// Test $newUrlAray['host'] to check link is external
// TODO
}
if (!$error) {
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0);
}
}
}