aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index f6b8303b6..15baa8fef 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1649,4 +1649,23 @@ function get_branch_from_version($version)
{
return implode('.', array_slice(explode('.', $version), 0, 2));
}
+
+/**
+ * return hostname with gethostbyaddr and keep it in database
+ */
+function get_host($force_update=false)
+{
+ global $conf;
+
+ if (!isset($conf['host']) or $force_update)
+ {
+ $conf['host'] = 'undefined';
+ if ($host = @gethostbyaddr($_SERVER['SERVER_ADDR']))
+ {
+ $conf['host'] = $host;
+ }
+ conf_update_param('host', $conf['host']);
+ }
+ return $conf['host'];
+}
?> \ No newline at end of file