Annotation of /mambo/branches/4.5.3h/globals.php
Parent Directory
|
Revision Log
Revision 1 -
(view)
(download)
Original Path: mambo/trunk/globals.php
| 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 : | |||
| 11 : | // reads configuration.php for mosConfig_register_globals | ||
| 12 : | function config_register_globals() { | ||
| 13 : | static $register_globals; | ||
| 14 : | if (is_null($register_globals)) { | ||
| 15 : | $config = implode(",", file(dirname(__FILE__).DIRECTORY_SEPARATOR.'configuration.php')); | ||
| 16 : | preg_match('/\$mosConfig_register_globals\s*=\s*\'([0-1]?)\'/', $config, $matches); | ||
| 17 : | $register_globals = isset($matches[1]) ? (int) $matches[1] : 0; | ||
| 18 : | } | ||
| 19 : | return $register_globals; | ||
| 20 : | } | ||
| 21 : | |||
| 22 : | // get mosConfig_register_globals | ||
| 23 : | $config_register_globals = config_register_globals(); | ||
| 24 : | |||
| 25 : | // superglobals array | ||
| 26 : | $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET); | ||
| 27 : | if (isset($_SESSION)) array_unshift ($superglobals , $_SESSION); | ||
| 28 : | |||
| 29 : | // Emulate register_globals on | ||
| 30 : | if (!ini_get('register_globals') && $config_register_globals) { | ||
| 31 : | foreach ($superglobals as $superglobal) { | ||
| 32 : | extract($superglobal, EXTR_SKIP); | ||
| 33 : | } | ||
| 34 : | } | ||
| 35 : | // Emulate register_globals off | ||
| 36 : | elseif (ini_get('register_globals') && !$config_register_globals) { | ||
| 37 : | foreach ($superglobals as $superglobal) { | ||
| 38 : | foreach ($superglobal as $key => $value) { | ||
| 39 : | unset($GLOBALS[$key]); | ||
| 40 : | } | ||
| 41 : | } | ||
| 42 : | } | ||
| 43 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

