Completed
Branch develop (2e938f)
by
unknown
19:39
created
htdocs/includes/sabre/sabre/dav/lib/DAV/IFile.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -17,67 +17,67 @@
 block discarded – undo
17 17
  */
18 18
 interface IFile extends INode
19 19
 {
20
-    /**
21
-     * Replaces the contents of the file.
22
-     *
23
-     * The data argument is a readable stream resource.
24
-     *
25
-     * After a successful put operation, you may choose to return an ETag. The
26
-     * etag must always be surrounded by double-quotes. These quotes must
27
-     * appear in the actual string you're returning.
28
-     *
29
-     * Clients may use the ETag from a PUT request to later on make sure that
30
-     * when they update the file, the contents haven't changed in the mean
31
-     * time.
32
-     *
33
-     * If you don't plan to store the file byte-by-byte, and you return a
34
-     * different object on a subsequent GET you are strongly recommended to not
35
-     * return an ETag, and just return null.
36
-     *
37
-     * @param resource|string $data
38
-     *
39
-     * @return string|null
40
-     */
41
-    public function put($data);
20
+	/**
21
+	 * Replaces the contents of the file.
22
+	 *
23
+	 * The data argument is a readable stream resource.
24
+	 *
25
+	 * After a successful put operation, you may choose to return an ETag. The
26
+	 * etag must always be surrounded by double-quotes. These quotes must
27
+	 * appear in the actual string you're returning.
28
+	 *
29
+	 * Clients may use the ETag from a PUT request to later on make sure that
30
+	 * when they update the file, the contents haven't changed in the mean
31
+	 * time.
32
+	 *
33
+	 * If you don't plan to store the file byte-by-byte, and you return a
34
+	 * different object on a subsequent GET you are strongly recommended to not
35
+	 * return an ETag, and just return null.
36
+	 *
37
+	 * @param resource|string $data
38
+	 *
39
+	 * @return string|null
40
+	 */
41
+	public function put($data);
42 42
 
43
-    /**
44
-     * Returns the data.
45
-     *
46
-     * This method may either return a string or a readable stream resource
47
-     *
48
-     * @return mixed
49
-     */
50
-    public function get();
43
+	/**
44
+	 * Returns the data.
45
+	 *
46
+	 * This method may either return a string or a readable stream resource
47
+	 *
48
+	 * @return mixed
49
+	 */
50
+	public function get();
51 51
 
52
-    /**
53
-     * Returns the mime-type for a file.
54
-     *
55
-     * If null is returned, we'll assume application/octet-stream
56
-     *
57
-     * @return string|null
58
-     */
59
-    public function getContentType();
52
+	/**
53
+	 * Returns the mime-type for a file.
54
+	 *
55
+	 * If null is returned, we'll assume application/octet-stream
56
+	 *
57
+	 * @return string|null
58
+	 */
59
+	public function getContentType();
60 60
 
61
-    /**
62
-     * Returns the ETag for a file.
63
-     *
64
-     * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
65
-     *
66
-     * Return null if the ETag can not effectively be determined.
67
-     *
68
-     * The ETag must be surrounded by double-quotes, so something like this
69
-     * would make a valid ETag:
70
-     *
71
-     *   return '"someetag"';
72
-     *
73
-     * @return string|null
74
-     */
75
-    public function getETag();
61
+	/**
62
+	 * Returns the ETag for a file.
63
+	 *
64
+	 * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
65
+	 *
66
+	 * Return null if the ETag can not effectively be determined.
67
+	 *
68
+	 * The ETag must be surrounded by double-quotes, so something like this
69
+	 * would make a valid ETag:
70
+	 *
71
+	 *   return '"someetag"';
72
+	 *
73
+	 * @return string|null
74
+	 */
75
+	public function getETag();
76 76
 
77
-    /**
78
-     * Returns the size of the node, in bytes.
79
-     *
80
-     * @return int
81
-     */
82
-    public function getSize();
77
+	/**
78
+	 * Returns the size of the node, in bytes.
79
+	 *
80
+	 * @return int
81
+	 */
82
+	public function getSize();
83 83
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/dav/lib/DAV/FSExt/Directory.php 1 patch
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -16,197 +16,197 @@
 block discarded – undo
16 16
  */
17 17
 class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTarget
18 18
 {
19
-    /**
20
-     * Creates a new file in the directory.
21
-     *
22
-     * Data will either be supplied as a stream resource, or in certain cases
23
-     * as a string. Keep in mind that you may have to support either.
24
-     *
25
-     * After successful creation of the file, you may choose to return the ETag
26
-     * of the new file here.
27
-     *
28
-     * The returned ETag must be surrounded by double-quotes (The quotes should
29
-     * be part of the actual string).
30
-     *
31
-     * If you cannot accurately determine the ETag, you should not return it.
32
-     * If you don't store the file exactly as-is (you're transforming it
33
-     * somehow) you should also not return an ETag.
34
-     *
35
-     * This means that if a subsequent GET to this new file does not exactly
36
-     * return the same contents of what was submitted here, you are strongly
37
-     * recommended to omit the ETag.
38
-     *
39
-     * @param string          $name Name of the file
40
-     * @param resource|string $data Initial payload
41
-     *
42
-     * @return string|null
43
-     */
44
-    public function createFile($name, $data = null)
45
-    {
46
-        // We're not allowing dots
47
-        if ('.' == $name || '..' == $name) {
48
-            throw new DAV\Exception\Forbidden('Permission denied to . and ..');
49
-        }
50
-        $newPath = $this->path.'/'.$name;
51
-        file_put_contents($newPath, $data);
52
-        clearstatcache(true, $newPath);
53
-
54
-        return '"'.sha1(
55
-            fileinode($newPath).
56
-            filesize($newPath).
57
-            filemtime($newPath)
58
-        ).'"';
59
-    }
60
-
61
-    /**
62
-     * Creates a new subdirectory.
63
-     *
64
-     * @param string $name
65
-     */
66
-    public function createDirectory($name)
67
-    {
68
-        // We're not allowing dots
69
-        if ('.' == $name || '..' == $name) {
70
-            throw new DAV\Exception\Forbidden('Permission denied to . and ..');
71
-        }
72
-        $newPath = $this->path.'/'.$name;
73
-        mkdir($newPath);
74
-        clearstatcache(true, $newPath);
75
-    }
76
-
77
-    /**
78
-     * Returns a specific child node, referenced by its name.
79
-     *
80
-     * This method must throw Sabre\DAV\Exception\NotFound if the node does not
81
-     * exist.
82
-     *
83
-     * @param string $name
84
-     *
85
-     * @throws DAV\Exception\NotFound
86
-     *
87
-     * @return DAV\INode
88
-     */
89
-    public function getChild($name)
90
-    {
91
-        $path = $this->path.'/'.$name;
92
-
93
-        if (!file_exists($path)) {
94
-            throw new DAV\Exception\NotFound('File could not be located');
95
-        }
96
-        if ('.' == $name || '..' == $name) {
97
-            throw new DAV\Exception\Forbidden('Permission denied to . and ..');
98
-        }
99
-        if (is_dir($path)) {
100
-            return new self($path);
101
-        } else {
102
-            return new File($path);
103
-        }
104
-    }
105
-
106
-    /**
107
-     * Checks if a child exists.
108
-     *
109
-     * @param string $name
110
-     *
111
-     * @return bool
112
-     */
113
-    public function childExists($name)
114
-    {
115
-        if ('.' == $name || '..' == $name) {
116
-            throw new DAV\Exception\Forbidden('Permission denied to . and ..');
117
-        }
118
-        $path = $this->path.'/'.$name;
119
-
120
-        return file_exists($path);
121
-    }
122
-
123
-    /**
124
-     * Returns an array with all the child nodes.
125
-     *
126
-     * @return DAV\INode[]
127
-     */
128
-    public function getChildren()
129
-    {
130
-        $nodes = [];
131
-        $iterator = new \FilesystemIterator(
132
-            $this->path,
133
-            \FilesystemIterator::CURRENT_AS_SELF
134
-          | \FilesystemIterator::SKIP_DOTS
135
-        );
136
-
137
-        foreach ($iterator as $entry) {
138
-            $nodes[] = $this->getChild($entry->getFilename());
139
-        }
140
-
141
-        return $nodes;
142
-    }
143
-
144
-    /**
145
-     * Deletes all files in this directory, and then itself.
146
-     *
147
-     * @return bool
148
-     */
149
-    public function delete()
150
-    {
151
-        // Deleting all children
152
-        foreach ($this->getChildren() as $child) {
153
-            $child->delete();
154
-        }
155
-
156
-        // Removing the directory itself
157
-        rmdir($this->path);
158
-
159
-        return true;
160
-    }
161
-
162
-    /**
163
-     * Returns available diskspace information.
164
-     *
165
-     * @return array
166
-     */
167
-    public function getQuotaInfo()
168
-    {
169
-        $total = disk_total_space(realpath($this->path));
170
-        $free = disk_free_space(realpath($this->path));
171
-
172
-        return [
173
-            $total - $free,
174
-            $free,
175
-        ];
176
-    }
177
-
178
-    /**
179
-     * Moves a node into this collection.
180
-     *
181
-     * It is up to the implementors to:
182
-     *   1. Create the new resource.
183
-     *   2. Remove the old resource.
184
-     *   3. Transfer any properties or other data.
185
-     *
186
-     * Generally you should make very sure that your collection can easily move
187
-     * the move.
188
-     *
189
-     * If you don't, just return false, which will trigger sabre/dav to handle
190
-     * the move itself. If you return true from this function, the assumption
191
-     * is that the move was successful.
192
-     *
193
-     * @param string    $targetName new local file/collection name
194
-     * @param string    $sourcePath Full path to source node
195
-     * @param DAV\INode $sourceNode Source node itself
196
-     *
197
-     * @return bool
198
-     */
199
-    public function moveInto($targetName, $sourcePath, DAV\INode $sourceNode)
200
-    {
201
-        // We only support FSExt\Directory or FSExt\File objects, so
202
-        // anything else we want to quickly reject.
203
-        if (!$sourceNode instanceof self && !$sourceNode instanceof File) {
204
-            return false;
205
-        }
206
-
207
-        // PHP allows us to access protected properties from other objects, as
208
-        // long as they are defined in a class that has a shared inheritance
209
-        // with the current class.
210
-        return rename($sourceNode->path, $this->path.'/'.$targetName);
211
-    }
19
+	/**
20
+	 * Creates a new file in the directory.
21
+	 *
22
+	 * Data will either be supplied as a stream resource, or in certain cases
23
+	 * as a string. Keep in mind that you may have to support either.
24
+	 *
25
+	 * After successful creation of the file, you may choose to return the ETag
26
+	 * of the new file here.
27
+	 *
28
+	 * The returned ETag must be surrounded by double-quotes (The quotes should
29
+	 * be part of the actual string).
30
+	 *
31
+	 * If you cannot accurately determine the ETag, you should not return it.
32
+	 * If you don't store the file exactly as-is (you're transforming it
33
+	 * somehow) you should also not return an ETag.
34
+	 *
35
+	 * This means that if a subsequent GET to this new file does not exactly
36
+	 * return the same contents of what was submitted here, you are strongly
37
+	 * recommended to omit the ETag.
38
+	 *
39
+	 * @param string          $name Name of the file
40
+	 * @param resource|string $data Initial payload
41
+	 *
42
+	 * @return string|null
43
+	 */
44
+	public function createFile($name, $data = null)
45
+	{
46
+		// We're not allowing dots
47
+		if ('.' == $name || '..' == $name) {
48
+			throw new DAV\Exception\Forbidden('Permission denied to . and ..');
49
+		}
50
+		$newPath = $this->path.'/'.$name;
51
+		file_put_contents($newPath, $data);
52
+		clearstatcache(true, $newPath);
53
+
54
+		return '"'.sha1(
55
+			fileinode($newPath).
56
+			filesize($newPath).
57
+			filemtime($newPath)
58
+		).'"';
59
+	}
60
+
61
+	/**
62
+	 * Creates a new subdirectory.
63
+	 *
64
+	 * @param string $name
65
+	 */
66
+	public function createDirectory($name)
67
+	{
68
+		// We're not allowing dots
69
+		if ('.' == $name || '..' == $name) {
70
+			throw new DAV\Exception\Forbidden('Permission denied to . and ..');
71
+		}
72
+		$newPath = $this->path.'/'.$name;
73
+		mkdir($newPath);
74
+		clearstatcache(true, $newPath);
75
+	}
76
+
77
+	/**
78
+	 * Returns a specific child node, referenced by its name.
79
+	 *
80
+	 * This method must throw Sabre\DAV\Exception\NotFound if the node does not
81
+	 * exist.
82
+	 *
83
+	 * @param string $name
84
+	 *
85
+	 * @throws DAV\Exception\NotFound
86
+	 *
87
+	 * @return DAV\INode
88
+	 */
89
+	public function getChild($name)
90
+	{
91
+		$path = $this->path.'/'.$name;
92
+
93
+		if (!file_exists($path)) {
94
+			throw new DAV\Exception\NotFound('File could not be located');
95
+		}
96
+		if ('.' == $name || '..' == $name) {
97
+			throw new DAV\Exception\Forbidden('Permission denied to . and ..');
98
+		}
99
+		if (is_dir($path)) {
100
+			return new self($path);
101
+		} else {
102
+			return new File($path);
103
+		}
104
+	}
105
+
106
+	/**
107
+	 * Checks if a child exists.
108
+	 *
109
+	 * @param string $name
110
+	 *
111
+	 * @return bool
112
+	 */
113
+	public function childExists($name)
114
+	{
115
+		if ('.' == $name || '..' == $name) {
116
+			throw new DAV\Exception\Forbidden('Permission denied to . and ..');
117
+		}
118
+		$path = $this->path.'/'.$name;
119
+
120
+		return file_exists($path);
121
+	}
122
+
123
+	/**
124
+	 * Returns an array with all the child nodes.
125
+	 *
126
+	 * @return DAV\INode[]
127
+	 */
128
+	public function getChildren()
129
+	{
130
+		$nodes = [];
131
+		$iterator = new \FilesystemIterator(
132
+			$this->path,
133
+			\FilesystemIterator::CURRENT_AS_SELF
134
+		  | \FilesystemIterator::SKIP_DOTS
135
+		);
136
+
137
+		foreach ($iterator as $entry) {
138
+			$nodes[] = $this->getChild($entry->getFilename());
139
+		}
140
+
141
+		return $nodes;
142
+	}
143
+
144
+	/**
145
+	 * Deletes all files in this directory, and then itself.
146
+	 *
147
+	 * @return bool
148
+	 */
149
+	public function delete()
150
+	{
151
+		// Deleting all children
152
+		foreach ($this->getChildren() as $child) {
153
+			$child->delete();
154
+		}
155
+
156
+		// Removing the directory itself
157
+		rmdir($this->path);
158
+
159
+		return true;
160
+	}
161
+
162
+	/**
163
+	 * Returns available diskspace information.
164
+	 *
165
+	 * @return array
166
+	 */
167
+	public function getQuotaInfo()
168
+	{
169
+		$total = disk_total_space(realpath($this->path));
170
+		$free = disk_free_space(realpath($this->path));
171
+
172
+		return [
173
+			$total - $free,
174
+			$free,
175
+		];
176
+	}
177
+
178
+	/**
179
+	 * Moves a node into this collection.
180
+	 *
181
+	 * It is up to the implementors to:
182
+	 *   1. Create the new resource.
183
+	 *   2. Remove the old resource.
184
+	 *   3. Transfer any properties or other data.
185
+	 *
186
+	 * Generally you should make very sure that your collection can easily move
187
+	 * the move.
188
+	 *
189
+	 * If you don't, just return false, which will trigger sabre/dav to handle
190
+	 * the move itself. If you return true from this function, the assumption
191
+	 * is that the move was successful.
192
+	 *
193
+	 * @param string    $targetName new local file/collection name
194
+	 * @param string    $sourcePath Full path to source node
195
+	 * @param DAV\INode $sourceNode Source node itself
196
+	 *
197
+	 * @return bool
198
+	 */
199
+	public function moveInto($targetName, $sourcePath, DAV\INode $sourceNode)
200
+	{
201
+		// We only support FSExt\Directory or FSExt\File objects, so
202
+		// anything else we want to quickly reject.
203
+		if (!$sourceNode instanceof self && !$sourceNode instanceof File) {
204
+			return false;
205
+		}
206
+
207
+		// PHP allows us to access protected properties from other objects, as
208
+		// long as they are defined in a class that has a shared inheritance
209
+		// with the current class.
210
+		return rename($sourceNode->path, $this->path.'/'.$targetName);
211
+	}
212 212
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/dav/lib/DAV/FSExt/File.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -16,138 +16,138 @@
 block discarded – undo
16 16
  */
17 17
 class File extends Node implements DAV\PartialUpdate\IPatchSupport
18 18
 {
19
-    /**
20
-     * Updates the data.
21
-     *
22
-     * Data is a readable stream resource.
23
-     *
24
-     * @param resource|string $data
25
-     *
26
-     * @return string
27
-     */
28
-    public function put($data)
29
-    {
30
-        file_put_contents($this->path, $data);
31
-        clearstatcache(true, $this->path);
19
+	/**
20
+	 * Updates the data.
21
+	 *
22
+	 * Data is a readable stream resource.
23
+	 *
24
+	 * @param resource|string $data
25
+	 *
26
+	 * @return string
27
+	 */
28
+	public function put($data)
29
+	{
30
+		file_put_contents($this->path, $data);
31
+		clearstatcache(true, $this->path);
32 32
 
33
-        return $this->getETag();
34
-    }
33
+		return $this->getETag();
34
+	}
35 35
 
36
-    /**
37
-     * Updates the file based on a range specification.
38
-     *
39
-     * The first argument is the data, which is either a readable stream
40
-     * resource or a string.
41
-     *
42
-     * The second argument is the type of update we're doing.
43
-     * This is either:
44
-     * * 1. append (default)
45
-     * * 2. update based on a start byte
46
-     * * 3. update based on an end byte
47
-     *;
48
-     * The third argument is the start or end byte.
49
-     *
50
-     * After a successful put operation, you may choose to return an ETag. The
51
-     * ETAG must always be surrounded by double-quotes. These quotes must
52
-     * appear in the actual string you're returning.
53
-     *
54
-     * Clients may use the ETag from a PUT request to later on make sure that
55
-     * when they update the file, the contents haven't changed in the mean
56
-     * time.
57
-     *
58
-     * @param resource|string $data
59
-     * @param int             $rangeType
60
-     * @param int             $offset
61
-     *
62
-     * @return string|null
63
-     */
64
-    public function patch($data, $rangeType, $offset = null)
65
-    {
66
-        switch ($rangeType) {
67
-            case 1:
68
-                $f = fopen($this->path, 'a');
69
-                break;
70
-            case 2:
71
-                $f = fopen($this->path, 'c');
72
-                fseek($f, $offset);
73
-                break;
74
-            case 3:
75
-                $f = fopen($this->path, 'c');
76
-                fseek($f, $offset, SEEK_END);
77
-                break;
78
-            default:
79
-                $f = fopen($this->path, 'a');
80
-                break;
81
-        }
82
-        if (is_string($data)) {
83
-            fwrite($f, $data);
84
-        } else {
85
-            stream_copy_to_stream($data, $f);
86
-        }
87
-        fclose($f);
88
-        clearstatcache(true, $this->path);
36
+	/**
37
+	 * Updates the file based on a range specification.
38
+	 *
39
+	 * The first argument is the data, which is either a readable stream
40
+	 * resource or a string.
41
+	 *
42
+	 * The second argument is the type of update we're doing.
43
+	 * This is either:
44
+	 * * 1. append (default)
45
+	 * * 2. update based on a start byte
46
+	 * * 3. update based on an end byte
47
+	 *;
48
+	 * The third argument is the start or end byte.
49
+	 *
50
+	 * After a successful put operation, you may choose to return an ETag. The
51
+	 * ETAG must always be surrounded by double-quotes. These quotes must
52
+	 * appear in the actual string you're returning.
53
+	 *
54
+	 * Clients may use the ETag from a PUT request to later on make sure that
55
+	 * when they update the file, the contents haven't changed in the mean
56
+	 * time.
57
+	 *
58
+	 * @param resource|string $data
59
+	 * @param int             $rangeType
60
+	 * @param int             $offset
61
+	 *
62
+	 * @return string|null
63
+	 */
64
+	public function patch($data, $rangeType, $offset = null)
65
+	{
66
+		switch ($rangeType) {
67
+			case 1:
68
+				$f = fopen($this->path, 'a');
69
+				break;
70
+			case 2:
71
+				$f = fopen($this->path, 'c');
72
+				fseek($f, $offset);
73
+				break;
74
+			case 3:
75
+				$f = fopen($this->path, 'c');
76
+				fseek($f, $offset, SEEK_END);
77
+				break;
78
+			default:
79
+				$f = fopen($this->path, 'a');
80
+				break;
81
+		}
82
+		if (is_string($data)) {
83
+			fwrite($f, $data);
84
+		} else {
85
+			stream_copy_to_stream($data, $f);
86
+		}
87
+		fclose($f);
88
+		clearstatcache(true, $this->path);
89 89
 
90
-        return $this->getETag();
91
-    }
90
+		return $this->getETag();
91
+	}
92 92
 
93
-    /**
94
-     * Returns the data.
95
-     *
96
-     * @return resource
97
-     */
98
-    public function get()
99
-    {
100
-        return fopen($this->path, 'r');
101
-    }
93
+	/**
94
+	 * Returns the data.
95
+	 *
96
+	 * @return resource
97
+	 */
98
+	public function get()
99
+	{
100
+		return fopen($this->path, 'r');
101
+	}
102 102
 
103
-    /**
104
-     * Delete the current file.
105
-     *
106
-     * @return bool
107
-     */
108
-    public function delete()
109
-    {
110
-        return unlink($this->path);
111
-    }
103
+	/**
104
+	 * Delete the current file.
105
+	 *
106
+	 * @return bool
107
+	 */
108
+	public function delete()
109
+	{
110
+		return unlink($this->path);
111
+	}
112 112
 
113
-    /**
114
-     * Returns the ETag for a file.
115
-     *
116
-     * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
117
-     * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
118
-     *
119
-     * Return null if the ETag can not effectively be determined
120
-     *
121
-     * @return string|null
122
-     */
123
-    public function getETag()
124
-    {
125
-        return '"'.sha1(
126
-            fileinode($this->path).
127
-            filesize($this->path).
128
-            filemtime($this->path)
129
-        ).'"';
130
-    }
113
+	/**
114
+	 * Returns the ETag for a file.
115
+	 *
116
+	 * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
117
+	 * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
118
+	 *
119
+	 * Return null if the ETag can not effectively be determined
120
+	 *
121
+	 * @return string|null
122
+	 */
123
+	public function getETag()
124
+	{
125
+		return '"'.sha1(
126
+			fileinode($this->path).
127
+			filesize($this->path).
128
+			filemtime($this->path)
129
+		).'"';
130
+	}
131 131
 
132
-    /**
133
-     * Returns the mime-type for a file.
134
-     *
135
-     * If null is returned, we'll assume application/octet-stream
136
-     *
137
-     * @return string|null
138
-     */
139
-    public function getContentType()
140
-    {
141
-        return null;
142
-    }
132
+	/**
133
+	 * Returns the mime-type for a file.
134
+	 *
135
+	 * If null is returned, we'll assume application/octet-stream
136
+	 *
137
+	 * @return string|null
138
+	 */
139
+	public function getContentType()
140
+	{
141
+		return null;
142
+	}
143 143
 
144
-    /**
145
-     * Returns the size of the file, in bytes.
146
-     *
147
-     * @return int
148
-     */
149
-    public function getSize()
150
-    {
151
-        return filesize($this->path);
152
-    }
144
+	/**
145
+	 * Returns the size of the file, in bytes.
146
+	 *
147
+	 * @return int
148
+	 */
149
+	public function getSize()
150
+	{
151
+		return filesize($this->path);
152
+	}
153 153
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/dav/lib/DAV/Mount/Plugin.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -19,60 +19,60 @@
 block discarded – undo
19 19
  */
20 20
 class Plugin extends DAV\ServerPlugin
21 21
 {
22
-    /**
23
-     * Reference to Server class.
24
-     *
25
-     * @var DAV\Server
26
-     */
27
-    protected $server;
22
+	/**
23
+	 * Reference to Server class.
24
+	 *
25
+	 * @var DAV\Server
26
+	 */
27
+	protected $server;
28 28
 
29
-    /**
30
-     * Initializes the plugin and registers event handles.
31
-     */
32
-    public function initialize(DAV\Server $server)
33
-    {
34
-        $this->server = $server;
35
-        $this->server->on('method:GET', [$this, 'httpGet'], 90);
36
-    }
29
+	/**
30
+	 * Initializes the plugin and registers event handles.
31
+	 */
32
+	public function initialize(DAV\Server $server)
33
+	{
34
+		$this->server = $server;
35
+		$this->server->on('method:GET', [$this, 'httpGet'], 90);
36
+	}
37 37
 
38
-    /**
39
-     * 'beforeMethod' event handles. This event handles intercepts GET requests ending
40
-     * with ?mount.
41
-     *
42
-     * @return bool
43
-     */
44
-    public function httpGet(RequestInterface $request, ResponseInterface $response)
45
-    {
46
-        $queryParams = $request->getQueryParameters();
47
-        if (!array_key_exists('mount', $queryParams)) {
48
-            return;
49
-        }
38
+	/**
39
+	 * 'beforeMethod' event handles. This event handles intercepts GET requests ending
40
+	 * with ?mount.
41
+	 *
42
+	 * @return bool
43
+	 */
44
+	public function httpGet(RequestInterface $request, ResponseInterface $response)
45
+	{
46
+		$queryParams = $request->getQueryParameters();
47
+		if (!array_key_exists('mount', $queryParams)) {
48
+			return;
49
+		}
50 50
 
51
-        $currentUri = $request->getAbsoluteUrl();
51
+		$currentUri = $request->getAbsoluteUrl();
52 52
 
53
-        // Stripping off everything after the ?
54
-        list($currentUri) = explode('?', $currentUri);
53
+		// Stripping off everything after the ?
54
+		list($currentUri) = explode('?', $currentUri);
55 55
 
56
-        $this->davMount($response, $currentUri);
56
+		$this->davMount($response, $currentUri);
57 57
 
58
-        // Returning false to break the event chain
59
-        return false;
60
-    }
58
+		// Returning false to break the event chain
59
+		return false;
60
+	}
61 61
 
62
-    /**
63
-     * Generates the davmount response.
64
-     *
65
-     * @param string $uri absolute uri
66
-     */
67
-    public function davMount(ResponseInterface $response, $uri)
68
-    {
69
-        $response->setStatus(200);
70
-        $response->setHeader('Content-Type', 'application/davmount+xml');
71
-        ob_start();
72
-        echo '<?xml version="1.0"?>', "\n";
73
-        echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n";
74
-        echo '  <dm:url>', htmlspecialchars($uri, ENT_NOQUOTES, 'UTF-8'), "</dm:url>\n";
75
-        echo '</dm:mount>';
76
-        $response->setBody(ob_get_clean());
77
-    }
62
+	/**
63
+	 * Generates the davmount response.
64
+	 *
65
+	 * @param string $uri absolute uri
66
+	 */
67
+	public function davMount(ResponseInterface $response, $uri)
68
+	{
69
+		$response->setStatus(200);
70
+		$response->setHeader('Content-Type', 'application/davmount+xml');
71
+		ob_start();
72
+		echo '<?xml version="1.0"?>', "\n";
73
+		echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n";
74
+		echo '  <dm:url>', htmlspecialchars($uri, ENT_NOQUOTES, 'UTF-8'), "</dm:url>\n";
75
+		echo '</dm:mount>';
76
+		$response->setBody(ob_get_clean());
77
+	}
78 78
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/dav/lib/DAV/IMultiGet.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
  */
25 25
 interface IMultiGet extends ICollection
26 26
 {
27
-    /**
28
-     * This method receives a list of paths in it's first argument.
29
-     * It must return an array with Node objects.
30
-     *
31
-     * If any children are not found, you do not have to return them.
32
-     *
33
-     * @param string[] $paths
34
-     *
35
-     * @return array
36
-     */
37
-    public function getMultipleChildren(array $paths);
27
+	/**
28
+	 * This method receives a list of paths in it's first argument.
29
+	 * It must return an array with Node objects.
30
+	 *
31
+	 * If any children are not found, you do not have to return them.
32
+	 *
33
+	 * @param string[] $paths
34
+	 *
35
+	 * @return array
36
+	 */
37
+	public function getMultipleChildren(array $paths);
38 38
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/dav/lib/DAV/StringUtil.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -17,70 +17,70 @@
 block discarded – undo
17 17
  */
18 18
 class StringUtil
19 19
 {
20
-    /**
21
-     * Checks if a needle occurs in a haystack ;).
22
-     *
23
-     * @param string $haystack
24
-     * @param string $needle
25
-     * @param string $collation
26
-     * @param string $matchType
27
-     *
28
-     * @return bool
29
-     */
30
-    public static function textMatch($haystack, $needle, $collation, $matchType = 'contains')
31
-    {
32
-        switch ($collation) {
33
-            case 'i;ascii-casemap':
34
-                // default strtolower takes locale into consideration
35
-                // we don't want this.
36
-                $haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack);
37
-                $needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle);
38
-                break;
20
+	/**
21
+	 * Checks if a needle occurs in a haystack ;).
22
+	 *
23
+	 * @param string $haystack
24
+	 * @param string $needle
25
+	 * @param string $collation
26
+	 * @param string $matchType
27
+	 *
28
+	 * @return bool
29
+	 */
30
+	public static function textMatch($haystack, $needle, $collation, $matchType = 'contains')
31
+	{
32
+		switch ($collation) {
33
+			case 'i;ascii-casemap':
34
+				// default strtolower takes locale into consideration
35
+				// we don't want this.
36
+				$haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack);
37
+				$needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle);
38
+				break;
39 39
 
40
-            case 'i;octet':
41
-                // Do nothing
42
-                break;
40
+			case 'i;octet':
41
+				// Do nothing
42
+				break;
43 43
 
44
-            case 'i;unicode-casemap':
45
-                $haystack = mb_strtoupper($haystack, 'UTF-8');
46
-                $needle = mb_strtoupper($needle, 'UTF-8');
47
-                break;
44
+			case 'i;unicode-casemap':
45
+				$haystack = mb_strtoupper($haystack, 'UTF-8');
46
+				$needle = mb_strtoupper($needle, 'UTF-8');
47
+				break;
48 48
 
49
-            default:
50
-                throw new Exception\BadRequest('Collation type: '.$collation.' is not supported');
51
-        }
49
+			default:
50
+				throw new Exception\BadRequest('Collation type: '.$collation.' is not supported');
51
+		}
52 52
 
53
-        switch ($matchType) {
54
-            case 'contains':
55
-                return false !== strpos($haystack, $needle);
56
-            case 'equals':
57
-                return $haystack === $needle;
58
-            case 'starts-with':
59
-                return 0 === strpos($haystack, $needle);
60
-            case 'ends-with':
61
-                return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle);
62
-            default:
63
-                throw new Exception\BadRequest('Match-type: '.$matchType.' is not supported');
64
-        }
65
-    }
53
+		switch ($matchType) {
54
+			case 'contains':
55
+				return false !== strpos($haystack, $needle);
56
+			case 'equals':
57
+				return $haystack === $needle;
58
+			case 'starts-with':
59
+				return 0 === strpos($haystack, $needle);
60
+			case 'ends-with':
61
+				return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle);
62
+			default:
63
+				throw new Exception\BadRequest('Match-type: '.$matchType.' is not supported');
64
+		}
65
+	}
66 66
 
