ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilWebDAVUtil Class Reference

This class contains some functions from the old ilDAVServer. More...

+ Collaboration diagram for ilWebDAVUtil:

Public Member Functions

 showMountInstructions (&$objDAV, &$options)
 TODO: Check if needed and refactor Mount instructions method handler for directories. More...
 
 toNodePath ($davPath)
 TODO: Check if needed and refactor Converts a DAV path into a node path. More...
 
 getObjectURI ($refId, $ressourceName=null, $parentRefId=null)
 TODO: Check if needed and refactor Returns an URI for getting a object using WebDAV by its name. More...
 
 getFileURI ($refId, $ressourceName=null, $parentRefId=null)
 TODO: Check if needed and refactor Returns an URI for getting a file object using WebDAV. More...
 
 isWebDAVoverHTTPS ()
 TODO: Check if needed and refactor Returns true, if the WebDAV server transfers data over HTTPS. More...
 
 isLocalPasswordInstructionRequired ()
 

Static Public Member Functions

static _isActionsVisible ()
 Static getter. More...
 
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 using Internet Explorer and Firefox with the "openwebfolder" plugin. More...
 
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. More...
 
static _isActive ()
 TODO: Check if needed and refactor Static getter. More...
 
static getInstance ()
 Get singleton instance. More...
 

Protected Member Functions

 checkLock ($path)
 TODO: Check if needed and refactor checkLock() helper. More...
 
 getLogin ($userId)
 TODO: Check if needed and refactor Returns the login for the specified user id, or null if the user does not exist. More...
 

Static Protected Attributes

static $clientBrowser = "firefox"
 
static $clientOS = "windows"
 
static $clientFlavor = "nichtxp"
 

Private Member Functions

 getObject ($davPath)
 TODO: Check if needed and refactor Gets a DAV object for the specified path. More...
 
 toObjectPath ($davPath)
 TODO: Check if needed and refactor Converts a DAV path into an array of DAV objects. More...
 
 davDeslashify ($path)
 TODO: Check if needed and refactor davDeslashify - make sure path does not end in a slash. More...
 
 davBasename ($path)
 TODO: Check if needed and refactor Private implementation of PHP basename() function. More...
 
 getUploadMaxFilesize ()
 TODO: Check if needed and refactor Gets the maximum permitted upload filesize from php.ini in bytes. More...
 
 __construct ()
 Singleton constructor. More...
 

Private Attributes

 $pwd_instruction = null
 

Static Private Attributes

static $instance = null
 

Detailed Description

This class contains some functions from the old ilDAVServer.

Sadly I wasn't able to refactor all of it. Some functions are still used in other classes. Will be refactored

Author
Raphael Heer rapha.nosp@m.el.h.nosp@m.eer@h.nosp@m.slu..nosp@m.ch $Id$

TODO: Check for refactoring potential

Definition at line 12 of file class.ilWebDAVUtil.php.

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVUtil::__construct ( )
private

Singleton constructor.

Returns

Definition at line 592 of file class.ilWebDAVUtil.php.

593 {
594 }

Member Function Documentation

◆ _isActionsVisible()

static ilWebDAVUtil::_isActionsVisible ( )
static

Static getter.

Returns true, if WebDAV actions are visible for repository items.

Returns
boolean value

Definition at line 23 of file class.ilWebDAVUtil.php.

24 {
25 global $DIC;
26 return $DIC->clientIni()->readVariable('file_access', 'webdav_actions_visible') == '1';
27 }
global $DIC
Definition: saml.php:7

References $DIC.

◆ _isActive()

static ilWebDAVUtil::_isActive ( )
static

TODO: Check if needed and refactor Static getter.

Returns true, if the WebDAV server is active.

THe WebDAV Server is active, if the variable file_access::webdav_enabled is set in the client ini file. (Removed wit 08.2016: , and if PEAR Auth_HTTP is installed).

Returns
boolean value

Definition at line 551 of file class.ilWebDAVUtil.php.

