root/trunk/patForms/Filter/XSS.php

Revision 2, 1.0 kB (checked in by schst, 5 years ago)

initial import on new server

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * patForms XSS filter
4  *
5  * Removes javascript and vbscript from user input.
6  *
7  * $Id$
8  *
9  * @package        patForms
10  * @subpackage    Filter
11  */
12
13 /**
14  * patForms XSS filter
15  *
16  * Removes javascript and vbscript from user input.
17  *
18  * @package        patForms
19  * @subpackage    Filter
20  * @author        Stephan Schmidt <schst@php-tools.net>
21  * @license        LGPL, see license.txt for details
22  * @link        http://www.php-tools.net
23  * @version        1.0
24  */
25 class patForms_Filter_XSS extends patForms_Filter
26 {
27    /**
28     * type of the filter
29     *
30     * @access    private
31     */
32     var $_type    =    PATFORMS_FILTER_TYPE_HTTP;
33
34    /**
35     * Filter value that is returned by patForms
36     *
37     * @abstract
38     * @access    public
39     * @param    string    value
40     * @return    float    filtered value
41     */
42     function out( $value )
43     {
44         return $value;
45     }
46
47    /**
48     * Filter value that is passed to patForms
49     *
50     * @abstract
51     * @access    public
52     * @param    mixed    value
53     * @return    mixed    filtered value
54     */
55     function in( $value )
56     {
57         $value    =    preg_replace( '!<(vb)?script[^>]*>.*</(vb)?script.*>!ims', '', $value );
58         return $value;
59     }
60 }
61 ?>
Note: See TracBrowser for help on using the browser.