PageRenderTime 26ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/js/3rd party/ckfinder/config.php

http://comet.googlecode.com/
PHP | 307 lines | 72 code | 35 blank | 200 comment | 0 complexity | c077207c31701003ad06b6a162ea0981 MD5 | raw file
Possible License(s): AGPL-3.0
  1. <?php
  2. /*
  3. * ### CKFinder : Configuration File - Basic Instructions
  4. *
  5. * In a generic usage case, the following tasks must be done to configure
  6. * CKFinder:
  7. * 1. Check the $baseUrl and $baseDir variables;
  8. * 2. If available, paste your license key in the "LicenseKey" setting;
  9. * 3. Create the CheckAuthentication() function that enables CKFinder for authenticated users;
  10. *
  11. * Other settings may be left with their default values, or used to control
  12. * advanced features of CKFinder.
  13. */
  14. /**
  15. * This function must check the user session to be sure that he/she is
  16. * authorized to upload and access files in the File Browser.
  17. *
  18. * @return boolean
  19. */
  20. function CheckAuthentication()
  21. {
  22. // WARNING : DO NOT simply return "true". By doing so, you are allowing
  23. // "anyone" to upload and list the files in your server. You must implement
  24. // some kind of session validation here. Even something very simple as...
  25. // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
  26. // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
  27. // user logs in your system. To be able to use session variables don't
  28. // forget to add session_start() at the top of this file.
  29. return true;
  30. }
  31. // LicenseKey : Paste your license key here. If left blank, CKFinder will be
  32. // fully functional, in demo mode.
  33. $config['LicenseName'] = '';
  34. $config['LicenseKey'] = '';
  35. /*
  36. Uncomment lines below to enable PHP error reporting and displaying PHP errors.
  37. Do not do this on a production server. Might be helpful when debugging why CKFinder does not work as expected.
  38. */
  39. // error_reporting(E_ALL);
  40. // ini_set('display_errors', 1);
  41. /*
  42. To make it easy to configure CKFinder, the $baseUrl and $baseDir can be used.
  43. Those are helper variables used later in this config file.
  44. */
  45. /*
  46. $baseUrl : the base path used to build the final URL for the resources handled
  47. in CKFinder. If empty, the default value (/userfiles/) is used.
  48. Examples:
  49. $baseUrl = 'http://example.com/ckfinder/files/';
  50. $baseUrl = '/userfiles/';
  51. ATTENTION: The trailing slash is required.
  52. */
  53. $baseUrl = '/js/3rd party/ckfinder/userfiles/';
  54. /*
  55. $baseDir : the path to the local directory (in the server) which points to the
  56. above $baseUrl URL. This is the path used by CKFinder to handle the files in
  57. the server. Full write permissions must be granted to this directory.
  58. Examples:
  59. // You may point it to a directory directly:
  60. $baseDir = '/home/login/public_html/ckfinder/files/';
  61. $baseDir = 'C:/SiteDir/CKFinder/userfiles/';
  62. // Or you may let CKFinder discover the path, based on $baseUrl.
  63. // WARNING: resolveUrl() *will not work* if $baseUrl does not start with a slash ("/"),
  64. // for example if $baseDir is set to http://example.com/ckfinder/files/
  65. $baseDir = resolveUrl($baseUrl);
  66. ATTENTION: The trailing slash is required.
  67. */
  68. $baseDir = resolveUrl($baseUrl);
  69. /*
  70. * ### Advanced Settings
  71. */
  72. /*
  73. Thumbnails : thumbnails settings. All thumbnails will end up in the same
  74. directory, no matter the resource type.
  75. */
  76. $config['Thumbnails'] = Array(
  77. 'url' => $baseUrl . '_thumbs',
  78. 'directory' => $baseDir . '_thumbs',
  79. 'enabled' => true,
  80. 'directAccess' => false,
  81. 'maxWidth' => 100,
  82. 'maxHeight' => 100,
  83. 'bmpSupported' => false,
  84. 'quality' => 80);
  85. /*
  86. Set the maximum size of uploaded images. If an uploaded image is larger, it
  87. gets scaled down proportionally. Set to 0 to disable this feature.
  88. */
  89. $config['Images'] = Array(
  90. 'maxWidth' => 1600,
  91. 'maxHeight' => 1200,
  92. 'quality' => 80);
  93. /*
  94. RoleSessionVar : the session variable name that CKFinder must use to retrieve
  95. the "role" of the current user. The "role", can be used in the "AccessControl"
  96. settings (bellow in this page).
  97. To be able to use this feature, you must initialize the session data by
  98. uncommenting the following "session_start()" call.
  99. */
  100. $config['RoleSessionVar'] = 'CKFinder_UserRole';
  101. //session_start();
  102. /*
  103. AccessControl : used to restrict access or features to specific folders.
  104. Many "AccessControl" entries can be added. All attributes are optional.
  105. Subfolders inherit their default settings from their parents' definitions.
  106. - The "role" attribute accepts the special '*' value, which means
  107. "everybody".
  108. - The "resourceType" attribute accepts the special value '*', which
  109. means "all resource types".
  110. */
  111. $config['AccessControl'][] = Array(
  112. 'role' => '*',
  113. 'resourceType' => '*',
  114. 'folder' => '/',
  115. 'folderView' => true,
  116. 'folderCreate' => true,
  117. 'folderRename' => true,
  118. 'folderDelete' => true,
  119. 'fileView' => true,
  120. 'fileUpload' => true,
  121. 'fileRename' => true,
  122. 'fileDelete' => true);
  123. /*
  124. For example, if you want to restrict the upload, rename or delete of files in
  125. the "Logos" folder of the resource type "Images", you may uncomment the
  126. following definition, leaving the above one:
  127. $config['AccessControl'][] = Array(
  128. 'role' => '*',
  129. 'resourceType' => 'Images',
  130. 'folder' => '/Logos',
  131. 'folderView' => true,
  132. 'folderCreate' => true,
  133. 'folderRename' => true,
  134. 'folderDelete' => true,
  135. 'fileView' => true,
  136. 'fileUpload' => false,
  137. 'fileRename' => false,
  138. 'fileDelete' => false);
  139. */
  140. /*
  141. ResourceType : defines the "resource types" handled in CKFinder. A resource
  142. type is nothing more than a way to group files under different paths, each one
  143. having different configuration settings.
  144. Each resource type name must be unique.
  145. When loading CKFinder, the "type" querystring parameter can be used to display
  146. a specific type only. If "type" is omitted in the URL, the
  147. "DefaultResourceTypes" settings is used (may contain the resource type names
  148. separated by a comma). If left empty, all types are loaded.
  149. maxSize is defined in bytes, but shorthand notation may be also used.
  150. Available options are: G, M, K (case insensitive).
  151. 1M equals 1048576 bytes (one Megabyte), 1K equals 1024 bytes (one Kilobyte), 1G equals one Gigabyte.
  152. Example: 'maxSize' => "8M",
  153. */
  154. $config['DefaultResourceTypes'] = '';
  155. $config['ResourceType'][] = Array(
  156. 'name' => 'Files', // Single quotes not allowed
  157. 'url' => $baseUrl . 'files',
  158. 'directory' => $baseDir . 'files',
  159. 'maxSize' => 0,
  160. 'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip',
  161. 'deniedExtensions' => '');
  162. $config['ResourceType'][] = Array(
  163. 'name' => 'Images',
  164. 'url' => $baseUrl . 'images',
  165. 'directory' => $baseDir . 'images',
  166. 'maxSize' => "16M",
  167. 'allowedExtensions' => 'bmp,gif,jpeg,jpg,png,avi,iso,mp3',
  168. 'deniedExtensions' => '');
  169. $config['ResourceType'][] = Array(
  170. 'name' => 'Flash',
  171. 'url' => $baseUrl . 'flash',
  172. 'directory' => $baseDir . 'flash',
  173. 'maxSize' => 0,
  174. 'allowedExtensions' => 'swf,flv',
  175. 'deniedExtensions' => '');
  176. /*
  177. Due to security issues with Apache modules, it is recommended to leave the
  178. following setting enabled.
  179. How does it work? Suppose the following:
  180. - If "php" is on the denied extensions list, a file named foo.php cannot be
  181. uploaded.
  182. - If "rar" (or any other) extension is allowed, one can upload a file named
  183. foo.rar.
  184. - The file foo.php.rar has "rar" extension so, in theory, it can be also
  185. uploaded.
  186. In some conditions Apache can treat the foo.php.rar file just like any PHP
  187. script and execute it.
  188. If CheckDoubleExtension is enabled, each part of the file name after a dot is
  189. checked, not only the last part. In this way, uploading foo.php.rar would be
  190. denied, because "php" is on the denied extensions list.
  191. */
  192. $config['CheckDoubleExtension'] = true;
  193. /*
  194. If you have iconv enabled (visit http://php.net/iconv for more information),
  195. you can use this directive to specify the encoding of file names in your
  196. system. Acceptable values can be found at:
  197. http://www.gnu.org/software/libiconv/
  198. Examples:
  199. $config['FilesystemEncoding'] = 'CP1250';
  200. $config['FilesystemEncoding'] = 'ISO-8859-2';
  201. */
  202. $config['FilesystemEncoding'] = 'UTF-8';
  203. /*
  204. Perform additional checks for image files
  205. if set to true, validate image size
  206. */
  207. $config['SecureImageUploads'] = true;
  208. /*
  209. Indicates that the file size (maxSize) for images must be checked only
  210. after scaling them. Otherwise, it is checked right after uploading.
  211. */
  212. $config['CheckSizeAfterScaling'] = true;
  213. /*
  214. For security, HTML is allowed in the first Kb of data for files having the
  215. following extensions only.
  216. */
  217. $config['HtmlExtensions'] = array('html', 'htm', 'xml', 'js');
  218. /*
  219. Folders to not display in CKFinder, no matter their location.
  220. No paths are accepted, only the folder name.
  221. The * and ? wildcards are accepted.
  222. */
  223. $config['HideFolders'] = Array(".svn", "CVS");
  224. /*
  225. Files to not display in CKFinder, no matter their location.
  226. No paths are accepted, only the file name, including extension.
  227. The * and ? wildcards are accepted.
  228. */
  229. $config['HideFiles'] = Array(".*");
  230. /*
  231. After file is uploaded, sometimes it is required to change its permissions
  232. so that it was possible to access it at the later time.
  233. If possible, it is recommended to set more restrictive permissions, like 0755.
  234. Set to 0 to disable this feature.
  235. Note: not needed on Windows-based servers.
  236. */
  237. $config['ChmodFiles'] = 0777 ;
  238. /*
  239. See comments above.
  240. Used when creating folders that does not exist.
  241. */
  242. $config['ChmodFolders'] = 0755 ;
  243. /*
  244. Force ASCII names for files and folders.
  245. If enabled, characters with diactric marks, like ĺ, ä, ö, ?, ?, ?, š
  246. will be automatically converted to ASCII letters.
  247. */
  248. $config['ForceAscii'] = false;
  249. include_once "plugins/imageresize/plugin.php";
  250. include_once "plugins/fileeditor/plugin.php";
  251. $config['plugin_imageresize']['smallThumb'] = '90x90';
  252. $config['plugin_imageresize']['mediumThumb'] = '120x120';
  253. $config['plugin_imageresize']['largeThumb'] = '180x180';