Annotation of /mambo/branches/4.5.3h/globals.php
Parent Directory
|
Revision Log
Revision 1414 - (view) (download)
| 1 : | root | 1 | <?php |
| 2 : | /** | ||
| 3 : | * @package Mambo | ||
| 4 : | elpie | 1414 | * @author Mambo Foundation Inc see README.php |
| 5 : | * @copyright Mambo Foundation Inc. | ||
| 6 : | * See COPYRIGHT.php for copyright notices and details. | ||
| 7 : | chanh | 1393 | * @license GNU/GPL Version 2, see LICENSE.php |
| 8 : | elpie | 1414 | * Mambo is free software; you can redistribute it and/or |
| 9 : | * modify it under the terms of the GNU General Public License | ||
| 10 : | * as published by the Free Software Foundation; version 2 of the License. | ||
| 11 : | root | 1 | */ |
| 12 : | |||
| 13 : | cauld | 676 | /** Set flag that this is a parent file */ |
| 14 : | cauld | 678 | if (!defined('_VALID_MOS')) define( '_VALID_MOS', 1 ); |
| 15 : | root | 1 | |
| 16 : | // reads configuration.php for mosConfig_register_globals | ||
| 17 : | function config_register_globals() { | ||
| 18 : | static $register_globals; | ||
| 19 : | if (is_null($register_globals)) { | ||
| 20 : | $config = implode(",", file(dirname(__FILE__).DIRECTORY_SEPARATOR.'configuration.php')); | ||
| 21 : | preg_match('/\$mosConfig_register_globals\s*=\s*\'([0-1]?)\'/', $config, $matches); | ||
| 22 : | csouza | 27 | $register_globals = isset($matches[1]) ? (int) $matches[1] : 1; |
| 23 : | root | 1 | } |
| 24 : | return $register_globals; | ||
| 25 : | } | ||
| 26 : | |||
| 27 : | // get mosConfig_register_globals | ||
| 28 : | $config_register_globals = config_register_globals(); | ||
| 29 : | |||
| 30 : | // superglobals array | ||
| 31 : | $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET); | ||
| 32 : | if (isset($_SESSION)) array_unshift ($superglobals , $_SESSION); | ||
| 33 : | |||
| 34 : | // Emulate register_globals on | ||
| 35 : | if (!ini_get('register_globals') && $config_register_globals) { | ||
| 36 : | cauld | 672 | while(list($key,$value)=each($_GET)) { |
| 37 : | if (!isset($GLOBALS[$key])) $GLOBALS[$key]=$value; | ||
| 38 : | } | ||
| 39 : | while(list($key,$value)=each($_POST)) { | ||
| 40 : | if (!isset($GLOBALS[$key])) $GLOBALS[$key]=$value; | ||
| 41 : | } | ||
| 42 : | root | 1 | } |
| 43 : | // Emulate register_globals off | ||
| 44 : | elseif (ini_get('register_globals') && !$config_register_globals) { | ||
| 45 : | foreach ($superglobals as $superglobal) { | ||
| 46 : | foreach ($superglobal as $key => $value) { | ||
| 47 : | unset($GLOBALS[$key]); | ||
| 48 : | cauld | 672 | unset( $GLOBALS[$key]); |
| 49 : | root | 1 | } |
| 50 : | } | ||
| 51 : | } | ||
| 52 : | cauld | 672 | |
| 53 : | cauld | 678 | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