67
-    /**
68
-     * This method takes an input string, checks if it's not valid UTF-8 and
69
-     * attempts to convert it to UTF-8 if it's not.
70
-     *
71
-     * Note that currently this can only convert ISO-8859-1 to UTF-8 (latin-1),
72
-     * anything else will likely fail.
73
-     *
74
-     * @param string $input
75
-     *
76
-     * @return string
77
-     */
78
-    public static function ensureUTF8($input)
79
-    {
80
-        if (!mb_check_encoding($input, 'UTF-8') && mb_check_encoding($input, 'ISO-8859-1')) {
81
-            return mb_convert_encoding($input, 'UTF-8', 'ISO-8859-1');
82
-        } else {
83
-            return $input;
84
-        }
85
-    }
67
+	/**
68
+	 * This method takes an input string, checks if it's not valid UTF-8 and
69
+	 * attempts to convert it to UTF-8 if it's not.
70
+	 *
71
+	 * Note that currently this can only convert ISO-8859-1 to UTF-8 (latin-1),
72
+	 * anything else will likely fail.
73
+	 *
74
+	 * @param string $input
75
+	 *
76
+	 * @return string
77
+	 */
78
+	public static function ensureUTF8($input)
79
+	{
80
+		if (!mb_check_encoding($input, 'UTF-8') && mb_check_encoding($input, 'ISO-8859-1')) {
81
+			return mb_convert_encoding($input, 'UTF-8', 'ISO-8859-1');
82
+		} else {
83
+			return $input;
84
+		}
85
+	}
86 86
 }
