ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\WebDAV\Request\RequestTranslation Class Reference
+ Collaboration diagram for ILIAS\WebDAV\Request\RequestTranslation:

Public Member Functions

 __construct (private Config $config, private ServerRequestInterface $request)
 
 getRequestedPath ()
 
 getBasePath ()
 
 getRequestedPathAsArray ()
 
 showMountPoint ()
 
 setup ()
 
 close ()
 

Private Attributes

string $endpoint
 
SuperGlobalDropInReplacement array $post
 

Detailed Description

Definition at line 30 of file RequestTranslation.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\WebDAV\Request\RequestTranslation::__construct ( private Config  $config,
private ServerRequestInterface  $request 
)

Definition at line 35 of file RequestTranslation.php.

38 {
39 $this->endpoint = '/' . trim($this->config->getEndpoint() . '/', '/');
40 }

Member Function Documentation

◆ close()

ILIAS\WebDAV\Request\RequestTranslation::close ( )

Definition at line 102 of file RequestTranslation.php.

102 : void
103 {
105 }
SuperGlobalDropInReplacement array $post
$_POST['cmd']
Definition: lti.php:27

References $_POST, and ILIAS\WebDAV\Request\RequestTranslation\$post.

◆ getBasePath()

ILIAS\WebDAV\Request\RequestTranslation::getBasePath ( )

Definition at line 61 of file RequestTranslation.php.

61 : string
62 {
63 $path = $this->request->getUri()->getPath();
64 $end = strpos($path, $this->endpoint);
65 if ($end === false) {
66 return rtrim($this->endpoint, '/') . '/';
67 }
68 $base = substr($path, 0, $end) . $this->endpoint . '/';
69
70 $client_id = $this->config->getClientId();
71 if ($client_id === '') {
72 return $base;
73 }
74
75 $remainder = ltrim(substr($path, $end + strlen($this->endpoint)), '/');
76 $first_segment = explode('/', $remainder, 2)[0] ?? '';
77 if ($first_segment === $client_id) {
78 return $base . $client_id . '/';
79 }
80
81 return $base;
82 }
string $client_id
Definition: class.ilias.php:36
$path
Definition: ltiservices.php:30

References ILIAS\$client_id, and $path.

◆ getRequestedPath()

ILIAS\WebDAV\Request\RequestTranslation::getRequestedPath ( )

Definition at line 42 of file RequestTranslation.php.

42 : string
43 {
44 $path = $this->request->getUri()->getPath();
45
46 $requested_path = ltrim(substr($path, strpos($path, $this->endpoint) + strlen($this->endpoint)), '/');
47
48 // Legacy client-name segment is optional: support both
49 // /webdav.php/<client_id>/ref_X and /webdav.php/ref_X
50 $client_id = $this->config->getClientId();
51 if ($client_id !== '') {
52 $segments = explode('/', $requested_path, 2);
53 if (($segments[0] ?? '') === $client_id) {
54 return $segments[1] ?? '';
55 }
56 }
57
58 return $requested_path;
59 }

References ILIAS\$client_id, and $path.

Referenced by ILIAS\WebDAV\Request\RequestTranslation\getRequestedPathAsArray().

+ Here is the caller graph for this function:

◆ getRequestedPathAsArray()

ILIAS\WebDAV\Request\RequestTranslation::getRequestedPathAsArray ( )

Definition at line 84 of file RequestTranslation.php.

84 : array
85 {
86 $path = $this->getRequestedPath();
87 return explode('/', $path);
88 }

References $path, and ILIAS\WebDAV\Request\RequestTranslation\getRequestedPath().

+ Here is the call graph for this function:

◆ setup()

ILIAS\WebDAV\Request\RequestTranslation::setup ( )

Definition at line 95 of file RequestTranslation.php.

95 : void
96 {
97 $this->post = $_POST;
98 $_POST = (array) $this->post;
99 $HTTP_POST_VARS = $_POST;
100 }

References $_POST.

◆ showMountPoint()

ILIAS\WebDAV\Request\RequestTranslation::showMountPoint ( )

Definition at line 90 of file RequestTranslation.php.

90 : bool
91 {
92 return array_key_exists($this->config->getMountInstructionsQuery(), $this->request->getQueryParams());
93 }

Field Documentation

◆ $endpoint

string ILIAS\WebDAV\Request\RequestTranslation::$endpoint
private

Definition at line 32 of file RequestTranslation.php.

◆ $post

SuperGlobalDropInReplacement array ILIAS\WebDAV\Request\RequestTranslation::$post
private

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