Sha256: 58cc2f7045b6fabca8c3bb63b08d290903116c157e9d1ab31cb91bba67be6875

Contents?: true

Size: 1.18 KB

Versions: 38

Compression:

Stored size: 1.18 KB

Contents

require 'el_finder/action'

module Optimacms
  class ElfinderController < ApplicationController
    skip_before_filter :verify_authenticity_token, :only => ['elfinder']

    def index
       render :layout => false
    end

    def elfinder
      dirpath = Optimacms.files_dir_path
      rootpath = File.join(Rails.public_path, dirpath)
      rooturl = '/'+dirpath

      h, r = ElFinder::Connector.new(
        :root => rootpath,
        :url => rooturl,
        :perms => {
           #/^(Welcome|README)$/ => {:read => true, :write => false, :rm => false},
           '.' => {:read => true, :write => true, :rm => true}, # '.' is the proper way to specify the home/root directory.
           #/^test$/ => {:read => true, :write => true, :rm => false},
           #'logo.png' => {:read => true},
           #/\.png$/ => {:read => false} # This will cause 'logo.png' to be unreadable.
           # Permissions err on the safe side. Once false, always false.
        },
        :thumbs => true
      ).run(params)

      headers.merge!(h)

      if r.empty?
        (render :nothing => true) and return
      end

      render :json => r, :layout => false
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
optimacms-0.3.12 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.11 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.26 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.25 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.24 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.4 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.3 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.21 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.20 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.16 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.15 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.14 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.13 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.12 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.11 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.9 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.3 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.1.59 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.1.58 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.1.57 app/controllers/optimacms/elfinder_controller.rb