552 {
553 global $DIC;
554 return $DIC->clientIni()->readVariable('file_access', 'webdav_enabled') == '1';
555 }

References $DIC.

◆ checkLock()

ilWebDAVUtil::checkLock (   $path)
protected

TODO: Check if needed and refactor checkLock() helper.

Parameters
stringresource path to check for locks
Returns
array with the following entries: { type => "write" scope => "exclusive" | "shared" depth => 0 | -1 owner => string token => string expires => timestamp

Definition at line 135 of file class.ilWebDAVUtil.php.

136 {
137 global $DIC;
138
139 $this->writelog('checkLock(' . $path . ')');
140 $result = null;
141
142 // get dav object for path
143 //$objDAV = $this->getObject($path);
144
145 // convert DAV path into ilObjectDAV path
146 $objPath = $this->toObjectPath($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();
153
154 // Check all locks on last object in path,
155 // but only locks with depth infinity on parent objects.
156 if ($isLastPathComponent || $lock['depth'] == 'infinity') {
157 // DAV Clients expects to see their own owner name in
158 // the locks. Since these names are not unique (they may
159 // just be the name of the local user running the DAV client)
160 // we return the ILIAS user name in all other cases.
161 if ($lock['ilias_owner'] == $DIC->user()->getId()) {
162 $owner = $lock['dav_owner'];
163 } else {
164 $owner = $this->getLogin($lock['ilias_owner']);
165 }
166
167 // FIXME - Shouldn't we collect all locks instead of
168 // using an arbitrary one?
169 $result = array(
170 "type" => "write",
171 "obj_id" => $lock['obj_id'],
172 "node_id" => $lock['node_id'],
173 "scope" => $lock['scope'],
174 "depth" => $lock['depth'],
175 "owner" => $owner,
176 "token" => $lock['token'],
177 "expires" => $lock['expires']
178 );
179 if ($lock['scope'] == 'exclusive') {
180 // If there is an exclusive lock in the path, it
181 // takes precedence over all non-exclusive locks in
182 // parent nodes. Therefore we can can finish collecting
183 // locks.
184 break;
185 }
186 }
187 }
188 }
189 $this->writelog('checkLock(' . $path . '):' . var_export($result, true));
190
191 return $result;
192 }
$result
$path
Definition: aliased.php:25
toObjectPath($davPath)
TODO: Check if needed and refactor Converts a DAV path into an array of DAV objects.
getLogin($userId)
TODO: Check if needed and refactor Returns the login for the specified user id, or null if the user d...

References $DIC, $path, $result, getLogin(), and toObjectPath().

+ Here is the call graph for this function:

◆ davBasename()

ilWebDAVUtil::davBasename (   $path)
private

TODO: Check if needed and refactor Private implementation of PHP basename() function.

The PHP basename() function does not work properly with filenames that contain international characters. e.g. basename('/x/ö') returns 'x' instead of 'ö'

Definition at line 351 of file class.ilWebDAVUtil.php.

352 {
353 $components = explode('/', $path);
354 return count($components) == 0 ? '' : $components[count($components) - 1];
355 }

References $path.

◆ davDeslashify()

ilWebDAVUtil::davDeslashify (   $path)
private

TODO: Check if needed and refactor davDeslashify - make sure path does not end in a slash.

Parameters
stringdirectory path
Returns
string directory path without trailing slash

Definition at line 334 of file class.ilWebDAVUtil.php.

335 {
337
338 if ($path[strlen($path) - 1] == '/') {
339 $path = substr($path, 0, strlen($path) - 1);
340 }
341 return $path;
342 }
static toNFC($string)
Convert a UTF-8 string to normal form C, canonical composition.
Definition: UtfNormal.php:157

References $path, and UtfNormal\toNFC().

Referenced by showMountInstructions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFileURI()

ilWebDAVUtil::getFileURI (   $refId,
  $ressourceName = null,
  $parentRefId = null 
)

TODO: Check if needed and refactor Returns an URI for getting a file object using WebDAV.

Browsers can use this URI to download a file from ILIAS.

