diff --git a/lib/weblib.php b/lib/weblib.php index c2eb914273f..9c71558a27b 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -228,6 +228,15 @@ function qualified_me() { notify('Warning: could not find the name of this server!'); return false; } + + if (!empty($url['port'])) { + $hostname .= ':'.$url['port']; + } else if (!empty($_SERVER['SERVER_PORT'])) { + if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) { + $hostname .= ':'.$_SERVER['SERVER_PORT']; + } + } + if (isset($_SERVER['HTTPS'])) { $protocol = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; } else if (isset($_SERVER['SERVER_PORT'])) { # Apache2 does not export $_SERVER['HTTPS'] @@ -571,12 +580,12 @@ function link_to_popup_window ($url, $name='popup', $linkname='click here', * @param int $width Height to assign to popup window * @param string $title Text to be displayed as popup page title * @param string $options List of additional options for popup window - * @todo Add code examples and list of some options that might be used. + * @param string $return If true, return as a string, otherwise print * @return string * @uses $CFG */ function button_to_popup_window ($url, $name='popup', $linkname='click here', - $height=400, $width=500, $title='Popup window', $options='none') { + $height=400, $width=500, $title='Popup window', $options='none', $return=false) { global $CFG; @@ -585,8 +594,13 @@ function button_to_popup_window ($url, $name='popup', $linkname='click here', } $fullscreen = 0; - echo '\n"; + $button = '\n"; + if ($return) { + return $button; + } else { + echo $button; + } } @@ -643,7 +657,7 @@ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $sc $attributes .= ' disabled="disabled"'; } - $output = '' . "\n"; if ($nothing) { $output .= '