00001 <?php 00002 00006 class HTMLPurifier_URIScheme_ftp extends HTMLPurifier_URIScheme { 00007 00008 public $default_port = 21; 00009 public $browsable = true; // usually 00010 public $hierarchical = true; 00011 00012 public function validate(&$uri, $config, $context) { 00013 parent::validate($uri, $config, $context); 00014 $uri->query = null; 00015 00016 // typecode check 00017 $semicolon_pos = strrpos($uri->path, ';'); // reverse 00018 if ($semicolon_pos !== false) { 00019 $type = substr($uri->path, $semicolon_pos + 1); // no semicolon 00020 $uri->path = substr($uri->path, 0, $semicolon_pos); 00021 $type_ret = ''; 00022 if (strpos($type, '=') !== false) { 00023 // figure out whether or not the declaration is correct 00024 list($key, $typecode) = explode('=', $type, 2); 00025 if ($key !== 'type') { 00026 // invalid key, tack it back on encoded 00027 $uri->path .= '%3B' . $type; 00028 } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') { 00029 $type_ret = ";type=$typecode"; 00030 } 00031 } else { 00032 $uri->path .= '%3B' . $type; 00033 } 00034 $uri->path = str_replace(';', '%3B', $uri->path); 00035 $uri->path .= $type_ret; 00036 } 00037 00038 return true; 00039 } 00040 00041 } 00042 00043 // vim: et sw=4 sts=4
| Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|
