(Sessions note template changed, code formatted with GesHi) |
(Article content moved to a template) |
||
Line 1: | Line 1: | ||
− | + | {{CKFinder_2.x_CheckAuthentication}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<source lang="cfm">function CheckAuthentication() | <source lang="cfm">function CheckAuthentication() | ||
{ | { | ||
Line 21: | Line 13: | ||
{{CKFinder_2.x Sessions note|lang=ColdFusion}} | {{CKFinder_2.x Sessions note|lang=ColdFusion}} | ||
− | + | {{CKFinder_2.x License|file=<code>config.cfm</code>|code= | |
− | |||
− | |||
<source lang="cfm">config.licenseName = 'put your license name here'; | <source lang="cfm">config.licenseName = 'put your license name here'; | ||
− | config.licenseKey = 'put your license key here';</source> | + | config.licenseKey = 'put your license key here';</source> }} |
− | |||
− | + | {{CKFinder_2.x baseUrl|baseUrl=baseUrl|code= | |
− | |||
− | |||
<source lang="cfm">config.baseUrl = 'http://example.com/ckfinder/files/'; | <source lang="cfm">config.baseUrl = 'http://example.com/ckfinder/files/'; | ||
− | config.baseUrl = '/userfiles/';</source> | + | config.baseUrl = '/userfiles/';</source>}} |
− | |||
− | |||
− | |||
− | |||
− | + | {{CKFinder_2.x baseDir|baseUrl=baseUrl|baseDir=baseDir|code1= | |
<source lang="cfm">config.baseDir = '/home/login/public_html/ckfinder/files/'; | <source lang="cfm">config.baseDir = '/home/login/public_html/ckfinder/files/'; | ||
− | config.baseDir = 'C:/SiteDir/CKFinder/userfiles/';</source> | + | config.baseDir = 'C:/SiteDir/CKFinder/userfiles/';</source>|code2= |
− | + | <source lang="cfm">config.baseDir = APPLICATION.CreateCFC("Utils.FileSystem").resolveUrl(config.baseUrl);</source>|code3= | |
− | <source lang="cfm">config.baseDir = APPLICATION.CreateCFC("Utils.FileSystem").resolveUrl(config.baseUrl);</source> | + | <source lang="cfm">config.baseUrl = '/userfiles/';</source>|code4= |
− | + | <source lang="cfm">config.baseUrl = 'http://example.com/ckfinder/files/';</source>}} | |
− | <source lang="cfm">config.baseUrl = '/userfiles/';</source> | ||
− | |||
− | <source lang="cfm">config.baseUrl = 'http://example.com/ckfinder/files/';</source> | ||
− |
Latest revision as of 13:25, 31 March 2011
This article describes how to get CKFinder up and running by adjusting some basic settings.
The CheckAuthentication() Function
By default, CKFinder will not work due to authentication restrictions. You must first make sure that you have configured it correctly, 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 ensuring that the requests are coming from an authenticated user. This is usually done by assigning a session variable when the user logs into your system.
If the user is properly authenticated, the fuction should return true
. We strongly recommend you to NOT simply return true
from this function without implementing authentication checks. Without authentication support anonymous users would be able to use CKFinder on your website, including uploading and deleting files from your server.
The following is a sample implementation of the CheckAuthentication()
function:
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 these fields blank, CKFinder will be fully functional, but it will be running in demonstration mode.
baseUrl
The baseUrl
is the base path used to build the final URL for the resources handled by 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.
baseDir
The baseDir
is the path to the local directory (on the server) which points to the baseUrl
URL described above. This is the path used by CKFinder to handle the files on the server. Full write permissions must be granted to this directory.
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);
Bear in mind 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, like the following one:
config.baseUrl = 'http://example.com/ckfinder/files/';
the path will not be discovered.