1 | <?php
|
---|
2 | /**
|
---|
3 | * ExtendedFileManager configuration file.
|
---|
4 | * Authors: Wei Zhuo, Afru
|
---|
5 | * Version: Updated on 08-01-2005 by Afru
|
---|
6 | * Version 1.1.2: Updated on 04-07-2006 by Krzysztof Kotowicz <koto@webworkers.pl>
|
---|
7 | * Package: ExtendedFileManager
|
---|
8 | * http://www.afrusoft.com/htmlarea
|
---|
9 | */
|
---|
10 |
|
---|
11 | /* Configuration file usage:
|
---|
12 | * There are two insertModes for this filemanager.
|
---|
13 | * One is "image" and another is "link".
|
---|
14 | * So you can assign config values as below
|
---|
15 | *
|
---|
16 | * if($insertMode=="image") $IMConfig['property']=somevalueforimagemode;
|
---|
17 | * else if($insertMode=="link") $IMConfig['property']=somevalueforlinkmode;
|
---|
18 | *
|
---|
19 | * (or) you can directly as $IMConfig['property']=somevalueforbothmodes;
|
---|
20 | *
|
---|
21 | * Best of Luck :) Afru.
|
---|
22 | */
|
---|
23 |
|
---|
24 | /*
|
---|
25 | * Getting the mode for further differentiation
|
---|
26 | */
|
---|
27 |
|
---|
28 | if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode'];
|
---|
29 | if(!isset($insertMode)) $insertMode="image";
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Default backend URL
|
---|
33 | *
|
---|
34 | * URL to use for unified backend.
|
---|
35 | *
|
---|
36 | * The ?__plugin=ExtendedFileManager& is required.
|
---|
37 | */
|
---|
38 |
|
---|
39 | $IMConfig['backend_url'] = "backend.php?__plugin=ExtendedFileManager&";
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Backend Installation Directory
|
---|
43 | *
|
---|
44 | * location of backend install; these are used to link to css and js
|
---|
45 | * assets because we may have the front end installed in a different
|
---|
46 | * directory than the backend. (i.e. nothing assumes that the frontend
|
---|
47 | * and the backend are in the same directory)
|
---|
48 | */
|
---|
49 | $IMConfig['base_dir'] = getcwd();
|
---|
50 | $IMConfig['base_url'] = '';
|
---|
51 |
|
---|
52 |
|
---|
53 | /*
|
---|
54 | File system path to the directory you want to manage the images
|
---|
55 | for multiple user systems, set it dynamically.
|
---|
56 |
|
---|
57 | NOTE: This directory requires write access by PHP. That is,
|
---|
58 | PHP must be able to create files in this directory.
|
---|
59 | Able to create directories is nice, but not necessary.
|
---|
60 | */
|
---|
61 | $IMConfig['images_dir'] = 'demo_images';
|
---|
62 | //You may set a different directory for the link mode; if you don't, the above setting will be used for both modes
|
---|
63 | //$IMConfig['files_dir'] = 'demo_files';
|
---|
64 |
|
---|
65 | /*
|
---|
66 | The URL to the above path, the web browser needs to be able to see it.
|
---|
67 | Please remove scripting capabilities in this directory
|
---|
68 | for this directory (i.e. disable PHP, Perl, CGI; see .htaccess file in demo_images folder).
|
---|
69 | */
|
---|
70 | $IMConfig['images_url'] = str_replace( array("backend.php","manager.php"), "", $_SERVER["PHP_SELF"] ) . $IMConfig['images_dir'];
|
---|
71 | //$IMConfig['files_url'] = 'url/to/files_dir';
|
---|
72 |
|
---|
73 | /*
|
---|
74 | Format of the Date Modified in list view.
|
---|
75 | It has to be a string understood by the PHP date() function (for possible values see http://http://php.net/manual/en/function.date.php)
|
---|
76 | */
|
---|
77 | $IMConfig['date_format'] = "d.m.y H:i";
|
---|
78 | /*
|
---|
79 | Possible values: true, false
|
---|
80 |
|
---|
81 | TRUE - If PHP on the web server is in safe mode, set this to true.
|
---|
82 | SAFE MODE restrictions: directory creation will not be possible,
|
---|
83 | only the GD library can be used, other libraries require
|
---|
84 | Safe Mode to be off.
|
---|
85 |
|
---|
86 | FALSE - Set to false if PHP on the web server is not in safe mode.
|
---|
87 | */
|
---|
88 | $IMConfig['safe_mode'] = false;
|
---|
89 |
|
---|
90 | /*
|
---|
91 | This specifies whether any image library is available to resize and edit images.TRUE - Thumbnails will be resized by image libraries and if there is no library, default thumbnail will be shown.
|
---|
92 | FALSE - Thumbnails will be resized by browser ignoring image libraries.
|
---|
93 | */
|
---|
94 | $IMConfig['img_library'] = true;
|
---|
95 |
|
---|
96 |
|
---|
97 | /*
|
---|
98 | View type when the File manager is in insert image mode.
|
---|
99 | Valid values are "thumbview" and "listview".
|
---|
100 | */
|
---|
101 |
|
---|
102 |
|
---|
103 | if ($insertMode == 'image')
|
---|
104 | $IMConfig['view_type'] = "thumbview";
|
---|
105 |
|
---|
106 | else if($insertMode == "link")
|
---|
107 | $IMConfig['view_type'] = "listview";
|
---|
108 |
|
---|
109 | $IMConfig['insert_mode'] = $insertMode;
|
---|
110 |
|
---|
111 | /*
|
---|
112 | Possible values: 'GD', 'IM', or 'NetPBM'
|
---|
113 |
|
---|
114 | The image manipulation library to use, either GD or ImageMagick or NetPBM.
|
---|
115 | If you have safe mode ON, or don't have the binaries to other packages,
|
---|
116 | your choice is 'GD' only. Other packages require Safe Mode to be off.
|
---|
117 | */
|
---|
118 | define('IMAGE_CLASS', 'GD');
|
---|
119 |
|
---|
120 |
|
---|
121 | /*
|
---|
122 | After defining which library to use, if it is NetPBM or IM, you need to
|
---|
123 | specify where the binary for the selected library are. And of course
|
---|
124 | your server and PHP must be able to execute them (i.e. safe mode is OFF).
|
---|
125 | GD does not require the following definition.
|
---|
126 | */
|
---|
127 | define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/');
|
---|
128 | //define('IMAGE_TRANSFORM_LIB_PATH', 'C:/"Program Files"/ImageMagick-5.5.7-Q16/');
|
---|
129 |
|
---|
130 |
|
---|
131 | /*
|
---|
132 | The prefix for thumbnail files, something like .thumb will do. The
|
---|
133 | thumbnails files will be named as "prefix_imagefile.ext", that is,
|
---|
134 | prefix + orginal filename.
|
---|
135 | */
|
---|
136 | $IMConfig['thumbnail_prefix'] = 't_';
|
---|
137 |
|
---|
138 |
|
---|
139 | /*
|
---|
140 | Thumbnail can also be stored in a directory, this directory
|
---|
141 | will be created by PHP. If PHP is in safe mode, this parameter
|
---|
142 | is ignored, you can not create directories.
|
---|
143 |
|
---|
144 | If you do not want to store thumbnails in a directory, set this
|
---|
145 | to false or empty string '';
|
---|
146 | */
|
---|
147 | $IMConfig['thumbnail_dir'] = 't';
|
---|
148 |
|
---|
149 | /**
|
---|
150 | * Resize files, or not. If the dimensions for an image are changed
|
---|
151 | * this will control if the image is actually resized.
|
---|
152 | *
|
---|
153 | * Usually you want this true, unless you are very disk space concious.
|
---|
154 | */
|
---|
155 |
|
---|
156 | $IMConfig['resize_files'] = true;
|
---|
157 |
|
---|
158 | /**
|
---|
159 | * Resized prefix
|
---|
160 | *
|
---|
161 | * The prefix for resized files, something like .resized will do. The
|
---|
162 | * resized files will be named <prefix>_<width>x<height>_<original>
|
---|
163 | * resized files are created when one changes the dimensions of an image
|
---|
164 | * in the image manager selection dialog - the image is scaled when the
|
---|
165 | * user clicks the ok button.
|
---|
166 | */
|
---|
167 |
|
---|
168 | $IMConfig['resized_prefix'] = '.resized';
|
---|
169 |
|
---|
170 | // -------------------------------------------------------------------------
|
---|
171 |
|
---|
172 | /**
|
---|
173 | * Resized Directory
|
---|
174 | *
|
---|
175 | * Resized images may also be stored in a directory, except in safe mode.
|
---|
176 | */
|
---|
177 |
|
---|
178 | $IMConfig['resized_dir'] = '';
|
---|
179 |
|
---|
180 | /*
|
---|
181 | Possible values: true, false
|
---|
182 |
|
---|
183 | TRUE - Allow the user to create new sub-directories in the
|
---|
184 | $IMConfig['images_dir']/$IMConfig['files_dir'].
|
---|
185 |
|
---|
186 | FALSE - No directory creation.
|
---|
187 |
|
---|
188 | NOTE: If $IMConfig['safe_mode'] = true, this parameter
|
---|
189 | is ignored, you can not create directories
|
---|
190 | */
|
---|
191 | $IMConfig['allow_new_dir'] = true;
|
---|
192 |
|
---|
193 | /*
|
---|
194 | Possible values: true, false
|
---|
195 |
|
---|
196 | TRUE - Allow the user to edit image by image editor.
|
---|
197 |
|
---|
198 | FALSE - No edit icon will be displayed.
|
---|
199 |
|
---|
200 | NOTE: If $IMConfig['img_library'] = false, this parameter
|
---|
201 | is ignored, you can not edit images.
|
---|
202 | */
|
---|
203 | $IMConfig['allow_edit_image'] = true;
|
---|
204 |
|
---|
205 | /*
|
---|
206 | Possible values: true, false
|
---|
207 |
|
---|
208 | TRUE - Allow the user to rename files and folders.
|
---|
209 |
|
---|
210 | FALSE - No rename icon will be displayed.
|
---|
211 |
|
---|
212 | */
|
---|
213 | $IMConfig['allow_rename'] = true;
|
---|
214 |
|
---|
215 | /*
|
---|
216 | Possible values: true, false
|
---|
217 |
|
---|
218 | TRUE - Allow the user to perform cut/copy/paste actions.
|
---|
219 |
|
---|
220 | FALSE - No cut/copy/paste icons will be displayed.
|
---|
221 |
|
---|
222 | */
|
---|
223 | $IMConfig['allow_cut_copy_paste'] = true;
|
---|
224 |
|
---|
225 | /*
|
---|
226 | Possible values: true, false
|
---|
227 |
|
---|
228 | TRUE - Display color pickers for image background / border colors
|
---|
229 |
|
---|
230 | FALSE - Don't display color pickers
|
---|
231 | */
|
---|
232 | $IMConfig['use_color_pickers'] = true;
|
---|
233 |
|
---|
234 | /*
|
---|
235 | Possible values: true, false
|
---|
236 |
|
---|
237 | TRUE - Allow the user to set alt (alternative text) attribute.
|
---|
238 |
|
---|
239 | FALSE - No input field for alt attribute will be displayed.
|
---|
240 |
|
---|
241 | NOTE: The alt attribute is _obligatory_ for images, so <img alt="" /> will be inserted
|
---|
242 | if 'images_enable_alt' is set to false
|
---|
243 | */
|
---|
244 | $IMConfig['images_enable_alt'] = true;
|
---|
245 |
|
---|
246 | /*
|
---|
247 | Possible values: true, false
|
---|
248 |
|
---|
249 | TRUE - Allow the user to set title attribute (usually displayed when mouse is over element).
|
---|
250 |
|
---|
251 | FALSE - No input field for title attribute will be displayed.
|
---|
252 |
|
---|
253 | */
|
---|
254 | $IMConfig['images_enable_title'] = false;
|
---|
255 |
|
---|
256 | /*
|
---|
257 | Possible values: true, false
|
---|
258 |
|
---|
259 | TRUE - Allow the user to set align attribute.
|
---|
260 |
|
---|
261 | FALSE - No selection box for align attribute will be displayed.
|
---|
262 |
|
---|
263 | */
|
---|
264 | $IMConfig['images_enable_align'] = true;
|
---|
265 |
|
---|
266 | /*
|
---|
267 | Possible values: true, false
|
---|
268 |
|
---|
269 | TRUE - Allow the user to set margin, padding, and border styles for the image
|
---|
270 |
|
---|
271 | FALSE - No styling input fields will be displayed.
|
---|
272 |
|
---|
273 | */
|
---|
274 | $IMConfig['images_enable_styling'] = true;
|
---|
275 |
|
---|
276 | /*
|
---|
277 | Possible values: true, false
|
---|
278 |
|
---|
279 | TRUE - Allow the user to set target attribute for link (the window in which the link will be opened).
|
---|
280 |
|
---|
281 | FALSE - No selection box for target attribute will be displayed.
|
---|
282 |
|
---|
283 | */
|
---|
284 | $IMConfig['link_enable_target'] = true;
|
---|
285 | /*
|
---|
286 | Possible values: true, false
|
---|
287 |
|
---|
288 | TRUE - Allow the user to upload files.
|
---|
289 |
|
---|
290 | FALSE - No uploading allowed.
|
---|
291 | */
|
---|
292 | $IMConfig['allow_upload'] = false;
|
---|
293 |
|
---|
294 | /* Maximum upload file size
|
---|
295 |
|
---|
296 | Possible values: number, "max"
|
---|
297 |
|
---|
298 | number - maximum size in Kilobytes.
|
---|
299 |
|
---|
300 | "max" - the maximum allowed by the server (the value is retrieved from the server configuration).
|
---|
301 | */
|
---|
302 | $IMConfig['max_filesize_kb_image'] = 200;
|
---|
303 |
|
---|
304 | $IMConfig['max_filesize_kb_link'] = 5000;
|
---|
305 |
|
---|
306 | /* Maximum upload folder size in Megabytes. Use 0 to disable limit */
|
---|
307 | $IMConfig['max_foldersize_mb'] = 0;
|
---|
308 |
|
---|
309 | /*
|
---|
310 | Allowed extensions that can be shown and allowed to upload.
|
---|
311 | Available icons are for "doc,fla,gif,gz,html,jpg,js,mov,pdf,php,png,ppt,rar,txt,xls,zip"
|
---|
312 | -Changed by AFRU.
|
---|
313 | */
|
---|
314 |
|
---|
315 | $IMConfig['allowed_image_extensions'] = array("jpg","gif","png","bmp");
|
---|
316 | $IMConfig['allowed_link_extensions'] = array("jpg","gif","js","php","pdf","zip","txt","psd","png","html","swf","xml","xls","doc");
|
---|
317 |
|
---|
318 |
|
---|
319 | /*
|
---|
320 | The default thumbnail and list view icon in case thumbnails are not created and the files are of unknown.
|
---|
321 | */
|
---|
322 | $IMConfig['default_thumbnail'] = 'icons/def.gif';
|
---|
323 | $IMConfig['default_listicon'] = 'icons/def_small.gif';
|
---|
324 |
|
---|
325 |
|
---|
326 | /*
|
---|
327 | Only files with these extensions will be shown as thumbnails. All other files will be shown as icons.
|
---|
328 | */
|
---|
329 | $IMConfig['thumbnail_extensions'] = array("jpg", "gif", "png", "bmp");
|
---|
330 |
|
---|
331 | /*
|
---|
332 | Thumbnail dimensions.
|
---|
333 | */
|
---|
334 | $IMConfig['thumbnail_width'] = 84;
|
---|
335 | $IMConfig['thumbnail_height'] = 84;
|
---|
336 |
|
---|
337 | /*
|
---|
338 | Image Editor temporary filename prefix.
|
---|
339 | */
|
---|
340 | $IMConfig['tmp_prefix'] = '.editor_';
|
---|
341 |
|
---|
342 |
|
---|
343 | // Standard PHP Backend Data Passing
|
---|
344 | // if data was passed using xinha_pass_to_php_backend() we merge the items
|
---|
345 | // provided into the Config
|
---|
346 | require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php'));
|
---|
347 | if($passed_data = xinha_read_passed_data())
|
---|
348 | {
|
---|
349 | $IMConfig = array_merge($IMConfig, $passed_data);
|
---|
350 | $IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&';
|
---|
351 | }
|
---|
352 | // Deprecated config passing, don't use this way any more!
|
---|
353 | elseif(isset($_REQUEST['backend_config']))
|
---|
354 | {
|
---|
355 | if(get_magic_quotes_gpc()) {
|
---|
356 | $_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']);
|
---|
357 | }
|
---|
358 |
|
---|
359 | // Config specified from front end, check that it's valid
|
---|
360 | session_start();
|
---|
361 | if (!array_key_exists($_REQUEST['backend_config_secret_key_location'], $_SESSION))
|
---|
362 | die("Backend security error.");
|
---|
363 |
|
---|
364 | $secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']];
|
---|
365 |
|
---|
366 | if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret))
|
---|
367 | {
|
---|
368 | die("Backend security error.");
|
---|
369 | }
|
---|
370 |
|
---|
371 | $to_merge = unserialize($_REQUEST['backend_config']);
|
---|
372 | if(!is_array($to_merge))
|
---|
373 | {
|
---|
374 | die("Backend config syntax error.");
|
---|
375 | }
|
---|
376 |
|
---|
377 | $IMConfig = array_merge($IMConfig, $to_merge);
|
---|
378 |
|
---|
379 | // changed config settings keys in relation to ImageManager
|
---|
380 | $IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&';
|
---|
381 | $IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&';
|
---|
382 | $IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&';
|
---|
383 |
|
---|
384 | }
|
---|
385 | if ($IMConfig['max_filesize_kb_link'] == "max")
|
---|
386 | {
|
---|
387 | $IMConfig['max_filesize_kb_link'] = upload_max_filesize_kb();
|
---|
388 | }
|
---|
389 |
|
---|
390 | if ($IMConfig['max_filesize_kb_image'] == "max")
|
---|
391 | {
|
---|
392 | $IMConfig['max_filesize_kb_image'] = upload_max_filesize_kb();
|
---|
393 | }
|
---|
394 | // END
|
---|
395 |
|
---|
396 | ?>
|
---|