[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/ -> system.php (source)

   1  <?php
   2  /**
   3   * gp_unregister_GLOBALS() - Turn register globals off
   4   *
   5   * @access private
   6   * @return null Will return null if register_globals PHP directive was disabled
   7   */
   8  function gp_unregister_GLOBALS() {
   9      if ( !ini_get( 'register_globals' ) ) {
  10          return;
  11      }
  12  
  13      if ( isset($_REQUEST['GLOBALS']) ) {
  14          die( 'GLOBALS overwrite attempt detected' );
  15      }
  16  
  17      // Variables that shouldn't be unset
  18      $noUnset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'gp_table_prefix' );
  19  
  20      $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
  21      foreach ( $input as $k => $v ) {
  22          if ( !in_array( $k, $noUnset ) && isset( $GLOBALS[$k] ) ) {
  23              $GLOBALS[$k] = NULL;
  24              unset( $GLOBALS[$k] );
  25          }
  26      }
  27  }
  28  
  29  function gp_urldecode_deep($value) {
  30      $value = is_array( $value ) ? array_map( 'gp_urldecode_deep', $value ) : urldecode( $value );
  31      return $value;
  32  }
  33  
  34  //TODO: add server-guessing code from bb-load.php in a function here
  35  
  36  function gp_is_installed() {
  37      // Check cache first. If the tables go away and we have true cached, oh well.
  38      if ( wp_cache_get( 'gp_is_installed' ) )
  39          return true;
  40  
  41      global $gpdb;
  42      $gpdb->flush();
  43      $gpdb->suppress_errors();
  44      $gpdb->query("SELECT id FROM $gpdb->translations WHERE 1=0");
  45      $gpdb->suppress_errors(false);
  46      $installed = ! (bool) $gpdb->last_error;
  47      wp_cache_set( 'gp_is_installed', $installed );
  48      return $installed;
  49  }
  50  
  51  /**
  52   * Makes all key/value pairs in $vars global variables
  53   */
  54  function gp_set_globals( &$vars ) {
  55      foreach( $vars as $name => &$value ) {
  56          $GLOBALS[$name] = &$value;
  57      }
  58  }


Generated: Thu May 24 03:59:35 2012 Hosted by follow the white rabbit.