Skip to content

CKFinderBundle for symfony2

Notifications You must be signed in to change notification settings

blablacar/JonlilCKFinderBundle

 
 

Repository files navigation

JonlilCKFinderBundle

  1. Installation

"require": {
    "jonlil/ckfinder-bundle": "dev-master"
}
public function registerBundles()
{
    $bundles = array(
        new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
        new Jonlil\CKFinderBundle\JonlilCKFinderBundle('IvoryCKEditorBundle'),
    );
}
  1. Configuration

Routing
# app/config/routing.yml

ck_finder:
    resource: "@JonlilCKFinderBundle/Resources/config/routing/routing.yml"
    prefix: /ckfinder
For usage with amazon s3
# app/config/config.yml

jonlil_ck_finder:
    license:
        key: ""
        name: ""
    baseDir: "/"
    baseUrl: "http://s3.amazonaws.com"
    service: "s3"
    accessKey: ""
    secret: ""
    bucket: ""

There are also some optional parameters :

"thumbnailsEnabled": if you want to display thumbnails on the different images

"thumbnailsFile": to use a specific thumbnails to make a preview

"directAccess": if you have a direct access to the file forthe preview

"fileDelete", "fileRename", "fileUpload", "fileView": if you want to prevent some file action

"folderRename", "folderDelete", "folderCreate", "folderView": If you want to prevent some action on the folder

For usage with native php storage
jonlil_ck_finder:
    license: # optional, can be used in demo mode also
        key: ""
        name: ""
    baseDir: "%assetic.read_from%"
    baseUrl: "/userfiles/"  # path where your files will be stored
    service: "php"
Authentication
# app/config/config.yml

parameters:
    jonlil.ckfinder.customAuthentication: %kernel.root_dir%/...path your custom config.php or any other file

Write your own function CheckAuthentication() in your custom config.php

Examlple:

function CheckAuthentication()
{
	isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];

}
  1. Usage

# in your symfony2 form - add this
public function buildForm (FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('title')
        ->add('text', 'ckfinder')
        ->add('createdAt')
        ->add('updatedAt')
    ;
}
  1. Testing

This bundle provides a set of integration tests you should run whenever you make changes in the source code.

  • Git clone the bundle.
  • Execute composer update
  • Run php vendor/bin/phpunit
  1. Todos

Fix amazon s3 thumbnails - Refer to this project https://github.com/jonlil/ckfinder

Security should be managed in CheckAuthentication(). Look at the config.php file for further details.

Packages

 
 
 

Languages

  • JavaScript 91.3%
  • PHP 7.4%
  • Other 1.3%