.tmp
10 months ago
editors
1 month ago
libs
7 years ago
plugins
3 years ago
resources
7 years ago
MySQLStorage.sql
1 year ago
autoload.php
10 months ago
connector.maximal.php-dist
1 year ago
connector.minimal.php-dist
1 year ago
elFinder.class.php
1 month ago
elFinderConnector.class.php
1 month ago
elFinderFlysystemGoogleDriveNetmount.php
5 years ago
elFinderPlugin.php
7 years ago
elFinderSession.php
4 years ago
elFinderSessionInterface.php
7 years ago
elFinderVolumeBox.class.php
5 years ago
elFinderVolumeDriver.class.php
1 month ago
elFinderVolumeDropbox.class.php
1 year ago
elFinderVolumeDropbox2.class.php
1 month ago
elFinderVolumeFTP.class.php
5 years ago
elFinderVolumeGoogleDrive.class.php
5 years ago
elFinderVolumeGroup.class.php
7 years ago
elFinderVolumeLocalFileSystem.class.php
2 years ago
elFinderVolumeMySQL.class.php
10 months ago
elFinderVolumeOneDrive.class.php
1 month ago
elFinderVolumeSFTPphpseclib.class.php
1 month ago
elFinderVolumeTrash.class.php
7 years ago
elFinderVolumeTrashMySQL.class.php
7 years ago
mime.types
3 years ago
connector.minimal.php-dist
181 lines
| 1 | <?php |
| 2 | |
| 3 | error_reporting(0); // Set E_ALL for debuging |
| 4 | |
| 5 | // // Optional exec path settings (Default is called with command name only) |
| 6 | // define('ELFINDER_TAR_PATH', '/PATH/TO/tar'); |
| 7 | // define('ELFINDER_GZIP_PATH', '/PATH/TO/gzip'); |
| 8 | // define('ELFINDER_BZIP2_PATH', '/PATH/TO/bzip2'); |
| 9 | // define('ELFINDER_XZ_PATH', '/PATH/TO/xz'); |
| 10 | // define('ELFINDER_ZIP_PATH', '/PATH/TO/zip'); |
| 11 | // define('ELFINDER_UNZIP_PATH', '/PATH/TO/unzip'); |
| 12 | // define('ELFINDER_RAR_PATH', '/PATH/TO/rar'); |
| 13 | // define('ELFINDER_UNRAR_PATH', '/PATH/TO/unrar'); |
| 14 | // define('ELFINDER_7Z_PATH', '/PATH/TO/7za'); |
| 15 | // define('ELFINDER_CONVERT_PATH', '/PATH/TO/convert'); |
| 16 | // define('ELFINDER_IDENTIFY_PATH', '/PATH/TO/identify'); |
| 17 | // define('ELFINDER_EXIFTRAN_PATH', '/PATH/TO/exiftran'); |
| 18 | // define('ELFINDER_JPEGTRAN_PATH', '/PATH/TO/jpegtran'); |
| 19 | // define('ELFINDER_FFMPEG_PATH', '/PATH/TO/ffmpeg'); |
| 20 | |
| 21 | // define('ELFINDER_CONNECTOR_URL', 'URL to this connector script'); // see elFinder::getConnectorUrl() |
| 22 | |
| 23 | // define('ELFINDER_DEBUG_ERRORLEVEL', -1); // Error reporting level of debug mode |
| 24 | |
| 25 | // // To Enable(true) handling of PostScript files by ImageMagick |
| 26 | // // It is disabled by default as a countermeasure |
| 27 | // // of Ghostscript multiple -dSAFER sandbox bypass vulnerabilities |
| 28 | // // see https://www.kb.cert.org/vuls/id/332928 |
| 29 | // define('ELFINDER_IMAGEMAGICK_PS', true); |
| 30 | // =============================================== |
| 31 | |
| 32 | // // load composer autoload before load elFinder autoload If you need composer |
| 33 | // // You need to run the composer command in the php directory. |
| 34 | is_readable('./vendor/autoload.php') && require './vendor/autoload.php'; |
| 35 | |
| 36 | // // elFinder autoload |
| 37 | require './autoload.php'; |
| 38 | // =============================================== |
| 39 | |
| 40 | // // Enable FTP connector netmount |
| 41 | elFinder::$netDrivers['ftp'] = 'FTP'; |
| 42 | // =============================================== |
| 43 | |
| 44 | // // Required for Dropbox network mount |
| 45 | // // Installation by composer |
| 46 | // // `composer require kunalvarma05/dropbox-php-sdk` on php directory |
| 47 | // // Enable network mount |
| 48 | // elFinder::$netDrivers['dropbox2'] = 'Dropbox2'; |
| 49 | // // Dropbox2 Netmount driver need next two settings. You can get at https://www.dropbox.com/developers/apps |
| 50 | // // AND require register redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=dropbox2&host=1" |
| 51 | // // If the elFinder HTML element ID is not "elfinder", you need to change "host=1" to "host=ElementID" |
| 52 | // define('ELFINDER_DROPBOX_APPKEY', ''); |
| 53 | // define('ELFINDER_DROPBOX_APPSECRET', ''); |
| 54 | // =============================================== |
| 55 | |
| 56 | // // Required for Google Drive network mount |
| 57 | // // Installation by composer |
| 58 | // // `composer require google/apiclient:^2.0` on php directory |
| 59 | // // Enable network mount |
| 60 | // elFinder::$netDrivers['googledrive'] = 'GoogleDrive'; |
| 61 | // // GoogleDrive Netmount driver need next two settings. You can get at https://console.developers.google.com |
| 62 | // // AND require register redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=googledrive&host=1" |
| 63 | // // If the elFinder HTML element ID is not "elfinder", you need to change "host=1" to "host=ElementID" |
| 64 | // define('ELFINDER_GOOGLEDRIVE_CLIENTID', ''); |
| 65 | // define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', ''); |
| 66 | // // Required case when Google API is NOT added via composer |
| 67 | // define('ELFINDER_GOOGLEDRIVE_GOOGLEAPICLIENT', '/path/to/google-api-php-client/vendor/autoload.php'); |
| 68 | // =============================================== |
| 69 | |
| 70 | // // Required for Google Drive network mount with Flysystem |
| 71 | // // Installation by composer |
| 72 | // // `composer require nao-pon/flysystem-google-drive:~1.1 nao-pon/elfinder-flysystem-driver-ext` on php directory |
| 73 | // // Enable network mount |
| 74 | // elFinder::$netDrivers['googledrive'] = 'FlysystemGoogleDriveNetmount'; |
| 75 | // // GoogleDrive Netmount driver need next two settings. You can get at https://console.developers.google.com |
| 76 | // // AND require register redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=googledrive&host=1" |
| 77 | // // If the elFinder HTML element ID is not "elfinder", you need to change "host=1" to "host=ElementID" |
| 78 | // define('ELFINDER_GOOGLEDRIVE_CLIENTID', ''); |
| 79 | // define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', ''); |
| 80 | // // And "php/.tmp" directory must exist and be writable by PHP. |
| 81 | // =============================================== |
| 82 | |
| 83 | // // Required for One Drive network mount |
| 84 | // // * cURL PHP extension required |
| 85 | // // * HTTP server PATH_INFO supports required |
| 86 | // // Enable network mount |
| 87 | // elFinder::$netDrivers['onedrive'] = 'OneDrive'; |
| 88 | // // OneDrive Netmount driver need next two settings. You can get at |
| 89 | // // https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps |
| 90 | // // AND require register redirect url to "YOUR_CONNECTOR_URL/netmount/onedrive/1" |
| 91 | // // If the elFinder HTML element ID is not "elfinder", you need to change "/1" to "/ElementID" |
| 92 | // define('ELFINDER_ONEDRIVE_CLIENTID', ''); |
| 93 | // define('ELFINDER_ONEDRIVE_CLIENTSECRET', ''); |
| 94 | // =============================================== |
| 95 | |
| 96 | // // Required for Box network mount |
| 97 | // // * cURL PHP extension required |
| 98 | // // Enable network mount |
| 99 | // elFinder::$netDrivers['box'] = 'Box'; |
| 100 | // // Box Netmount driver need next two settings. You can get at https://developer.box.com |
| 101 | // // AND require register redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=box&host=1" |
| 102 | // // If the elFinder HTML element ID is not "elfinder", you need to change "host=1" to "host=ElementID" |
| 103 | // define('ELFINDER_BOX_CLIENTID', ''); |
| 104 | // define('ELFINDER_BOX_CLIENTSECRET', ''); |
| 105 | // =============================================== |
| 106 | |
| 107 | |
| 108 | // // Zoho Office Editor APIKey |
| 109 | // // https://www.zoho.com/docs/help/office-apis.html |
| 110 | // define('ELFINDER_ZOHO_OFFICE_APIKEY', ''); |
| 111 | // =============================================== |
| 112 | |
| 113 | // // Online converter (online-convert.com) APIKey |
| 114 | // // https://apiv2.online-convert.com/docs/getting_started/api_key.html |
| 115 | // define('ELFINDER_ONLINE_CONVERT_APIKEY', ''); |
| 116 | // =============================================== |
| 117 | |
| 118 | // // Zip Archive editor |
| 119 | // // Installation by composer |
| 120 | // // `composer require nao-pon/elfinder-flysystem-ziparchive-netmount` on php directory |
| 121 | // define('ELFINDER_DISABLE_ZIPEDITOR', false); // set `true` to disable zip editor |
| 122 | // =============================================== |
| 123 | |
| 124 | /** |
| 125 | * Simple function to demonstrate how to control file access using "accessControl" callback. |
| 126 | * This method will disable accessing files/folders starting from '.' (dot) |
| 127 | * |
| 128 | * @param string $attr attribute name (read|write|locked|hidden) |
| 129 | * @param string $path absolute file path |
| 130 | * @param string $data value of volume option `accessControlData` |
| 131 | * @param object $volume elFinder volume driver object |
| 132 | * @param bool|null $isDir path is directory (true: directory, false: file, null: unknown) |
| 133 | * @param string $relpath file path relative to volume root directory started with directory separator |
| 134 | * @return bool|null |
| 135 | **/ |
| 136 | function access($attr, $path, $data, $volume, $isDir, $relpath) { |
| 137 | $basename = basename($path); |
| 138 | return $basename[0] === '.' // if file/folder begins with '.' (dot) |
| 139 | && strlen($relpath) !== 1 // but with out volume root |
| 140 | ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true |
| 141 | : null; // else elFinder decide it itself |
| 142 | } |
| 143 | |
| 144 | |
| 145 | // Documentation for connector options: |
| 146 | // https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options |
| 147 | $opts = array( |
| 148 | // 'debug' => true, |
| 149 | 'roots' => array( |
| 150 | // Items volume |
| 151 | array( |
| 152 | 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) |
| 153 | 'path' => '../files/', // path to files (REQUIRED) |
| 154 | 'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED) |
| 155 | 'trashHash' => 't1_Lw', // elFinder's hash of trash folder |
| 156 | 'winHashFix' => DIRECTORY_SEPARATOR !== '/', // to make hash same to Linux one on windows too |
| 157 | 'uploadDeny' => array('all'), // All Mimetypes not allowed to upload |
| 158 | 'uploadAllow' => array('image/x-ms-bmp', 'image/gif', 'image/jpeg', 'image/png', 'image/x-icon', 'text/plain'), // Mimetype `image` and `text/plain` allowed to upload |
| 159 | 'uploadOrder' => array('deny', 'allow'), // allowed Mimetype `image` and `text/plain` only |
| 160 | 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) |
| 161 | ), |
| 162 | // Trash volume |
| 163 | array( |
| 164 | 'id' => '1', |
| 165 | 'driver' => 'Trash', |
| 166 | 'path' => '../files/.trash/', |
| 167 | 'tmbURL' => dirname($_SERVER['PHP_SELF']) . '/../files/.trash/.tmb/', |
| 168 | 'winHashFix' => DIRECTORY_SEPARATOR !== '/', // to make hash same to Linux one on windows too |
| 169 | 'uploadDeny' => array('all'), // Recomend the same settings as the original volume that uses the trash |
| 170 | 'uploadAllow' => array('image/x-ms-bmp', 'image/gif', 'image/jpeg', 'image/png', 'image/x-icon', 'text/plain'), // Same as above |
| 171 | 'uploadOrder' => array('deny', 'allow'), // Same as above |
| 172 | 'accessControl' => 'access', // Same as above |
| 173 | ), |
| 174 | ) |
| 175 | ); |
| 176 | |
| 177 | // run elFinder |
| 178 | $connector = new elFinderConnector(new elFinder($opts)); |
| 179 | $connector->run(); |
| 180 | |
| 181 |