mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-22663, fixed webdav url path
This commit is contained in:
parent
786d886efe
commit
a63f4129ee
@ -154,7 +154,7 @@ class webdav_client {
|
||||
function open() {
|
||||
// let's try to open a socket
|
||||
$this->_error_log('open a socket connection');
|
||||
$this->sock = @fsockopen ($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
|
||||
$this->sock = fsockopen($this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);
|
||||
set_time_limit(30);
|
||||
if (is_resource($this->sock)) {
|
||||
socket_set_blocking($this->sock, true);
|
||||
@ -787,7 +787,6 @@ EOD;
|
||||
fputs($this->sock, $xml);
|
||||
$this->get_respond();
|
||||
$response = $this->process_respond();
|
||||
echo_fb($response);
|
||||
// validate the response ... (only basic validation)
|
||||
// check http-version
|
||||
if ($response['status']['http-version'] == 'HTTP/1.1' ||
|
||||
|
@ -61,14 +61,15 @@ class repository_webdav extends repository {
|
||||
public function check_login() {
|
||||
return true;
|
||||
}
|
||||
public function get_file($url, $title) {
|
||||
public function get_file($path, $title) {
|
||||
global $CFG;
|
||||
$path = urldecode($path);
|
||||
$path = $this->prepare_file($title);
|
||||
$buffer = '';
|
||||
if (!$this->dav->open()) {
|
||||
return false;
|
||||
}
|
||||
$this->dav->get($url, $buffer);
|
||||
$this->dav->get($path, $buffer);
|
||||
$fp = fopen($path, 'wb');
|
||||
fwrite($fp, $buffer);
|
||||
return array('path'=>$path);
|
||||
@ -96,6 +97,7 @@ class repository_webdav extends repository {
|
||||
}
|
||||
$dir = $this->dav->ls($path);
|
||||
} else {
|
||||
$path = urldecode($path);
|
||||
if (empty($this->options['webdav_type'])) {
|
||||
$partern = '#http://'.$this->webdav_host.'/#';
|
||||
} else {
|
||||
@ -125,8 +127,8 @@ class repository_webdav extends repository {
|
||||
$title = urldecode($v['href']);
|
||||
}
|
||||
$ret['list'][] = array(
|
||||
'title'=>$title,
|
||||
'thumbnail'=>$OUTPUT->pix_url('f/folder-32').out(false),
|
||||
'title'=>urldecode(basename($title)),
|
||||
'thumbnail'=>$OUTPUT->pix_url('f/folder-32')->out(false),
|
||||
'children'=>array(),
|
||||
'date'=>$filedate,
|
||||
'size'=>0,
|
||||
@ -136,6 +138,7 @@ class repository_webdav extends repository {
|
||||
}else{
|
||||
// a file
|
||||
$title = urldecode(substr($v['href'], strpos($v['href'], $path)+strlen($path)));
|
||||
$title = basename($title);
|
||||
$size = !empty($v['getcontentlength'])? $v['getcontentlength']:'';
|
||||
$ret['list'][] = array(
|
||||
'title'=>$title,
|
||||
|
Loading…
x
Reference in New Issue
Block a user