526285a216119914499f90c42f8f98f28a1e5725
[mtweb] / web / app / env / modules / mw_env_inputs.php
1 <?php
2
3   class mw_env_inputs extends mw_env
4   {
5
6     function prepare_inputs()
7     { if($_POST)
8       { require_once $this->path("libs")."inputfilter.php";
9         $allowed_tags = array
10         ( "p", "span", "pre", "blockquote", "address", "hr", "br",
11           "img",
12           "strong", "em", "u", "i", "b", "s",
13           "a",
14           "ul", "ol", "li",
15           "h1", "h2", "h3", "h4", "h5", "h6"
16         );
17         $allowed_attrs = array
18         ( "style",
19           "src", "alt", "width", "height",
20           "href", "title"
21         );
22         $input_filter = new InputFilter($allowed_tags, $allowed_attrs);
23         $_POST = $input_filter->process($_POST);
24       }
25       if($_FILES)
26       { foreach($_FILES as $file_key => $file_infos)
27         { $v_name = explode(".", $file_infos["name"]);
28           $ext = strtolower($v_name[count($v_name) - 1]);
29           if
30           (    $ext != "png"
31             && $ext != "jpg"
32             && $ext != "jpeg"
33             && $ext != "gif"
34           ) unset($_FILES[$file_key]);
35         }
36       }
37       return true;
38     }
39
40   }
41
42 ?>