drupal_detect_baseurl

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/install.inc, строка 126

Версии
5 – 6
drupal_detect_baseurl($file = 'install.php')

Auto detect the base_url with PHP predefined variables.

Параметры

$file The name of the file calling this function so we can strip it out of the URI when generating the base_url.

Возвращаемое значение

The auto-detected $base_url that should be configured in settings.php

Код

<?php
function drupal_detect_baseurl($file = 'install.php') {
  global $profile;
  $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://';
  $host = $_SERVER['SERVER_NAME'];
  $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'. $_SERVER['SERVER_PORT']);
  $uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']);
  $dir = str_replace("/$file", '', $uri);

  return "$proto$host$port$dir";
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему