Author: Dmitry (dio) Levashov
Inheritance: extends elFinderConnector
Ejemplo n.º 1
0
 public function showConnector()
 {
     $roots = $this->app->config->get('elfinder.roots', []);
     if (empty($roots)) {
         $dirs = (array) $this->app['config']->get('elfinder.dir', []);
         foreach ($dirs as $dir) {
             $roots[] = ['driver' => 'LocalFileSystem', 'path' => public_path($dir), 'URL' => url($dir), 'accessControl' => $this->app->config->get('elfinder.access')];
         }
         $disks = (array) $this->app['config']->get('elfinder.disks', []);
         foreach ($disks as $key => $root) {
             if (is_string($root)) {
                 $key = $root;
                 $root = [];
             }
             $disk = app('filesystem')->disk($key);
             if ($disk instanceof FilesystemAdapter) {
                 $defaults = ['driver' => 'Flysystem', 'filesystem' => $disk->getDriver(), 'alias' => $key];
                 $roots[] = array_merge($defaults, $root);
             }
         }
     }
     $opts = $this->app->config->get('elfinder.options', array());
     $opts = array_merge(['roots' => $roots], $opts);
     // run elFinder
     $connector = new Connector(new \elFinder($opts));
     $connector->run();
     return $connector->getResponse();
 }
Ejemplo n.º 2
0
 public function getConnector(Request $request)
 {
     $own_directory = $this->makeDirectory();
     $uploadAllow = ['image/jpeg', 'image/png', 'image/gif', 'image/vnd.adobe.photoshop', 'application/pdf', 'application/x-shockwave-flash', 'video/x-flv', 'video/h264', 'video/webm', 'audio/aac', 'audio/mp4', 'audio/mpeg', 'audio/ogg', 'audio/webm', 'image/vnd.djvu', 'application/vnd.oasis.opendocument.chart', 'application/vnd.oasis.opendocument.formula', 'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.image', 'application/vnd.oasis.opendocument.presentation', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.text', 'application/epub+zip', 'application/vnd.ms-htmlhelp', 'application/x-mobipocket-ebook', 'application/onenote', 'application/vnd.ms-project', 'application/x-mspublisher', 'application/vnd.visio', 'application/x-mswrite', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.sun.xml.calc', 'application/vnd.sun.xml.draw', 'application/vnd.sun.xml.impress', 'application/vnd.sun.xml.math', 'text/plain', 'application/zip', 'application/x-rar-compressed'];
     $customType = $request->input('custom_type', '');
     $onlyMimes = $this->onlyMimes($customType);
     if (!empty($onlyMimes)) {
         $uploadAllow = $onlyMimes;
     }
     $connector = new Connector(new \elFinder(['roots' => [['driver' => 'LocalFileSystem', 'path' => public_path('files/' . $own_directory), 'alias' => 'Online drive: \\Home', 'URL' => asset('files/' . $own_directory . '/'), 'accessControl' => config('elfinder.access'), 'dateFormat' => DateTimeHelper::shortDateFormat(), 'timeFormat' => DateTimeHelper::shortTimeFormat(), 'uploadAllow' => $uploadAllow, 'uploadDeny' => ['all'], 'uploadOrder' => ['deny', 'allow']]]]));
     $connector->run();
     return $connector->getResponse();
 }
Ejemplo n.º 3
0
 public function showConnector()
 {
     $dir = $this->app->config->get($this->package . '::dir');
     $roots = $this->app->config->get($this->package . '::roots');
     if (!$roots) {
         $roots = array(array('driver' => 'LocalFileSystem', 'path' => $this->app['path.public'] . DIRECTORY_SEPARATOR . $dir, 'URL' => $this->app['url']->asset($dir), 'accessControl' => $this->app->config->get($this->package . '::access')));
     }
     $opts = $this->app->config->get($this->package . '::options', array());
     $opts = array_merge(array('roots' => $roots), $opts);
     // run elFinder
     $connector = new Connector(new \elFinder($opts));
     $connector->run();
     return $connector->getResponse();
 }
 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function showConnector()
 {
     // xAbe todo : decommente dans le controller le _before();
     $debug = false;
     $session = null;
     $roots = $this->getElFinderRoots();
     if (empty($roots)) {
         $roots = array_merge($this->getMountableElFinderDirectoriesList(), $this->getMountableElFinderDisksList());
     }
     //		if (app()->bound('session.store'))
     //		{
     //			$sessionStore = app('session.store');
     //			$session = new LaravelSession($sessionStore);
     //		}
     $rootOptions = Settings::get('elfinder.root_options', []);
     foreach ($roots as $key => $root) {
         if (is_array($rootOptions)) {
             $roots[$key] = array_merge($rootOptions, $root);
         }
     }
     $opts = Settings::get('elfinder.options', []);
     $opts = array_merge($opts, ['roots' => $roots, 'session' => $session, 'debug' => $debug]);
     $elFinder = new \elFinder($opts);
     // run elFinder
     $connector = new Connector($elFinder, $debug);
     $connector->run();
     return $connector->getResponse();
 }
 public function showConnector()
 {
     $roots = $this->app->config->get('elfinder.roots', []);
     if (empty($roots)) {
         $dirs = (array) $this->app['config']->get('elfinder.dir', []);
         foreach ($dirs as $dir) {
             $roots[] = ['driver' => 'LocalFileSystem', 'path' => public_path($dir), 'URL' => url($dir), 'accessControl' => $this->app->config->get('elfinder.access')];
         }
         $disks = (array) $this->app['config']->get('elfinder.disks', []);
         foreach ($disks as $key => $root) {
             if (is_string($root)) {
                 $key = $root;
                 $root = [];
             }
             $disk = app('filesystem')->disk($key);
             if ($disk instanceof FilesystemAdapter) {
                 $filesystem = $disk->getDriver();
                 if (method_exists($filesystem, 'getAdapter')) {
                     $adapter = $filesystem->getAdapter();
                     if (!$adapter instanceof CachedAdapter) {
                         $adapter = new CachedAdapter($adapter, new Memory());
                         $filesystem = new Filesystem($adapter);
                     }
                 }
                 $defaults = ['driver' => 'Flysystem', 'filesystem' => $filesystem, 'alias' => $key];
                 $roots[] = array_merge($defaults, $root);
             }
         }
     }
     if (app()->bound('session.store')) {
         $sessionStore = app('session.store');
         $session = new LaravelSession($sessionStore);
     } else {
         $session = null;
     }
     $rootOptions = $this->app->config->get('elfinder.root_options', array());
     foreach ($roots as $key => $root) {
         $roots[$key] = array_merge($rootOptions, $root);
     }
     $opts = $this->app->config->get('elfinder.options', array());
     $opts = array_merge($opts, ['roots' => $roots, 'session' => $session]);
     // run elFinder
     $connector = new Connector(new \elFinder($opts));
     $connector->run();
     return $connector->getResponse();
 }