file.php 804 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Validates file as defined by RFC 1630 and RFC 1738.
  4. */
  5. class HTMLPurifier_URIScheme_file extends HTMLPurifier_URIScheme {
  6. // Generally file:// URLs are not accessible from most
  7. // machines, so placing them as an img src is incorrect.
  8. public $browsable = false;
  9. public function validate(&$uri, $config, $context) {
  10. parent::validate($uri, $config, $context);
  11. // Authentication method is not supported
  12. $uri->userinfo = null;
  13. // file:// makes no provisions for accessing the resource
  14. $uri->port = null;
  15. // While it seems to work on Firefox, the querystring has
  16. // no possible effect and is thus stripped.
  17. $uri->query = null;
  18. return true;
  19. }
  20. }
  21. // vim: et sw=4 sts=4