This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-02-06 16:39:40 +01:00
commit fac786d7d0
3 changed files with 7 additions and 6 deletions

View file

@ -53,7 +53,9 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'assetlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'alpha'); // mode view (kanban or common)
$mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...)
$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
$id = GETPOSTINT('id');
// Load variable for pagination

View file

@ -114,7 +114,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, getDolGlobalInt('MAIN_USE_CONNECT_TIMEOUT', 5));
curl_setopt($ch, CURLOPT_TIMEOUT, getDolGlobalInt('MAIN_USE_RESPONSE_TIMEOUT', 30));
// limit size of downloaded files. TODO Add MAIN_SECURITY_MAXFILESIZE_DOWNLOADED
// limit size of downloaded files.
$maxsize = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED');
if ($maxsize && defined('CURLOPT_MAXFILESIZE_LARGE')) {
curl_setopt($ch, CURLOPT_MAXFILESIZE_LARGE, $maxsize); // @phan-suppress-current-line PhanTypeMismatchArgumentNullableInternal

View file

@ -212,10 +212,9 @@ class DocumentController extends Controller
exit;
}
$fileSize = dol_filesize($fullpath_original_file); // the returned value is in byte
$fileSizeMaxDefault = 20 * 1024 * 1024; // 20 Mo by default
$fileSizeMax = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED', $fileSizeMaxDefault);
if ($fileSize > $fileSizeMax) {
$fileSize = dol_filesize($fullpath_original_file);
$fileSizeMax = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED');
if ($fileSizeMax && $fileSize > $fileSizeMax) {
dol_syslog('ErrorFileSizeTooLarge: ' . $fileSize);
print 'ErrorFileSizeTooLarge: ' . $fileSize . ' (max ' . $fileSizeMax . ')';
exit;