public function handleOptions() { $opts = array('debug' => true, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => APP_DIR . '/media/' . $_GET["path"], 'URL' => '/www/media/' . $_GET["path"], 'uploadDeny' => array('all'), 'uploadAllow' => array('image', 'text/plain'), 'uploadOrder' => array('deny', 'allow'), 'accessControl' => 'access', 'fileMode' => 0644, 'attributes' => $this->getHiddenDirectories()), array('driver' => 'LocalFileSystem', 'path' => APP_DIR . '/images', 'URL' => '/www/images', 'uploadDeny' => array('all'), 'uploadAllow' => array('image', 'text/plain'), 'uploadOrder' => array('deny', 'allow'), 'accessControl' => 'access', 'fileMode' => 0644, 'attributes' => $this->getHiddenDirectories()))); // Run elFinder $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); }
public function load() { error_reporting(0); // Set E_ALL for debuging import("@.ORG.elfinder.elFinderConnector"); import("@.ORG.elfinder.elFinder"); import("@.ORG.elfinder.elFinderVolumeDriver"); import("@.ORG.elfinder.elFinderVolumeLocalFileSystem"); //include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php'; //include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php'; //include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php'; //include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php'; // Required for MySQL storage connector // include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php'; // Required for FTP connector support // include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php'; /** * Simple function to demonstrate how to control file access using "accessControl" callback. * This method will disable accessing files/folders starting from '.' (dot) * * @param string $attr attribute name (read|write|locked|hidden) * @param string $path file path relative to volume root directory started with directory separator * @return bool|null **/ function access($attr, $path, $data, $volume) { return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null; // else elFinder decide it itself } $opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => BASE_PATH . '/uploads/', 'URL' => __ROOT__ . '/uploads/', 'accessControl' => 'access'))); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); }
/** * Method to run this controller. * * @return mixed */ protected function doExecute() { // Init some API objects // ================================================================================ $elfinder_path = WINDWALKER . '/src/Elfinder/Connect/'; include_once $elfinder_path . 'elFinderConnector.class.php'; include_once $elfinder_path . 'elFinder.class.php'; include_once $elfinder_path . 'elFinderVolumeDriver.class.php'; /** * Simple function to demonstrate how to control file access using "accessControl" callback. * This method will disable accessing files/folders starting from '.' (dot) * * @param string $attr attribute name (read|write|locked|hidden) * @param string $path file path relative to volume root directory started with directory separator * * @return bool|null */ function access($attr, $path) { // If file/folder begins with '.' (dot). Set read+write to false, other (locked+hidden) set to true if (strpos(basename($path), '.') === 0) { return !($attr == 'read' || $attr == 'write'); } else { return null; } } $opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => JPath::clean(JPATH_ROOT . '/images/quickicons'), 'URL' => JPath::clean(JURI::root(true) . '/images/quickicons/'), 'tmbPath' => JPath::clean(JPATH_ROOT . '/cache/aqi-finder-thumb'), 'tmbURL' => JURI::root(true) . '/cache/aqi-finder-thumb', 'tmp' => JPath::clean(JPATH_ROOT . '/cache/aqi-finder-temp'), 'accessControl' => 'access', 'uploadDeny' => array('text/x-php'), 'disabled' => array('archive', 'extract', 'rename', 'mkfile')))); foreach ($opts['roots'] as $driver) { include_once $elfinder_path . 'elFinderVolume' . $driver['driver'] . '.class.php'; } // Run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); exit; }
/** * Connector action */ public function actionConnector() { /** @var ElFinderComponent $elFinder */ $elFinder = Yii::$app->get('elFinder'); $roots = array_map(function ($root) { /** @var Root $root */ return $root->getOptions(); }, $elFinder->roots); /** @var FilesystemComponent $filesystem */ $filesystem = Yii::$app->get('filesystem'); foreach ($elFinder->filesystems as $key => $root) { if (is_string($root)) { $key = $root; $root = []; } $fs = $filesystem->get($key); if ($fs instanceof Filesystem) { $defaults = ['driver' => 'Flysystem', 'filesystem' => $fs, 'alias' => Inflector::titleize($key)]; $roots[] = array_merge($defaults, $root); } } $options = array('locale' => '', 'roots' => $roots); $connector = new \elFinderConnector(new \elFinder($options)); $connector->run(); }
public function connector() { $this->controller->autoRender = false; $options = Configure::read('Elfinder.options'); $connector = new elFinderConnector(new elFinder($options)); $connector->run(); }
function connector() { $mainframe = JFactory::getApplication(); $params = JComponentHelper::getParams('com_digicom'); $root = $params->get('ftp_source_path', 'digicom'); $folder = JRequest::getVar('folder', $root, 'default', 'path'); if (JString::trim($folder) == "") { $folder = $root; } else { // Ensure that we are always below the root directory if (strpos($folder, $root) !== 0) { $folder = $root; } } // Disable debug JRequest::setVar('debug', false); $url = JURI::root(true) . '/' . $folder; $path = JPATH_SITE . '/' . JPath::clean($folder); JPath::check($path); include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderConnector.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinder.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeDriver.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeLocalFileSystem.class.php'; function access($attr, $path, $data, $volume) { $mainframe = JFactory::getApplication(); // Hide PHP files. $ext = strtolower(JFile::getExt(basename($path))); if ($ext == 'php') { return true; } // Hide files and folders starting with . if (strpos(basename($path), '.') === 0 && $attr == 'hidden') { return true; } // Read only access for front-end. Full access for administration section. switch ($attr) { case 'read': return true; break; case 'write': return $mainframe->isSite() ? false : true; break; case 'locked': return $mainframe->isSite() ? true : false; break; case 'hidden': return false; break; } } if ($mainframe->isAdmin()) { $permissions = array('read' => true, 'write' => true); } else { $permissions = array('read' => true, 'write' => false); } $options = array('debug' => false, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions))); $connector = new elFinderConnector(new elFinder($options)); $connector->run(); }
public function run() { $opts = array('bind' => array('mkdir' => 'dirCreated', 'mkfile' => 'mkfileDone', 'rm' => 'rmDone', 'rename' => 'renameDone', 'upload' => 'uploadFileDone'), 'debug' => true, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => base64_decode(getRParam('elfinder_path')), 'URL' => base64_decode(getRParam('elfinder_url')), 'accessControl' => 'access'))); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); }
public function run() { $this->options = array_merge($this->options, array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => Yii::getPathOfAlias('webroot.uploads'), 'URL' => Yii::app()->baseUrl . '/uploads/', 'rootAlias' => 'Home')))); // $fm = new elFinder($this->options); // $fm->run(); $fm = new elFinderConnector(new elFinder($this->options)); $fm->run(); }
/** * Method to run this controller. * * @return mixed */ protected function doExecute() { \JLoader::register('elFinderConnector', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderConnector.class.php'); \JLoader::register('elFinder', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinder.class.php'); \JLoader::register('elFinderVolumeDriver', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeDriver.class.php'); \JLoader::register('elFinderVolumeLocalFileSystem', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeLocalFileSystem.class.php'); \JLoader::register('elFinderVolumeFTP', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeFTP.class.php'); // Required for MySQL storage connector // \JLoader::register('elFinderVolumeMySQL', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeMySQL.class.php'); // \JLoader::register('elFinderVolumeS3', REMOTEIMAGE_ADMIN . '/src/Elfinder/elFinderVolumeS3.class.php'); $params = \JComponentHelper::getParams('com_remoteimage'); $safemode = $params->get('Safemode', true); $host = $params->get('Ftp_Host', '127.0.0.1'); $port = $params->get('Ftp_Port', 21); $user = $params->get('Ftp_User'); $pass = $params->get('Ftp_Password'); $active = $params->get('Ftp_Active', 'passive'); $url = $params->get('Ftp_Url'); $root = $params->get('Ftp_Root', '/'); $local_root = $params->get('Local_Root', 'images'); //Patch $image_resize_enabled = $params->get('Image_Resize_Enabled', true); $image_max_width = $params->get('Image_Max_Width', 1024); $image_max_height = $params->get('Image_Max_Height', 1024); $image_jpeg_quality = $params->get('Image_JPEG_Quality', 95); // End patch $roots = array(); if ($params->get('Connection_Local', 1)) { $roots[] = array('driver' => 'LocalFileSystem', 'path' => JPATH_ROOT . '/' . trim($local_root, '/'), 'URL' => \JURI::root() . trim($local_root, '/'), 'accessControl' => array(__CLASS__, 'access'), 'uploadDeny' => array('text/x-php'), 'icon' => \JURI::root() . 'administrator/components/com_remoteimage/asset/js/elfinder/img/volume_icon_local.png', 'tmbPath' => JPATH_ROOT . '/cache/elfinderThumbs', 'tmbURL' => \JURI::root() . '/cache/elfinderThumbs', 'tmbPathMode' => 0755, 'tmp' => JPATH_ROOT . '/cache/elfinderTemps'); } if ($params->get('Connection_Ftp', 0)) { $roots[] = array('driver' => 'FTP', 'alias' => $host, 'host' => $host, 'user' => $user, 'pass' => $pass, 'port' => $port, 'mode' => $active, 'path' => $root, 'timeout' => 10, 'owner' => true, 'tmbPath' => JPATH_ROOT . '/cache/elfinderThumbs', 'tmbURL' => \JURI::root() . '/cache/elfinderThumbs', 'tmp' => JPATH_ROOT . '/cache/elfinderTemps', 'tmbPathMode' => 0755, 'dirMode' => 0755, 'fileMode' => 0644, 'URL' => $url, 'checkSubfolders' => false, 'uploadDeny' => array('text/x-php'), 'icon' => \JURI::root() . 'administrator/components/com_remoteimage/asset/js/elfinder/img/volume_icon_ftp.png'); } // Safe Mode if ($safemode) { foreach ($roots as &$root) { $root['disabled'] = array('archive', 'extract', 'rename', 'mkfile'); } } //Patch $lResizePluginOption = array(); $lResizePluginOption['enable'] = $image_resize_enabled; if ($image_max_width > 0) { $lResizePluginOption['maxWidth'] = $image_max_width; } if ($image_max_height > 0) { $lResizePluginOption['maxHeight'] = $image_max_height; } if ($image_jpeg_quality > 0) { $lResizePluginOption['quality'] = $image_jpeg_quality; } $opts = array('plugin' => array('AutoResize' => $lResizePluginOption), 'bind' => array('upload.presave' => array('Plugin.AutoResize.onUpLoadPreSave')), 'roots' => $roots); // Run elFinder $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); exit; }
public function connector() { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $path = SigProHelper::getPath('site'); $url = SigProHelper::getHTTPPath($path); JPath::check($path); include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderConnector.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinder.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeDriver.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeLocalFileSystem.class.php'; function access($attr, $path, $data, $volume) { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); // Hide files and folders starting with . if (strpos(basename($path), '.') === 0 && $attr == 'hidden') { return true; } // Read only access for front-end. Full access for administration section. switch ($attr) { case 'read': return true; break; case 'write': if ($mainframe->isSite()) { return false; } else { return version_compare(JVERSION, '1.6.0', 'ge') ? $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro') : true; } break; case 'locked': if ($mainframe->isSite()) { return true; } else { return version_compare(JVERSION, '1.6.0', 'ge') ? !($user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro')) : false; } break; case 'hidden': return false; break; } } if ($mainframe->isAdmin()) { if (version_compare(JVERSION, '1.6.0', 'ge')) { $write = $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro'); } else { $write = true; } $permissions = array('read' => true, 'write' => $write); } else { $permissions = array('read' => true, 'write' => false); } $options = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions))); $connector = new elFinderConnector(new elFinder($options)); $connector->run(); }
public function run() { require_once dirname(__FILE__) . '/php/elFinderConnector.class.php'; require_once dirname(__FILE__) . '/php/elFinder.class.php'; require_once dirname(__FILE__) . '/php/elFinderVolumeDriver.class.php'; require_once dirname(__FILE__) . '/php/elFinderVolumeLocalFileSystem.class.php'; $connector = new elFinderConnector(new elFinder($this->settings)); $connector->run(); }
/** * @return \Zend\View\Model\ViewModel */ public function connectorAction() { $view = new ViewModel(); $this->getConfig(); $opts = array('roots' => array($this->Config['QuRoots'])); $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); $view->setTerminal(true); return $view; }
function connector() { include_once APPPATH . 'third_party/finder/elFinderConnector.class.php'; include_once APPPATH . 'third_party/finder/elFinder.class.php'; include_once APPPATH . 'third_party/finder/elFinderVolumeDriver.class.php'; include_once APPPATH . 'third_party/finder/elFinderVolumeLocalFileSystem.class.php'; $opts = array('debug' => true, 'uploadMaxSize' => "5M", 'uploadTotalSize' => "5000000000", 'uploadFileSize' => "5M", 'uploadAllow' => array('image'), 'roots' => array(array('uploadMaxSize' => "5M", 'uploadTotalSize' => "5M", 'uploadFileSize' => "5M", 'driver' => 'LocalFileSystem', 'path' => APPPATH . '../files/', 'URL' => '/files/', 'accessControl' => 'access', 'defaults' => array('read' => true, 'write' => true, 'rm' => true), 'perms' => array('/^test_dir\\/.*/' => array('read' => true, 'write' => true, 'rm' => true))))); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); }
public function connector() { $folder_path = Config::get($this->package . '::folder_path'); $roots = Config::get($this->package . '::roots'); if (!$roots) { $roots = array(array('driver' => 'LocalFileSystem', 'path' => public_path() . DIRECTORY_SEPARATOR . $folder_path, 'URL' => asset($folder_path), 'accessControl' => Config::get($this->package . '::access'))); } $opts = array('roots' => $roots); $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); }
public function elfRunConnector($options) { $elFinderPath = Yii::getPathOfAlias('application.vendors.elfinder2.php'); require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinderConnector.class.php'; require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinder.class.php'; require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinderVolumeDriver.class.php'; require_once $elFinderPath . DIRECTORY_SEPARATOR . 'elFinderVolumeLocalFileSystem.class.php'; // Defining default connector options $connector = new elFinderConnector(new elFinder($options)); $connector->run(); }
public function run() { // php/connector.php.dist $path = dirname(__FILE__) . '/php/'; include_once $path . 'elFinderConnector.class.php'; include_once $path . 'elFinder.class.php'; include_once $path . 'elFinderVolumeDriver.class.php'; include_once $path . 'elFinderVolumeLocalFileSystem.class.php'; $connection = new elFinderConnector(new elFinder($this->serverSettings)); $connection->run(); }
public function run() { $connectorPath = \Yii::getAlias('@vendor/Studio-42/elFinder/php'); include $connectorPath . DIRECTORY_SEPARATOR . 'elFinderConnector.class.php'; include $connectorPath . DIRECTORY_SEPARATOR . 'elFinder.class.php'; include $connectorPath . DIRECTORY_SEPARATOR . 'elFinderVolumeDriver.class.php'; include $connectorPath . DIRECTORY_SEPARATOR . 'elFinderVolumeLocalFileSystem.class.php'; $opts = array('locale' => '', 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => \Yii::getAlias(\Yii::$app->params['imagePath']), 'URL' => \Yii::$app->params['imageDomain']))); $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); }
/** * Elfinder injector file listing * @throws ForbiddenException */ public function actionFiles() { $user = App::$User->identity(); if ($user === null || !$user->isAuth() || !$user->getRole()->can('admin/main/files')) { throw new ForbiddenException('This action is not allowed!'); } // legacy lib can throw some shits error_reporting(0); $this->setJsonHeader(); $connector = new \elFinderConnector(new \elFinder(['locale' => '', 'roots' => [['driver' => 'LocalFileSystem', 'path' => root . '/upload/', 'URL' => App::$Alias->scriptUrl . '/upload/']]])); $connector->run(); }
public function main() { require_once DIR_APPLICATION . 'view/template/module/image_manager_plus/php/elFinderConnector.class.php'; require_once DIR_APPLICATION . 'view/template/module/image_manager_plus/php/elFinder.class.php'; require_once DIR_APPLICATION . 'view/template/module/image_manager_plus/php/elFinderVolumeDriver.class.php'; require_once DIR_APPLICATION . 'view/template/module/image_manager_plus/php/elFinderVolumeLocalFileSystem.class.php'; require_once DIR_APPLICATION . 'view/template/module/image_manager_plus/php/elFinderVolumeFTP.class.php'; $opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => DIR_IMAGE . '/data', 'startPath' => DIR_IMAGE . '/data', 'URL' => HTTP_CATALOG . 'image/data', 'uploadOrder' => 'deny,allow', 'mimeDetect' => 'internal', 'tmbPath' => DIR_IMAGE . '/thumb', 'tmbURL' => HTTP_CATALOG . 'image/thumb', 'utf8fix' => true, 'tmbCrop' => false, 'tmbBgColor' => 'transparent', 'accessControl' => 'access', 'copyOverwrite' => false, 'uploadOverwrite' => false), array('driver' => 'FTP', 'host' => FLINK, 'user' => FUSER, 'pass' => FPASS, 'port' => 21, 'URL' => FHTTP . '/data', 'mode' => 'passive', 'path' => FPATH, 'timeout' => 20, 'owner' => true, 'dirMode' => 0755, 'fileMode' => 0644, 'startPath' => FPATH . '/data', 'URL' => FHTTP, 'uploadOrder' => 'deny,allow', 'mimeDetect' => 'internal', 'tmbPath' => FPATH . '/thumb', 'tmbURL' => FHTTP . '/thumb', 'utf8fix' => true, 'tmbCrop' => false, 'tmbBgColor' => 'transparent', 'accessControl' => 'access', 'copyOverwrite' => false, 'uploadOverwrite' => false))); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); }
function init() { parent::init(); $path_asset = $this->app->pathfinder->base_location->base_path . '/websites/' . $this->app->current_website_name . '/assets'; $path_www = $this->app->pathfinder->base_location->base_path . '/websites/' . $this->app->current_website_name . '/www'; \elFinder::$netDrivers['ftp'] = 'FTP'; \elFinder::$netDrivers['dropbox'] = 'Dropbox'; $opts = array('locale' => '', 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path_asset, 'URL' => 'websites/' . $this->app->current_website_name . '/assets'), array('driver' => 'LocalFileSystem', 'path' => $path_www, 'URL' => 'websites/' . $this->app->current_website_name . '/www'))); // run elFinder $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); exit; }
function api() { include_once APP_PATH . '/lib/elFinderConnector.class.php'; include_once APP_PATH . '/lib/elFinder.class.php'; include_once APP_PATH . '/lib/elFinderVolumeDriver.class.php'; include_once APP_PATH . '/lib/elFinderVolumeLocalFileSystem.class.php'; include_once APP_PATH . '/lib/elFinderVolumeMySQL.class.php'; $id = FeiClass('model_yunpan')->index(); $option = array('roots' => array(array('driver' => 'MySQL', 'path' => $id, 'accessControl' => 'access', 'uploadMaxSize' => '10000K', 'acceptedName' => ''))); //print_r($opts);exit; $connector = new elFinderConnector(new elFinder($option)); $connector->run(); }
public function showConnector() { $dir = Config::get($this->package . '::dir'); $roots = Config::get($this->package . '::roots'); if (!$roots) { $roots = array(array('driver' => 'LocalFileSystem', 'path' => public_path() . DIRECTORY_SEPARATOR . $dir, 'URL' => asset($dir), 'accessControl' => Config::get($this->package . '::access'))); } // Documentation for connector options: // https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options $opts = array('roots' => $roots); // run elFinder $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); }
public function before() { parent::before(); include_once Kohana::find_file('media', 'libs/elfinder/php/elFinderConnector.class'); include_once Kohana::find_file('media', 'libs/elfinder/php/elFinder.class'); include_once Kohana::find_file('media', 'libs/elfinder/php/elFinderVolumeDriver.class'); include_once Kohana::find_file('media', 'libs/elfinder/php/elFinderVolumeLocalFileSystem.class'); include_once Kohana::find_file('media', 'libs/elfinder/php/elFinderVolumeMySQL.class'); $opts = array('roots' => Config::get('elfinder', 'volumes')); $this->json = NULL; // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); }
/** * @return \Zend\View\Model\ViewModel */ public function connectorAction() { $view = new ViewModel(); $this->getConfig(); $root = array(); if (isset($this->Config['QuRoots'])) { $root = $this->Config['QuRoots']; } $opts = array('debug' => false, 'roots' => array($root)); $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); $view->setTerminal(true); return $view; }
function connector() { $mainframe =& JFactory::getApplication(); $params =& JComponentHelper::getParams('com_media'); $root = $params->get('file_path', 'media'); $folder = JRequest::getVar('folder', $root, 'default', 'path'); $type = JRequest::getCmd('type', 'video'); if (JString::trim($folder) == "") { $folder = $root; } $url = JURI::root(true) . '/' . $folder; $path = JPATH_SITE . DS . JPath::clean($folder); JPath::check($path); include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinderConnector.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinder.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinderVolumeDriver.class.php'; include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinderVolumeLocalFileSystem.class.php'; function access($attr, $path, $data, $volume) { $mainframe =& JFactory::getApplication(); // Hide files and folders starting with . if (strpos(basename($path), '.') === 0 && $attr == 'hidden') { return true; } // Read only access for front-end. Full access for administration section. switch ($attr) { case 'read': return true; break; case 'write': return $mainframe->isSite() ? false : true; break; case 'locked': return $mainframe->isSite() ? true : false; break; case 'hidden': return false; break; } } if ($mainframe->isAdmin()) { $permissions = array('read' => true, 'write' => true); } else { $permissions = array('read' => true, 'write' => false); } $options = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions))); $connector = new elFinderConnector(new elFinder($options)); $connector->run(); }
/** * Constructor * * @param $elFinder * @param bool $debug * @author Dmitry (dio) Levashov */ public function __construct($elFinder, $debug = false) { $this->elFinder = $elFinder; $this->reqMethod = strtoupper($_SERVER["REQUEST_METHOD"]); if ($debug) { self::$contentType = 'Content-Type: text/html; charset=utf-8'; } }
/** * Retrieves connector's configuration from URL parameter and creates * an instance of ElFinder connector. */ public function run() { // Defining default connector options $connectorOptions = array('roots' => array(array('driver' => "LocalFileSystem", 'path' => realpath(Yii::app()->basePath . "/../files"), 'URL' => "/files", 'accessControl' => "access"))); // Retrieving connector's options from GET-request $connectorOptionsEncoded = Yii::app()->request->getParam(self::GET_PARAM_ELFINDER_CONNECTOR_OPTIONS); if ($connectorOptionsEncoded) { $connectorOptionsSerialized = base64_decode($connectorOptionsEncoded); $connectorOptionsUnserialized = unserialize($connectorOptionsSerialized); if (is_array($connectorOptionsUnserialized)) { $connectorOptions = array_merge($connectorOptions, $connectorOptionsUnserialized); } } // Running ElFinder $connector = new elFinderConnector(new elFinder($connectorOptions)); $connector->run(); }
public function actionIndex() { $elFinderPath = Yii::getPathOfAlias('ext.elrte.lib.elfinder.php'); include $elFinderPath . '/elFinderConnector.class.php'; include $elFinderPath . '/elFinder.class.php'; include $elFinderPath . '/elFinderVolumeDriver.class.php'; include $elFinderPath . '/elFinderVolumeLocalFileSystem.class.php'; function access($attr, $path, $data, $volume) { return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null; // else elFinder decide it itself } $opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => Yii::getPathOfAlias('webroot.uploads'), 'URL' => '/uploads/', 'accessControl' => 'access'))); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); exit; }
/** * @Route("/connector") * @Method({"GET"}) */ public function connectorAction() { error_reporting(-1); $connector = $this->getEditorConnector(); $driverList = $this->getRequest()->get('driver_list'); if (!empty($driverList)) { $connector->setDriverList(explode(',', $driverList)); } $operations = $connector->getOperations(); include_once api_get_path(LIBRARY_PATH) . 'elfinder/php/elFinderConnector.class.php'; include_once api_get_path(LIBRARY_PATH) . 'elfinder/php/elFinder.class.php'; include_once api_get_path(LIBRARY_PATH) . 'elfinder/php/elFinderVolumeDriver.class.php'; include_once api_get_path(LIBRARY_PATH) . 'elfinder/php/elFinderVolumeLocalFileSystem.class.php'; // Run elFinder $finder = new Finder($operations); $elFinderConnector = new \elFinderConnector($finder); $elFinderConnector->run(); }
public function connector() { include_once __DIR__ . '/../../../js/vendor/elfinder/php/elFinderConnector.class.php'; include_once __DIR__ . '/../../../js/vendor/elfinder/php/elFinder.class.php'; include_once __DIR__ . '/../../../js/vendor/elfinder/php/elFinderVolumeDriver.class.php'; include_once __DIR__ . '/../../../js/vendor/elfinder/php/elFinderVolumeLocalFileSystem.class.php'; // Required for MySQL storage connector // include_once __DIR__.'/../../../js/vendor/elfinder/php/elFinderVolumeMySQL.class.php'; // Required for FTP connector support // include_once __DIR__.'/../../../js/vendor/elfinder/php/elFinderVolumeFTP.class.php'; // path to files $path = dirname($this->get('request')->server->get('SCRIPT_FILENAME')) . '/uploads/' . trim($this->get('request')->get('path'), '/'); // URL to files $url = $this->get('request')->getBaseURL() . '/uploads/' . trim($this->get('request')->get('path'), '/'); $opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => array($this, 'access')))); // run elFinder $connector = new \elFinderConnector(new \elFinder($opts)); $connector->run(); }