bb_unregister_GLOBALS

Bb_unregister_GLOBALS() - Turn register globals off.

Description

(null) bb_unregister_GLOBALS(); 

Returns (null)

Will return null if register_globals PHP directive was disabled


Usage

  1. if ( !function_exists( 'bb_unregister_GLOBALS' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-settings.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bb_unregister_GLOBALS(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-settings.php  
  1. function bb_unregister_GLOBALS() 
  2. if ( !ini_get( 'register_globals' ) ) { 
  3. return; 
  4.  
  5. if ( isset($_REQUEST['GLOBALS']) ) { 
  6. die( 'GLOBALS overwrite attempt detected' ); 
  7.  
  8. // Variables that shouldn't be unset 
  9. $noUnset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'bb_table_prefix', 'bb' ); 
  10.  
  11. $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() ); 
  12. foreach ( $input as $k => $v ) { 
  13. if ( !in_array( $k, $noUnset ) && isset( $GLOBALS[$k] ) ) { 
  14. $GLOBALS[$k] = NULL; 
  15. unset( $GLOBALS[$k] );