Note: This could be the same URI that is returned by getObjectURI. But we use a different URI, because we want to use the regular ILIAS authentication method, if no session exists, and we want to be able to download a file from the repository, even if the name of the file object is not unique.

Parameters
refIdof the file object.
ressourceNametitle of the file object (if known), to reduce SQL queries
parentRefIdrefId of parent object (if known), to reduce SQL queries
Returns
Returns the URI or null if the URI can not be constructed.

Definition at line 498 of file class.ilWebDAVUtil.php.

499 {
500 global $DIC;
501 $nodeId = 0;
502 $baseUri = ($this->isWebDAVoverHTTPS() ? "https:" : "http:") .
503 "//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
504 $baseUri = substr($baseUri, 0, strrpos($baseUri, '/')) . '/webdav.php/' . CLIENT_ID;
505
506 if (!is_null($ressourceName) && !is_null($parentRefId)) {
507 // Quickly create URI from the known data without needing SQL queries
508 $uri = $baseUri . '/file_' . $refId . '/' . $this->davUrlEncode($ressourceName);
509 } else {
510 // Create URI and use some SQL queries to get the missing data
511 $nodePath = $DIC->repositoryTree()->getNodePath($refId);
512
513 if (is_null($nodePath) || count($nodePath) < 2) {
514 // No object path? Return null - file is not in repository.
515 $uri = null;
516 } else {
517 $uri = $baseUri . '/file_' . $nodePath[count($nodePath) - 1]['child'] . '/' .
518 $this->davUrlEncode($nodePath[count($nodePath) - 1]['title']);
519 }
520 }
521 return $uri;
522 }
isWebDAVoverHTTPS()
TODO: Check if needed and refactor Returns true, if the WebDAV server transfers data over HTTPS.

References $baseUri, $DIC, and isWebDAVoverHTTPS().

+ Here is the call graph for this function:

◆ getFolderURI()

static ilWebDAVUtil::getFolderURI (   $refId,
  $nodeId = 0,
  $ressourceName = null,
  $parentRefId = null 
)
static

TODO: Check if needed and refactor Returns an URI for mounting the repository object as a webfolder using Internet Explorer and Firefox with the "openwebfolder" plugin.

The FolderURI is only in effect on Windows. Therefore we don't need to deal with other pecularities.

The URI can be used as the value of a "folder" attribute inside of an HTML anchor tag "<a>".

Parameters
refIdof the repository object.
nodeIdof a childnode of the repository object.
ressourceNameressource name (if known), to reduce SQL queries
parentRefIdrefId of parent object (if known), to reduce SQL queries

Definition at line 372 of file class.ilWebDAVUtil.php.

373 {
374 if (self::$clientOS == 'windows') {
375 $baseUri = "https:";
376 $query = null;
377 } elseif (self::$clientBrowser == 'konqueror') {
378 $baseUri = "webdavs:";
379 $query = null;
380 } elseif (self::$clientBrowser == 'nautilus') {
381 $baseUri = "davs:";
382 $query = null;
383 } else {
384 $baseUri = "https:";
385 $query = null;
386 }
387 $baseUri .= "//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
388 $baseUri = substr($baseUri, 0, strrpos($baseUri, '/')) . '/webdav.php/' . CLIENT_ID;
389
390 $uri = $baseUri . '/ref_' . $refId . '/';
391 if ($query != null) {
392 $uri .= '?' . $query;
393 }
394
395 return $uri;
396 }
$query

References $baseUri, and $query.

◆ getInstance()

static ilWebDAVUtil::getInstance ( )
static

Get singleton instance.

Returns
object ilDAVUtils

Definition at line 600 of file class.ilWebDAVUtil.php.

601 {
602 if (self::$instance) {
603 return self::$instance;
604 }
605 return self::$instance = new ilWebDAVUtil();
606 }
This class contains some functions from the old ilDAVServer.

References $instance.

