diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-21 15:57:10 +0100 |
commit | 99679d06884120c57f43b44e55e03595f1f87bed (patch) | |
tree | a3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/URIScheme/file.php | |
parent | 655214ab30ee84884dc408488b85586f36263fcb (diff) | |
parent | d3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff) | |
download | wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.gz wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.zst wallabag-99679d06884120c57f43b44e55e03595f1f87bed.zip |
Merge pull request #481 from wallabag/dev1.5.2
1.5.2
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/URIScheme/file.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/URIScheme/file.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/URIScheme/file.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/URIScheme/file.php new file mode 100644 index 00000000..a220a6ad --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/URIScheme/file.php | |||
@@ -0,0 +1,44 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * Validates file as defined by RFC 1630 and RFC 1738. | ||
5 | */ | ||
6 | class HTMLPurifier_URIScheme_file extends HTMLPurifier_URIScheme | ||
7 | { | ||
8 | /** | ||
9 | * Generally file:// URLs are not accessible from most | ||
10 | * machines, so placing them as an img src is incorrect. | ||
11 | * @type bool | ||
12 | */ | ||
13 | public $browsable = false; | ||
14 | |||
15 | /** | ||
16 | * Basically the *only* URI scheme for which this is true, since | ||
17 | * accessing files on the local machine is very common. In fact, | ||
18 | * browsers on some operating systems don't understand the | ||
19 | * authority, though I hear it is used on Windows to refer to | ||
20 | * network shares. | ||
21 | * @type bool | ||
22 | */ | ||
23 | public $may_omit_host = true; | ||
24 | |||
25 | /** | ||
26 | * @param HTMLPurifier_URI $uri | ||
27 | * @param HTMLPurifier_Config $config | ||
28 | * @param HTMLPurifier_Context $context | ||
29 | * @return bool | ||
30 | */ | ||
31 | public function doValidate(&$uri, $config, $context) | ||
32 | { | ||
33 | // Authentication method is not supported | ||
34 | $uri->userinfo = null; | ||
35 | // file:// makes no provisions for accessing the resource | ||
36 | $uri->port = null; | ||
37 | // While it seems to work on Firefox, the querystring has | ||
38 | // no possible effect and is thus stripped. | ||
39 | $uri->query = null; | ||
40 | return true; | ||
41 | } | ||
42 | } | ||
43 | |||
44 | // vim: et sw=4 sts=4 | ||