26 return $DIC->clientIni()->readVariable(
'file_access',
'webdav_actions_visible') ==
'1';
39 $lng = $DIC->language();
51 foreach ($objectPath as $object) {
52 if ($object->getRefId() == 1 && $this->isFileHidden($object)) {
56 $fullPath .=
'/ref_1';
58 $fullPath .=
'/' . $this->davUrlEncode($object->getResourceName());
63 $shortenedPath =
'/ref_' .
64 $objectPath[count($objectPath) - 1]->getRefId();
66 if ($objDAV->isCollection()) {
67 $shortenedPath .=
'/';
72 $shortenedPath =
'/' . CLIENT_ID . $shortenedPath;
73 $fullPath =
'/' . CLIENT_ID . $fullPath;
78 $webfolderURI = $this->base_uri . $shortenedPath;
80 substr($this->base_uri, strrpos($this->base_uri,
':')) .
84 substr($this->base_uri, strrpos($this->base_uri,
':')) .
87 $webfolderURI_IE = $this->base_uri . $shortenedPath;
89 $webfolderTitle = $objectPath[count($objectPath) - 1]->getResourceName();
91 header(
'Content-Type: text/html; charset=UTF-8');
92 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
93 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN\"\n";
94 echo " \"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd\">\n";
95 echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
97 echo " <title>" . sprintf(
$lng->txt(
'webfolder_instructions_titletext'), $webfolderTitle) .
"</title>\n";
101 echo ilDAVServer::_getWebfolderInstructionsFor(
105 $webfolderURI_Konqueror,
106 $webfolderURI_Nautilus,
108 $this->clientOSFlavor
115 if (
$ilUser->getId() == ANONYMOUS_USER_ID) {
116 $DIC[
'ilAuthSession']->logout();
139 $this->writelog(
'checkLock(' .
$path .
')');
147 if (!is_null($objPath)) {
148 $objDAV = $objPath[count($objPath) - 1];
149 $locks = $this->locks->getLocksOnPathDAV($objPath);
150 foreach ($locks as $lock) {
151 $isLastPathComponent = $lock[
'obj_id'] == $objDAV->getObjectId()
152 && $lock[
'node_id'] == $objDAV->getNodeId();
156 if ($isLastPathComponent || $lock[
'depth'] ==
'infinity') {
161 if ($lock[
'ilias_owner'] == $DIC->user()->getId()) {
162 $owner = $lock[
'dav_owner'];
164 $owner = $this->
getLogin($lock[
'ilias_owner']);
171 "obj_id" => $lock[
'obj_id'],
172 "node_id" => $lock[
'node_id'],
173 "scope" => $lock[
'scope'],
174 "depth" => $lock[
'depth'],
176 "token" => $lock[
'token'],
177 "expires" => $lock[
'expires']
179 if ($lock[
'scope'] ==
'exclusive') {
189 $this->writelog(
'checkLock(' .
$path .
'):' . var_export(
$result,
true));
202 $this->writelog(
'getLogin(' . $userId .
'):' . var_export(
$login,
true));
217 $tree = $DIC->repositoryTree();
223 $davPathComponents = explode(
'/', substr($davPath, 1));
225 if (count($davPathComponents) > 1 &&
226 substr($davPathComponents[1], 0, 5) ==
'file_') {
227 $ref_id = substr($davPathComponents[1], 5);
228 $nodePath =
$tree->getNodePath($ref_id,
$tree->root_id);
232 header(
'Pragma: private');
235 if ($nodePath == null && count($davPathComponents) == 1) {
236 return ilObjectDAV::createObject(-1,
'mountPoint');
239 if (is_null($nodePath)) {
242 $top = $nodePath[count($nodePath) - 1];
243 return ilObjectDAV::createObject($top[
'child'], $top[
'type']);
255 $this->writelog(
'toObjectPath(' . $davPath);
259 if (is_null($nodePath)) {
262 $objectPath = array();
263 foreach ($nodePath as $node) {
264 $pathElement = ilObjectDAV::createObject($node[
'child'], $node[
'type']);
265 if (is_null($pathElement)) {
268 $objectPath[] = $pathElement;
289 $tree = $DIC->repositoryTree();
291 $this->writelog(
'toNodePath(' . $davPath .
')...');
294 $titlePath = explode(
'/', substr($davPath, 1));
297 if (count($titlePath) > 0) {
298 array_shift($titlePath);
302 if (count($titlePath) > 0 && $titlePath[count($titlePath) - 1] ==
'') {
303 array_pop($titlePath);
307 if (count($titlePath) == 0) {
308 $this->writelog(
'toNodePath(' . $davPath .
'):null, because path is empty.');
316 if (count($titlePath) > 0 && substr($titlePath[0], 0, 4) ==
'ref_') {
317 $ref_id = substr($titlePath[0], 4);
318 array_shift($titlePath);
321 $nodePath =
$tree->getNodePathForTitlePath($titlePath, $ref_id);
323 $this->writelog(
'toNodePath():' . var_export($nodePath,
true));
353 $components = explode(
'/',
$path);
354 return count($components) == 0 ?
'' : $components[count($components) - 1];
372 public static function getFolderURI($refId, $nodeId = 0, $ressourceName = null, $parentRefId = null)
374 if (self::$clientOS ==
'windows') {
377 } elseif (self::$clientBrowser ==
'konqueror') {
380 } elseif (self::$clientBrowser ==
'nautilus') {
387 $baseUri .=
"//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
390 $uri =
$baseUri .
'/ref_' . $refId .
'/';
413 public static function getMountURI($refId, $nodeId = 0, $ressourceName = null, $parentRefId = null, $genericURI =
false)
418 } elseif (self::$clientOS ==
'windows') {
420 $query =
'mount-instructions';
421 } elseif (self::$clientBrowser ==
'konqueror') {
424 } elseif (self::$clientBrowser ==
'nautilus') {
429 $query =
'mount-instructions';
431 $baseUri .=
"//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
434 $uri =
$baseUri .
'/ref_' . $refId .
'/';
454 public function getObjectURI($refId, $ressourceName = null, $parentRefId = null)
459 "//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
462 if (!is_null($ressourceName) && !is_null($parentRefId)) {
464 $uri =
$baseUri .
'/ref_' . $parentRefId .
'/' . $this->davUrlEncode($ressourceName);
467 $nodePath = $DIC->repositoryTree()->getNodePath($refId);
469 if (is_null($nodePath) || count($nodePath) < 2) {
473 $uri =
$baseUri .
'/ref_' . $nodePath[count($nodePath) - 2][
'child'] .
'/' .
474 $this->davUrlEncode($nodePath[count($nodePath) - 1][
'title']);
498 public function getFileURI($refId, $ressourceName = null, $parentRefId = null)
503 "//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
506 if (!is_null($ressourceName) && !is_null($parentRefId)) {
508 $uri =
$baseUri .
'/file_' . $refId .
'/' . $this->davUrlEncode($ressourceName);
511 $nodePath = $DIC->repositoryTree()->getNodePath($refId);
513 if (is_null($nodePath) || count($nodePath) < 2) {
517 $uri =
$baseUri .
'/file_' . $nodePath[count($nodePath) - 1][
'child'] .
'/' .
518 $this->davUrlEncode($nodePath[count($nodePath) - 1][
'title']);
532 if ($this->isHTTPS == null) {
535 require_once
'./Services/Http/classes/class.ilHTTPS.php';
539 return $this->isHTTPS;
554 return $DIC->clientIni()->readVariable(
'file_access',
'webdav_enabled') ==
'1';
565 $val = ini_get(
'upload_max_filesize');
568 $last = strtolower($val[strlen($val) - 1]);
602 if (self::$instance) {
603 return self::$instance;
617 if ($this->pwd_instruction !== null) {
620 include_once
'./Services/Authentication/classes/class.ilAuthUtils.php';
623 return $this->pwd_instruction =
false;
626 return $this->pwd_instruction = (bool) !strlen(
$ilUser->getPasswd());
static _lookupLogin($a_user_id)
lookup login
getObjectURI($refId, $ressourceName=null, $parentRefId=null)
TODO: Check if needed and refactor Returns an URI for getting a object using WebDAV by its name...
checkLock($path)
TODO: Check if needed and refactor checkLock() helper.
getUploadMaxFilesize()
TODO: Check if needed and refactor Gets the maximum permitted upload filesize from php...
toNodePath($davPath)
TODO: Check if needed and refactor Converts a DAV path into a node path.
isLocalPasswordInstructionRequired()
__construct()
Singleton constructor.
toObjectPath($davPath)
TODO: Check if needed and refactor Converts a DAV path into an array of DAV objects.
static supportsLocalPasswordValidation($a_authmode)
Check if local password validation is supported.
getLogin($userId)
TODO: Check if needed and refactor Returns the login for the specified user id, or null if the user d...
This class contains some functions from the old ilDAVServer.
static getMountURI($refId, $nodeId=0, $ressourceName=null, $parentRefId=null, $genericURI=false)
TODO: Check if needed and refactor Returns an URI for mounting the repository object as a webfolder...
static toNFC($string)
Convert a UTF-8 string to normal form C, canonical composition.
davBasename($path)
TODO: Check if needed and refactor Private implementation of PHP basename() function.
davDeslashify($path)
TODO: Check if needed and refactor davDeslashify - make sure path does not end in a slash...
static getFolderURI($refId, $nodeId=0, $ressourceName=null, $parentRefId=null)
TODO: Check if needed and refactor Returns an URI for mounting the repository object as a webfolder u...
static getInstance()
Get singleton instance.
static _isActionsVisible()
Static getter.
isWebDAVoverHTTPS()
TODO: Check if needed and refactor Returns true, if the WebDAV server transfers data over HTTPS...
getFileURI($refId, $ressourceName=null, $parentRefId=null)
TODO: Check if needed and refactor Returns an URI for getting a file object using WebDAV...
getObject($davPath)
TODO: Check if needed and refactor Gets a DAV object for the specified path.
static _isActive()
TODO: Check if needed and refactor Static getter.
showMountInstructions(&$objDAV, &$options)
TODO: Check if needed and refactor Mount instructions method handler for directories.