Referenced by ilObjCategoryAccess\_getCommands(), ilObjCourseAccess\_getCommands(), ilObjFolderAccess\_getCommands(), ilObjGroupAccess\_getCommands(), ilTemplate\fillSideIcons(), ilObjCategoryListGUI\getCommandLink(), ilObjFolderListGUI\getCommandLink(), ilObjGroupListGUI\getCommandLink(), ilObjectListGUI\getCommandLink(), and ilContainerGUI\showPasswordInstructionObject().

+ Here is the caller graph for this function:

◆ getLogin()

ilWebDAVUtil::getLogin (   $userId)
protected

TODO: Check if needed and refactor Returns the login for the specified user id, or null if the user does not exist.

Definition at line 199 of file class.ilWebDAVUtil.php.

200 {
202 $this->writelog('getLogin(' . $userId . '):' . var_export($login, true));
203 return $login;
204 }
static _lookupLogin($a_user_id)
lookup login
$login
Definition: cron.php:13

References $login, and ilObjUser\_lookupLogin().

Referenced by checkLock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMountURI()

static ilWebDAVUtil::getMountURI (   $refId,
  $nodeId = 0,
  $ressourceName = null,
  $parentRefId = null,
  $genericURI = false 
)
static

TODO: Check if needed and refactor Returns an URI for mounting the repository object as a webfolder.

The URI can be used as the value of a "href" attribute attribute inside of an HTML anchor tag "<a>".

Parameters
refIdof the repository object.
nodeIdof a childnode of the repository object.
ressourceNameressource name (if known), to reduce SQL queries
parentRefIdrefId of parent object (if known), to reduce SQL queries
genericURIboolean Returns a generic mount URI, which works on all platforms which support WebDAV as in the IETF specification.

Definition at line 413 of file class.ilWebDAVUtil.php.

414 {
415 if ($genericURI) {
416 $baseUri = "https:";
417 $query = null;
418 } elseif (self::$clientOS == 'windows') {
419 $baseUri = "http:";
420 $query = 'mount-instructions';
421 } elseif (self::$clientBrowser == 'konqueror') {
422 $baseUri = "webdavs:";
423 $query = null;
424 } elseif (self::$clientBrowser == 'nautilus') {
425 $baseUri = "davs:";
426 $query = null;
427 } else {
428 $baseUri = "https:";
429 $query = 'mount-instructions';
430 }
431 $baseUri .= "//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
432 $baseUri = substr($baseUri, 0, strrpos($baseUri, '/')) . '/webdav.php/' . CLIENT_ID;
433
434 $uri = $baseUri . '/ref_' . $refId . '/';
435 if ($query != null) {
436 $uri .= '?' . $query;
437 }
438
439 return $uri;
440 }

References $baseUri, and $query.

◆ getObject()

ilWebDAVUtil::getObject (   $davPath)
private

TODO: Check if needed and refactor Gets a DAV object for the specified path.

Parameters
StringdavPath A DAV path expression.
Returns
ilObjectDAV object or null, if the path does not denote an object.

Definition at line 214 of file class.ilWebDAVUtil.php.

215 {
216 global $DIC;
217 $tree = $DIC->repositoryTree();
218
219
220 // If the second path elements starts with 'file_', the following
221 // characters of the path element directly identify the ref_id of
222 // a file object.
223 $davPathComponents = explode('/', substr($davPath, 1));
224
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);
229
230 // Poor IE needs this, in order to successfully display
231 // PDF documents
232 header('Pragma: private');
233 } else {
234 $nodePath = $this->toNodePath($davPath);
235 if ($nodePath == null && count($davPathComponents) == 1) {
236 return ilObjectDAV::createObject(-1, 'mountPoint');
237 }
238 }
239 if (is_null($nodePath)) {
240 return null;
241 } else {
242 $top = $nodePath[count($nodePath) - 1];
243 return ilObjectDAV::createObject($top['child'], $top['type']);
244 }
245 }
toNodePath($davPath)
TODO: Check if needed and refactor Converts a DAV path into a node path.

References $DIC, $tree, and toNodePath().

+ Here is the call graph for this function:

◆ getObjectURI()

ilWebDAVUtil::getObjectURI (   $refId,
  $ressourceName = null,
  $parentRefId = null 
)

TODO: Check if needed and refactor Returns an URI for getting a object using WebDAV by its name.

WebDAV clients can use this URI to access the object from ILIAS.

Parameters
refIdof the object.
ressourceNameobject title (if known), to reduce SQL queries
parentRefIdrefId of parent object (if known), to reduce SQL queries
Returns
Returns the URI or null if the URI can not be constructed.

Definition at line 454 of file class.ilWebDAVUtil.php.

455 {
456 global $DIC;
457 $nodeId = 0;
458 $baseUri = ($this->isWebDAVoverHTTPS() ? "https:" : "http:") .
459 "//$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]";
460 $baseUri = substr($baseUri, 0, strrpos($baseUri, '/')) . '/webdav.php/' . CLIENT_ID;
461
462 if (!is_null($ressourceName) && !is_null($parentRefId)) {
463 // Quickly create URI from the known data without needing SQL queries
464 $uri = $baseUri . '/ref_' . $parentRefId . '/' . $this->davUrlEncode($ressourceName);
465 } else {
466 // Create URI and use some SQL queries to get the missing data
467 $nodePath = $DIC->repositoryTree()->getNodePath($refId);
468
469 if (is_null($nodePath) || count($nodePath) < 2) {
470 // No object path? Return null - file is not in repository.
471 $uri = null;
472 } else {
473 $uri = $baseUri . '/ref_' . $nodePath[count($nodePath) - 2]['child'] . '/' .
474 $this->davUrlEncode($nodePath[count($nodePath) - 1]['title']);
475 }
476 }
477 return $uri;
478 }

References $baseUri, $DIC, and isWebDAVoverHTTPS().

+ Here is the call graph for this function:

◆ getUploadMaxFilesize()

ilWebDAVUtil::getUploadMaxFilesize ( )
private

TODO: Check if needed and refactor Gets the maximum permitted upload filesize from php.ini in bytes.

Returns
int Upload Max Filesize in bytes.

Definition at line 563 of file class.ilWebDAVUtil.php.

564 {
565 $val = ini_get('upload_max_filesize');
566
567 $val = trim($val);
568 $last = strtolower($val[strlen($val) - 1]);
569 switch ($last) {
570 // The 'G' modifier is available since PHP 5.1.0
571 case 'g':
572 $val *= 1024;
573 // no break
574 case 'm':
575 $val *= 1024;
576 // no break
577 case 'k':
578 $val *= 1024;
579 }
580
581 return $val;
582 }

◆ isLocalPasswordInstructionRequired()

ilWebDAVUtil::isLocalPasswordInstructionRequired ( )
Returns

Definition at line 612 of file class.ilWebDAVUtil.php.

613 {
614 global $DIC;
615 $ilUser = $DIC->user();
616
617 if ($this->pwd_instruction !== null) {
619 }
620 include_once './Services/Authentication/classes/class.ilAuthUtils.php';
621 $status = ilAuthUtils::supportsLocalPasswordValidation($ilUser->getAuthMode(true));
622 if ($status != ilAuthUtils::LOCAL_PWV_USER) {
623 return $this->pwd_instruction = false;
624 }
625 // Check if user has local password
626 return $this->pwd_instruction = (bool) !strlen($ilUser->getPasswd());
627 }
static supportsLocalPasswordValidation($a_authmode)
Check if local password validation is supported.
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, $pwd_instruction, ilAuthUtils\LOCAL_PWV_USER, and ilAuthUtils\supportsLocalPasswordValidation().

+ Here is the call graph for this function:

◆ isWebDAVoverHTTPS()

ilWebDAVUtil::isWebDAVoverHTTPS ( )

TODO: Check if needed and refactor Returns true, if the WebDAV server transfers data over HTTPS.

Returns
boolean Returns true if HTTPS is active.

Definition at line 530 of file class.ilWebDAVUtil.php.

