PageRenderTime 61ms CodeModel.GetById 34ms RepoModel.GetById 1ms app.codeStats 0ms

/public/ctl/ck/ckfinder/config.php

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