简体   繁体   中英

Integrate CKfinder in CKEditor

i have tried using this http://dwij.co.in/ckeditor-ckfinder-integration-using-php/ for integrating CKfinder with CKeditor but didnt work.

Its showing me error. "The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file". (Is this warrning is because i just download the trial version?)

Here is my config file.

<?php

function CheckAuthentication()
{

    return false;
}
$config['LicenseName'] = '';
$config['LicenseKey'] = '';

$baseUrl = 'http://localhost/test/uploads';

$baseDir = resolveUrl($baseUrl);

$config['Thumbnails'] = Array(
        'url' => $baseUrl . '_thumbs',
        'directory' => $baseDir . '_thumbs',
        'enabled' => true,
        'directAccess' => false,
        'maxWidth' => 100,
        'maxHeight' => 100,
        'bmpSupported' => false,
        'quality' => 80);

$config['Images'] = Array(
        'maxWidth' => 1600,
        'maxHeight' => 1200,
        'quality' => 80);

$config['RoleSessionVar'] = 'CKFinder_UserRole';

$config['AccessControl'][] = Array(
        'role' => '*',
        'resourceType' => '*',
        'folder' => '/',

        'folderView' => true,
        'folderCreate' => true,
        'folderRename' => true,
        'folderDelete' => true,

        'fileView' => true,
        'fileUpload' => true,
        'fileRename' => true,
        'fileDelete' => true);

$config['DefaultResourceTypes'] = '';

$config['ResourceType'][] = Array(
        'name' => 'Files',              // Single quotes not allowed
        'url' => $baseUrl . 'files',
        'directory' => $baseDir . 'files',
        'maxSize' => 0,
        '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',
        'deniedExtensions' => '');

$config['ResourceType'][] = Array(
        'name' => 'Images',
        'url' => $baseUrl . 'images',
        'directory' => $baseDir . 'images',
        'maxSize' => 0,
        'allowedExtensions' => 'bmp,gif,jpeg,jpg,png',
        'deniedExtensions' => '');

$config['ResourceType'][] = Array(
        'name' => 'Flash',
        'url' => $baseUrl . 'flash',
        'directory' => $baseDir . 'flash',
        'maxSize' => 0,
        'allowedExtensions' => 'swf,flv',
        'deniedExtensions' => '');

$config['CheckDoubleExtension'] = true;

$config['DisallowUnsafeCharacters'] = false;

$config['FilesystemEncoding'] = 'UTF-8';

$config['SecureImageUploads'] = false;

$config['CheckSizeAfterScaling'] = true;

$config['HtmlExtensions'] = array('html', 'htm', 'xml', 'js');

$config['HideFolders'] = Array(".*", "CVS");

$config['HideFiles'] = Array(".*");

$config['ChmodFiles'] = 0777 ;

$config['ChmodFolders'] = 0777 ;

$config['ForceAscii'] = false;

$config['XSendfile'] = false;


include_once "plugins/imageresize/plugin.php";
include_once "plugins/fileeditor/plugin.php";
include_once "plugins/zip/plugin.php";

$config['plugin_imageresize']['smallThumb'] = '90x90';
$config['plugin_imageresize']['mediumThumb'] = '120x120';
$config['plugin_imageresize']['largeThumb'] = '180x180';

Here:

function CheckAuthentication()
{

    return false;
}

By default CheckAuthentication() it is disabled for security reason, because it would allow anyone to upload files to your server.

For testing purposes you can return true but the point is that you implement some logic to only authorize autenticated user.

function CheckAuthentication()
{
    //put some logic here

    return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
}

This is only for PHP User

To enable CKFinder you have to just open config.php file in CKFinder folder

then search for the below code...

function CheckAuthentication()
{
    return false;
}
$config['LicenseName'] = '';
$config['LicenseKey'] = '';

Now Replace false to true

and put LicenseName and LicenseKey

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM