Skip to content

Commit

Permalink
FIxes to qualified_me suggested by Greg Barnett
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Sep 14, 2004
1 parent d2481a4 commit f77c261
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,26 @@ function me() {
function qualified_me() {
/// like me() but returns a full URL

if (!empty($_SERVER["HTTP_HOST"])) {
$hostname = $_SERVER["HTTP_HOST"];
} else if (!empty($_ENV["HTTP_HOST"])) {
$hostname = $_ENV["HTTP_HOST"];
} else if (!empty($_SERVER["SERVER_NAME"])) {
if (!empty($_SERVER["SERVER_NAME"])) {
$hostname = $_SERVER["SERVER_NAME"];
} else if (!empty($_ENV["SERVER_NAME"])) {
$hostname = $_ENV["SERVER_NAME"];
} else if (!empty($_SERVER["HTTP_HOST"])) {
$hostname = $_SERVER["HTTP_HOST"];
} else if (!empty($_ENV["HTTP_HOST"])) {
$hostname = $_ENV["HTTP_HOST"];
} else {
notify("Warning: could not find the name of this server!");
return false;
}
if (isset($_SERVER['HTTPS'])) {
$protocol = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
} else if (isset($_SERVER['SERVER_PORT'])) { # Apache2 does not export $_SERVER['HTTPS']
$protocol = ($_SERVER['SERVER_PORT'] == '443') ? 'https://' : 'http://';
} else {
$protocol = 'http://';
}

$protocol = (isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$url_prefix = $protocol.$hostname;
return $url_prefix . me();
}
Expand Down

0 comments on commit f77c261

Please sign in to comment.