531 {
532 if ($this->isHTTPS == null) {
533 global $DIC;
534 $ilSetting = $DIC->settings();
535 require_once './Services/Http/classes/class.ilHTTPS.php';
536 $https = new ilHTTPS();
537 $this->isHTTPS = $https->isDetected() || $ilSetting->get('https');
538 }
539 return $this->isHTTPS;
540 }
HTTPS.
global $ilSetting
Definition: privfeed.php:17
$https
Definition: imgupload.php:19

References $DIC, $https, and $ilSetting.

Referenced by getFileURI(), getObjectURI(), and showMountInstructions().

+ Here is the caller graph for this function:

◆ showMountInstructions()

ilWebDAVUtil::showMountInstructions ( $objDAV,
$options 
)

TODO: Check if needed and refactor Mount instructions method handler for directories.

Parameters
ilObjectDAVdav object handler
Returns
This function does not return. It exits PHP.

Definition at line 36 of file class.ilWebDAVUtil.php.

37 {
38 global $DIC;
39 $lng = $DIC->language();
40 $ilUser = $DIC->user();
41
42 $path = $this->davDeslashify($options['path']);
43
44 // The $path variable may contain a full or a shortened DAV path.
45 // We convert it into an object path, which we can then use to
46 // construct a new full DAV path.
47 $objectPath = $this->toObjectPath($path);
48
49 // Construct a (possibly) full DAV path from the object path.
50 $fullPath = '';
51 foreach ($objectPath as $object) {
52 if ($object->getRefId() == 1 && $this->isFileHidden($object)) {
53 // If the repository root object is hidden, we can not
54 // create a full path, because nothing would appear in the
55 // webfolder. We resort to a shortened path instead.
56 $fullPath .= '/ref_1';
57 } else {
58 $fullPath .= '/' . $this->davUrlEncode($object->getResourceName());
59 }
60 }
61
62 // Construct a shortened DAV path from the object path.
63 $shortenedPath = '/ref_' .
64 $objectPath[count($objectPath) - 1]->getRefId();
65
66 if ($objDAV->isCollection()) {
67 $shortenedPath .= '/';
68 $fullPath .= '/';
69 }
70
71 // Prepend client id to path
72 $shortenedPath = '/' . CLIENT_ID . $shortenedPath;
73 $fullPath = '/' . CLIENT_ID . $fullPath;
74
75 // Construct webfolder URI's. The URI's are used for mounting the
76 // webfolder. Since mounting using URI's is not standardized, we have
77 // to create different URI's for different browsers.
78 $webfolderURI = $this->base_uri . $shortenedPath;
79 $webfolderURI_Konqueror = ($this->isWebDAVoverHTTPS() ? "webdavs" : "webdav") .
80 substr($this->base_uri, strrpos($this->base_uri, ':')) .
81 $shortenedPath;
82 ;
83 $webfolderURI_Nautilus = ($this->isWebDAVoverHTTPS() ? "davs" : "dav") .
84 substr($this->base_uri, strrpos($this->base_uri, ':')) .
85 $shortenedPath
86 ;
87 $webfolderURI_IE = $this->base_uri . $shortenedPath;
88
89 $webfolderTitle = $objectPath[count($objectPath) - 1]->getResourceName();
90
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";
96 echo " <head>\n";
97 echo " <title>" . sprintf($lng->txt('webfolder_instructions_titletext'), $webfolderTitle) . "</title>\n";
98 echo " </head>\n";
99 echo " <body>\n";
100
101 echo ilDAVServer::_getWebfolderInstructionsFor(
102 $webfolderTitle,
103 $webfolderURI,
104 $webfolderURI_IE,
105 $webfolderURI_Konqueror,
106 $webfolderURI_Nautilus,
107 $this->clientOS,
108 $this->clientOSFlavor
109 );
110
111 echo " </body>\n";
112 echo "</html>\n";
113
114 // Logout anonymous user to force authentication after calling mount uri
115 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
116 $DIC['ilAuthSession']->logout();
117 }
118
119 exit;
120 }
exit
Definition: backend.php:16
davDeslashify($path)
TODO: Check if needed and refactor davDeslashify - make sure path does not end in a slash.
$lng

