1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* elFinder driver for Volume Group. |
5
|
|
|
* |
6
|
|
|
* @author Naoki Sawada |
7
|
|
|
**/ |
8
|
|
|
class elFinderVolumeGroup extends elFinderVolumeDriver |
|
|
|
|
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Driver id |
12
|
|
|
* Must be started from letter and contains [a-z0-9] |
13
|
|
|
* Used as part of volume id. |
14
|
|
|
* |
15
|
|
|
* @var string |
16
|
|
|
**/ |
17
|
|
|
protected $driverId = 'g'; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Constructor |
21
|
|
|
* Extend options with required fields. |
22
|
|
|
*/ |
23
|
|
|
public function __construct() |
24
|
|
|
{ |
25
|
|
|
$this->options['type'] = 'group'; |
26
|
|
|
$this->options['path'] = '/'; |
27
|
|
|
$this->options['dirUrlOwn'] = true; |
28
|
|
|
$this->options['syncMinMs'] = 0; |
29
|
|
|
$this->options['tmbPath'] = ''; |
30
|
|
|
$this->options['disabled'] = [ |
31
|
|
|
'archive', |
32
|
|
|
'cut', |
33
|
|
|
'duplicate', |
34
|
|
|
'edit', |
35
|
|
|
'extract', |
36
|
|
|
'getfile', |
37
|
|
|
'mkdir', |
38
|
|
|
'mkfile', |
39
|
|
|
'paste', |
40
|
|
|
'rename', |
41
|
|
|
'resize', |
42
|
|
|
'rm', |
43
|
|
|
'upload', |
44
|
|
|
]; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/*********************************************************************/ |
48
|
|
|
/* FS API */ |
49
|
|
|
/*********************************************************************/ |
50
|
|
|
|
51
|
|
|
/*********************** paths/urls *************************/ |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* {@inheritdoc} |
55
|
|
|
**/ |
56
|
|
|
protected function _dirname($path) |
57
|
|
|
{ |
58
|
|
|
return '/'; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* {@inheritdoc} |
63
|
|
|
**/ |
64
|
|
|
protected function _basename($path) |
65
|
|
|
{ |
66
|
|
|
return ''; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* {@inheritdoc} |
71
|
|
|
**/ |
72
|
|
|
protected function _joinPath($dir, $name) |
73
|
|
|
{ |
74
|
|
|
return '/'.$name; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* {@inheritdoc} |
79
|
|
|
**/ |
80
|
|
|
protected function _normpath($path) |
81
|
|
|
{ |
82
|
|
|
return '/'; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* {@inheritdoc} |
87
|
|
|
**/ |
88
|
|
|
protected function _relpath($path) |
89
|
|
|
{ |
90
|
|
|
return '/'; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* {@inheritdoc} |
95
|
|
|
**/ |
96
|
|
|
protected function _abspath($path) |
97
|
|
|
{ |
98
|
|
|
return '/'; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* {@inheritdoc} |
103
|
|
|
**/ |
104
|
|
|
protected function _path($path) |
105
|
|
|
{ |
106
|
|
|
return '/'; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* {@inheritdoc} |
111
|
|
|
**/ |
112
|
|
|
protected function _inpath($path, $parent) |
113
|
|
|
{ |
114
|
|
|
return false; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/***************** file stat ********************/ |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* {@inheritdoc} |
121
|
|
|
**/ |
122
|
|
|
protected function _stat($path) |
123
|
|
|
{ |
124
|
|
|
if ($path === '/') { |
125
|
|
|
return [ |
126
|
|
|
'size' => 0, |
127
|
|
|
'ts' => 0, |
128
|
|
|
'mime' => 'directory', |
129
|
|
|
'read' => true, |
130
|
|
|
'write' => false, |
131
|
|
|
'locked' => true, |
132
|
|
|
'hidden' => false, |
133
|
|
|
'dirs' => 0, |
134
|
|
|
]; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
return false; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* {@inheritdoc} |
142
|
|
|
**/ |
143
|
|
|
protected function _subdirs($path) |
144
|
|
|
{ |
145
|
|
|
$dirs = false; |
146
|
|
|
if ($path === '/') { |
147
|
|
|
return true; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
return $dirs; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* {@inheritdoc} |
155
|
|
|
**/ |
156
|
|
|
protected function _dimensions($path, $mime) |
157
|
|
|
{ |
158
|
|
|
return false; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/******************** file/dir content *********************/ |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* {@inheritdoc} |
165
|
|
|
**/ |
166
|
|
|
protected function readlink($path) |
|
|
|
|
167
|
|
|
{ |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* {@inheritdoc} |
172
|
|
|
**/ |
173
|
|
|
protected function _scandir($path) |
174
|
|
|
{ |
175
|
|
|
return []; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* {@inheritdoc} |
180
|
|
|
**/ |
181
|
|
|
protected function _fopen($path, $mode = 'rb') |
182
|
|
|
{ |
183
|
|
|
return false; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* {@inheritdoc} |
188
|
|
|
**/ |
189
|
|
|
protected function _fclose($fp, $path = '') |
190
|
|
|
{ |
191
|
|
|
return true; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/******************** file/dir manipulations *************************/ |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* {@inheritdoc} |
198
|
|
|
**/ |
199
|
|
|
protected function _mkdir($path, $name) |
200
|
|
|
{ |
201
|
|
|
return false; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* {@inheritdoc} |
206
|
|
|
**/ |
207
|
|
|
protected function _mkfile($path, $name) |
208
|
|
|
{ |
209
|
|
|
return false; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* {@inheritdoc} |
214
|
|
|
**/ |
215
|
|
|
protected function _symlink($source, $targetDir, $name) |
216
|
|
|
{ |
217
|
|
|
return false; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* {@inheritdoc} |
222
|
|
|
**/ |
223
|
|
|
protected function _copy($source, $targetDir, $name) |
224
|
|
|
{ |
225
|
|
|
return false; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* {@inheritdoc} |
230
|
|
|
**/ |
231
|
|
|
protected function _move($source, $targetDir, $name) |
232
|
|
|
{ |
233
|
|
|
return false; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* {@inheritdoc} |
238
|
|
|
**/ |
239
|
|
|
protected function _unlink($path) |
240
|
|
|
{ |
241
|
|
|
return false; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* {@inheritdoc} |
246
|
|
|
**/ |
247
|
|
|
protected function _rmdir($path) |
248
|
|
|
{ |
249
|
|
|
return false; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* {@inheritdoc} |
254
|
|
|
**/ |
255
|
|
|
protected function _save($fp, $dir, $name, $stat) |
256
|
|
|
{ |
257
|
|
|
return false; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* {@inheritdoc} |
262
|
|
|
**/ |
263
|
|
|
protected function _getContents($path) |
264
|
|
|
{ |
265
|
|
|
return false; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* {@inheritdoc} |
270
|
|
|
**/ |
271
|
|
|
protected function _filePutContents($path, $content) |
272
|
|
|
{ |
273
|
|
|
return false; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* {@inheritdoc} |
278
|
|
|
**/ |
279
|
|
|
protected function _checkArchivers() |
280
|
|
|
{ |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* {@inheritdoc} |
285
|
|
|
**/ |
286
|
|
|
protected function _chmod($path, $mode) |
287
|
|
|
{ |
288
|
|
|
return false; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* {@inheritdoc} |
293
|
|
|
**/ |
294
|
|
|
protected function _findSymlinks($path) |
|
|
|
|
295
|
|
|
{ |
296
|
|
|
return false; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* {@inheritdoc} |
301
|
|
|
**/ |
302
|
|
|
protected function _extract($path, $arc) |
303
|
|
|
{ |
304
|
|
|
return false; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* {@inheritdoc} |
309
|
|
|
**/ |
310
|
|
|
protected function _archive($dir, $files, $name, $arc) |
311
|
|
|
{ |
312
|
|
|
return false; |
313
|
|
|
} |
314
|
|
|
} |
315
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.