drg_elfinder 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/app/assets/config/drg_elfinder_manifest.js +1 -0
- data/app/assets/javascripts/drg_elfinder.js +15 -0
- data/app/assets/javascripts/elfinder/Changelog +1283 -0
- data/app/assets/javascripts/elfinder/LICENSE.md +15 -0
- data/app/assets/javascripts/elfinder/README.md +216 -0
- data/app/assets/javascripts/elfinder/bower.json +28 -0
- data/app/assets/javascripts/elfinder/composer.json +39 -0
- data/app/assets/javascripts/elfinder/css/elfinder.full.css +5350 -0
- data/app/assets/javascripts/elfinder/css/elfinder.min.css +9 -0
- data/app/assets/javascripts/elfinder/css/theme.css +430 -0
- data/app/assets/javascripts/elfinder/elfinder.html +74 -0
- data/app/assets/javascripts/elfinder/elfinder.legacy.html +94 -0
- data/app/assets/javascripts/elfinder/img/arrows-active.png +0 -0
- data/app/assets/javascripts/elfinder/img/arrows-normal.png +0 -0
- data/app/assets/javascripts/elfinder/img/crop.gif +0 -0
- data/app/assets/javascripts/elfinder/img/dialogs.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_aceeditor.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_ckeditor.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_ckeditor5.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_codemirror.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_creativecloud.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_onlineconvert.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_pixlreditor.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_pixlrexpress.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_simplemde.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_tinymce.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_tuiimgedit.png +0 -0
- data/app/assets/javascripts/elfinder/img/edit_zohooffice.png +0 -0
- data/app/assets/javascripts/elfinder/img/editor-icons.png +0 -0
- data/app/assets/javascripts/elfinder/img/icons-big.png +0 -0
- data/app/assets/javascripts/elfinder/img/icons-big.svg +1 -0
- data/app/assets/javascripts/elfinder/img/icons-small.png +0 -0
- data/app/assets/javascripts/elfinder/img/logo.png +0 -0
- data/app/assets/javascripts/elfinder/img/progress.gif +0 -0
- data/app/assets/javascripts/elfinder/img/quicklook-bg.png +0 -0
- data/app/assets/javascripts/elfinder/img/quicklook-icons.png +0 -0
- data/app/assets/javascripts/elfinder/img/resize.png +0 -0
- data/app/assets/javascripts/elfinder/img/spinner-mini.gif +0 -0
- data/app/assets/javascripts/elfinder/img/toolbar.png +0 -0
- data/app/assets/javascripts/elfinder/img/trashmesh.png +0 -0
- data/app/assets/javascripts/elfinder/img/tui-icon-a.svg +235 -0
- data/app/assets/javascripts/elfinder/img/tui-icon-b.svg +224 -0
- data/app/assets/javascripts/elfinder/img/tui-icon-c.svg +224 -0
- data/app/assets/javascripts/elfinder/img/tui-icon-d.svg +224 -0
- data/app/assets/javascripts/elfinder/img/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_box.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_box.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_dropbox.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_dropbox.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_ftp.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_ftp.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_googledrive.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_googledrive.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_local.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_local.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_network.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_network.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_onedrive.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_onedrive.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_sql.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_sql.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_trash.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_trash.svg +1 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_zip.png +0 -0
- data/app/assets/javascripts/elfinder/img/volume_icon_zip.svg +1 -0
- data/app/assets/javascripts/elfinder/js/elfinder.full.js +36019 -0
- data/app/assets/javascripts/elfinder/js/elfinder.min.js +25 -0
- data/app/assets/javascripts/elfinder/js/extras/editors.default.js +2643 -0
- data/app/assets/javascripts/elfinder/js/extras/editors.default.min.js +2 -0
- data/app/assets/javascripts/elfinder/js/extras/quicklook.googledocs.js +75 -0
- data/app/assets/javascripts/elfinder/js/extras/quicklook.googledocs.min.js +1 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.LANG.js +587 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.ar.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.bg.js +559 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.ca.js +375 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.cs.js +581 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.da.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.de.js +582 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.el.js +374 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.es.js +546 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.fa.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.fallback.js +11 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.fo.js +419 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.fr.js +578 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.fr_CA.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.he.js +375 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.hr.js +434 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.hu.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.id.js +498 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.it.js +552 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.ja.js +581 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.ko.js +582 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.nl.js +581 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.no.js +374 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.pl.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.pt_BR.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.ro.js +417 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.ru.js +582 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.si.js +537 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.sk.js +581 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.sl.js +374 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.sr.js +374 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.sv.js +375 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.tr.js +583 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.ug_CN.js +374 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.uk.js +580 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.vi.js +579 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.zh_CN.js +585 -0
- data/app/assets/javascripts/elfinder/js/i18n/elfinder.zh_TW.js +582 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/cs.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/de.html.js +15 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/en.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/es.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/ja.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/ko.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/pl.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/ru.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/sk.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/i18n/help/tr.html.js +10 -0
- data/app/assets/javascripts/elfinder/js/proxy/elFinderSupportVer1.js +408 -0
- data/app/assets/javascripts/elfinder/js/worker/calcfilehash.js +20 -0
- data/app/assets/javascripts/elfinder/js/worker/quicklook.tiff.js +7 -0
- data/app/assets/javascripts/elfinder/js/worker/quicklook.unzip.js +55 -0
- data/app/assets/javascripts/elfinder/main.default.js +175 -0
- data/app/assets/javascripts/elfinder/package.json +13 -0
- data/app/assets/javascripts/elfinder/php/MySQLStorage.sql +47 -0
- data/app/assets/javascripts/elfinder/php/autoload.php +56 -0
- data/app/assets/javascripts/elfinder/php/connector.maximal.php-dist +449 -0
- data/app/assets/javascripts/elfinder/php/connector.minimal.php-dist +180 -0
- data/app/assets/javascripts/elfinder/php/editors/OnlineConvert/editor.php +113 -0
- data/app/assets/javascripts/elfinder/php/editors/ZipArchive/editor.php +12 -0
- data/app/assets/javascripts/elfinder/php/editors/ZohoOffice/editor.php +206 -0
- data/app/assets/javascripts/elfinder/php/editors/editor.php +79 -0
- data/app/assets/javascripts/elfinder/php/elFinder.class.php +5401 -0
- data/app/assets/javascripts/elfinder/php/elFinderConnector.class.php +380 -0
- data/app/assets/javascripts/elfinder/php/elFinderFlysystemGoogleDriveNetmount.php +380 -0
- data/app/assets/javascripts/elfinder/php/elFinderPlugin.php +113 -0
- data/app/assets/javascripts/elfinder/php/elFinderSession.php +335 -0
- data/app/assets/javascripts/elfinder/php/elFinderSessionInterface.php +57 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeBox.class.php +1972 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeDriver.class.php +7651 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeDropbox.class.php +1464 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeDropbox2.class.php +1516 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeFTP.class.php +1810 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeGoogleDrive.class.php +2163 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeGroup.class.php +315 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeLocalFileSystem.class.php +1477 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeMySQL.class.php +1022 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeOneDrive.class.php +2131 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeSFTPphpseclib.class.php +838 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeTrash.class.php +51 -0
- data/app/assets/javascripts/elfinder/php/elFinderVolumeTrashMySQL.class.php +51 -0
- data/app/assets/javascripts/elfinder/php/libs/GdBmp.php +473 -0
- data/app/assets/javascripts/elfinder/php/mime.types +781 -0
- data/app/assets/javascripts/elfinder/php/plugins/AutoResize/plugin.php +151 -0
- data/app/assets/javascripts/elfinder/php/plugins/AutoRotate/plugin.php +148 -0
- data/app/assets/javascripts/elfinder/php/plugins/Normalizer/plugin.php +204 -0
- data/app/assets/javascripts/elfinder/php/plugins/Sanitizer/plugin.php +157 -0
- data/app/assets/javascripts/elfinder/php/plugins/Watermark/logo.png +0 -0
- data/app/assets/javascripts/elfinder/php/plugins/Watermark/plugin.php +432 -0
- data/app/assets/javascripts/elfinder/php/plugins/WinRemoveTailDots/plugin.php +114 -0
- data/app/assets/javascripts/elfinder/php/resources/image.png +0 -0
- data/app/assets/javascripts/elfinder/php/resources/video.png +0 -0
- data/app/assets/javascripts/elfinder/sounds/rm.wav +0 -0
- data/app/controllers/dc_elfinder_controller.rb +63 -0
- data/app/models/drgcms_form_fields/elfinder.rb +85 -0
- data/changelog.md +0 -0
- data/lib/drg_elfinder/engine.rb +5 -0
- data/lib/drg_elfinder/version.rb +3 -0
- data/lib/drg_elfinder.rb +9 -0
- data/lib/el_finder/action.rb +19 -0
- data/lib/el_finder/base64.rb +24 -0
- data/lib/el_finder/connector.rb +625 -0
- data/lib/el_finder/image.rb +33 -0
- data/lib/el_finder/mime_type.rb +86 -0
- data/lib/el_finder/pathname.rb +185 -0
- data/lib/el_finder/version.rb +5 -0
- data/lib/el_finder.rb +8 -0
- data/lib/patches/patch_for_elfinder.rb +115 -0
- data/lib/tasks/drg_elfinder_tasks.rake +10 -0
- metadata +245 -0
|
@@ -0,0 +1,449 @@
|
|
|
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
|
+
// define('ELFINDER_DROPBOX_APPKEY', '');
|
|
52
|
+
// define('ELFINDER_DROPBOX_APPSECRET', '');
|
|
53
|
+
// ===============================================
|
|
54
|
+
|
|
55
|
+
// // Required for Google Drive network mount
|
|
56
|
+
// // Installation by composer
|
|
57
|
+
// // `composer require google/apiclient:^2.0` on php directory
|
|
58
|
+
// // Enable network mount
|
|
59
|
+
// elFinder::$netDrivers['googledrive'] = 'GoogleDrive';
|
|
60
|
+
// // GoogleDrive Netmount driver need next two settings. You can get at https://console.developers.google.com
|
|
61
|
+
// // AND require register redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=googledrive&host=1"
|
|
62
|
+
// define('ELFINDER_GOOGLEDRIVE_CLIENTID', '');
|
|
63
|
+
// define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', '');
|
|
64
|
+
// // Required case when Google API is NOT added via composer
|
|
65
|
+
// define('ELFINDER_GOOGLEDRIVE_GOOGLEAPICLIENT', '/path/to/google-api-php-client/vendor/autoload.php');
|
|
66
|
+
// ===============================================
|
|
67
|
+
|
|
68
|
+
// // Required for Google Drive network mount with Flysystem
|
|
69
|
+
// // Installation by composer
|
|
70
|
+
// // `composer require nao-pon/flysystem-google-drive:~1.1 nao-pon/elfinder-flysystem-driver-ext` on php directory
|
|
71
|
+
// // Enable network mount
|
|
72
|
+
// elFinder::$netDrivers['googledrive'] = 'FlysystemGoogleDriveNetmount';
|
|
73
|
+
// // GoogleDrive Netmount driver need next two settings. You can get at https://console.developers.google.com
|
|
74
|
+
// // AND require register redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=googledrive&host=1"
|
|
75
|
+
// define('ELFINDER_GOOGLEDRIVE_CLIENTID', '');
|
|
76
|
+
// define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', '');
|
|
77
|
+
// // And "php/.tmp" directory must exist and be writable by PHP.
|
|
78
|
+
// ===============================================
|
|
79
|
+
|
|
80
|
+
// // Required for One Drive network mount
|
|
81
|
+
// // * cURL PHP extension required
|
|
82
|
+
// // * HTTP server PATH_INFO supports required
|
|
83
|
+
// // Enable network mount
|
|
84
|
+
// elFinder::$netDrivers['onedrive'] = 'OneDrive';
|
|
85
|
+
// // OneDrive Netmount driver need next two settings. You can get at
|
|
86
|
+
// // https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps
|
|
87
|
+
// // AND require register redirect url to "YOUR_CONNECTOR_URL/netmount/onedrive/1"
|
|
88
|
+
// define('ELFINDER_ONEDRIVE_CLIENTID', '');
|
|
89
|
+
// define('ELFINDER_ONEDRIVE_CLIENTSECRET', '');
|
|
90
|
+
// ===============================================
|
|
91
|
+
|
|
92
|
+
// // Required for Box network mount
|
|
93
|
+
// // * cURL PHP extension required
|
|
94
|
+
// // Enable network mount
|
|
95
|
+
// elFinder::$netDrivers['box'] = 'Box';
|
|
96
|
+
// // Box Netmount driver need next two settings. You can get at https://developer.box.com
|
|
97
|
+
// // AND require register redirect url to "YOUR_CONNECTOR_URL?cmd=netmount&protocol=box&host=1"
|
|
98
|
+
// define('ELFINDER_BOX_CLIENTID', '');
|
|
99
|
+
// define('ELFINDER_BOX_CLIENTSECRET', '');
|
|
100
|
+
// ===============================================
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
// // Zoho Office Editor APIKey
|
|
104
|
+
// // https://www.zoho.com/docs/help/office-apis.html
|
|
105
|
+
// define('ELFINDER_ZOHO_OFFICE_APIKEY', '');
|
|
106
|
+
// ===============================================
|
|
107
|
+
|
|
108
|
+
// // Online converter (online-convert.com) APIKey
|
|
109
|
+
// // https://apiv2.online-convert.com/docs/getting_started/api_key.html
|
|
110
|
+
// define('ELFINDER_ONLINE_CONVERT_APIKEY', '');
|
|
111
|
+
// ===============================================
|
|
112
|
+
|
|
113
|
+
// // Zip Archive editor
|
|
114
|
+
// // Installation by composer
|
|
115
|
+
// // `composer require nao-pon/elfinder-flysystem-ziparchive-netmount` on php directory
|
|
116
|
+
// define('ELFINDER_DISABLE_ZIPEDITOR', false); // set `true` to disable zip editor
|
|
117
|
+
// ===============================================
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Simple function to demonstrate how to control file access using "accessControl" callback.
|
|
121
|
+
* This method will disable accessing files/folders starting from '.' (dot)
|
|
122
|
+
*
|
|
123
|
+
* @param string $attr attribute name (read|write|locked|hidden)
|
|
124
|
+
* @param string $path absolute file path
|
|
125
|
+
* @param string $data value of volume option `accessControlData`
|
|
126
|
+
* @param object $volume elFinder volume driver object
|
|
127
|
+
* @param bool|null $isDir path is directory (true: directory, false: file, null: unknown)
|
|
128
|
+
* @param string $relpath file path relative to volume root directory started with directory separator
|
|
129
|
+
* @return bool|null
|
|
130
|
+
**/
|
|
131
|
+
function access($attr, $path, $data, $volume, $isDir, $relpath) {
|
|
132
|
+
$basename = basename($path);
|
|
133
|
+
return $basename[0] === '.' // if file/folder begins with '.' (dot)
|
|
134
|
+
&& strlen($relpath) !== 1 // but with out volume root
|
|
135
|
+
? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true
|
|
136
|
+
: null; // else elFinder decide it itself
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Simple debug function
|
|
141
|
+
* Usage: debug($anyVal[, $anyVal2 ...]);
|
|
142
|
+
*/
|
|
143
|
+
function debug() {
|
|
144
|
+
$arg = func_get_args();
|
|
145
|
+
ob_start();
|
|
146
|
+
foreach($arg as $v) {
|
|
147
|
+
var_dump($v);
|
|
148
|
+
}
|
|
149
|
+
$o = ob_get_contents();
|
|
150
|
+
ob_end_clean();
|
|
151
|
+
file_put_contents('.debug.txt', $o, FILE_APPEND);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Simple logger function.
|
|
156
|
+
* Demonstrate how to work with elFinder event api.
|
|
157
|
+
*
|
|
158
|
+
* @package elFinder
|
|
159
|
+
* @author Dmitry (dio) Levashov
|
|
160
|
+
**/
|
|
161
|
+
class elFinderSimpleLogger {
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Log file path
|
|
165
|
+
*
|
|
166
|
+
* @var string
|
|
167
|
+
**/
|
|
168
|
+
protected $file = '';
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* constructor
|
|
172
|
+
*
|
|
173
|
+
* @return void
|
|
174
|
+
* @author Dmitry (dio) Levashov
|
|
175
|
+
**/
|
|
176
|
+
public function __construct($path)
|
|
177
|
+
{
|
|
178
|
+
$this->file = $path;
|
|
179
|
+
$dir = dirname($path);
|
|
180
|
+
if (!is_dir($dir)) {
|
|
181
|
+
mkdir($dir);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Create log record
|
|
187
|
+
*
|
|
188
|
+
* @param string $cmd command name
|
|
189
|
+
* @param array $result command result
|
|
190
|
+
* @param array $args command arguments from client
|
|
191
|
+
* @param elFinder $elfinder elFinder instance
|
|
192
|
+
* @param elFinderVolumeDriver $volume current volume driver instance
|
|
193
|
+
* @return void|true
|
|
194
|
+
* @author Dmitry (dio) Levashov
|
|
195
|
+
**/
|
|
196
|
+
public function log($cmd, $result, $args, $elfinder, $volume)
|
|
197
|
+
{
|
|
198
|
+
$log = $cmd.' ['.date('d.m H:s')."]\n";
|
|
199
|
+
|
|
200
|
+
if (!empty($result['error'])) {
|
|
201
|
+
$log .= "\tERROR: ".implode(' ', $result['error'])."\n";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (!empty($result['warning'])) {
|
|
205
|
+
$log .= "\tWARNING: ".implode(' ', $result['warning'])."\n";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!empty($result['removed'])) {
|
|
209
|
+
foreach ($result['removed'] as $file) {
|
|
210
|
+
// removed file contain additional field "realpath"
|
|
211
|
+
$log .= "\tREMOVED: ".$file['realpath']."\n";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (!empty($result['added'])) {
|
|
216
|
+
foreach ($result['added'] as $file) {
|
|
217
|
+
$log .= "\tADDED: ".$elfinder->realpath($file['hash'])."\n";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (!empty($result['changed'])) {
|
|
222
|
+
foreach ($result['changed'] as $file) {
|
|
223
|
+
$log .= "\tCHANGED: ".$elfinder->realpath($file['hash'])."\n";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
$this->write($log);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Write log into file
|
|
232
|
+
*
|
|
233
|
+
* @param string $log log record
|
|
234
|
+
* @return void
|
|
235
|
+
* @author Dmitry (dio) Levashov
|
|
236
|
+
**/
|
|
237
|
+
protected function write($log)
|
|
238
|
+
{
|
|
239
|
+
|
|
240
|
+
if (($fp = @fopen($this->file, 'a'))) {
|
|
241
|
+
fwrite($fp, $log."\n");
|
|
242
|
+
fclose($fp);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
} // END class
|
|
247
|
+
// Make logger instance
|
|
248
|
+
$logger = new elFinderSimpleLogger('.log.txt');
|
|
249
|
+
|
|
250
|
+
// Documentation for connector options:
|
|
251
|
+
// https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options
|
|
252
|
+
$opts = array(
|
|
253
|
+
'debug' => true, // enable debug mode
|
|
254
|
+
'roots' => array(
|
|
255
|
+
// Items volume
|
|
256
|
+
array(
|
|
257
|
+
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
|
|
258
|
+
'path' => '../files/', // path to files (REQUIRED)
|
|
259
|
+
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
|
|
260
|
+
'trashHash' => 't1_Lw', // elFinder's hash of trash folder
|
|
261
|
+
'winHashFix' => DIRECTORY_SEPARATOR !== '/', // to make hash same to Linux one on windows too
|
|
262
|
+
'uploadDeny' => array('all'), // All Mimetypes not allowed to upload
|
|
263
|
+
'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
|
|
264
|
+
'uploadOrder' => array('deny', 'allow'), // allowed Mimetype `image` and `text/plain` only
|
|
265
|
+
'accessControl' => 'access', // disable and hide dot starting files (OPTIONAL)
|
|
266
|
+
'attributes' => array( // additional thumbnail directories
|
|
267
|
+
'pattern' => '~^/\.tmb(?:Cloud|Netmount)$~',
|
|
268
|
+
'read' => false,
|
|
269
|
+
'write' => false,
|
|
270
|
+
'locked' => true,
|
|
271
|
+
'hidden' => true ),
|
|
272
|
+
),
|
|
273
|
+
// Trash volume
|
|
274
|
+
array(
|
|
275
|
+
'id' => '1',
|
|
276
|
+
'driver' => 'Trash',
|
|
277
|
+
'path' => '../files/.trash/',
|
|
278
|
+
'tmbURL' => dirname($_SERVER['PHP_SELF']) . '/../files/.trash/.tmb/',
|
|
279
|
+
'winHashFix' => DIRECTORY_SEPARATOR !== '/', // to make hash same to Linux one on windows too
|
|
280
|
+
'uploadDeny' => array('all'), // Recomend the same settings as the original volume that uses the trash
|
|
281
|
+
'uploadAllow' => array('image/x-ms-bmp', 'image/gif', 'image/jpeg', 'image/png', 'image/x-icon', 'text/plain'), // Same as above
|
|
282
|
+
'uploadOrder' => array('deny', 'allow'), // Same as above
|
|
283
|
+
'accessControl' => 'access', // Same as above
|
|
284
|
+
),
|
|
285
|
+
),
|
|
286
|
+
// some bind functions
|
|
287
|
+
'bind' => array(
|
|
288
|
+
// enable logger
|
|
289
|
+
// '*' => array($logger, 'log'),
|
|
290
|
+
'mkdir mkfile rename duplicate upload rm paste' => array($logger, 'log'),
|
|
291
|
+
// enable plugins
|
|
292
|
+
'archive.pre ls.pre mkdir.pre mkfile.pre rename.pre upload.pre' => array(
|
|
293
|
+
'Plugin.Normalizer.cmdPreprocess',
|
|
294
|
+
'Plugin.Sanitizer.cmdPreprocess'
|
|
295
|
+
),
|
|
296
|
+
'upload.presave' => array(
|
|
297
|
+
'Plugin.AutoRotate.onUpLoadPreSave',
|
|
298
|
+
'Plugin.AutoResize.onUpLoadPreSave',
|
|
299
|
+
'Plugin.Watermark.onUpLoadPreSave',
|
|
300
|
+
'Plugin.Normalizer.onUpLoadPreSave',
|
|
301
|
+
'Plugin.Sanitizer.onUpLoadPreSave',
|
|
302
|
+
),
|
|
303
|
+
),
|
|
304
|
+
// volume options of netmount volumes
|
|
305
|
+
'optionsNetVolumes' => array(
|
|
306
|
+
'*' => array( // "*" is all of netmount volumes
|
|
307
|
+
'tmbURL' => dirname($_SERVER['PHP_SELF']) . '/../files/.tmbNetmount/',
|
|
308
|
+
'tmbPath' => '../files/.tmbNetmount',
|
|
309
|
+
'tmbGcMaxlifeHour' => 1, // 1 hour
|
|
310
|
+
'tmbGcPercentage' => 10, // 10 execute / 100 tmb querys
|
|
311
|
+
'plugin' => array(
|
|
312
|
+
'AutoResize' => array(
|
|
313
|
+
'enable' => false
|
|
314
|
+
),
|
|
315
|
+
'Watermark' => array(
|
|
316
|
+
'enable' => false
|
|
317
|
+
),
|
|
318
|
+
'Normalizer' => array(
|
|
319
|
+
'enable' => false
|
|
320
|
+
),
|
|
321
|
+
'Sanitizer' => array(
|
|
322
|
+
'enable' => false
|
|
323
|
+
)
|
|
324
|
+
),
|
|
325
|
+
)
|
|
326
|
+
),
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
// Extended other volume types
|
|
330
|
+
// To get an access token or refresh token, see the elFinder wiki.
|
|
331
|
+
// https://github.com/Studio-42/elFinder/wiki/How-to-get-OAuth-token
|
|
332
|
+
|
|
333
|
+
// Thumbnail settings for cloud volumes
|
|
334
|
+
$tmbConfig = array(
|
|
335
|
+
'tmbPath' => '../files/.tmbCloud',
|
|
336
|
+
'tmbURL' => dirname($_SERVER['PHP_SELF']) . '/../files/.tmbCloud/',
|
|
337
|
+
'tmbGcMaxlifeHour' => 2160, // 90 days
|
|
338
|
+
'tmbGcPercentage' => 5, // 5 execute / 100 tmb querys
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
// MySQL config
|
|
342
|
+
$mySqlConfig = array(
|
|
343
|
+
'path' => 1,
|
|
344
|
+
'host' => '127.0.0.1',
|
|
345
|
+
'user' => '', // @String DB user name
|
|
346
|
+
'pass' => '', // @String DB user password
|
|
347
|
+
'db' => '', // @String Database name
|
|
348
|
+
'uploadMaxSize' => '10M', // It should be less than "max_allowed_packet" value of MySQL setting
|
|
349
|
+
);
|
|
350
|
+
// MySQL volume
|
|
351
|
+
$opts['roots'][] = array_merge($tmbConfig, $mySqlConfig, array(
|
|
352
|
+
'driver' => 'MySQL',
|
|
353
|
+
'trashHash' => 'tm1_MQ', // set trash to MySQL trash (tm1_) 1 (MQ)
|
|
354
|
+
'files_table' => 'elfinder_file',
|
|
355
|
+
));
|
|
356
|
+
// MySQL trash volume
|
|
357
|
+
$opts['roots'][] = array_merge($tmbConfig, $mySqlConfig, array(
|
|
358
|
+
'id' => '1', // volume id became "tm1_"
|
|
359
|
+
'alias' => 'DB Trash',
|
|
360
|
+
'driver' => 'TrashMySQL',
|
|
361
|
+
'files_table' => 'elfinder_trash',
|
|
362
|
+
));
|
|
363
|
+
|
|
364
|
+
// Volume group
|
|
365
|
+
$opts['roots'][] = array(
|
|
366
|
+
'id' => '1', // volume id became "g1_"
|
|
367
|
+
'alias' => 'CloudVolumes',
|
|
368
|
+
'driver' => 'Group',
|
|
369
|
+
'rootCssClass' => 'elfinder-navbar-root-network' // set volume icon
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
// FTP volume
|
|
373
|
+
$opts['roots'][] = array_merge($tmbConfig, array(
|
|
374
|
+
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
|
|
375
|
+
'driver' => 'FTP',
|
|
376
|
+
'host' => 'ftp.jaist.ac.jp',
|
|
377
|
+
'user' => 'anonymous',
|
|
378
|
+
'path' => '/',
|
|
379
|
+
'owner' => false,
|
|
380
|
+
));
|
|
381
|
+
|
|
382
|
+
// To enable the following cloud volumes, first complete the steps
|
|
383
|
+
// for enabling each network-mounted volume described earlier in this file.
|
|
384
|
+
|
|
385
|
+
// Box volume
|
|
386
|
+
// Require constant "ELFINDER_BOX_CLIENTID" and "ELFINDER_BOX_CLIENTSECRET"
|
|
387
|
+
$opts['roots'][] = array_merge($tmbConfig, array(
|
|
388
|
+
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
|
|
389
|
+
'driver' => 'Box',
|
|
390
|
+
'path' => '/', // or folder id as root
|
|
391
|
+
'accessToken' => '', // @JSON String access token including refresh token
|
|
392
|
+
));
|
|
393
|
+
|
|
394
|
+
// Dropbox volume
|
|
395
|
+
// Require constant "ELFINDER_DROPBOX_APPKEY" and "ELFINDER_DROPBOX_APPSECRET"
|
|
396
|
+
$opts['roots'][] = array_merge($tmbConfig, array(
|
|
397
|
+
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
|
|
398
|
+
'driver' => 'Dropbox2',
|
|
399
|
+
'path' => '/', // or folder path as root
|
|
400
|
+
'access_token' => '', // @String your access token
|
|
401
|
+
));
|
|
402
|
+
|
|
403
|
+
// GoogleDrive volume with refresh token
|
|
404
|
+
// Require constant "ELFINDER_GOOGLEDRIVE_CLIENTID" and "ELFINDER_GOOGLEDRIVE_CLIENTSECRET"
|
|
405
|
+
$opts['roots'][] = array_merge($tmbConfig, array(
|
|
406
|
+
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
|
|
407
|
+
'driver' => 'GoogleDrive',
|
|
408
|
+
'path' => '/', // or folder id as root
|
|
409
|
+
'refresh_token' => '', // @String your refresh token
|
|
410
|
+
));
|
|
411
|
+
|
|
412
|
+
// GoogleDrive volume with service account
|
|
413
|
+
// Require constant "ELFINDER_GOOGLEDRIVE_CLIENTID" and "ELFINDER_GOOGLEDRIVE_CLIENTSECRET"
|
|
414
|
+
$opts['roots'][] = array_merge($tmbConfig, array(
|
|
415
|
+
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
|
|
416
|
+
'driver' => 'GoogleDrive',
|
|
417
|
+
'path' => '/', // or folder id as root
|
|
418
|
+
'serviceAccountConfigFile' => '', // @String path to config json file
|
|
419
|
+
));
|
|
420
|
+
|
|
421
|
+
// OneDrive volume
|
|
422
|
+
// Require constant "ELFINDER_ONEDRIVE_CLIENTID" and "ELFINDER_ONEDRIVE_CLIENTSECRET"
|
|
423
|
+
$opts['roots'][] = array_merge($tmbConfig, array(
|
|
424
|
+
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
|
|
425
|
+
'driver' => 'OneDrive',
|
|
426
|
+
'path' => '/', // or folder id as root
|
|
427
|
+
'accessToken' => '', // @JSON String access token including refresh token
|
|
428
|
+
));
|
|
429
|
+
|
|
430
|
+
// SFTP volume
|
|
431
|
+
// Require phpseclib 1 installed (http://phpseclib.sourceforge.net)
|
|
432
|
+
// pear install example:
|
|
433
|
+
//sudo pear channel-discover phpseclib.sourceforge.net
|
|
434
|
+
//sudo pear remote-list -c phpseclib
|
|
435
|
+
//sudo pear install phpseclib/Net_SFTP
|
|
436
|
+
/*$opts['roots'][] = array_merge($tmbConfig, array(
|
|
437
|
+
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
|
|
438
|
+
'driver' => 'SFTPphpseclib',
|
|
439
|
+
'host' => '127.0.0.1',
|
|
440
|
+
'path' => '/tmp', // or folder id as root
|
|
441
|
+
'user' => 'test', // @JSON String access token including refresh token
|
|
442
|
+
'pass' => 'test',
|
|
443
|
+
));*/
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
// run elFinder
|
|
447
|
+
$connector = new elFinderConnector(new elFinder($opts));
|
|
448
|
+
$connector->run();
|
|
449
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
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
|
+
|