References $DIC, $ilUser, $lng, PHPMailer\PHPMailer\$options, $path, davDeslashify(), exit, isWebDAVoverHTTPS(), and toObjectPath().

+ Here is the call graph for this function:

◆ toNodePath()

ilWebDAVUtil::toNodePath (   $davPath)

TODO: Check if needed and refactor Converts a DAV path into a node path.

The returned array is granted to represent an absolute path.

The first component of a DAV Path is the ILIAS client id. The following component either denote an absolute path, or a relative path starting at a ref_id.

Parameters
StringdavPath A DAV path expression.
Returns
Array<String> An Array of path titles.

Definition at line 286 of file class.ilWebDAVUtil.php.

287 {
288 global $DIC;
289 $tree = $DIC->repositoryTree();
290
291 $this->writelog('toNodePath(' . $davPath . ')...');
292
293 // Split the davPath into path titles
294 $titlePath = explode('/', substr($davPath, 1));
295
296 // Remove the client id from the beginning of the title path
297 if (count($titlePath) > 0) {
298 array_shift($titlePath);
299 }
300
301 // If the last path title is empty, remove it
302 if (count($titlePath) > 0 && $titlePath[count($titlePath) - 1] == '') {
303 array_pop($titlePath);
304 }
305
306 // If the path is empty, return null
307 if (count($titlePath) == 0) {
308 $this->writelog('toNodePath(' . $davPath . '):null, because path is empty.');
309 return null;
310 }
311
312 // If the path is an absolute path, ref_id is null.
313 $ref_id = null;
314
315 // If the path is a relative folder path, convert it into an absolute path
316 if (count($titlePath) > 0 && substr($titlePath[0], 0, 4) == 'ref_') {
317 $ref_id = substr($titlePath[0], 4);
318 array_shift($titlePath);
319 }
320
321 $nodePath = $tree->getNodePathForTitlePath($titlePath, $ref_id);
322
323 $this->writelog('toNodePath():' . var_export($nodePath, true));
324 return $nodePath;
325 }

References $DIC, and $tree.

Referenced by getObject(), and toObjectPath().

+ Here is the caller graph for this function:

◆ toObjectPath()

ilWebDAVUtil::toObjectPath (   $davPath)
private

TODO: Check if needed and refactor Converts a DAV path into an array of DAV objects.

Parameters
StringdavPath A DAV path expression.
Returns
array<ilObjectDAV> object or null, if the path does not denote an object.

Definition at line 253 of file class.ilWebDAVUtil.php.

254 {
255 $this->writelog('toObjectPath(' . $davPath);
256
257 $nodePath = $this->toNodePath($davPath);
258
259 if (is_null($nodePath)) {
260 return null;
261 } else {
262 $objectPath = array();
263 foreach ($nodePath as $node) {
264 $pathElement = ilObjectDAV::createObject($node['child'], $node['type']);
265 if (is_null($pathElement)) {
266 break;
267 }
268 $objectPath[] = $pathElement;
269 }
270 return $objectPath;
271 }
272 }

References toNodePath().

Referenced by checkLock(), and showMountInstructions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $clientBrowser

ilWebDAVUtil::$clientBrowser = "firefox"
staticprotected

Definition at line 14 of file class.ilWebDAVUtil.php.

◆ $clientFlavor

ilWebDAVUtil::$clientFlavor = "nichtxp"
staticprotected

Definition at line 16 of file class.ilWebDAVUtil.php.

◆ $clientOS

ilWebDAVUtil::$clientOS = "windows"
staticprotected

Definition at line 15 of file class.ilWebDAVUtil.php.

◆ $instance

ilWebDAVUtil::$instance = null
staticprivate

Definition at line 584 of file class.ilWebDAVUtil.php.

Referenced by getInstance().

◆ $pwd_instruction

ilWebDAVUtil::$pwd_instruction = null
private

Definition at line 586 of file class.ilWebDAVUtil.php.

Referenced by isLocalPasswordInstructionRequired().


The documentation for this class was generated from the following file: