File:
1.15.3a/server/base/testtext.inc.php (
View as Code)
1: 2: /* -------------------------------------------------------------
3: This file is part of FreeNATS
4:
5: FreeNATS is (C) Copyright 2008-2010 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 $NATS->Lang->Item("web.size");
29: //case "tcp": return "TCP Port Test";
30: case "testloop": return $NATS->Lang->Item("test.loop");
31: case "wtime": return $NATS->Lang->Item("web.time");
32: case "ICMP": return $NATS->Lang->Item("node.ping");
33: case "ping": return $NATS->Lang->Item("remote.ping");
34: case "testrand": return $NATS->Lang->Item("test.random");
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 $NATS->Lang->Item("dns.host");
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",$NATS->Lang->Item("untested"));
86: return $NATS->Lang->Item("untested");
87: case 0:
88: if ($n) return $NATS->Cfg->Get("site.text.passed",$NATS->Lang->Item("passed"));
89: return $NATS->Lang->Item("passed");
90: case 1:
91: if ($n) return $NATS->Cfg->Get("site.text.warning",$NATS->Lang->Item("warning"));
92: return $NATS->Lang->Item("warning");
93: case 2:
94: if ($n) return $NATS->Cfg->Get("site.text.failed",$NATS->Lang->Item("failed"));
95: return $NATS->Lang->Item("failed");
96: default:
97: if ($n) return $NATS->Cfg->Get("site.text.unknown",$NATS->Lang->Item("unknown"));
98: return $NATS->Lang->Item("unknown");
99: }
100: }
101: ?>