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