|
|
|
@ -166,7 +166,7 @@ class CourseDriver extends Driver implements DriverInterface |
|
|
|
|
return $config; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return array(); |
|
|
|
|
return []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -229,6 +229,7 @@ class CourseDriver extends Driver implements DriverInterface |
|
|
|
|
*/ |
|
|
|
|
public function upload($fp, $dst, $name, $tmpname, $hashes = array()) |
|
|
|
|
{ |
|
|
|
|
// Needed to load course information in elfinder |
|
|
|
|
$this->setConnectorFromPlugin(); |
|
|
|
|
|
|
|
|
|
if ($this->allowToEdit()) { |
|
|
|
@ -331,23 +332,25 @@ class CourseDriver extends Driver implements DriverInterface |
|
|
|
|
/** |
|
|
|
|
* @inheritdoc |
|
|
|
|
*/ |
|
|
|
|
protected function _mkdir($path, $name) |
|
|
|
|
public function mkdir($path, $name) |
|
|
|
|
{ |
|
|
|
|
// Needed to load course information in elfinder |
|
|
|
|
$this->setConnectorFromPlugin(); |
|
|
|
|
|
|
|
|
|
if ($this->allowToEdit() == false) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$path = $this->_joinPath($path, $name); |
|
|
|
|
$result = parent::mkdir($path, $name); |
|
|
|
|
|
|
|
|
|
if (mkdir($path)) { |
|
|
|
|
$this->setConnectorFromPlugin(); |
|
|
|
|
chmod($path, $this->options['dirMode']); |
|
|
|
|
clearstatcache(); |
|
|
|
|
if ($result && isset($result['hash'])) { |
|
|
|
|
$_course = $this->connector->course; |
|
|
|
|
$realPathRoot = $this->getCourseDocumentSysPath(); |
|
|
|
|
$realPath = $this->realpath($result['hash']); |
|
|
|
|
|
|
|
|
|
// Removing course path |
|
|
|
|
$newPath = str_replace($realPathRoot, '/', $path); |
|
|
|
|
$newPath = str_replace($realPathRoot, '/', $realPath); |
|
|
|
|
|
|
|
|
|
$documentId = add_document( |
|
|
|
|
$_course, |
|
|
|
|
$newPath, |
|
|
|
@ -363,12 +366,12 @@ class CourseDriver extends Driver implements DriverInterface |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (empty($documentId)) { |
|
|
|
|
unlink($path); |
|
|
|
|
$this->rm($result['hash']); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $path; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|