Line 1: | Line 1: | ||
− | === | + | === The CheckAuthentication() function<br> === |
+ | |||
+ | By default, CKFinder will not work due to authentication restrictions. You must first be sure that you have configured it properly, and then enable it. | ||
+ | |||
+ | Once you have completely configured CKFinder, you are ready to enable it for use. The CheckAuthentication() function is used for that. In this function, you must implement the code that ensures that the requests are coming from an authenticated user. This is usually done by assigning a session variable when the user logs on your system. | ||
+ | |||
+ | Return "true" if the user is properly authenticated. We strongly recommend you to NOT simply return "true" from this function without implementing authentication checks. Anonymous users would be able to use CKFinder, including uploading and deleting files from your server. | ||
+ | |||
+ | The following is a sample implementation for it: | ||
+ | <pre>public override bool CheckAuthentication() | ||
+ | { | ||
+ | if ( Session[ "IsAuthenticated" ] && (bool)Session[ "IsAuthenticated" ] == true ) | ||
+ | { | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | return false; | ||
+ | } | ||
+ | </pre> | ||
− | |||
− | |||
=== License === | === License === | ||
Revision as of 11:52, 11 January 2008
The CheckAuthentication() function
By default, CKFinder will not work due to authentication restrictions. You must first be sure that you have configured it properly, and then enable it.
Once you have completely configured CKFinder, you are ready to enable it for use. The CheckAuthentication() function is used for that. In this function, you must implement the code that ensures that the requests are coming from an authenticated user. This is usually done by assigning a session variable when the user logs on your system.
Return "true" if the user is properly authenticated. We strongly recommend you to NOT simply return "true" from this function without implementing authentication checks. Anonymous users would be able to use CKFinder, including uploading and deleting files from your server.
The following is a sample implementation for it:
public override bool CheckAuthentication() { if ( Session[ "IsAuthenticated" ] && (bool)Session[ "IsAuthenticated" ] == true ) { return true; } return false; }
License
If you purchased CKFinder you should put your license key in the ckfinder.config file:
licenseName = "put your license name here" licenseKey = "put your license key here"
If you leave this fields blank CKFinder will be fully functional but it will be ruining in demo mode.
BaseDirectory
The url is the base path used to build the final URL for the resources handled in CKFinder. Examples:
url = "/ckfinder/userfiles/"
Notice that the trailing slash is required.
The serverPath is the path to the local directory (in the server) which points to the above url. This is the path used by CKFinder to handle the files in the server. Full write permissions must be granted to this directory. Examples:
You may point it to a directory directly:
serverPath = "/home/login/public_html/ckfinder/files/" serverPath = "C:/SiteDir/CKFinder/userfiles/"
Or you may let CKFinder discover the path, based on url by leaving the field empty
serverPath = ""
Remember that CKFinder will only discover the path when the base url is a local web path ( relative to document root ).
Example:
url = "/userfiles/"
If it is a full URL address.
Example:
url= "http://example.com/ckfinder/files/"
the path won't be discovered. Notice that the trailing slash is required.