Closed sauerlu closed 6 years ago
Dear sirs,
Since a few days I not able to upload pictures over the elfinder (2.0 rc1). I receive the error: "Unable to connect to backend"
The file elfinder/php//connector.php looks like this:
defined( '_JEXEC' ) or die; error_reporting(0); // Set E_ALL for debuging include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'elFinderConnector.class.php'; include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'elFinder.class.php'; include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'elFinderVolumeDriver.class.php'; include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'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 // if file/folder begins with '.' (dot) ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true : null; // else elFinder decide it itself } //Get select image folder by option $elfinderfolderaccess = array_filter(json_decode(get_yeeditor_option('yeeditor_elfinderfolderaccess','[]'),true)); $user = JFactory::getUser(); $imagefolder = "images/"; foreach($user->groups as $group){ if(isset($elfinderfolderaccess[$group])){ $imagefolder = $elfinderfolderaccess[$group]."/"; } } $opts = array( 'debug' => true, 'bind' => array( 'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre' => array( 'Plugin.Normalizer.cmdPreprocess', 'Plugin.Sanitizer.cmdPreprocess' ), 'ls' => array( 'Plugin.Normalizer.cmdPostprocess', 'Plugin.Sanitizer.cmdPostprocess' ), 'upload.presave' => array( 'Plugin.AutoResize.onUpLoadPreSave', 'Plugin.Normalizer.onUpLoadPreSave', 'Plugin.Sanitizer.onUpLoadPreSave' ), ), 'plugin' => array( 'AutoResize' => array( 'enable' => true, 'maxWidth' => 1200, 'maxHeight' => 1200, 'quality' => 95 ), 'Sanitizer' => array( 'enable' => true, 'targets' => array('\\','/',':','*','?','"','<','>','|',' ',',','^',',','à','ä','é','è','ü','ö','(',')'), // target chars 'replace' => '_' // replace to this ), 'Normalizer' => array( 'convmap' => array( ' ' => '_', ',' => '_', '^' => '_', ',' => '_', 'à' => 'a', 'ä' => 'a', 'é' => 'e', 'è' => 'e', 'ü' => 'u', 'ö' => 'o' ) ), ), 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => JPATH_ROOT.'/'.$imagefolder, // '../files/', // path to files (REQUIRED) 'URL' => JURI::root().$imagefolder, //dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED) 'accessControl' => 'access', // disable and hide dot starting files (OPTIONAL) 'mimeDetect' => 'mime_content_type', 'uploadDeny' => array('text/x-php'), 'disabled' => array('mkfile', 'edit') ) ) ); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run();
So I want to update the elfinder to 2.1.37. Also there I receive this Error message: "Unable to connect to backend. Backend not found."
The file elfinder/php/connector.minimal.php looks like this:
<?php error_reporting(0); // Set E_ALL for debuging // load composer autoload before load elFinder autoload If you need composer //require './vendor/autoload.php'; // elFinder autoload require './autoload.php'; // =============================================== // Enable FTP connector netmount elFinder::$netDrivers['ftp'] = 'FTP'; // =============================================== // // Required for Dropbox network mount // // Installation by composer // // `composer require kunalvarma05/dropbox-php-sdk` // // Enable network mount // elFinder::$netDrivers['dropbox2'] = 'Dropbox2'; // // Dropbox2 Netmount driver need next two settings. You can get at https://www.dropbox.com/developers/apps // // AND reuire regist redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=dropbox2&host=1" // define('ELFINDER_DROPBOX_APPKEY', ''); // define('ELFINDER_DROPBOX_APPSECRET', ''); // =============================================== // // Required for Google Drive network mount // // Installation by composer // // `composer require google/apiclient:^2.0` // // Enable network mount // elFinder::$netDrivers['googledrive'] = 'GoogleDrive'; // // GoogleDrive Netmount driver need next two settings. You can get at https://console.developers.google.com // // AND reuire regist redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=googledrive&host=1" // define('ELFINDER_GOOGLEDRIVE_CLIENTID', ''); // define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', ''); // // Required case of without composer // define('ELFINDER_GOOGLEDRIVE_GOOGLEAPICLIENT', '/path/to/google-api-php-client/vendor/autoload.php'); // =============================================== // // Required for Google Drive network mount with Flysystem // // Installation by composer // // `composer require nao-pon/flysystem-google-drive:~1.1 nao-pon/elfinder-flysystem-driver-ext` // // Enable network mount // elFinder::$netDrivers['googledrive'] = 'FlysystemGoogleDriveNetmount'; // // GoogleDrive Netmount driver need next two settings. You can get at https://console.developers.google.com // // AND reuire regist redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=googledrive&host=1" // define('ELFINDER_GOOGLEDRIVE_CLIENTID', ''); // define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', ''); // =============================================== // // Required for One Drive network mount // // * cURL PHP extension required // // * HTTP server PATH_INFO supports required // // Enable network mount // elFinder::$netDrivers['onedrive'] = 'OneDrive'; // // GoogleDrive Netmount driver need next two settings. You can get at https://dev.onedrive.com // // AND reuire regist redirect url to "YOUR_CONNECTOR_URL/netmount/onedrive/1" // define('ELFINDER_ONEDRIVE_CLIENTID', ''); // define('ELFINDER_ONEDRIVE_CLIENTSECRET', ''); // =============================================== // // Required for Box network mount // // * cURL PHP extension required // // Enable network mount // elFinder::$netDrivers['box'] = 'Box'; // // Box Netmount driver need next two settings. You can get at https://developer.box.com // // AND reuire regist redirect url to "YOUR_CONNECTOR_URL" // define('ELFINDER_BOX_CLIENTID', ''); // define('ELFINDER_BOX_CLIENTSECRET', ''); // =============================================== // // Zoho Office Editor APIKey // // https://www.zoho.com/docs/help/office-apis.html // define('ELFINDER_ZOHO_OFFICE_APIKEY', ''); // =============================================== // // Zip Archive editor // // Installation by composer // // `composer require nao-pon/elfinder-flysystem-ziparchive-netmount` // define('ELFINDER_DISABLE_ZIPEDITOR', false); // set `true` to disable zip editor // =============================================== /** * 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 absolute file path * @param string $data value of volume option `accessControlData` * @param object $volume elFinder volume driver object * @param bool|null $isDir path is directory (true: directory, false: file, null: unknown) * @param string $relpath file path relative to volume root directory started with directory separator * @return bool|null **/ include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'elFinderConnector.class.php'; include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'elFinder.class.php'; include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'elFinderVolumeDriver.class.php'; include_once JPATH_ROOT.'/plugins/editors/yeeditor/assets/js/ckeditor/elfinder/php/'.'elFinderVolumeLocalFileSystem.class.php'; function access($attr, $path, $data, $volume, $isDir, $relpath) { $basename = basename($path); return $basename[0] === '.' // if file/folder begins with '.' (dot) && strlen($relpath) !== 1 // but with out volume root ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true : null; // else elFinder decide it itself } // Documentation for connector options: // https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options $opts = array( // 'debug' => true, 'bind' => array( 'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre' => array( 'Plugin.Normalizer.cmdPreprocess', 'Plugin.Sanitizer.cmdPreprocess' ), 'ls' => array( 'Plugin.Normalizer.cmdPostprocess', 'Plugin.Sanitizer.cmdPostprocess' ), 'upload.presave' => array( 'Plugin.AutoResize.onUpLoadPreSave', 'Plugin.Normalizer.onUpLoadPreSave', 'Plugin.Sanitizer.onUpLoadPreSave' ), ), 'plugin' => array( 'AutoResize' => array( 'enable' => true, 'maxWidth' => 1200, 'maxHeight' => 1200, 'quality' => 95 ), 'Sanitizer' => array( 'enable' => true, 'targets' => array('\\','/',':','*','?','"','<','>','|',' ',',','^',',','à','ä','é','è','ü','ö','(',')'), // target chars 'replace' => '_' // replace to this ), 'Normalizer' => array( 'convmap' => array( ' ' => '_', ',' => '_', '^' => '_', ',' => '_', 'à' => 'a', 'ä' => 'a', 'é' => 'e', 'è' => 'e', 'ü' => 'u', 'ö' => 'o' ) ), ), 'roots' => array( // Items volume array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => JPATH_ROOT.'/'.$imagefolder, // path to files (REQUIRED) 'URL' => JURI::root().$imagefolder, // URL to files (REQUIRED) 'trashHash' => 't1_Lw', // elFinder's hash of trash folder 'winHashFix' => DIRECTORY_SEPARATOR !== '/', // to make hash same to Linux one on windows too 'uploadDeny' => array('all'), // All Mimetypes not allowed to upload 'uploadAllow' => array('image', 'text/plain'),// Mimetype `image` and `text/plain` allowed to upload 'uploadOrder' => array('deny', 'allow'), // allowed Mimetype `image` and `text/plain` only 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ), ) ); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run();
Any help would be appreciate. Thanks a lot sir.
Greetings.
@sauerlu This is a problem of file location configuration on your server, so it is not a problem of elFinder. Please configure so that elfinder/php/autoload.php is loaded correctly.
elfinder/php/autoload.php
Dear sirs,
Since a few days I not able to upload pictures over the elfinder (2.0 rc1). I receive the error: "Unable to connect to backend"
The file elfinder/php//connector.php looks like this:
So I want to update the elfinder to 2.1.37. Also there I receive this Error message: "Unable to connect to backend. Backend not found."
The file elfinder/php/connector.minimal.php looks like this:
Any help would be appreciate. Thanks a lot sir.
Greetings.