30define(
'NOTOKENRENEWAL', 1);
36require_once
'../../../../main.inc.php';
46$pos = strstr($uri,
'/');
51$entity = ((!empty($_SESSION[
'dol_entity']) && $_SESSION[
'dol_entity'] > 1) ? $_SESSION[
'dol_entity'] : null);
55 accessforbidden(
'Upload of files in medias directory using this legacy tool is no more allowed');
62if (empty($user->admin) && !$user->hasRight(
'website',
'write')) {
63 accessforbidden(
'Need to have website write permission to upload files in medias directory.');
69$Config[
'Enabled'] =
true;
73$extEntity = (empty($entity) ? 1 : $entity);
75$Config[
'UserFilesPath'] = DOL_URL_ROOT.
'/viewimage.php?modulepart=medias'.(empty($website) ?
'' :
'_'.$website).
'&entity='.$extEntity.
'&file=';
76$Config[
'UserFilesAbsolutePathRelative'] = (!empty($entity) ?
'/'.$entity :
'').(empty($website) ?
'/medias/' : (
'/website/'.$website));
83$Config[
'UserFilesAbsolutePath'] = $dolibarr_main_data_root.$Config[
'UserFilesAbsolutePathRelative'];
87$Config[
'ForceSingleExtension'] =
true;
91$Config[
'SecureImageUploads'] =
true;
94$Config[
'ConfigAllowedCommands'] = array(
'QuickUpload',
'FileUpload',
'GetFolders',
'GetFoldersAndFiles',
'CreateFolder');
97$Config[
'ConfigAllowedTypes'] = array(
'File',
'Image',
'Media');
101$Config[
'HtmlExtensions'] = array(
"html",
"htm",
"xml",
"xsd",
"txt",
"js");
112$Config[
'ChmodOnUpload'] = $newmask;
117$dirmaskdec = octdec($newmask);
121$dirmaskdec |= octdec(
'0200');
122$newmask = decoct($dirmaskdec);
124$Config[
'ChmodOnFolderCreate'] = $newmask;
178$Config[
'AllowedExtensions'][
'File'] = array(
'7z',
'aiff',
'asf',
'avi',
'bmp',
'csv',
'doc',
'fla',
'flv',
'gif',
'gz',
'gzip',
'jpeg',
'jpg',
'mid',
'mov',
'mp3',
'mp4',
'mpc',
'mpeg',
'mpg',
'ods',
'odt',
'pdf',
'png',
'ppt',
'pxd',
'qt',
'ram',
'rar',
'rm',
'rmi',
'rmvb',
'rtf',
'sdc',
'sitd',
'swf',
'sxc',
'sxw',
'tar',
'tgz',
'tif',
'tiff',
'txt',
'vsd',
'wav',
'wma',
'wmv',
'xls',
'xml',
'zip');
179$Config[
'DeniedExtensions'][
'File'] = array();
180$Config[
'FileTypesPath'][
'File'] = $Config[
'UserFilesPath'].
'file/';
181$Config[
'FileTypesAbsolutePath'][
'File'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'file/';
182$Config[
'QuickUploadPath'][
'File'] = $Config[
'UserFilesPath'];
183$Config[
'QuickUploadAbsolutePath'][
'File'] = $Config[
'UserFilesAbsolutePath'];
185$Config[
'AllowedExtensions'][
'Image'] = array(
'bmp',
'gif',
'jpeg',
'jpg',
'png',
'ai');
187 $Config[
'AllowedExtensions'][
'Image'][] =
'svg';
189$Config[
'DeniedExtensions'][
'Image'] = array();
190$Config[
'FileTypesPath'][
'Image'] = $Config[
'UserFilesPath'].
'image/';
191$Config[
'FileTypesAbsolutePath'][
'Image'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'image/';
192$Config[
'QuickUploadPath'][
'Image'] = $Config[
'UserFilesPath'];
193$Config[
'QuickUploadAbsolutePath'][
'Image'] = $Config[
'UserFilesAbsolutePath'];
195$Config[
'AllowedExtensions'][
'Flash'] = array(
'swf',
'flv');
196$Config[
'DeniedExtensions'][
'Flash'] = array();
197$Config[
'FileTypesPath'][
'Flash'] = $Config[
'UserFilesPath'].
'flash/';
198$Config[
'FileTypesAbsolutePath'][
'Flash'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'flash/';
199$Config[
'QuickUploadPath'][
'Flash'] = $Config[
'UserFilesPath'];
200$Config[
'QuickUploadAbsolutePath'][
'Flash'] = $Config[
'UserFilesAbsolutePath'];
202$Config[
'AllowedExtensions'][
'Media'] = array(
'aiff',
'asf',
'avi',
'bmp',
'fla',
'flv',
'gif',
'jpeg',
'jpg',
'mid',
'mov',
'mp3',
'mp4',
'mpc',
'mpeg',
'mpg',
'png',
'qt',
'ram',
'rm',
'rmi',
'rmvb',
'swf',
'tif',
'tiff',
'wav',
'wma',
'wmv');
203$Config[
'DeniedExtensions'][
'Media'] = array();
204$Config[
'FileTypesPath'][
'Media'] = $Config[
'UserFilesPath'].
'media/';
205$Config[
'FileTypesAbsolutePath'][
'Media'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'media/';
206$Config[
'QuickUploadPath'][
'Media'] = $Config[
'UserFilesPath'];
207$Config[
'QuickUploadAbsolutePath'][
'Media'] = $Config[
'UserFilesAbsolutePath'];
global $dolibarr_main_url_root
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.