Project

General

Profile

Bug #16113 ยป uname.diff

Administrator Admin, 2006-05-08 21:29

View differences:

class.t3lib_div-uname.php 2006-05-08 21:00:29.000000000 +0200
return $bInfo;
}
/**
* Get the fully-qualified domain name of the host.
* Usage: 2
*
* @param boolean Use request host (when not in CLI mode).
* @return string The fully-qualified host name.
*/
function getHostname($requestHost=TRUE) {
$host = '';
if ($requestHost && (!defined('TYPO3_cliMode') || !TYPO3_cliMode)) {
$host = $_SERVER['HTTP_HOST'];
}
if (!$host) {
// will fail for PHP 4.1 and 4.2
$host = @php_uname('n');
// 'n' is ignored in broken installations
if (strpos($host, ' ')) $host = '';
}
// we have not found a FQDN yet
if ($host && strpos('.',$host) === FALSE) {
$ip = gethostbyname($host);
$fqdn = gethostbyaddr($ip);
if ($ip != $fqdn) $host = $fqdn;
}
if (!$host) $host = 'localhost';
return $host;
}
......
// for CLI logging name is <fqdn-hostname>:<TYPO3-path>
if (defined('TYPO3_cliMode') && TYPO3_cliMode) {
// find FQDN
$host = php_uname('n');
if (strpos($host,'.') === FALSE) {
$ip = gethostbyname($host);
$fqdn = gethostbyaddr($ip);
if ($ip != $fqdn) $host = $fqdn;
}
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = $TYPO3_CONF_VARS['SYS']['systemLogHost'] = $host.':'.PATH_site;
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = t3lib_div::getHostname(FALSE).':'.PATH_site;
}
// for Web logging name is <protocol>://<request-hostame>
// for Web logging name is <protocol>://<request-hostame>/<site-path>
else {
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST');
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
}
// init custom logging
-- class.t3lib_htmlmail.php 2006-04-26 18:24:54.000000000 +0200
++ class.t3lib_htmlmail-uname.php 2006-05-08 21:11:05.000000000 +0200
......
global $TYPO3_CONF_VARS;
// Sets the message id
$host = php_uname('n');
if (strpos('.',$host) === FALSE) {
$host = gethostbyaddr(gethostbyname($host));
}
$host = t3lib_div::getHostname();
if (!$host || $host == '127.0.0.1' || $host == 'localhost') {
$host = ($TYPO3_CONF_VARS['SYS']['sitename'] ? preg_replace('/[^A-Za-z0-9_\-]/', '_', $TYPO3_CONF_VARS['SYS']['sitename']) : 'localhost') . '.TYPO3';
}
......
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_htmlmail.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_htmlmail.php']);
}
?>
?>
    (1-1/1)