source: trunk/plugins/MootoolsFileManager/config.php @ 1324

Last change on this file since 1324 was 1324, checked in by gogo, 8 years ago

Update to latest mootools-filemanager
Rename some MootoolsFileManager? config options to be more consistent, backcompat code has been added so you can still use the old names.

File size: 9.3 KB
Line 
1<?php
2  /**
3    = MootoolsFileManager Configuration File =
4       
5    Configure either by directly editing the config.php file (not recommended) or
6    as follows...
7
8    1. You need to be able to put PHP in your XinhaConfig.js, so
9      you may want to call it XinhaConfig.php instead, or whatever other
10      method you choose (eg put the config as an inline script in your
11      main php page).
12     
13    2. In step 3 of your XinhaConfig write something like...
14      {{{
15        with (xinha_config.MootoolsFileManager)
16        {
17          <?php
18            require_once('/path/to/xinha/contrib/php-xinha.php');
19            xinha_pass_to_php_backend
20            (       
21              array
22              (
23                'images_dir' => '/home/your/directory',
24                'images_url' => '/directory',
25                'allow_images_upload' => true,
26              )
27            )
28          ?>
29        }
30      }}}
31
32    This will work provided you are using normal file-based PHP sessions
33    (most likely), if not, you may need to modify the php-xinha.php
34    file to suit your setup.
35 
36  * @author $Author$
37  * @version $Id$
38  * @package MootoolsFileManager
39  *
40  */
41
42
43  /**   
44    == File Paths REQUIRED ==
45   
46    This plugin operates (optionally) in two modes.
47   
48    1. As a File Manager where people are inserting a link to a file
49      (eg a doc or pdf commonly), we call this "files" mode.
50    2. As an Image Manager where people are inserting an inline image,
51      we call this "images" mode.
52   
53    You may provide one of, or both of, files_dir and images_dir.  If you do not
54    provide one, that mode of MootoolsFileManager will be disabled.
55   
56    # `files_dir` -- Directory path to the location where ordinary files are stored
57                      (eg /home/you/public_html/downloads/ )                   
58    # `files_url` -- The URL path to the files_dir
59                      (eg /downloads/) 
60    # `images_dir` -- Directory path to the location where inline images are stored
61                      (eg /home/you/public_html/images/)
62    # `images_url` -- The URL path to the images_dir
63
64    === Security Caution ===
65
66    You should ensure that the paths you specify are protected against having PHP and
67    other scripts from being executed.  The following .htaccess file is a good idea
68
69    {{{
70      <IfModule mod_php.c>
71        php_flag engine off
72      </IfModule>
73      AddType text/html .html .htm .shtml .php .php3 .php4 .php5 .php6 .php7 .php8 .phtml .phtm .pl .py .cgi
74      RemoveHandler .php
75      RemoveHandler .php8
76      RemoveHandler .php7
77      RemoveHandler .php6
78      RemoveHandler .php5
79      RemoveHandler .php4
80      RemoveHandler .php3
81    }}}
82   
83  */
84
85  $IMConfig['files_dir']  = FALSE; // No trailing slash
86  $IMConfig['files_url']  = FALSE; // No trailing slash
87
88  $IMConfig['images_dir'] = FALSE; // No trailing slash
89  $IMConfig['images_url'] = FALSE; // No trailing slash
90 
91  $IMConfig['thumbs_dir'] = NULL;  // Will default to images_dir/.thumbs or files_dir/.thumbs
92  $IMConfig['thumbs_url'] = NULL;  // Will default to images_url/.thumbs or files_url/.thumbs
93  /**
94    == Turning On Uploads ==
95    We have two sets of settings for turning on uploads, one controls the files mode
96    of the plugin, the other is for images mode.
97
98    Note that allowing upload also permits the user to create subdirectories to better
99    organise the files.
100   
101    === Maximum File Sizes ===
102
103    Each mode can have a different maximum file size that can be uploaded, this
104    size is a number followed by one of M, KB or B.
105
106    === Suggested Image Dimensions ===
107
108    Each mode can have a different "suggested maximum image dimension", when the
109    user uses the Mootools File Manager to upload a file, they are able to choose
110    to "resize large images" on upload.  This defines what "large" means.
111 
112  */
113
114  $IMConfig['files_allow_upload']     = false;
115  $IMConfig['files_allow_delete']     = false;
116  $IMConfig['files_max_upload_size']  = '3M';
117  $IMConfig['files_suggested_image_dimension']  = array('width' => 2048, 'height' => 1536);
118
119  $IMConfig['images_allow_upload']     = false;
120  $IMConfig['images_allow_delete']     = false;
121  $IMConfig['images_max_upload_size']  = '3M';
122  $IMConfig['images_suggested_image_dimension']  = array('width' => 1024, 'height' => 768);
123
124
125// -------------------------------------------------------------------------
126//                OPTIONAL SETTINGS
127// -------------------------------------------------------------------------
128
129/** Expanded Permissions */
130
131$IMConfig['images_allow_create_dir']  = NULL;  // Defaults to allow_images_upload
132$IMConfig['images_allow_move']        = false;
133$IMConfig['images_allow_download']    = false;
134 
135$IMConfig['files_allow_create_dir']  = NULL; // Defaults to allow_files_upload
136$IMConfig['files_allow_move']        = false;
137$IMConfig['files_allow_download']    = false;
138 
139/** Listing Mode Configuration */
140
141$IMConfig['images_list_type']        = 'list'; // Or 'thumb'
142$IMConfig['images_pagination_size']  = 10000;  // By default, a large number to avoid pagination strongly
143                                               // The MFM may reduce this automatically however.                                               
144$IMConfig['images_list_mode_over']   = 30;     // If a folder contains more than this many entries
145                                               // it will fall back to 'list' mode when in 'thumb' mode
146                                               // the user can switch back to 'thumb' if they want.
147$IMConfig['images_list_start_in']    = NULL;   // You can set this to a path relative to the images_dir
148
149
150$IMConfig['files_list_type']        = 'list';  // Or 'thumb'
151$IMConfig['files_pagination_size']  = 10000;   // By default, a large number to avoid pagination strongly
152                                               // The MFM may reduce this automatically however.                                               
153$IMConfig['files_list_mode_over']   = 30;      // If a folder contains more than this many entries
154                                               // it will fall back to 'list' mode when in 'thumb' mode
155                                               // the user can switch back to 'thumb' if they want.
156$IMConfig['files_list_start_in']    = NULL;    // You can set this to a path relative to the images_dir
157                                               
158/**
159
160== Plugin Path ==
161 
162 For most people the defaults will work fine, but if you have trouble, you can set
163 `base_dir` to be the directory path to xinha/plugins/MootoolsFileManager
164 `base_url` to be the url path to xinha/plugins/MootoolsFileManager
165*/
166
167$IMConfig['base_dir'] = getcwd();
168$IMConfig['base_url'] = preg_replace('/\/backend\.php.*/', '', $_SERVER['REQUEST_URI']);
169
170/**
171
172== HTML Compatability ==
173
174 If the HTML you are editing in Xinha is destined for an email you will probably want to use hspace and vspace instead of CSS margins because of poor Email support for CSS.
175 
176*/
177
178$IMConfig['images_use_hspace_vspace'] = TRUE;
179
180////////////////////////////////////////////////////////////////////////////////
181//       ================== END OF CONFIGURATION =======================      //
182////////////////////////////////////////////////////////////////////////////////
183
184// Standard PHP Backend Data Passing
185//  if data was passed using xinha_pass_to_php_backend() we merge the items
186//  provided into the Config
187require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php'));
188
189if($passed_data = xinha_read_passed_data())
190{
191  $IMConfig = array_merge($IMConfig, $passed_data);
192}
193@session_write_close(); // Close session now so we don't lock.
194
195// Back Compat, Some of our config options have been renamed,
196// if the old name is present, that takes precendence.
197$RenamedConfigVars = array(
198  'UseHSpaceVSpace'        => 'images_use_hspace_vspace',
199 
200  'allow_files_upload'     => 'files_allow_upload',
201  'allow_files_delete'     => 'files_allow_delete',
202  'allow_files_create_dir' => 'files_allow_create_dir',
203  'allow_files_move'       => 'files_allow_move',
204  'allow_files_download'   => 'files_allow_download',
205 
206  'max_files_upload_size'   => 'files_max_upload_size',
207  'suggested_files_image_dimension' => 'files_suggested_image_dimension',
208 
209  'allow_images_upload'     => 'images_allow_upload',
210  'allow_images_delete'     => 'images_allow_delete',
211  'allow_images_create_dir' => 'images_allow_create_dir',
212  'allow_images_move'       => 'images_allow_move',
213  'allow_images_download'   => 'images_allow_download',
214 
215  'max_images_upload_size'  => 'images_max_upload_size',
216  'suggested_images_image_dimension' => 'images_suggested_image_dimension', 
217);
218
219foreach($RenamedConfigVars as $Old => $New)
220{
221  if(isset($IMConfig[$Old]))
222  {
223    $New = $IMConfig[$Old];
224    unset($IMConfig[$Old]);   
225  }
226}
227
228if(!isset($IMConfig['thumbs_dir']))
229{
230  $IMConfig['thumbs_dir'] = (isset($IMConfig['images_dir']) ? $IMConfig['images_dir'] : $IMConfig['files_dir']) . '/.thumbs';
231}
232
233if(!isset($IMConfig['thumbs_url']))
234{
235  $IMConfig['thumbs_url'] = (isset($IMConfig['images_url']) ? $IMConfig['images_url'] : $IMConfig['files_url']) . '/.thumbs';
236}
237
238if(!isset($IMConfig['images_allow_create_dir']))
239{
240  $IMConfig['images_allow_create_dir'] = $IMConfig['images_allow_upload'];
241}
242
243if(!isset($IMConfig['files_allow_create_dir']))
244{
245  $IMConfig['files_allow_create_dir'] = $IMConfig['files_allow_upload'];
246}
247
248?>
Note: See TracBrowser for help on using the repository browser.