3 * PersistentStorage Server backend configuration file.
4 * @author Douglas Mayle <douglas@openplans.org>
6 * @package PersistentStorage
10 * If this file is being requested over the web, we display a JSON version of
11 * the publicly viewable config info.
13 if (__FILE__
== $_SERVER['SCRIPT_FILENAME']) {
14 echo json_encode(get_config());
18 * Gets the configuration information used by this package.
20 * @param boolean $getprivates Return private configuration info merged with the public.
21 * @returns array The configuration information for this package.
23 function get_config($getprivates=False) {
25 // We set up two different settings array, so that we can have settings
26 // that won't be shown to the public.
31 * For demo purposes, we can lie to the frontend and pretend to have user
32 * storage. Since we don't have a password mechanism, this simulation will
33 * accept any password.
35 $Private['simulate_user_auth'] = false;
38 * The capabilities array contains directives about what major options to
41 $Public['capabilities'] = array(
42 // Allow directory operations (e.g. rename, create, delete directories)
43 'directory_operations' => true,
44 // Allow file operations (e.g. copy, rename, delete files)
45 'file_operations' => true,
46 // Allow image operations (e.g. scale, rotate, convert images)
47 'image_operations' => true,
49 'upload_operations' => true,
50 // Stored files have a published URL
51 'shared_publish' => true,
52 // By default, if the user is authenticated, we enable user storage.
53 // Set to false to disable.
54 'user_storage' => !empty($_SERVER['PHP_AUTH_USER']) ||
$Private['simulate_user_auth']
58 * Directory exposed to user operations. Be sure that the web server has
59 * read and write access to this directory.
61 $Private['storage_dir'] = 'demo_images';
64 * The URL that the storage directory is exposed as. By default, we try
65 * and guess based on the URL used to access this page. Also, since we
66 * allow user upload, this directory should not be executable by the
67 * server. A sample .htaccess file is included in demo_images.
69 $Private['storage_url'] = str_replace( array("backend.php","manager.php"),
70 "", $_SERVER["PHP_SELF"] ) . $Private['storage_dir'];
73 Possible values: true, false
75 TRUE - If PHP on the web server is in safe mode, set this to true.
76 SAFE MODE restrictions: directory creation will not be possible,
77 only the GD library can be used, other libraries require
80 FALSE - Set to false if PHP on the web server is not in safe mode.
82 $Private['safe_mode'] = ini_get('safe_mode');
85 * If PHP Safe Mode is on than only the GD image library will function, so
86 * we force the default
88 if ($Private['safe_mode']) {
89 @define
('IMAGE_CLASS', 'GD');
92 Possible values: 'GD', 'IM', or 'NetPBM'
94 The image manipulation library to use, either GD or ImageMagick or NetPBM.
96 @define
('IMAGE_CLASS', 'GD');
99 After defining which library to use, if it is NetPBM or IM, you need to
100 specify where the binary for the selected library are. And of course
101 your server and PHP must be able to execute them (i.e. safe mode is OFF).
102 GD does not require the following definition.
104 @define
('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/');
108 The prefix for thumbnail files, something like .thumb will do. The
109 thumbnails files will be named as "prefix_imagefile.ext", that is,
110 prefix + orginal filename.
112 $Private['thumbnail_prefix'] = 't_';
115 * The thumbnail array groups all of the configuration related to thumbnail
118 $Private['thumbnails'] = array(
119 // The prefix to apply to all created thumbnails.
121 // A subdirectory to keep thumbnails in. If this is empty, thumbnails
122 // will be stored alongside the files.
124 // Whether or not to filter thumbnails from the directory listing.
126 // Filetypes which we restrict thumbnail operations to.
127 'filetypes' => array("jpg", "gif", "png", "bmp"),
128 // What pixel sizes to save the thumbnails as.
137 * The prefix for resized files, something like .resized will do. The
138 * resized files will be named <prefix>_<width>x<height>_<original>
139 * resized files are created when one changes the dimensions of an image
140 * in the image manager selection dialog - the image is scaled when the
141 * user clicks the ok button.
144 $Private['resized_prefix'] = '.resized';
146 // -------------------------------------------------------------------------
151 * Resized images may also be stored in a directory, except in safe mode.
154 $Private['resized_dir'] = '';
156 /* Maximum upload file size
158 Possible values: number, "max"
160 number - maximum size in Kilobytes.
162 "max" - the maximum allowed by the server (the value is retrieved from the server configuration).
164 $Private['max_filesize_kb_image'] = 200;
166 $Private['max_filesize_kb_link'] = 5000;
168 /* Maximum upload folder size in Megabytes. Use 0 to disable limit */
169 $Private['max_foldersize_mb'] = 0;
172 Allowed extensions that can be shown and allowed to upload.
173 Available icons are for "doc,fla,gif,gz,html,jpg,js,mov,pdf,php,png,ppt,rar,txt,xls,zip"
177 $Private['allowed_image_extensions'] = array("jpg","gif","png","bmp");
178 $Private['allowed_link_extensions'] = array("jpg","gif","js","php","pdf","zip","txt","psd","png","html","swf","xml","xls","doc");
182 Image Editor temporary filename prefix.
184 $Private['tmp_prefix'] = '.editor_';
187 // Config variables are finished, this returns our data to the caller.
189 return $Public+
$Private;