From 1a385052f6e66436784a40d286dc609a7febfa30 Mon Sep 17 00:00:00 2001 From: kastoras Date: Fri, 7 May 2021 23:39:14 +0300 Subject: [PATCH] New Create share link on file upload Create MAIN_CREATE_SHARE_ON_FILE_UPLOAD, when this set to 1 and a file is uploaded a shared link will be created --- htdocs/core/lib/files.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index ce5e7129bcf..1a52102d61d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1766,7 +1766,7 @@ function dol_remove_file_process($filenb, $donotupdatesession = 0, $donotdeletef */ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uploaded', $setsharekey = 0, $object = null) { - global $db, $user; + global $db, $user, $conf; $result = 0; @@ -1792,6 +1792,9 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo $ecmfile->src_object_type = $object->table_element; } + if(!empty($conf->global->MAIN_CREATE_SHARE_ON_FILE_UPLOAD) && $conf->global->MAIN_CREATE_SHARE_ON_FILE_UPLOAD=='1'){ + $setsharekey = 1; + } if ($setsharekey) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $ecmfile->share = getRandomPassword(true);