Same name and namespace in other branches
  1. 4.6.x includes/bootstrap.inc \request_uri()
  2. 4.7.x includes/bootstrap.inc \request_uri()
  3. 5.x includes/bootstrap.inc \request_uri()
  4. 6.x includes/bootstrap.inc \request_uri()

Returns the equivalent of Apache's $_SERVER['REQUEST_URI'] variable.

Because $_SERVER['REQUEST_URI'] is only available on Apache, we generate an equivalent using other environment variables.

16 calls to request_uri()
DBLogTestCase::generateLogEntries in modules/dblog/dblog.test
Generates a number of random database log events.
DBLogTestCase::testDBLogAddAndClear in modules/dblog/dblog.test
Tests the addition and clearing of log events through the admin interface.
DBLogTestCase::testDBLogCorrupted in modules/dblog/dblog.test
Tests corrupted log entries can still display available data.
DBLogTestCase::testDBLogException in modules/dblog/dblog.test
Verifies that exceptions are caught in dblog_watchdog().
drupal_deliver_html_page in includes/common.inc
Packages and sends the result of a page callback to the browser as HTML.

... See full list

7 string references to 'request_uri'
DBLogTestCase::generateLogEntries in modules/dblog/dblog.test
Generates a number of random database log events.
DBLogTestCase::testDBLogAddAndClear in modules/dblog/dblog.test
Tests the addition and clearing of log events through the admin interface.
DBLogTestCase::testDBLogCorrupted in modules/dblog/dblog.test
Tests corrupted log entries can still display available data.
DBLogTestCase::testDBLogException in modules/dblog/dblog.test
Verifies that exceptions are caught in dblog_watchdog().
DBLogTestCase::testLogMessageSanitized in modules/dblog/dblog.test
Make sure HTML tags are filtered out in the log detail page.

... See full list

File

includes/bootstrap.inc, line 1954
Functions that need to be loaded on every Drupal request.

Code

function request_uri() {
  if (isset($_SERVER['REQUEST_URI'])) {
    $uri = $_SERVER['REQUEST_URI'];
  }
  else {
    if (isset($_SERVER['argv'])) {
      $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0];
    }
    elseif (isset($_SERVER['QUERY_STRING'])) {
      $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
    }
    else {
      $uri = $_SERVER['SCRIPT_NAME'];
    }
  }

  // Prevent multiple slashes to avoid cross site requests via the Form API.
  $uri = '/' . ltrim($uri, '/');
  return $uri;
}