File: 0.04.20a/server/base/testtext.inc.php (View as Code)

1: 2: /* ------------------------------------------------------------- 3: This file is part of FreeNATS 4: 5: FreeNATS is (C) Copyright 2008 PurplePixie Systems 6: 7: FreeNATS is free software: you can redistribute it and/or modify 8: it under the terms of the GNU General Public License as published by 9: the Free Software Foundation, either version 3 of the License, or 10: (at your option) any later version. 11: 12: FreeNATS is distributed in the hope that it will be useful, 13: but WITHOUT ANY WARRANTY; without even the implied warranty of 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15: GNU General Public License for more details. 16: 17: You should have received a copy of the GNU General Public License 18: along with FreeNATS. If not, see www.gnu.org/licenses 19: 20: For more information see www.purplepixie.org/freenats 21: -------------------------------------------------------------- */ 22: 23: function lText($test) 24: { 25: switch ($test) 26: { 27: case "web": return "Web Size"; 28: case "tcp": return "TCP Port Test"; 29: case "testloop": return "Test Loop"; 30: case "wtime": return "Web Time"; 31: case "ICMP": return "Node Ping"; 32: case "ping": return "Remote Ping Test"; 33: case "testrand": return "Test Random Return"; 34: case "mysql": return "MySQL"; 35: case "mysqlrows": return "MySQL Rows"; 36: case "imap": return "IMAP"; 37: case "smtp": return "SMTP"; 38: case "host": return "Host Lookup"; 39: case "dns": return "DNS Query"; 40: default: return $test; 41: } 42: } 43: 44: function lUnit($test) 45: { 46: global $NATS; 47: switch ($test) 48: { 49: case "web": case "wsize": return "KiloBytes"; 50: case "tcp": return "Pass/Fail"; 51: case "testloop": return ""; 52: case "wtime": return "Seconds"; 53: case "ICMP": case "ping": 54: if ($NATS->Cfg->Get("test.icmp.returnms",0)==1) return "Milliseconds"; 55: else return "Seconds"; 56: 57: case "testrand": return ""; 58: case "imap": return "Seconds"; 59: case "smtp": return "Seconds"; 60: case "mysql": return "Seconds"; 61: case "mysqlrows": return "Rows"; 62: case "host": return "Seconds"; 63: case "dns": return "Seconds"; 64: default: return ""; 65: } 66: } 67: 68: function oText($val) 69: { 70: global $NATS; 71: if (isset($NATS)) $n=true; 72: else $n=false; 73: switch ($val) 74: { 75: case -1: 76: if ($n) return $NATS->Cfg->Get("site.text.untested","Untested"); 77: return "Untested"; 78: case 0: 79: if ($n) return $NATS->Cfg->Get("site.text.passed","Passed"); 80: return "Passed"; 81: case 1: 82: if ($n) return $NATS->Cfg->Get("site.text.warning","Warning"); 83: return "Warning"; 84: case 2: 85: if ($n) return $NATS->Cfg->Get("site.text.failed","Failed"); 86: return "Failed"; 87: default: 88: if ($n) return $NATS->Cfg->Get("site.text.unknown","Unknown"); 89: return "Unknown"; 90: } 91: } 92: ?>