File: 1.15.0a/server/web/monitor.popup.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: ob_start(); 23: 24: // This really should be handled by clever Data API (XML) calls but alas 25: // that is too much work hence the AJAH framework 26: 27: require("include.php"); 28: $NATS->Start(); 29: 30: // Timeskip check - means this page skips timecheck/reset if site.monitor.keepalive is 0 31: if ($NATS->Cfg->Get("site.monitor.keepalive",1)==0) $timeskip=true; 32: else $timeskip=false; 33: 34: if (!$NATS_Session->Check($NATS->DB,$timeskip)) 35: { 36: header("Location: ./?login_msg=Invalid+Or+Expired+Session"); 37: exit(); 38: } 39: if ($NATS_Session->userlevel<1) UL_Error("Monitor Popup"); 40: 41: if (isset($_REQUEST['type'])) $type=$_REQUEST['type']; 42: else $type=""; 43: 44: echo "
"; 45: 46: switch ($type) 47: { 48: case "node": // a node details 49: if (isset($_REQUEST['nodeid'])) 50: { 51: $nodeid=ss($_REQUEST['nodeid']); 52: $node=$NATS->GetNode($nodeid); 53: if ($node===false) echo $NATS->Lang->Item("mon.popup.error"); 54: else 55: { 56: echo ""; 57: echo $node['name']; 58: echo ""; 59: echo " (".$NATS->Lang->Item("mon.goto.node").")"; 60: 61: echo "

";
62: $tests = $NATS->GetNodeTests($nodeid); 63: echo ""; 64: foreach($tests as $testid) 65: { 66: echo "\n"; 77: } 78: echo "
"; 67: $test=$NATS->GetTest($testid); 68: echo ""; 69: echo $test['name']; 70: echo ":"; 71: echo ""; 72: if (is_numeric($test['lastvalue'])) echo round($test['lastvalue'],2); 73: else echo $test['lastvalue']; 74: $c=$testid[0]; 75: if ( is_numeric($c) || ($c=="L") ) echo " ".lUnit($test['testtype']); 76: echo "

\n";
79: 80: echo "".$NATS->Lang->Item("mon.goto.node.page")."
";
81: 82: } 83: } 84: else echo $NATS->Lang->Item("mon.popup.error"); 85: break; 86: default: 87: echo "Incorrect or invalid request type to popup framework"; 88: break; 89: } 90: 91: echo "
";
92: ?>