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');
59if (empty($user->admin) && !$user->hasRight(
'website',
'write')) {
60 accessforbidden(
'Need to have website write permission to upload files in medias directory.');
67$Config[
'Enabled'] =
true;
71$extEntity = (empty($entity) ? 1 : $entity);
73$Config[
'UserFilesPath'] = DOL_URL_ROOT.
'/viewimage.php?modulepart=medias'.(empty($website) ?
'' :
'_'.$website).
'&entity='.$extEntity.
'&file=';
74$Config[
'UserFilesAbsolutePathRelative'] = (!empty($entity) ?
'/'.$entity :
'').(empty($website) ?
'/medias/' : (
'/website/'.$website));
81$Config[
'UserFilesAbsolutePath'] = $dolibarr_main_data_root.$Config[
'UserFilesAbsolutePathRelative'];
85$Config[
'ForceSingleExtension'] =
true;
89$Config[
'SecureImageUploads'] =
true;
92$Config[
'ConfigAllowedCommands'] = array(
'QuickUpload',
'FileUpload',
'GetFolders',
'GetFoldersAndFiles',
'CreateFolder');
95$Config[
'ConfigAllowedTypes'] = array(
'File',
'Image',
'Media');
99$Config[
'HtmlExtensions'] = array(
"html",
"htm",
"xml",
"xsd",
"txt",
"js");
110$Config[
'ChmodOnUpload'] = $newmask;
115$dirmaskdec = octdec($newmask);
119$dirmaskdec |= octdec(
'0200');
120$newmask = decoct($dirmaskdec);
122$Config[
'ChmodOnFolderCreate'] = $newmask;
176$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');
177$Config[
'DeniedExtensions'][
'File'] = array();
178$Config[
'FileTypesPath'][
'File'] = $Config[
'UserFilesPath'].
'file/';
179$Config[
'FileTypesAbsolutePath'][
'File'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'file/';
180$Config[
'QuickUploadPath'][
'File'] = $Config[
'UserFilesPath'];
181$Config[
'QuickUploadAbsolutePath'][
'File'] = $Config[
'UserFilesAbsolutePath'];
183$Config[
'AllowedExtensions'][
'Image'] = array(
'bmp',
'gif',
'jpeg',
'jpg',
'png',
'ai');
185 $Config[
'AllowedExtensions'][
'Image'][] =
'svg';
187$Config[
'DeniedExtensions'][
'Image'] = array();
188$Config[
'FileTypesPath'][
'Image'] = $Config[
'UserFilesPath'].
'image/';
189$Config[
'FileTypesAbsolutePath'][
'Image'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'image/';
190$Config[
'QuickUploadPath'][
'Image'] = $Config[
'UserFilesPath'];
191$Config[
'QuickUploadAbsolutePath'][
'Image'] = $Config[
'UserFilesAbsolutePath'];
193$Config[
'AllowedExtensions'][
'Flash'] = array(
'swf',
'flv');
194$Config[
'DeniedExtensions'][
'Flash'] = array();
195$Config[
'FileTypesPath'][
'Flash'] = $Config[
'UserFilesPath'].
'flash/';
196$Config[
'FileTypesAbsolutePath'][
'Flash'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'flash/';
197$Config[
'QuickUploadPath'][
'Flash'] = $Config[
'UserFilesPath'];
198$Config[
'QuickUploadAbsolutePath'][
'Flash'] = $Config[
'UserFilesAbsolutePath'];
200$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');
201$Config[
'DeniedExtensions'][
'Media'] = array();
202$Config[
'FileTypesPath'][
'Media'] = $Config[
'UserFilesPath'].
'media/';
203$Config[
'FileTypesAbsolutePath'][
'Media'] = ($Config[
'UserFilesAbsolutePath'] ==
'') ?
'' : $Config[
'UserFilesAbsolutePath'].
'media/';
204$Config[
'QuickUploadPath'][
'Media'] = $Config[
'UserFilesPath'];
205$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.