Please login to merge, or discard this patch.
includes/sabre/sabre/dav/lib/DAV/Exception/RequestedRangeNotSatisfiable.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
18 18
  */
19 19
 class RequestedRangeNotSatisfiable extends DAV\Exception
20 20
 {
21
-    /**
22
-     * returns the http statuscode for this exception.
23
-     *
24
-     * @return int
25
-     */
26
-    public function getHTTPCode()
27
-    {
28
-        return 416;
29
-    }
21
+	/**
22
+	 * returns the http statuscode for this exception.
23
+	 *
24
+	 * @return int
25
+	 */
26
+	public function getHTTPCode()
27
+	{
28
+		return 416;
29
+	}
30 30
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/dav/lib/DAV/Exception/LengthRequired.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
18 18
  */
19 19
 class LengthRequired extends DAV\Exception
20 20
 {
21
-    /**
22
-     * Returns the HTTP statuscode for this exception.
23
-     *
24
-     * @return int
25
-     */
26
-    public function getHTTPCode()
27
-    {
28
-        return 411;
29
-    }
21
+	/**
22
+	 * Returns the HTTP statuscode for this exception.
23
+	 *
24
+	 * @return int
25
+	 */
26
+	public function getHTTPCode()
27
+	{
28
+		return 411;
29
+	}
30 30
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/dav/lib/DAV/Exception/ConflictingLock.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@
 block discarded – undo
18 18
  */
19 19
 class ConflictingLock extends Locked
20 20
 {
21
-    /**
22
-     * This method allows the exception to include additional information into the WebDAV error response.
23
-     */
24
-    public function serialize(DAV\Server $server, \DOMElement $errorNode)
25
-    {
26
-        if ($this->lock) {
27
-            $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:no-conflicting-lock');
28
-            $errorNode->appendChild($error);
29
-            $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:href', $this->lock->uri));
30
-        }
31
-    }
21
+	/**
22
+	 * This method allows the exception to include additional information into the WebDAV error response.
23
+	 */
24
+	public function serialize(DAV\Server $server, \DOMElement $errorNode)
25
+	{
26
+		if ($this->lock) {
27
+			$error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:no-conflicting-lock');
28
+			$errorNode->appendChild($error);
29
+			$error->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:href', $this->lock->uri));
30
+		}
31
+	}
32 32
 }
Please login to merge, or discard this patch.