Sha256: 8bb041ac6c43d892ad6d149387df1a0e54d8106a048304af93136e17f89ff37b

Contents?: true

Size: 1.15 KB

Versions: 23

Compression:

Stored size: 1.15 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

23 entries across 23 versions & 1 rubygems

Version Path
optimacms-0.1.61 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.9 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.8 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.7 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.6 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.5 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.2 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.3.1 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.23 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.22 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.19 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.18 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.17 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.8 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.7 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.6 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.5 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.1.60 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.2 app/controllers/optimacms/elfinder_controller.rb
optimacms-0.2.1 app/controllers/optimacms/elfinder_controller.rb