[php] fix #2014 "Parse error" on PHP < 5.3

This commit is contained in:
nao-pon
2017-05-21 00:18:00 +09:00
parent e4ba3c1b10
commit 117f5dee38
3 changed files with 9 additions and 6 deletions
+3 -2
View File
@@ -82,8 +82,9 @@ elFinder::$netDrivers['ftp'] = 'FTP';
* @return bool|null
**/
function access($attr, $path, $data, $volume, $isDir, $relpath) {
return basename($path)[0] === '.' // if file/folder begins with '.' (dot) with out volume root
&& strlen($relpath) !== 1
$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
}
+5 -3
View File
@@ -249,9 +249,11 @@ class elFinderSimpleLogger {
* @return bool|null
**/
function access($attr, $path, $data, $volume, $isDir) {
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
$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
}
/**
+1 -1
View File
@@ -1084,7 +1084,7 @@ class elFinderVolumeBox extends elFinderVolumeDriver
protected function getSharedWebContentLink($raw)
{
$fExtension = pathinfo($raw->name, PATHINFO_EXTENSION);
$fType = explode('/', self::mimetypeInternalDetect($raw->name))[0];
list($fType) = explode('/', self::mimetypeInternalDetect($raw->name));
if ($raw->shared_link->url && ($fType == 'image' || $fType == 'video' || $fType == 'audio')) {
if ($fExtension == 'jpg' && $fType == 'image') {