You are here

function _sharedblocks_set_globals in Shared Blocks 7.2

1 call to _sharedblocks_set_globals()
sharedblocks_get_block in ./sharedblocks.publish.inc
Fetch a block in the same manner as _block_render_blocks().

File

./sharedblocks.publish.inc, line 128
Publish block page callbacks for the sharedblocks module.

Code

function _sharedblocks_set_globals() {
  $values =& drupal_static('sharedblocks_globals');
  if (isset($values)) {
    return;
  }
  else {

    // Set the static to a non-NULL variable so we know that this function was
    // called at least once.
    $values = array();
  }

  // Set the current path to the homepage.
  if ($_GET['q'] != variable_get('site_frontpage', 'node')) {
    $values['q'] = $_GET['q'];
    $_GET['q'] = variable_get('site_frontpage', 'node');
    drupal_static_reset('drupal_is_front_page');
  }

  // Set the current user to anonymous and reset the session.
  if ($GLOBALS['user']->uid > 0) {
    $values['user'] = $GLOBALS['user'];
    $values['session'] = drupal_save_session();
    drupal_save_session(FALSE);
    $GLOBALS['user'] = drupal_anonymous_user();
  }
}