- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / include / inc_vars_resolve.php
blob8182cae17fb968951db265deacde09185eafa09c
1 <?php
2 /**
3 * importGlobalVariable solves the different global variable names
4 * in different versions of php
5 * original idea by Chris Burkert
6 */
7 function importGlobalVariable($variable)
8 {
9 switch (strtolower($variable))
10 { case 'server' :
11 if (isset($_SERVER)) { return $_SERVER; }
12 else
13 { return $GLOBALS['HTTP_SERVER_VARS']; }
14 break;
15 /* case 'session' :
16 if (isset($_SESSION)) { return $_SESSION; }
17 else
18 { return $GLOBALS['HTTP_SESSION_VARS']; }
19 break;*/
20 case 'post' :
21 if (isset($_POST)) { return $_POST; }
22 else
23 { return $GLOBALS['HTTP_POST_VARS']; }
24 break;
25 case 'get' :
26 if (isset($_GET)) { return $_GET; }
27 else
28 { return $GLOBALS['HTTP_GET_VARS']; }
29 break;
30 case 'cookie' :
31 if (isset($_COOKIE)) { return $_COOKIE; }
32 else
33 { return $GLOBALS['HTTP_COOKIE_VARS']; }
34 break;
35 default:return null;
36 break;
40 /**
41 * This routine will check whether the register_globals of php is on or off.
42 * If it is off, all GET,POST, and COOKIE variables will be explicitely 'globalized' here
43 * Note: this uses the $$ variable which will not work in php3
45 $reg_glob_ini=ini_get('register_globals');
47 if(empty($reg_glob_ini)||(!$reg_glob_ini))
50 /* Process GET vars */
52 //if(sizeof($HTTP_GET_VARS))
53 if(sizeof($global_vars=&importGlobalVariable('get')))
55 //while(list($x,$v)=each($HTTP_GET_VARS))
56 while(list($x,$v)=each($global_vars))
58 $$x=$v;
60 reset($global_vars);
63 /* Process POST vars */
65 //if(sizeof($HTTP_POST_VARS))
66 if(sizeof($global_vars=&importGlobalVariable('post')))
68 //while(list($x,$v)=each($HTTP_POST_VARS))
69 while(list($x,$v)=each($global_vars))
71 $$x=$v;
73 //reset($HTTP_POST_VARS);
74 reset($global_vars);
77 /* Process COOKIE vars */
79 //if(sizeof($HTTP_COOKIE_VARS))
80 if(sizeof($global_vars=&importGlobalVariable('cookie')))
82 //while(list($x,$v)=each($HTTP_COOKIE_VARS))
83 while(list($x,$v)=each($global_vars))
85 $$x=$v;
87 //reset($HTTP_COOKIE_VARS);
88 reset($global_vars);
91 /* Get cookie vars equivalent */
92 $HTTP_COOKIE_VARS=&importGlobalVariable('cookie');
94 /* Process SERVER vars */
96 //if(sizeof($HTTP_SERVER_VARS))
97 if(sizeof($global_vars=&importGlobalVariable('server')))
99 //while(list($x,$v)=each($HTTP_SERVER_VARS))
100 while(list($x,$v)=each($global_vars))
102 $$x=$v;
104 //reset($HTTP_SERVER_VARS);
105 reset($global_vars);
108 /* Get server vars equivalent */
109 $CARE_SERVER_VARS=&importGlobalVariable('server');
111 /* Process SESSION vars */
112 /* if(sizeof($global_vars=&importGlobalVariable('session')))
114 //while(list($x,$v)=each($HTTP_SERVER_VARS))
115 while(list($x,$v)=each($global_vars))
117 $$x=$v;
119 //reset($HTTP_SERVER_VARS);
120 reset($global_vars);
125 //$HTTP_SESSION_VARS=&importGlobalVariable('session');
129 /*------begin------ This protection code was suggested by Luki R. luki@karet.org ---- */
130 if (eregi('inc_vars_resolve.php',$PHP_SELF))
131 die('<meta http-equiv="refresh" content="0; url=../">');
132 /*------end------*/