import mtweb.0.4.1
[mtweb] / web / app / init / 0200_inputs.php
1 <?php
2
3   if(get_magic_quotes_gpc())
4   { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
5     while(list($key, $val) = each($process))
6     { foreach($val as $k => $v)
7       { unset($process[$key][$k]);
8         if(is_array($v))
9         { $process[$key][stripslashes($k)] = $v;
10           $process[] = &$process[$key][stripslashes($k)];
11         }
12         else $process[$key][stripslashes($k)] = stripslashes($v);
13       }
14     }
15     unset($process);
16   }
17
18
19
20   /*
21    *
22    * decommentez la fin du fichier pour activer le filtrage
23    * des inputs (ici POST et FILES)
24    *
25
26   if($_POST)
27   { require $this->path("libs")."inputfilter.php";
28     $allowed_tags = array
29     ( "p", "span", "pre", "blockquote", "address", "hr", "br",
30       "img",
31       "strong", "em", "u", "i", "b", "s",
32       "a",
33       "ul", "ol", "li",
34       "h1", "h2", "h3", "h4", "h5", "h6"
35     );
36     $allowed_attrs = array
37     ( "style",
38       "src", "alt", "width", "height",
39       "href", "title"
40     );
41     $input_filter = new InputFilter($allowed_tags, $allowed_attrs);
42     $_POST = $input_filter->process($_POST);
43   }
44
45   if($_FILES)
46   { foreach($_FILES as $file_key => $file_infos)
47     { $v_name = explode(".", $file_infos["name"]);
48       $ext = strtolower($v_name[count($v_name) - 1]);
49       if
50       (    $ext != "png"
51         && $ext != "jpg"
52         && $ext != "jpeg"
53         && $ext != "gif"
54       ) unset($_FILES[$file_key]);
55     }
56   }
57
58   */
59
60 ?>