dolibarr 21.0.0-beta
config.inc.php
1<?php
2/*
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 *
7 * == BEGIN LICENSE ==
8 *
9 * Licensed under the terms of any of the following licenses at your
10 * choice:
11 *
12 * - GNU General Public License Version 2 or later (the "GPL")
13 * https://www.gnu.org/licenses/gpl.html
14 *
15 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16 * https://www.gnu.org/licenses/lgpl.html
17 *
18 * - Mozilla Public License Version 1.1 or later (the "MPL")
19 * http://www.mozilla.org/MPL/MPL-1.1.html
20 *
21 * == END LICENSE ==
22 *
23 * Configuration file for the File Manager Connector for PHP.
24 */
25
26global $Config;
27global $website;
28
29define('NOTOKENRENEWAL', 1); // Disables token renewal
30
31// We must include the main because this page is
32// a web page that require security controls and
33// is a security hole if anybody can access without
34// being an authenticated user.
35require_once '../../../../main.inc.php';
36
44$uri = preg_replace('/^http(s?):\/\//i', '', $dolibarr_main_url_root);
45$pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine
46if ($pos == '/') {
47 $pos = ''; // si $pos vaut /, on le met a ''
48}
49//define('DOL_URL_ROOT', $pos);
50$entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null);
51
52// SECURITY: You must explicitly enable this "connector". (Set it to "true").
53// WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only
54// authenticated users can access this file or use some kind of session checking.
55$Config['Enabled'] = true;
56
57
58// Path to user files relative to the document root.
59$extEntity = (empty($entity) ? 1 : $entity); // For multicompany with external access
60
61$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website) ? '' : '_'.$website).'&entity='.$extEntity.'&file=';
62$Config['UserFilesAbsolutePathRelative'] = (!empty($entity) ? '/'.$entity : '').(empty($website) ? '/medias/' : ('/website/'.$website));
63
64
65// Fill the following value it you prefer to specify the absolute path for the
66// user files directory. Useful if you are using a virtual directory, symbolic
67// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
68// Attention: The above 'UserFilesPath' must point to the same directory.
69$Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root.$Config['UserFilesAbsolutePathRelative'];
70
71// Due to security issues with Apache modules, it is recommended to leave the
72// following setting enabled.
73$Config['ForceSingleExtension'] = true;
74
75// Perform additional checks for image files.
76// If set to true, validate image size (using getimagesize).
77$Config['SecureImageUploads'] = true;
78
79// What the user can do with this connector.
80$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder');
81
82// Allowed Resource Types.
83$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Media');
84
85// For security, HTML is allowed in the first Kb of data for files having the
86// following extensions only.
87$Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js");
88
89// After file is uploaded, sometimes it is required to change its permissions
90// so that it was possible to access it at the later time.
91// If possible, it is recommended to set more restrictive permissions, like 0755.
92// Set to 0 to disable this feature.
93// Note: not needed on Windows-based servers.
94$newmask = '0644';
95if (getDolGlobalString('MAIN_UMASK')) {
96 $newmask = getDolGlobalString('MAIN_UMASK');
97}
98$Config['ChmodOnUpload'] = $newmask;
99
100// See comments above.
101// Used when creating folders that does not exist.
102$newmask = '0755';
103$dirmaskdec = octdec($newmask);
104if (getDolGlobalString('MAIN_UMASK')) {
105 $dirmaskdec = octdec($conf->global->MAIN_UMASK);
106}
107$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
108$newmask = decoct($dirmaskdec);
109
110$Config['ChmodOnFolderCreate'] = $newmask;
111
112/*
113 Configuration settings for each Resource Type
114
115 - AllowedExtensions: the possible extensions that can be allowed.
116 If it is empty then any file type can be uploaded.
117 - DeniedExtensions: The extensions that won't be allowed.
118 If it is empty then no restrictions are done here.
119
120 For a file to be uploaded it has to fulfill both the AllowedExtensions
121 and DeniedExtensions (that's it: not being denied) conditions.
122
123 - FileTypesPath: the virtual folder relative to the document root where
124 these resources will be located.
125 Attention: It must start and end with a slash: '/'
126
127 - FileTypesAbsolutePath: the physical path to the above folder. It must be
128 an absolute path.
129 If it's an empty string then it will be autocalculated.
130 Useful if you are using a virtual directory, symbolic link or alias.
131 Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
132 Attention: The above 'FileTypesPath' must point to the same directory.
133 Attention: It must end with a slash: '/'
134
135 - QuickUploadPath: the virtual folder relative to the document root where
136 these resources will be uploaded using the Upload tab in the resources
137 dialogs.
138 Attention: It must start and end with a slash: '/'
139
140 - QuickUploadAbsolutePath: the physical path to the above folder. It must be
141 an absolute path.
142 If it's an empty string then it will be autocalculated.
143 Useful if you are using a virtual directory, symbolic link or alias.
144 Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
145 Attention: The above 'QuickUploadPath' must point to the same directory.
146 Attention: It must end with a slash: '/'
147
148 NOTE: by default, QuickUploadPath and QuickUploadAbsolutePath point to
149 "userfiles" directory to maintain backwards compatibility with older versions of FCKeditor.
150 This is fine, but you in some cases you will be not able to browse uploaded files using file browser.
151 Example: if you click on "image button", select "Upload" tab and send image
152 to the server, image will appear in FCKeditor correctly, but because it is placed
153 directly in /userfiles/ directory, you'll be not able to see it in built-in file browser.
154 The more expected behaviour would be to send images directly to "image" subfolder.
155 To achieve that, simply change
156 $Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
157 $Config['QuickUploadAbsolutePath']['Image'] = $Config['UserFilesAbsolutePath'] ;
158 into:
159 $Config['QuickUploadPath']['Image'] = $Config['FileTypesPath']['Image'] ;
160 $Config['QuickUploadAbsolutePath']['Image'] = $Config['FileTypesAbsolutePath']['Image'] ;
161
162*/
163
164$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');
165$Config['DeniedExtensions']['File'] = array();
166$Config['FileTypesPath']['File'] = $Config['UserFilesPath'].'file/';
167$Config['FileTypesAbsolutePath']['File'] = ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/';
168$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'];
169$Config['QuickUploadAbsolutePath']['File'] = $Config['UserFilesAbsolutePath'];
170
171$Config['AllowedExtensions']['Image'] = array('bmp', 'gif', 'jpeg', 'jpg', 'png', 'ai');
172if (getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_IMAGES')) {
173 $Config['AllowedExtensions']['Image'][] = 'svg';
174}
175$Config['DeniedExtensions']['Image'] = array();
176$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'].'image/';
177$Config['FileTypesAbsolutePath']['Image'] = ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/';
178$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'];
179$Config['QuickUploadAbsolutePath']['Image'] = $Config['UserFilesAbsolutePath'];
180
181$Config['AllowedExtensions']['Flash'] = array('swf', 'flv');
182$Config['DeniedExtensions']['Flash'] = array();
183$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'].'flash/';
184$Config['FileTypesAbsolutePath']['Flash'] = ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/';
185$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'];
186$Config['QuickUploadAbsolutePath']['Flash'] = $Config['UserFilesAbsolutePath'];
187
188$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');
189$Config['DeniedExtensions']['Media'] = array();
190$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'].'media/';
191$Config['FileTypesAbsolutePath']['Media'] = ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/';
192$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'];
193$Config['QuickUploadAbsolutePath']['Media'] = $Config['UserFilesAbsolutePath'];
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79