Annotation of /mambo/branches/4.5.3h/globals.php
Parent Directory
|
Revision Log
Revision 678 - (view) (download)
| 1 : | root | 1 | <?php |
| 2 : | /** | ||
| 3 : | * @version $Id: globals.php,v 1.6 2005/11/26 00:43:58 csouza Exp $ | ||
| 4 : | * @package Mambo | ||
| 5 : | * @copyright (C) 2000 - 2005 Miro International Pty Ltd | ||
| 6 : | * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||
| 7 : | * Mambo is Free Software | ||
| 8 : | */ | ||
| 9 : | |||
| 10 : | cauld | 676 | /** Set flag that this is a parent file */ |
| 11 : | cauld | 678 | if (!defined('_VALID_MOS')) define( '_VALID_MOS', 1 ); |
| 12 : | root | 1 | |
| 13 : | // reads configuration.php for mosConfig_register_globals | ||
| 14 : | function config_register_globals() { | ||
| 15 : | static $register_globals; | ||
| 16 : | if (is_null($register_globals)) { | ||
| 17 : | $config = implode(",", file(dirname(__FILE__).DIRECTORY_SEPARATOR.'configuration.php')); | ||
| 18 : | preg_match('/\$mosConfig_register_globals\s*=\s*\'([0-1]?)\'/', $config, $matches); | ||
| 19 : | csouza | 27 | $register_globals = isset($matches[1]) ? (int) $matches[1] : 1; |
| 20 : | root | 1 | } |
| 21 : | return $register_globals; | ||
| 22 : | } | ||
| 23 : | |||
| 24 : | // get mosConfig_register_globals | ||
| 25 : | $config_register_globals = config_register_globals(); | ||
| 26 : | |||
| 27 : | // superglobals array | ||
| 28 : | $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET); | ||
| 29 : | if (isset($_SESSION)) array_unshift ($superglobals , $_SESSION); | ||
| 30 : | |||
| 31 : | // Emulate register_globals on | ||
| 32 : | if (!ini_get('register_globals') && $config_register_globals) { | ||
| 33 : | cauld | 672 | while(list($key,$value)=each($_GET)) { |
| 34 : | if (!isset($GLOBALS[$key])) $GLOBALS[$key]=$value; | ||
| 35 : | } | ||
| 36 : | while(list($key,$value)=each($_POST)) { | ||
| 37 : | if (!isset($GLOBALS[$key])) $GLOBALS[$key]=$value; | ||
| 38 : | } | ||
| 39 : | root | 1 | } |
| 40 : | // Emulate register_globals off | ||
| 41 : | elseif (ini_get('register_globals') && !$config_register_globals) { | ||
| 42 : | foreach ($superglobals as $superglobal) { | ||
| 43 : | foreach ($superglobal as $key => $value) { | ||
| 44 : | unset($GLOBALS[$key]); | ||
| 45 : | cauld | 672 | unset( $GLOBALS[$key]); |
| 46 : | root | 1 | } |
| 47 : | } | ||
| 48 : | } | ||
| 49 : | cauld | 672 | |
| 50 : | cauld | 678 | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

