1 | <?php
|
---|
2 | /**
|
---|
3 | * PersistentStorage Server backend configuration file.
|
---|
4 | * @author Douglas Mayle <douglas@openplans.org>
|
---|
5 | * @version 1.0
|
---|
6 | * @package PersistentStorage
|
---|
7 | */
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * If this file is being requested over the web, we display a JSON version of
|
---|
11 | * the publicly viewable config info.
|
---|
12 | */
|
---|
13 | if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
|
---|
14 | echo json_encode(get_config());
|
---|
15 | }
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Gets the configuration information used by this package.
|
---|
19 | * {@source }
|
---|
20 | * @param boolean $getprivates Return private configuration info merged with the public.
|
---|
21 | * @returns array The configuration information for this package.
|
---|
22 | */
|
---|
23 | function get_config($getprivates=False) {
|
---|
24 |
|
---|
25 | // We set up two different settings array, so that we can have settings
|
---|
26 | // that won't be shown to the public.
|
---|
27 | $Private = array();
|
---|
28 | $Public = array();
|
---|
29 |
|
---|
30 | /**
|
---|
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.
|
---|
34 | */
|
---|
35 | $Private['simulate_user_auth'] = false;
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * The capabilities array contains directives about what major options to
|
---|
39 | * allow or disallow.
|
---|
40 | */
|
---|
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,
|
---|
48 | // Allow file uploads
|
---|
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']
|
---|
55 | );
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Directory exposed to user operations. Be sure that the web server has
|
---|
59 | * read and write access to this directory.
|
---|
60 | */
|
---|
61 | $Private['storage_dir'] = 'demo_images';
|
---|
62 |
|
---|
63 | /**
|
---|
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.
|
---|
68 | */
|
---|
69 | $Private['storage_url'] = str_replace( array("backend.php","manager.php"),
|
---|
70 | "", $_SERVER["PHP_SELF"] ) . $Private['storage_dir'];
|
---|
71 |
|
---|
72 | /*
|
---|
73 | Possible values: true, false
|
---|
74 |
|
---|
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
|
---|
78 | Safe Mode to be off.
|
---|
79 |
|
---|
80 | FALSE - Set to false if PHP on the web server is not in safe mode.
|
---|
81 | */
|
---|
82 | $Private['safe_mode'] = ini_get('safe_mode');
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * If PHP Safe Mode is on than only the GD image library will function, so
|
---|
86 | * we force the default
|
---|
87 | */
|
---|
88 | if ($Private['safe_mode']) {
|
---|
89 | @define('IMAGE_CLASS', 'GD');
|
---|
90 | } else {
|
---|
91 | /*
|
---|
92 | Possible values: 'GD', 'IM', or 'NetPBM'
|
---|
93 |
|
---|
94 | The image manipulation library to use, either GD or ImageMagick or NetPBM.
|
---|
95 | */
|
---|
96 | @define('IMAGE_CLASS', 'GD');
|
---|
97 |
|
---|
98 | /*
|
---|
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.
|
---|
103 | */
|
---|
104 | @define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/');
|
---|
105 | }
|
---|
106 |
|
---|
107 | /*
|
---|
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.
|
---|
111 | */
|
---|
112 | $Private['thumbnail_prefix'] = 't_';
|
---|
113 |
|
---|
114 | /**
|
---|
115 | * The thumbnail array groups all of the configuration related to thumbnail
|
---|
116 | * operations.
|
---|
117 | */
|
---|
118 | $Private['thumbnails'] = array(
|
---|
119 | // The prefix to apply to all created thumbnails.
|
---|
120 | 'prefix' => 't_',
|
---|
121 | // A subdirectory to keep thumbnails in. If this is empty, thumbnails
|
---|
122 | // will be stored alongside the files.
|
---|
123 | 'directory' => '',
|
---|
124 | // Whether or not to filter thumbnails from the directory listing.
|
---|
125 | 'filter' => true,
|
---|
126 | // Filetypes which we restrict thumbnail operations to.
|
---|
127 | 'filetypes' => array("jpg", "gif", "png", "bmp"),
|
---|
128 | // What pixel sizes to save the thumbnails as.
|
---|
129 | 'width' => 84,
|
---|
130 | 'height' => 84
|
---|
131 | );
|
---|
132 |
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Resized prefix
|
---|
136 | *
|
---|
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.
|
---|
142 | */
|
---|
143 |
|
---|
144 | $Private['resized_prefix'] = '.resized';
|
---|
145 |
|
---|
146 | // -------------------------------------------------------------------------
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Resized Directory
|
---|
150 | *
|
---|
151 | * Resized images may also be stored in a directory, except in safe mode.
|
---|
152 | */
|
---|
153 |
|
---|
154 | $Private['resized_dir'] = '';
|
---|
155 |
|
---|
156 | /* Maximum upload file size
|
---|
157 |
|
---|
158 | Possible values: number, "max"
|
---|
159 |
|
---|
160 | number - maximum size in Kilobytes.
|
---|
161 |
|
---|
162 | "max" - the maximum allowed by the server (the value is retrieved from the server configuration).
|
---|
163 | */
|
---|
164 | $Private['max_filesize_kb_image'] = 200;
|
---|
165 |
|
---|
166 | $Private['max_filesize_kb_link'] = 5000;
|
---|
167 |
|
---|
168 | /* Maximum upload folder size in Megabytes. Use 0 to disable limit */
|
---|
169 | $Private['max_foldersize_mb'] = 0;
|
---|
170 |
|
---|
171 | /*
|
---|
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"
|
---|
174 | -Changed by AFRU.
|
---|
175 | */
|
---|
176 |
|
---|
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");
|
---|
179 |
|
---|
180 |
|
---|
181 | /*
|
---|
182 | Image Editor temporary filename prefix.
|
---|
183 | */
|
---|
184 | $Private['tmp_prefix'] = '.editor_';
|
---|
185 |
|
---|
186 |
|
---|
187 | // Config variables are finished, this returns our data to the caller.
|
---|
188 | if ($getprivates) {
|
---|
189 | return $Public+$Private;
|
---|
190 | }
|
---|
191 |
|
---|
192 | return $Public;
|
---|
193 | }
|
---|
194 | ?>
|
---|