src build elFinder-2.1-24b2607

This commit is contained in:
nao-pon
2020-01-12 20:15:48 +09:00
parent f0925d2f27
commit dd941fa56e
11 changed files with 109 additions and 75 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
/*!
* elFinder - file manager for web
* Version 2.1.51 (2.1-src Nightly: 9924919) (2020-01-11)
* Version 2.1.51 (2.1-src Nightly: 24b2607) (2020-01-12)
* http://elfinder.org
*
* Copyright 2009-2020, Studio 42
+1 -1
View File
@@ -1,6 +1,6 @@
/*!
* elFinder - file manager for web
* Version 2.1.51 (2.1-src Nightly: 9924919) (2020-01-11)
* Version 2.1.51 (2.1-src Nightly: 24b2607) (2020-01-12)
* http://elfinder.org
*
* Copyright 2009-2020, Studio 42
+6 -4
View File
@@ -1,6 +1,6 @@
/*!
* elFinder - file manager for web
* Version 2.1.51 (2.1-src Nightly: 9924919) (2020-01-11)
* Version 2.1.51 (2.1-src Nightly: 24b2607) (2020-01-12)
* http://elfinder.org
*
* Copyright 2009-2020, Studio 42
@@ -428,6 +428,7 @@ var elFinder = function(elm, opts, bootCallback) {
diff = self.diff([data.cwd], true);
if (diff.changed.length) {
cache(diff.changed, 'change');
self.change({changed: diff.changed});
}
}
@@ -7029,8 +7030,9 @@ elFinder.prototype = {
name = fm.date(fm.nonameDateFormat) + '.png';
}
} else {
if (file.name) {
name = file.name;
fm.log(file.webkitRelativePath || file.relativePath || file.name);
if (name = file.webkitRelativePath || file.relativePath || file.name) {
//name = file.name;
if (fm.UA.iOS) {
if (name.match(/^image\.jpe?g$/i)) {
data.overwrite = 0;
@@ -10267,7 +10269,7 @@ if (!window.cancelAnimationFrame) {
*
* @type String
**/
elFinder.prototype.version = '2.1.51 (2.1-src Nightly: 9924919)';
elFinder.prototype.version = '2.1.51 (2.1-src Nightly: 24b2607)';
+6 -6
View File
File diff suppressed because one or more lines are too long
+10 -10
View File
@@ -31,7 +31,7 @@ error_reporting(0); // Set E_ALL for debuging
// // load composer autoload before load elFinder autoload If you need composer
// // You need to run the composer command in the php directory.
// require './vendor/autoload.php';
is_readable('./vendor/autoload.php') && require './vendor/autoload.php';
// // elFinder autoload
require './autoload.php';
@@ -244,7 +244,7 @@ class elFinderSimpleLogger {
} // END class
// Make logger instance
$logger = new elFinderSimpleLogger('log.txt');
$logger = new elFinderSimpleLogger('.log.txt');
// Documentation for connector options:
// https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options
@@ -341,9 +341,9 @@ $tmbConfig = array(
$mySqlConfig = array(
'path' => 1,
'host' => '127.0.0.1',
'user' => 'DB user',
'pass' => 'DB user password',
'db' => 'DB name',
'user' => '', // @String DB user name
'pass' => '', // @String DB user password
'db' => '', // @String Database name
'uploadMaxSize' => '10M', // It should be less than "max_allowed_packet" value of MySQL setting
);
// MySQL volume
@@ -387,7 +387,7 @@ $opts['roots'][] = array_merge($tmbConfig, array(
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
'driver' => 'Box',
'path' => '/', // or folder id as root
'accessToken' => 'JSON strings of access token including refresh token',
'accessToken' => '', // @JSON String access token including refresh token
));
// Dropbox volume
@@ -396,7 +396,7 @@ $opts['roots'][] = array_merge($tmbConfig, array(
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
'driver' => 'Dropbox2',
'path' => '/', // or folder path as root
'access_token' => 'access token strings',
'access_token' => '', // @String your access token
));
// GoogleDrive volume with refresh token
@@ -405,7 +405,7 @@ $opts['roots'][] = array_merge($tmbConfig, array(
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
'driver' => 'GoogleDrive',
'path' => '/', // or folder id as root
'refresh_token' => 'refresh token strings',
'refresh_token' => '', // @String your refresh token
));
// GoogleDrive volume with service account
@@ -414,7 +414,7 @@ $opts['roots'][] = array_merge($tmbConfig, array(
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
'driver' => 'GoogleDrive',
'path' => '/', // or folder id as root
'serviceAccountConfigFile' => '/path/to/config/json',
'serviceAccountConfigFile' => '', // @String path to config json file
));
// OneDrive volume
@@ -423,7 +423,7 @@ $opts['roots'][] = array_merge($tmbConfig, array(
'phash' => 'g1_Lw', // set parent to Volume group (g1_) root "/" (Lw)
'driver' => 'OneDrive',
'path' => '/', // or folder id as root
'accessToken' => 'JSON string of access token including refresh token',
'accessToken' => '', // @JSON String access token including refresh token
));
+23 -15
View File
@@ -744,8 +744,8 @@ class elFinderVolumeBox extends elFinderVolumeDriver
$html = '<input id="elf-volumedriver-box-host-btn" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" value="{msg:btnApprove}" type="button" onclick="window.open(\'' . $url . '\')">';
$html .= '<script>
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", {protocol: "box", mode: "makebtn"});
</script>';
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", {protocol: "box", mode: "makebtn"});
</script>';
return array('exit' => true, 'body' => $html);
} else {
@@ -772,8 +772,8 @@ class elFinderVolumeBox extends elFinderVolumeDriver
$json = '{"protocol": "box", "mode": "done", "folders": ' . $folders . ', "expires": ' . $expires . $mnt2res . '}';
$html = 'Box.com';
$html .= '<script>
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", ' . $json . ');
</script>';
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", ' . $json . ');
</script>';
return array('exit' => true, 'body' => $html);
}
@@ -879,8 +879,12 @@ class elFinderVolumeBox extends elFinderVolumeDriver
if ($this->aTokenFile) {
if (is_file($this->aTokenFile)) {
$this->token = json_decode(file_get_contents($this->aTokenFile));
if (!is_object($this->token)) {
unlink($this->aTokenFile);
throw new Exception('Required option `accessToken` is invalid JSON.');
}
} else {
file_put_contents($this->aTokenFile, $this->token);
file_put_contents($this->aTokenFile, json_encode($this->token));
}
}
} else if (is_file($this->aTokenFile)) {
@@ -897,13 +901,13 @@ class elFinderVolumeBox extends elFinderVolumeDriver
}
if ($this->netMountKey) {
$this->tmbPrefix = 'box' . base_convert($this->netMountKey, 10, 32);
$this->tmbPrefix = 'box' . base_convert($this->netMountKey, 16, 32);
}
if ($error) {
if (empty($this->options['netkey']) && $this->tmbPrefix) {
// for delete thumbnail
$this->netunmount();
$this->netunmount(null, null);
}
return false;
}
@@ -915,18 +919,22 @@ class elFinderVolumeBox extends elFinderVolumeDriver
$this->root = $this->options['path'] = $this->_normpath($this->options['path']);
$this->options['root'] == '' ? $this->options['root'] = 'Box.com' : $this->options['root'];
$this->options['root'] = ($this->options['root'] == '')? 'Box.com' : $this->options['root'];
if ($this->needOnline && empty($this->options['alias'])) {
list(, $itemId) = $this->_bd_splitPath($this->options['path']);
$this->options['alias'] = ($this->options['path'] === '/') ? $this->options['root'] :
$this->_bd_query($itemId, $fetch_self = true)->name . '@Box.com';
if (!empty($this->options['netkey'])) {
elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $this->options['alias']);
if (empty($this->options['alias'])) {
if ($this->needOnline) {
list(, $itemId) = $this->_bd_splitPath($this->options['path']);
$this->options['alias'] = ($this->options['path'] === '/') ? $this->options['root'] :
$this->_bd_query($itemId, $fetch_self = true)->name . '@Box';
if (!empty($this->options['netkey'])) {
elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $this->options['alias']);
}
} else {
$this->options['alias'] = $this->options['root'];
}
}
$this->rootName = isset($this->options['alias'])? $this->options['alias'] : 'Box.com';
$this->rootName = $this->options['alias'];
// This driver dose not support `syncChkAsTs`
$this->options['syncChkAsTs'] = false;
+1 -1
View File
@@ -1183,7 +1183,7 @@ abstract class elFinderVolumeDriver
foreach ($this->options['attributes'] as $a) {
// attributes must contain pattern and at least one rule
if (!empty($a['pattern']) || count($a) > 1) {
if (!empty($a['pattern']) || (is_array($a) && count($a) > 1)) {
$this->attributes[] = $a;
}
}
+1 -1
View File
@@ -524,7 +524,7 @@ class elFinderVolumeDropbox2 extends elFinderVolumeDriver
$this->root = $this->options['path'] = $this->_normpath($this->options['path']);
if (empty($this->options['alias'])) {
$this->options['alias'] = sprintf($this->options['aliasFormat'], ($this->options['path'] === '/') ? 'Dropbox.com' : ($this->_basename($this->options['path']) . '@Dropbox.com'));
$this->options['alias'] = sprintf($this->options['aliasFormat'], ($this->options['path'] === '/') ? 'Root' : $this->_basename($this->options['path']));
if (!empty($this->options['netkey'])) {
elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $this->options['alias']);
}
+10 -6
View File
@@ -976,12 +976,16 @@ class elFinderVolumeGoogleDrive extends elFinderVolumeDriver
}
$this->root = $this->options['path'] = $this->_normpath($this->options['path']);
$this->options['root'] == '' ? $this->options['root'] = $this->_gd_getNameByPath('root') : $this->options['root'];
if ($this->needOnline && empty($this->options['alias'])) {
$this->options['alias'] = ($this->options['path'] === '/') ? $this->options['root'] : sprintf($this->options['gdAlias'], $this->_gd_getNameByPath($this->options['path']));
if (!empty($this->options['netkey'])) {
elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $this->options['alias']);
if (empty($this->options['alias'])) {
if ($this->needOnline) {
$this->options['root'] = ($this->options['root'] === '')? $this->_gd_getNameByPath('root') : $this->options['root'];
$this->options['alias'] = ($this->options['path'] === '/') ? $this->options['root'] : sprintf($this->options['gdAlias'], $this->_gd_getNameByPath($this->options['path']));
if (!empty($this->options['netkey'])) {
elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $this->options['alias']);
}
} else {
$this->options['root'] = ($this->options['root'] === '')? 'GoogleDrive' : $this->options['root'];
$this->options['alias'] = $this->options['root'];
}
}
+29 -17
View File
@@ -106,13 +106,25 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver
|| !$this->options['db']
|| !$this->options['path']
|| !$this->options['files_table']) {
return false;
return $this->setError('Required options "host", "socket", "user", "pass", "db", "path" or "files_table" are undefined.');
}
$err = null;
if ($this->db = @new mysqli($this->options['host'], $this->options['user'], $this->options['pass'], $this->options['db'], $this->options['port'], $this->options['socket'])) {
if ($this->db && $this->db->connect_error) {
$err = $this->db->connect_error;
}
} else {
$err = mysqli_connect_error();
}
if ($err) {
return $this->setError(array('Unable to connect to MySQL server.', $err));
}
$this->db = new mysqli($this->options['host'], $this->options['user'], $this->options['pass'], $this->options['db'], $this->options['port'], $this->options['socket']);
if ($this->db->connect_error || mysqli_connect_error()) {
return false;
if (!$this->needOnline && empty($this->ARGS['init'])) {
$this->db->close();
$this->db = null;
return true;
}
$this->db->set_charset('utf8');
@@ -127,7 +139,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver
}
if (!$this->tbf) {
return false;
return $this->setError('The specified database table cannot be found.');
}
$this->updateCache($this->options['path'], $this->_stat($this->options['path']));
@@ -182,7 +194,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver
**/
public function umount()
{
$this->db->close();
$this->db && $this->db->close();
}
/**
@@ -255,10 +267,10 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver
$this->dirsCache[$path] = array();
$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs
FROM ' . $this->tbf . ' AS f
LEFT JOIN ' . $this->tbf . ' AS ch ON ch.parent_id=f.id AND ch.mime=\'directory\'
WHERE f.parent_id=\'' . $path . '\'
GROUP BY f.id, ch.id';
FROM ' . $this->tbf . ' AS f
LEFT JOIN ' . $this->tbf . ' AS ch ON ch.parent_id=f.id AND ch.mime=\'directory\'
WHERE f.parent_id=\'' . $path . '\'
GROUP BY f.id, ch.id';
$res = $this->query($sql);
if ($res) {
@@ -389,8 +401,8 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver
}
$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, 0 AS dirs
FROM %s AS f
WHERE %s';
FROM %s AS f
WHERE %s';
$sql = sprintf($sql, $this->tbf, $whr);
@@ -457,7 +469,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver
**/
protected function _basename($path)
{
return ($stat = $this->stat($path)) ? $stat['name'] : false;
return (($stat = $this->stat($path)) && isset($stat['name'])) ? $stat['name'] : false;
}
/**
@@ -581,10 +593,10 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver
protected function _stat($path)
{
$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs
FROM ' . $this->tbf . ' AS f
LEFT JOIN ' . $this->tbf . ' AS ch ON ch.parent_id=f.id AND ch.mime=\'directory\'
WHERE f.id=\'' . $path . '\'
GROUP BY f.id, ch.id';
FROM ' . $this->tbf . ' AS f
LEFT JOIN ' . $this->tbf . ' AS ch ON ch.parent_id=f.id AND ch.mime=\'directory\'
WHERE f.id=\'' . $path . '\'
GROUP BY f.id, ch.id';
$res = $this->query($sql);
+21 -13
View File
@@ -847,8 +847,8 @@ class elFinderVolumeOneDrive extends elFinderVolumeDriver
$html = '<input id="elf-volumedriver-onedrive-host-btn" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" value="{msg:btnApprove}" type="button" onclick="window.open(\'' . $url . '\')">';
$html .= '<script>
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", {protocol: "onedrive", mode: "makebtn"});
</script>';
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", {protocol: "onedrive", mode: "makebtn"});
</script>';
return array('exit' => true, 'body' => $html);
} else {
@@ -873,8 +873,8 @@ class elFinderVolumeOneDrive extends elFinderVolumeDriver
$json = '{"protocol": "onedrive", "mode": "done", "folders": ' . $folders . ', "expires": ' . $expires . $mnt2res .'}';
$html = 'OneDrive.com';
$html .= '<script>
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", ' . $json . ');
</script>';
$("#' . $options['id'] . '").elfinder("instance").trigger("netmount", ' . $json . ');
</script>';
return array('exit' => true, 'body' => $html);
}
@@ -979,6 +979,10 @@ class elFinderVolumeOneDrive extends elFinderVolumeDriver
if ($this->aTokenFile) {
if (is_file($this->aTokenFile)) {
$this->token = json_decode(file_get_contents($this->aTokenFile));
if (!is_object($this->token)) {
unlink($this->aTokenFile);
throw new Exception('Required option `accessToken` is invalid JSON.');
}
} else {
file_put_contents($this->aTokenFile, $this->token);
}
@@ -1001,13 +1005,13 @@ class elFinderVolumeOneDrive extends elFinderVolumeDriver
}
if ($this->netMountKey) {
$this->tmbPrefix = 'onedrive' . base_convert($this->netMountKey, 10, 32);
$this->tmbPrefix = 'onedrive' . base_convert($this->netMountKey, 16, 32);
}
if ($error) {
if (empty($this->options['netkey']) && $this->tmbPrefix) {
// for delete thumbnail
$this->netunmount();
$this->netunmount(null, null);
}
return false;
}
@@ -1019,17 +1023,21 @@ class elFinderVolumeOneDrive extends elFinderVolumeDriver
$this->root = $this->options['path'] = $this->_normpath($this->options['path']);
$this->options['root'] == '' ? $this->options['root'] = 'OneDrive.com' : $this->options['root'];
$this->options['root'] = ($this->options['root'] == '')? 'OneDrive.com' : $this->options['root'];
if ($this->needOnline && empty($this->options['alias'])) {
$this->options['alias'] = ($this->options['path'] === '/') ? $this->options['root'] :
$this->_od_query(basename($this->options['path']), $fetch_self = true)->name . '@OneDrive';
if (!empty($this->options['netkey'])) {
elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $this->options['alias']);
if (empty($this->options['alias'])) {
if ($this->needOnline) {
$this->options['alias'] = ($this->options['path'] === '/') ? $this->options['root'] :
$this->_od_query(basename($this->options['path']), $fetch_self = true)->name . '@OneDrive';
if (!empty($this->options['netkey'])) {
elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $this->options['alias']);
}
} else {
$this->options['alias'] = $this->options['root'];
}
}
$this->rootName = isset($this->options['alias'])? $this->options['alias'] : 'OneDrive.com';
$this->rootName = $this->options['alias'];
// This driver dose not support `syncChkAsTs`
$this->options['syncChkAsTs'] = false;