Documentation TYPO3 par Ameos

grab_globals.lib.php

00001 <?php
00002 /* $Id: grab_globals.lib.php,v 2.4 2003/11/26 22:52:23 rabus Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 
00015 function PMA_gpc_extract($array, &$target) {
00016     if (!is_array($array)) {
00017         return FALSE;
00018     }
00019     $is_magic_quotes = get_magic_quotes_gpc();
00020     foreach($array AS $key => $value) {
00021         if (is_array($value)) {
00022             // there could be a variable coming from a cookie of
00023             // another application, with the same name as this array
00024             unset($target[$key]);
00025 
00026             PMA_gpc_extract($value, $target[$key]);
00027         } else if ($is_magic_quotes) {
00028             $target[$key] = stripslashes($value);
00029         } else {
00030             $target[$key] = $value;
00031         }
00032     }
00033     return TRUE;
00034 }
00035 
00036 if (!empty($_GET)) {
00037     PMA_gpc_extract($_GET, $GLOBALS);
00038 } // end if
00039 
00040 if (!empty($_POST)) {
00041     PMA_gpc_extract($_POST, $GLOBALS);
00042 } // end if
00043 
00044 if (!empty($_FILES)) {
00045     foreach($_FILES AS $name => $value) {
00046         $$name = $value['tmp_name'];
00047         ${$name . '_name'} = $value['name'];
00048     }
00049 } // end if
00050 
00051 if (!empty($_SERVER)) {
00052     $server_vars = array('PHP_SELF', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_AUTHORIZATION');
00053     foreach ($server_vars as $current) {
00054         if (isset($_SERVER[$current])) {
00055             $$current = $_SERVER[$current];
00056         } elseif (!isset($$current)) {
00057             $$current = '';
00058         }
00059     }
00060     unset($server_vars, $current);
00061 } // end if
00062 
00063 // Security fix: disallow accessing serious server files via "?goto="
00064 if (isset($goto) && strpos(' ' . $goto, '/') > 0 && substr($goto, 0, 2) != './') {
00065     unset($goto);
00066 } // end if
00067 
00068 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6