1: | <?php
|
2: |
|
3: | |
4: | |
5: |
|
6: | class HTMLPurifier_URIScheme_ftp extends HTMLPurifier_URIScheme
|
7: | {
|
8: | |
9: | |
10: |
|
11: | public $default_port = 21;
|
12: |
|
13: | |
14: | |
15: |
|
16: | public $browsable = true;
|
17: |
|
18: | |
19: | |
20: |
|
21: | public $hierarchical = true;
|
22: |
|
23: | |
24: | |
25: | |
26: | |
27: | |
28: |
|
29: | public function doValidate(&$uri, $config, $context)
|
30: | {
|
31: | $uri->query = null;
|
32: |
|
33: |
|
34: | $semicolon_pos = strrpos($uri->path, ';');
|
35: | if ($semicolon_pos !== false) {
|
36: | $type = substr($uri->path, $semicolon_pos + 1);
|
37: | $uri->path = substr($uri->path, 0, $semicolon_pos);
|
38: | $type_ret = '';
|
39: | if (strpos($type, '=') !== false) {
|
40: |
|
41: | list($key, $typecode) = explode('=', $type, 2);
|
42: | if ($key !== 'type') {
|
43: |
|
44: | $uri->path .= '%3B' . $type;
|
45: | } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') {
|
46: | $type_ret = ";type=$typecode";
|
47: | }
|
48: | } else {
|
49: | $uri->path .= '%3B' . $type;
|
50: | }
|
51: | $uri->path = str_replace(';', '%3B', $uri->path);
|
52: | $uri->path .= $type_ret;
|
53: | }
|
54: | return true;
|
55: | }
|
56: | }
|
57: |
|
58: |
|
59: | |