File: 0.04.15b/server/base/testtext.inc.php (View as HTML)

  1: <?php
  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: 	default: return $test;
 39: 	}
 40: }
 41: 
 42: function lUnit($test)
 43: {
 44: global $NATS;
 45: switch ($test)
 46: 	{
 47: 	case "web": case "wsize": return "KiloBytes";
 48: 	case "tcp": return "Pass/Fail";
 49: 	case "testloop": return "";
 50: 	case "wtime": return "Seconds";
 51: 	case "ICMP": case "ping": 
 52: 				if ($NATS->Cfg->Get("test.icmp.returnms",0)==1) return "Milliseconds";
 53: 				else return "Seconds";
 54: 
 55: 	case "testrand": return "";
 56: 	case "imap": return "Seconds";
 57: 	case "smtp": return "Seconds";
 58: 	case "mysql": return "Seconds";
 59: 	case "mysqlrows": return "Rows";
 60: 	default: return "";
 61: 	}
 62: }
 63: 
 64: function oText($val)
 65: {
 66: global $NATS;
 67: if (isset($NATS)) $n=true;
 68: else $n=false;
 69: switch ($val)
 70: 	{
 71: 	case -1: 
 72: 		if ($n) return $NATS->Cfg->Get("site.text.untested","Untested");
 73: 		return "Untested";
 74: 	case 0:
 75: 		if ($n) return $NATS->Cfg->Get("site.text.passed","Passed"); 
 76: 		return "Passed";
 77: 	case 1: 
 78: 		if ($n) return $NATS->Cfg->Get("site.text.warning","Warning");
 79: 		return "Warning";
 80: 	case 2: 
 81: 		if ($n) return $NATS->Cfg->Get("site.text.failed","Failed");
 82: 		return "Failed";
 83: 	default:
 84: 		if ($n) return $NATS->Cfg->Get("site.text.unknown","Unknown"); 
 85: 		return "Unknown";
 86: 	}
 87: }	
 88: ?>