[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @ Version: $Id: globals.php 1878 2008-01-25 21:26:29Z datahell $ 4 * @ Copyright: Copyright (C) 2006-2008 Elxis.org. All rights reserved. 5 * @ Package: Elxis 6 * @ Subpackage: Globals emulation 7 * @ Author: Elxis Team 8 * @ E-mail: info@elxis.org 9 * @ URL: http://www.elxis.org 10 * @ License: http://www.gnu.org/copyleft/gpl.html GNU/GPL 11 * Elxis CMS is a Free Software 12 */ 13 14 15 // reads configuration.php for mosConfig_register_globals 16 function config_register_globals() { 17 static $register_globals; 18 if (is_null($register_globals)) { 19 $config = implode(",", file(dirname(__FILE__).DIRECTORY_SEPARATOR.'configuration.php')); 20 preg_match('/\$mosConfig_register_globals\s*=\s*\'([0-1]?)\'/', $config, $matches); 21 $register_globals = isset($matches[1]) ? (int) $matches[1] : 1; 22 } 23 return $register_globals; 24 } 25 26 // get mosConfig_register_globals 27 $config_register_globals = config_register_globals(); 28 29 // superglobals array 30 $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET); 31 if (isset($_SESSION)) array_unshift ($superglobals , $_SESSION); 32 33 // Emulate register_globals on 34 if (!ini_get('register_globals') && $config_register_globals) { 35 foreach ($superglobals as $superglobal) { 36 extract($superglobal, EXTR_SKIP); 37 } 38 } 39 // Emulate register_globals off 40 elseif (ini_get('register_globals') && !$config_register_globals) { 41 foreach ($superglobals as $superglobal) { 42 foreach ($superglobal as $key => $value) { 43 unset($GLOBALS[$key]); 44 } 45 } 46 } 47 48 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body