diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php index 08dd2429b7b..608c2ba4cd6 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php @@ -329,7 +329,14 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $sExtension = strtolower($sExtension); // Check permission - if (!$user->hasRight('website', 'write') && !$user->hasRight('mailing', 'write') || !empty($user->socid)) { + $permissiontouploadmediaisok = 1; + if (!empty($user->socid)) { + $permissiontouploadmediaisok = 0; + } + /*if (!$user->hasRight('website', 'write') && !$user->hasRight('mailing', 'write')) { + $permissiontouploadmediaisok = 0; + }*/ + if (!$permissiontouploadmediaisok) { dol_syslog("connector.lib.php Try to upload a file with no permission"); $sErrorNumber = '202'; } @@ -547,7 +554,9 @@ function GetParentFolder($folderPath) */ function CreateServerFolder($folderPath, $lastFolder = null) { + global $user; global $Config; + $sParent = GetParentFolder($folderPath); // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms @@ -555,6 +564,17 @@ function CreateServerFolder($folderPath, $lastFolder = null) $folderPath = str_replace('//', '/', $folderPath); } + $permissiontouploadmediaisok = 1; + if (!empty($user->socid)) { + $permissiontouploadmediaisok = 0; + } + /*if (!$user->hasRight('website', 'write') && !$user->hasRight('mailing', 'write')) { + $permissiontouploadmediaisok = 0; + }*/ + if (!$permissiontouploadmediaisok) { + return 'Bad permissions to create a folder in media directory'; + } + // Check if the parent exists, or create it. if (!empty($sParent) && !file_exists($sParent)) { //prevents agains infinite loop when we can't create root folder diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 405759c104d..ee631c7bdb8 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2902,5 +2902,6 @@ function acceptLocalLinktoMedia() } } + //return 1; return $acceptlocallinktomedia; }