source: trunk/unsupported_plugins/ImageManager/config.inc.php @ 1367

Last change on this file since 1367 was 1367, checked in by gogo, 22 months ago

Fix loading warning for a not-found or forbidden plugin. Remove the die's I just added to EFM and IM, they would be "hard to discover" because first you would get the .htaccess denial warning, you'd fix that, but it still wouldn't work.

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 13.3 KB
Line 
1<?php
2
3/**
4 * Image Manager configuration file.
5 * @author $Author:gogo $
6 * @version $Id:config.inc.php 830 2007-05-09 13:27:34Z gogo $
7 * @package ImageManager
8 *
9 * @todo change all these config values to defines()
10 */
11
12// REVISION HISTORY:
13//
14// 2005-03-20 Yermo Lamers (www.formvista.com):
15//      . unified backend.
16// . created a set of defaults that make sense for bundling with Xinha.
17
18// -------------------------------------------------------------------------
19
20/**
21* Default backend URL
22*
23* URL to use for unified backend.
24*
25* The ?__plugin=ImageManager& is required.
26*/
27
28$IMConfig['backend_url'] = "backend.php?__plugin=ImageManager&";
29
30/**
31* Backend Installation Directory
32*
33* location of backend install; these are used to link to css and js
34* assets because we may have the front end installed in a different
35* directory than the backend. (i.e. nothing assumes that the frontend
36* and the backend are in the same directory)
37*/
38
39$IMConfig['base_dir'] = getcwd();
40$IMConfig['base_url'] = '';
41
42// ------------------------------------------------------------
43
44/**
45* Path to directory containing images.
46*
47* File system path to the directory you want to manage the images
48* for multiple user systems, set it dynamically.
49*
50* NOTE: This directory requires write access by PHP. That is,
51* PHP must be able to create files in this directory.
52* Able to create directories is nice, but not necessary.
53*
54* CHANGE THIS: for out-of-the-box demo purposes we're setting this to ./demo_images
55* which has some graphics in it.
56*/
57
58// $IMConfig['images_dir'] = "/some/path/to/images/directory;
59
60$IMConfig['images_dir'] = "demo_images";
61
62// -------------------------------------------------------------------------
63
64/**
65* URL of directory containing images.
66*
67* The URL to the above path, the web browser needs to be able to see it.
68* It can be protected via .htaccess on apache or directory permissions on IIS,
69* check you web server documentation for futher information on directory protection
70* If this directory needs to be publicly accessiable, remove scripting capabilities
71* for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets
72* in this directory and its subdirectories.
73*
74* CHANGE THIS: You need to change this to match the url where you have Xinha
75* installed. If the images show up blank chances are this is not set correctly.
76*/
77
78// $IMConfig['images_url'] = "/url/to/above";
79
80// try to figure out the URL of the sample images directory. For your installation
81// you will probably want to keep images in another directory.
82
83$IMConfig['images_url'] = str_replace( "backend.php", "", $_SERVER["PHP_SELF"] ) . "demo_images";
84
85// -------------------------------------------------------------------------
86
87/**
88* PHP Safe Mode?
89*
90* Possible values: true, false
91*
92* TRUE - If PHP on the web server is in safe mode, set this to true.
93* SAFE MODE restrictions: directory creation will not be possible,
94* only the GD library can be used, other libraries require
95* Safe Mode to be off.
96*
97* FALSE - Set to false if PHP on the web server is not in safe mode.
98*/
99
100$IMConfig['safe_mode'] = false;
101
102// -------------------------------------------------------------------------
103
104/**
105* Image Library to use.
106*
107* Possible values: 'GD', 'IM', or 'NetPBM'
108*
109* The image manipulation library to use, either GD or ImageMagick or NetPBM.
110* If you have safe mode ON, or don't have the binaries to other packages,
111* your choice is 'GD' only. Other packages require Safe Mode to be off.
112*
113* DEFAULT: GD is probably the most likely to be available.
114*/
115
116$IMConfig['IMAGE_CLASS'] = 'GD';
117
118
119// -------------------------------------------------------------------------
120
121/**
122* NetPBM or IM binary path.
123*
124* After defining which library to use, if it is NetPBM or IM, you need to
125* specify where the binary for the selected library are. And of course
126* your server and PHP must be able to execute them (i.e. safe mode is OFF).
127* GD does not require the following definition.
128*/
129
130$IMConfig['IMAGE_TRANSFORM_LIB_PATH'] ='/usr/bin/';
131
132// For windows, something like
133// C:/"Program Files"/ImageMagick-5.5.7-Q16/
134
135// -------------------------------------------------------------------------
136//                OPTIONAL SETTINGS
137// -------------------------------------------------------------------------
138
139/**
140* Thumbnail prefix
141*
142* The prefix for thumbnail files, something like .thumb will do. The
143* thumbnails files will be named as "prefix_imagefile.ext", that is,
144*  prefix + orginal filename.
145*/
146
147$IMConfig['thumbnail_prefix'] = '.';
148
149// -------------------------------------------------------------------------
150
151/**
152* Thumbnail Directory
153*
154* Thumbnail can also be stored in a directory, this directory
155* will be created by PHP. If PHP is in safe mode, this parameter
156*  is ignored, you can not create directories.
157*
158*  If you do not want to store thumbnails in a directory, set this
159*  to false or empty string '';
160*/
161
162$IMConfig['thumbnail_dir'] = '.thumbs';
163
164// -------------------------------------------------------------------------
165
166/**
167 * Resize files, or not.  If the dimensions for an image are changed
168 * this will control if the image is actually resized. 
169 *
170 * Usually you want this true, unless you are very disk space concious.
171 */
172 
173$IMConfig['resize_files'] = true;
174
175// -------------------------------------------------------------------------
176
177/**
178* Resized prefix
179*
180* The prefix for resized files, something like .resized will do.  The
181* resized files will be named <prefix>_<width>x<height>_<original>
182* resized files are created when one changes the dimensions of an image
183* in the image manager selection dialog - the image is scaled when the
184* user clicks the ok button.
185*/
186
187$IMConfig['resized_prefix'] = '.resized';
188
189// -------------------------------------------------------------------------
190
191/**
192* Resized Directory
193*
194* Resized images may also be stored in a directory, except in safe mode.
195*/
196
197$IMConfig['resized_dir'] = '.resized';
198
199/**
200 * Full options
201 *
202 * Determines whether the user is given options for padding,
203 * background/padding colour, margin, border and border colour.
204 */
205
206$IMConfig['show_full_options'] = true;
207 
208// -------------------------------------------------------------------------
209
210/**
211* Allow New Directories
212*
213*
214* Possible values: true, false
215*
216* TRUE -  Allow the user to create new sub-directories in the
217*        $IMConfig['base_dir'].
218*
219* FALSE - No directory creation.
220*
221* NOTE: If $IMConfig['safe_mode'] = true, this parameter
222*     is ignored, you can not create directories
223*
224* DEFAULT: for demo purposes we turn this off.
225*/
226
227$IMConfig['allow_new_dir'] = false;
228
229// -------------------------------------------------------------------------
230
231/**
232* Allow Uploads
233*
234*  Possible values: true, false
235*
236*  TRUE - Allow the user to upload files.
237*
238*  FALSE - No uploading allowed.
239*
240* DEFAULT: for demo purposes we turn this off.
241*/
242
243$IMConfig['allow_upload'] = false;
244
245// -------------------------------------------------------------------------
246
247/**
248* Allow Delete
249*
250*  Possible values: true, false
251*
252*  TRUE - Allow the user to delete files/dirs
253*
254*  FALSE - No deleting allowed.
255*
256*/
257
258$IMConfig['allow_delete'] = false;
259
260// -------------------------------------------------------------------------
261
262/**
263* Allow Edit
264*
265*  Possible values: true, false
266*
267*  TRUE - Allow the user to edit files
268*
269*  FALSE - No editing allowed.
270*
271*/
272
273$IMConfig['allow_edit'] = false;
274
275
276// -------------------------------------------------------------------------
277
278/**
279* Validate Images
280*
281* Possible values: true, false
282*
283* TRUE - If set to true, uploaded files will be validated based on the
284*        function getImageSize, if we can get the image dimensions then
285*        I guess this should be a valid image. Otherwise the file will be rejected.
286*
287* FALSE - All uploaded files will be processed.
288*
289* NOTE: If uploading is not allowed, this parameter is ignored.
290*/
291
292$IMConfig['validate_images'] = true;
293
294$IMConfig['allowed_image_extensions'] = array("jpg","gif","png","jpeg");
295
296// -------------------------------------------------------------------------
297
298/**
299* Default Thumnail.
300*
301* The default thumbnail if the thumbnails can not be created, either
302* due to error or bad image file.
303*/
304
305$IMConfig['default_thumbnail'] = 'img/default.gif';
306
307// -------------------------------------------------------------------------
308
309/**
310*  Thumbnail dimensions.
311*/
312
313$IMConfig['thumbnail_width'] = 96;
314$IMConfig['thumbnail_height'] = 96;
315
316// -------------------------------------------------------------------------
317
318/**
319* Editor Temporary File Prefix.
320*
321* Image Editor temporary filename prefix.
322*/
323
324$IMConfig['tmp_prefix'] = '.editor_';
325
326
327$IMConfig['ViewMode'] = 'thumbs';
328
329// -------------------------------------------------------------------------
330
331/** Margin Types
332 *  If your HTML will be used in an email, then using CSS type "margin"
333 *  is not so reliable and you should set UseHSpaceVSpace to be true
334 *  to go back to the old fashioned hspace="" and vspace="" attributes on
335 *  images.
336 */
337$IMConfig['UseHSpaceVSpace'] = false;
338
339// -------------------------------------------------------------------------
340
341/**
342 * ImageManager/Picker can provide selection interfaces for more than just
343 * images on the server ("Pictures").
344 *
345 *  Local - the classical ImageManager for images stored on this server.
346 *
347 *  YouTube  - provides selection (but not upload etc) of videos on YouTube
348 *    see smart-image.js for how to make the videos work as videos instead of
349 *    static images.
350 *
351 *  Flickr   - provides selection (but not upload etc) of public images on Flickr
352 *    Set
353 *       $IMConfig['Flickr'] = array('Key' => 'yourkeyhere');
354 *    to turn on Flickr support.
355 *
356 *    To get a key: http://www.flickr.com/services/api/keys/
357 *
358 *    WARNING: Flickr restricts commercial use of the API.  If your site is in any way even
359 *     remotely commercial you need to ask for a commercial key from flickr.
360 *
361 *    ADDITIONAL WARNING: Flickr requires that you provide a link back to them, preferably
362 *     on the image itself (linking to the image) - you can use smart-image.js to do
363 *     something like this.
364 *
365 *    ADDITIONAL ADDITIONAL WARNING: It's up to you to comply with the image's license!!
366 */
367 
368$IMConfig['Local'] = TRUE;
369$IMConfig['YouTube']  = FALSE;
370$IMConfig['Flickr']   = FALSE;
371
372// These are some configurable defaults for Flickr, to override
373//  $IMConfig['Flickr'] = array('Whatever' => 'You Want');
374$FlickrDefaults = array
375(
376  // This is the URL as flickr provides it for the licence which you wish
377  // to search on by default.  The default here is the least restrictive one.
378  'Default License' => 'http://creativecommons.org/licenses/by/2.0/',
379   
380); 
381
382
383////////////////////////////////////////////////////////////////////////////////
384//       ================== END OF CONFIGURATION =======================      //
385////////////////////////////////////////////////////////////////////////////////
386
387
388// Standard PHP Backend Data Passing
389//  if data was passed using xinha_pass_to_php_backend() we merge the items
390//  provided into the Config
391require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php'));
392if($passed_data = xinha_read_passed_data())
393{
394  $IMConfig = array_merge($IMConfig, $passed_data);
395  $IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&';
396 
397  if($IMConfig['Flickr'])
398  {
399    foreach($FlickrDefaults as $k => $v)
400    {
401      if(!isset($IMConfig['Flickr'][$k]))
402      {
403        $IMConfig['Flickr'][$k] = $v;
404      }
405    }
406  }
407}
408// Deprecated config passing, don't use this way any more!
409elseif(isset($_REQUEST['backend_config']))
410{
411  if(get_magic_quotes_gpc()) {
412    $_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']);
413  }
414 
415  if($_REQUEST['backend_config_secret_key_location'] !== 'Xinha:ImageManager')
416  {
417    trigger_error('Programming Error - please contact the website administrator/programmer to alert them to this problem. A non-default backend key location is being used to pass backend data to Xinha, but the same key location is not being used to receive data.  The special backend configuration has been ignored.  To resolve this, you should edit plugins/ImageManager/config.php and change the default key location from "Xinha:ImageManager" to your desired non default.  See: http://trac.xinha.org/ticket/1518', E_USER_ERROR);   
418  }
419  else
420  {
421 
422  // Config specified from front end, check that it's valid
423  session_start();
424  $secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']];
425
426  if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret))
427  {
428    die("Backend security error.");
429  }
430
431  $to_merge = unserialize($_REQUEST['backend_config']);
432  if(!is_array($to_merge))
433  {
434    die("Backend config syntax error.");
435  }
436
437  $IMConfig = array_merge($IMConfig, $to_merge);
438  $IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&';
439  $IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&';
440  $IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&';
441  }
442}
443
444define('IMAGE_CLASS', $IMConfig['IMAGE_CLASS']);
445define('IMAGE_TRANSFORM_LIB_PATH', $IMConfig['IMAGE_TRANSFORM_LIB_PATH']);
446define( "IM_CONFIG_LOADED", "yes" );
447
448// bring in the debugging library
449
450include_once( "ddt.php" );
451
452// uncomment to send debug messages to a local file
453// _setDebugLog( "/tmp/debug_log.txt" );
454
455// turn debugging on everywhere.
456// _ddtOn();
457
458// END
459
460?>
Note: See TracBrowser for help on using the repository browser.