(Created page with '== 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, …') |
(Sessions note template changed, code formatted with GesHi) |
||
Line 8: | Line 8: | ||
The following is a sample implementation for it: | The following is a sample implementation for it: | ||
− | < | + | <source lang="cfm">function CheckAuthentication() |
{ | { | ||
if ( structKeyExists(session, "IsAuthenticated") and session.IsAuthenticated ) | if ( structKeyExists(session, "IsAuthenticated") and session.IsAuthenticated ) | ||
Line 17: | Line 17: | ||
return false; | return false; | ||
} | } | ||
− | </ | + | </source> |
− | {{CKFinder_2.x Sessions|lang=ColdFusion}} | + | |
+ | {{CKFinder_2.x Sessions note|lang=ColdFusion}} | ||
+ | |||
=== License === | === License === | ||
If you purchased CKFinder you should put your license key in the config.cfm file: | If you purchased CKFinder you should put your license key in the config.cfm file: | ||
− | < | + | <source lang="cfm">config.licenseName = 'put your license name here'; |
− | config.licenseKey = 'put your license key here';</ | + | config.licenseKey = 'put your license key here';</source> |
If you leave this fields blank CKFinder will be fully functional but it will be ruining in demo mode. | If you leave this fields blank CKFinder will be fully functional but it will be ruining in demo mode. | ||
Line 29: | Line 31: | ||
The '''baseUrl''' is the base path used to build the final URL for the resources handled in CKFinder. Examples: | The '''baseUrl''' is the base path used to build the final URL for the resources handled in CKFinder. Examples: | ||
− | < | + | <source lang="cfm">config.baseUrl = 'http://example.com/ckfinder/files/'; |
− | config.baseUrl = '/userfiles/';</ | + | config.baseUrl = '/userfiles/';</source> |
If you leave this field empty the default value (/userfiles/) will be used. Notice that the trailing slash is required. | If you leave this field empty the default value (/userfiles/) will be used. Notice that the trailing slash is required. | ||
Line 38: | Line 40: | ||
You may point it to a directory directly: | You may point it to a directory directly: | ||
− | < | + | <source lang="cfm">config.baseDir = '/home/login/public_html/ckfinder/files/'; |
− | config.baseDir = 'C:/SiteDir/CKFinder/userfiles/';</ | + | config.baseDir = 'C:/SiteDir/CKFinder/userfiles/';</source> |
Or you may let CKFinder discover the path, based on baseUrl: | Or you may let CKFinder discover the path, based on baseUrl: | ||
− | < | + | <source lang="cfm">config.baseDir = APPLICATION.CreateCFC("Utils.FileSystem").resolveUrl(config.baseUrl);</source> |
Remember that CKFinder will only discover the path when the base url is a local web path ( relative to document root ).<br>Example: | Remember that CKFinder will only discover the path when the base url is a local web path ( relative to document root ).<br>Example: | ||
− | < | + | <source lang="cfm">config.baseUrl = '/userfiles/';</source> |
If it is a full URL address.<br>Example: | If it is a full URL address.<br>Example: | ||
− | < | + | <source lang="cfm">config.baseUrl = 'http://example.com/ckfinder/files/';</source> |
the path won't be discovered. Notice that the trailing slash is required. | the path won't be discovered. Notice that the trailing slash is required. |
Revision as of 11:44, 31 March 2011
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:
function CheckAuthentication() { if ( structKeyExists(session, "IsAuthenticated") and session.IsAuthenticated ) { return true; } return false; }
License
If you purchased CKFinder you should put your license key in the config.cfm file:
config.licenseName = 'put your license name here'; config.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.
baseUrl
The baseUrl is the base path used to build the final URL for the resources handled in CKFinder. Examples:
config.baseUrl = 'http://example.com/ckfinder/files/'; config.baseUrl = '/userfiles/';
If you leave this field empty the default value (/userfiles/) will be used. Notice that the trailing slash is required.
baseDir
The baseDir is the path to the local directory (in the server) which points to the above baseUrl 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:
config.baseDir = '/home/login/public_html/ckfinder/files/'; config.baseDir = 'C:/SiteDir/CKFinder/userfiles/';
Or you may let CKFinder discover the path, based on baseUrl:
config.baseDir = APPLICATION.CreateCFC("Utils.FileSystem").resolveUrl(config.baseUrl);
Remember that CKFinder will only discover the path when the base url is a local web path ( relative to document root ).
Example:
config.baseUrl = '/userfiles/';
If it is a full URL address.
Example:
config.baseUrl = 'http://example.com/ckfinder/files/';
the path won't be discovered. Notice that the trailing slash is required.