diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 598e24ee220..820e9455efb 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1336,7 +1336,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!$value['active']) { break; } - print ''.$langs->trans($value['label']).''; + print ''.$langs->trans($value['label']).''; } } diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 5ea581296af..8bddb3579e7 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -64,8 +64,8 @@ if (GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) { if ($action == 'updateform') { $antivircommand = GETPOST('MAIN_ANTIVIRUS_COMMAND', 'restricthtml'); // Use GETPOST restricthtml because we must accept ". Example c:\Progra~1\ClamWin\bin\clamscan.exe $antivirparam = GETPOST('MAIN_ANTIVIRUS_PARAM', 'restricthtml'); // Use GETPOST restricthtml because we must accept ". Example --database="C:\Program Files (x86)\ClamWin\lib" - $antivircommand = dol_string_nospecial($antivircommand, '', array("|", ";", "<", ">", "&")); // Sanitize command - $antivirparam = dol_string_nospecial($antivirparam, '', array("|", ";", "<", ">", "&")); // Sanitize params + $antivircommand = dol_string_nospecial($antivircommand, '', array("|", ";", "<", ">", "&", "+")); // Sanitize command + $antivirparam = dol_string_nospecial($antivirparam, '', array("|", ";", "<", ">", "&", "+")); // Sanitize params if ($antivircommand && !empty($dolibarr_main_restrict_os_commands)) { $arrayofallowedcommand = explode(',', $dolibarr_main_restrict_os_commands); diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 6c5ac91c9bb..62ca6ab5361 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -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); + } } } diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 368b82c42e7..7407ab706a7 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -160,7 +160,7 @@ $Config['QuickUploadPath']['File'] = $Config['UserFilesPath']; $Config['QuickUploadAbsolutePath']['File'] = $Config['UserFilesAbsolutePath']; $Config['AllowedExtensions']['Image'] = array('bmp', 'gif', 'jpeg', 'jpg', 'png', 'ai'); -if (!empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) { +if (getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_IMAGES')) { $Config['AllowedExtensions']['Image'][] = 'svg'; } $Config['DeniedExtensions']['Image'] = array(); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index ea1297bc442..1ca41cadfb7 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -315,6 +315,7 @@ ErrorUploadFileDragDropPermissionDenied=There was an error while the file(s) upl ErrorFixThisHere=Fix this here ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup=Error: The URL of you current instance (%s) does not match the URL defined into your OAuth2 login setup (%s). Doing OAuth2 login in such a configuration is not allowed. ErrorMenuExistValue=A Menu already exist with this Title or URL +ErrorSVGFilesNotAllowedAsLinksWithout=SVG files are not allowed as external links without option %s # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1d2f0817c20..c281ea45e22 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -964,7 +964,7 @@ if ($action == 'create' && $user->rights->projet->creer) { print ''; print ''; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + print 'usage_opportunity ? ' checked="checked"' : '')).'> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print ''; print '