File: 1.00.6a/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: global $NATS; 26: switch ($test) 27: { 28: case "web": return "Web Size"; 29: case "tcp": return "TCP Port Test"; 30: case "testloop": return "Test Loop"; 31: case "wtime": return "Web Time"; 32: case "ICMP": return "Node Ping"; 33: case "ping": return "Remote Ping Test"; 34: case "testrand": return "Test Random Return"; 35: //case "mysql": return "MySQL"; 36: //case "mysqlrows": return "MySQL Rows"; 37: //case "imap": return "IMAP"; 38: //case "smtp": return "SMTP"; 39: case "host": return "Host Lookup"; 40: //case "dns": return "DNS Query"; 41: default: 42: if (isset($NATS)) 43: { 44: if (isset($NATS->Tests->QuickList[$test])) return $NATS->Tests->QuickList[$test]; 45: } 46: return $test; 47: } 48: } 49: 50: function lUnit($test) 51: { 52: global $NATS; 53: switch ($test) 54: { 55: case "web": case "wsize": return "KiloBytes"; 56: case "tcp": return "Pass/Fail"; 57: case "testloop": return ""; 58: case "wtime": return "Seconds"; 59: case "ICMP": case "ping": 60: if ($NATS->Cfg->Get("test.icmp.returnms",0)==1) return "Milliseconds"; 61: else return "Seconds"; 62: 63: case "testrand": return ""; 64: //case "imap": return "Seconds"; 65: //case "smtp": return "Seconds"; 66: //case "mysql": return "Seconds"; 67: //case "mysqlrows": return "Rows"; 68: case "host": return "Seconds"; 69: //case "dns": return "Seconds"; 70: default: 71: if (isset($NATS)) 72: return $NATS->Tests->Units($test); 73: return ""; 74: } 75: } 76: 77: function oText($val) 78: { 79: global $NATS; 80: if (isset($NATS)) $n=true; 81: else $n=false; 82: switch ($val) 83: { 84: case -1: 85: if ($n) return $NATS->Cfg->Get("site.text.untested","Untested"); 86: return "Untested"; 87: case 0: 88: if ($n) return $NATS->Cfg->Get("site.text.passed","Passed"); 89: return "Passed"; 90: case 1: 91: if ($n) return $NATS->Cfg->Get("site.text.warning","Warning"); 92: return "Warning"; 93: case 2: 94: if ($n) return $NATS->Cfg->Get("site.text.failed","Failed"); 95: return "Failed"; 96: default: 97: if ($n) return $NATS->Cfg->Get("site.text.unknown","Unknown"); 98: return "Unknown"; 99: } 100: } 101: ?>