From aa91161d1ae78ea347410b64658fc581abb2a35c Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Mon, 14 May 2012 12:55:19 +0000 Subject: [PATCH] allow the ability to rewrite locations git-svn-id: http://www.observium.org/svn/observer/trunk@3180 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/defaults.inc.php | 5 +++++ includes/polling/system.inc.php | 7 +++++++ includes/rewrites.php | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 141add720..f1eb09681 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -269,6 +269,11 @@ $config['nfsen_enable'] = 0; #$config['nfsen_rrds'] = "/var/nfsen/profiles-stat/live/"; #$config['nfsen_suffix'] = "_yourdomain_com"; +### Location Mapping +### Use this feature to map ugly locations to pretty locations +#config['location_map']['Under the Sink'] = "Under The Sink, The Office, London, UK"; + + ### Ignores & Allows # Has to be lowercase diff --git a/includes/polling/system.inc.php b/includes/polling/system.inc.php index 27a9f685b..23b1dc26d 100755 --- a/includes/polling/system.inc.php +++ b/includes/polling/system.inc.php @@ -82,6 +82,13 @@ } $poll_device['sysLocation'] = str_replace("\"","", $poll_device['sysLocation']); + + /// Rewrite sysLocation if there is a mapping array (database too?) + if(!empty($poll_device['sysLocation']) && is_array($config['location_map'])) + { + $poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']); + } + $poll_device['sysContact'] = str_replace("\"","", $poll_device['sysContact']); if ($poll_device['sysLocation'] == "not set") diff --git a/includes/rewrites.php b/includes/rewrites.php index ac9014b6a..38e6b7ffb 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -1,5 +1,21 @@