PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/data/xinha/plugins/ExtendedFileManager/config.inc.php

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