PageRenderTime 186ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/Quản lý website bán vé máy bay PHP/ckfinder/config.php

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