Пример #1
0
function Events($lim, $in, $op, $st, $co, $mod = 0)
{
    global $link, $modgroup, $self, $bg, $bi, $mico, $mbak, $mlvl, $noiplink;
    global $gralbl, $lstlbl, $levlbl, $timlbl, $tgtlbl, $srclbl, $monlbl, $msglbl, $stalbl, $cfglbl, $cmdlbl, $nonlbl, $clalbl, $limlbl;
    $query = GenQuery('events', 's', 'id,level,time,source,info,class,device,type,readcomm', 'id desc', $lim, $in, $op, $st, $co, 'LEFT JOIN devices USING (device)');
    $res = DbQuery($query, $link);
    if ($res) {
        $nmsg = DbNumRows($res);
        if ($nmsg) {
            $row = 0;
            if ($mod > 1) {
                if ($mod == 2) {
                    ?>
<table class="content"><tr>
<th width="50" class="<?php 
                    echo $modgroup[$self];
                    ?>
2"><img src="img/16/idea.png"><br><?php 
                    echo $levlbl;
                    ?>
</th>
<th class="<?php 
                    echo $modgroup[$self];
                    ?>
2"><img src="img/16/clock.png"><br><?php 
                    echo $timlbl;
                    ?>
</th>
<th class="<?php 
                    echo $modgroup[$self];
                    ?>
2"><img src="img/16/say.png"><br><?php 
                    echo $srclbl;
                    ?>
</th>
<th class="<?php 
                    echo $modgroup[$self];
                    ?>
2"><img src="img/16/find.png"><br>Info</th>
</tr>
<?php 
                }
                while ($m = DbFetchRow($res)) {
                    if ($row % 2) {
                        $bg = "txta";
                        $bi = "imga";
                    } else {
                        $bg = "txtb";
                        $bi = "imgb";
                    }
                    $row++;
                    $time = date($_SESSION['date'], $m[2]);
                    $fd = urlencode(date("m/d/Y H:i:s", $m[2]));
                    $usrc = urlencode($m[3]);
                    $ssrc = substr($m[3], 0, $_SESSION['lsiz']);
                    $sinf = strlen($m[4]) > 60 ? substr($m[4], 0, 60) . "..." : $m[4];
                    if ($mod == 2) {
                        TblRow($bg);
                        echo "<th class=\"" . $mbak[$m[1]] . "\"><a href=Monitoring-Events.php?lvl={$m['1']}>\n";
                        echo "<img src=\"img/16/" . $mico[$m[1]] . ".png\" title=\"" . $mlvl[$m[1]] . "\"></a></th>\n";
                        echo "<td nowrap><a href=Monitoring-Events.php?in[]=time&op[]==&st[]={$fd}>{$time}</a></td><td nowrap>\n";
                        echo "<a href=Monitoring-Events.php?in[]=source&op[]==&st[]={$usrc}>{$ssrc}</a></td><td>{$sinf}</td></tr>\n";
                    } else {
                        # Mobile mode, mh.php
                        echo "<tr class=\"" . $mbak[$m[1]] . "\"><th nowrap>{$ssrc}</th><td nowrap>{$time}</td><td>{$sinf}</td></tr>\n";
                    }
                }
                echo "</table>\n";
            } else {
                ?>
<table class="content"><tr>
<th width="50" class="<?php 
                echo $modgroup[$self];
                ?>
2"><img src="img/16/key.png"><br>Id</th>
<th width="50" class="<?php 
                echo $modgroup[$self];
                ?>
2"><img src="img/16/idea.png" title="10=<?php 
                echo $mlvl['10'];
                ?>
,50=<?php 
                echo $mlvl['50'];
                ?>
, 100=<?php 
                echo $mlvl['100'];
                ?>
, 150=<?php 
                echo $mlvl['150'];
                ?>
, 200=<?php 
                echo $mlvl['200'];
                ?>
, 250=<?php 
                echo $mlvl['250'];
                ?>
"><br><?php 
                echo $levlbl;
                ?>
</th>
<th width="120" class="<?php 
                echo $modgroup[$self];
                ?>
2"><img src="img/16/clock.png"><br><?php 
                echo $timlbl;
                ?>
</th>
<th class="<?php 
                echo $modgroup[$self];
                ?>
2"><img src="img/16/say.png" title="<?php 
                echo $monlbl;
                ?>
 <?php 
                echo $tgtlbl;
                ?>
 || IP (<?php 
                echo $msglbl;
                ?>
 <?php 
                echo $levlbl;
                ?>
 < 50)"><br><?php 
                echo $srclbl;
                ?>
</th>
<th width="50" class="<?php 
                echo $modgroup[$self];
                ?>
2"><img src="img/16/abc.png" title="<?php 
                echo $msglbl;
                ?>
 <?php 
                echo $clalbl;
                ?>
:<?php 
                echo $cmdlbl;
                ?>
"><br><?php 
                echo $clalbl;
                ?>
</th>
<th class="<?php 
                echo $modgroup[$self];
                ?>
2"><img src="img/16/find.png"><br>Info</th>
</tr>
<?php 
                while ($m = DbFetchRow($res)) {
                    if ($row % 2) {
                        $bg = "txta";
                        $bi = "imga";
                    } else {
                        $bg = "txtb";
                        $bi = "imgb";
                    }
                    $row++;
                    $time = date($_SESSION['date'], $m[2]);
                    $fd = urlencode(date("m/d/Y H:i:s", $m[2]));
                    $usrc = urlencode($m[3]);
                    $utgt = urlencode($m[6]);
                    list($ei, $et) = EvClass($m[5]);
                    TblRow($bg);
                    echo "<th><a href=\"Monitoring-Events.php?in[]=id&op[]==&st[]={$m['0']}\">{$m['0']}</a></th>\n";
                    echo "<th class=\"" . $mbak[$m[1]] . "\"><a href=\"Monitoring-Events.php?in[]=level&op[]==&st[]={$m['1']}&co[]={$co['0']}&in[]={$in['1']}&op[]={$op['1']}&st[]=" . urlencode($st[1]) . "\"><img src=\"img/16/" . $mico[$m[1]] . ".png\" title=\"" . $mlvl[$m[1]] . "\"></a></th>\n";
                    echo "<td nowrap><a href=\"Monitoring-Events.php?in[]=time&op[]==&st[]={$fd}\">{$time}</a></td>\n";
                    if ($m[7] == 'NeDi Agent') {
                        $agnt = "{$m['8']}://{$utgt}/";
                        $alnk = "on <a href=\"Devices-Status.php?dev={$utgt}\">{$utgt}</a> ";
                    } else {
                        $agnt = "";
                        $alnk = "";
                    }
                    echo "<td><a href=\"Monitoring-Events.php?in[]=source&op[]==&st[]={$usrc}\"><b>{$m['3']}</b></a> {$alnk}</td>\n";
                    $action = "<a href=\"{$agnt}Devices-Status.php?dev={$usrc}&pop=1\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, Device {$stalbl}\"></a>";
                    if ($m[5] == "node") {
                        # Syslog from a node
                        $action = "<a href=\"{$agnt}Nodes-List.php?in[]=name&op[]==&st[]={$m['3']}\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, Node {$lstlbl}\"></a>";
                    } elseif ($m[3] == "NeDi") {
                        # Not related to a dev or node!
                        $action = "<a href=\"{$agnt}System-Files.php\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, NeDi {$cfglbl}\"></a>";
                    } elseif ($m[5] == "moni") {
                        # Monitoring events
                        $action = "<a href=\"{$agnt}Monitoring-Setup.php?in[]=name&op[]=%3D&st[]={$usrc}\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, Monitoring Setup\"></a>";
                    } elseif ($m[5] == "cfgn" or $m[5] == "cfgc") {
                        # New config or changes
                        $action = "<a href=\"Devices-Config.php?shc={$usrc}\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, Device {$cfglbl}\"></a>";
                    } elseif (strpos($m[5], "trf") !== FALSE) {
                        # Traffic warnings or alerts
                        $action = "<a href=\"{$agnt}Devices-Status.php?dev={$usrc}&trg=1&erg=1\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, Device {$stalbl}\"></a>";
                    } elseif ($m[1] < 50) {
                        $action = "<a href=\"{$agnt}Nodes-List.php?in[]=nodip&op[]==&st[]={$m['3']}\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, Node {$lstlbl}\"></a>";
                    } elseif ($m[5] == "ip") {
                        # syslog from unmonitored source
                        $action = "<img src=\"img/16/{$ei}.png\" title=\"{$et} ->{$msglbl} {$clalbl} {$m['5']}\">";
                    } elseif ($m[5] == "secs") {
                        # Security Stolen
                        $action = "<a href=\"{$agnt}Nodes-Stolen.php\"><img src=\"img/16/{$ei}.png\" title=\"{$et}, Nodes Stolen\"></a>";
                    }
                    echo "<th class=\"{$bi}\">{$action}</th><td>";
                    if ($noiplink) {
                        $info = preg_replace('/[\\s:]([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})(\\s|:|,|$)/', " <span class=\"blu\">\$1</span> ", $m[4]);
                        echo preg_replace('/[\\s:]([0-9a-f]{4}[\\.-]?[0-9a-f]{4}[\\.-]?[0-9a-f]{4}|[0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2})(\\s|$)/', " <span class=\"mrn\">\$1</span> ", $info);
                    } else {
                        $info = preg_replace('/[\\s:]([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})(\\s|:|,|$)/', " <span class=\"blu\">\$1</span>\n\t\t\t\t\t\t<a href=\"Nodes-Toolbox.php?Dest=\$1\"><img src=\"img/16/dril.png\" title=\"Lookup\"></a>\n\t\t\t\t\t\t<a href=\"Nodes-List.php?in[]=nodip&op[]=%3D&st[]=\$1\"><img src=\"img/16/nods.png\" title=\"Nodes {$lstlbl}\"></a>\n\t\t\t\t\t\t<a href=\"?in[]=info&op[]=~&st[]=\$1\"><img src=\"img/16/bell.png\" title=\"Monitoring-Events\"></a>", $m[4]);
                        echo preg_replace('/[\\s:]([0-9a-f]{4}[\\.-]?[0-9a-f]{4}[\\.-]?[0-9a-f]{4}|[0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2}[-:][0-9a-f]{2})(\\s|$)/', " <span class=\"mrn\">\$1</span> <a href=\"Nodes-Status.php?mac=\$1\"><img src=\"img/16/node.png\" title=\"Node {$stalbl}\"></a> ", $info);
                    }
                    echo "</td></tr>\n";
                }
                ?>
</table>
<table class="content">
<tr><td class="<?php 
                echo $modgroup[$self];
                ?>
2"><?php 
                echo $row;
                ?>
 <?php 
                echo $msglbl;
                echo $lim ? ", {$limlbl}: {$lim}" : "";
                ?>
</td></tr>
</table>
<?php 
            }
        } else {
            echo "<p><h5>{$nonlbl}</h5>";
        }
        DbFreeResult($res);
    } else {
        print DbError($link);
    }
}
Пример #2
0
				$ifstat = "alrm";
			}
		}else{
			$ifstat = "imga";
		}
		if($rport == $po){$rpimg = "<img src=\"img/16/home.png\" title=Rootport>";}
		if($pstate[$po] == 1 or $pstate[$po] == "disabled"){$pst = "<img src=\"img/16/bcls.png\" title=\"STP disabled\">";}
		elseif($pstate[$po] == 2 or $pstate[$po] == "blocking"){$pst = "<img src=\"img/16/bstp.png\" title=\"STP blocking\">";}
		elseif($pstate[$po] == 3 or $pstate[$po] == "listening"){$pst = "<img src=\"img/16/bup.png\" title=\"STP listening\">";}
		elseif($pstate[$po] == 4 or $pstate[$po] == "learning"){$pst = "<img src=\"img/16/brld.png\" title=\"STP learning\">";}
		elseif($pstate[$po] == 5 or $pstate[$po] == "forwarding"){$pst = "<img src=\"img/16/brgt.png\" title=\"STP forwarding\">";}
		else{$pst = "<img src=\"img/16/bcls.png\" title=\"broken\">";}

		$ui = urlencode($ifn[$ix]);
		list($ifimg,$iftit) = Iftype($ift[$ix]);
		TblRow($bg);
		echo "<th class=\"$ifstat\" width=\"20\"><img src=\"img/$ifimg\" title=\"$ix - $iftit\"></th>\n";
		echo "<th class=\"$bi\"  width=\"20\">$pst $sten $rpimg</th><td>\n";
		if($ifstat == "good" and $guiauth != 'none' and !isset($_GET['print'])){
			echo "<div style=\"font-weight: bold\" class=\"blu\" title=\"$rltlbl $trflbl\" onclick=\"window.open('inc/rt-popup.php?d=$debug&ip=$ip&v=$rv&c=$rc&i=$ix&t=$ud&in=$ui','$ip_$ix','scrollbars=0,menubar=0,resizable=1,width=600,height=400')\">$ifn[$ix]</div></td>\n";
		}else{
			echo "<b>$ifn[$ix]</b></td>\n";
		}
		echo "<td align=\"right\">$pcost[$po]</td><td align=\"right\">".DecFix($ifs[$ix])."</td><td>$ifi[$ix]</td>\n";
		if($shg){
			echo "<td nowrap align=\"center\">\n";
			IfGraphs($ud, $ui, $ifs[$i], ($_SESSION['gsiz'] == 4)?2:1 );
			echo "</td>";
		}
		echo "</tr>\n";
	}
Пример #3
0
function VlanEmpty($ina, $opa, $sta, $lim, $ord)
{
    global $link, $modgroup, $self, $verb1, $srtlbl, $lstlbl, $loclbl, $locsep, $conlbl, $emplbl;
    ?>
<h2><?php 
    echo $verb1 ? "{$emplbl} Vlans" : "Vlans {$emplbl}";
    ?>
</h2>

<table class="content"><tr class="<?php 
    echo $modgroup[$self];
    ?>
2">
<th colspan="2" width="20%"><img src="img/16/dev.png"><br>Device</th>
<th><img src="img/16/vlan.png"><br>Vlan <?php 
    echo $lstlbl;
    ?>
</th></tr>
<?php 
    if ($ord) {
        $ocol = 'vlans.vlanid';
        $srt = "{$srtlbl}: Vlan";
    } else {
        $ocol = 'vlans.device';
        $srt = "{$srtlbl}: Device";
    }
    if ($ina == "device") {
        $ina = "vlans.device";
    }
    if ($ina == "vlanid") {
        $ina = "vlans.vlanid";
    }
    $query = GenQuery('vlans', 's', 'vlans.device,vlans.vlanid,vlans.vlanname,contact,location,icon', $ocol, $lim, array('mac', $ina), array('COL IS', $opa), array('NULL', $sta), array('AND'), 'LEFT JOIN nodes on (vlans.device = nodes.device and vlans.vlanid = nodes.vlanid) LEFT JOIN devices on (vlans.device = devices.device)');
    $res = DbQuery($query, $link);
    if ($res) {
        $row = 0;
        $nif = 0;
        while ($r = DbFetchRow($res)) {
            $curi = "<img src=\"img/chip.png\" title=\"{$r['2']}\">{$r['1']} ";
            if ($r[0] == $prev) {
                echo $curi;
                $nif++;
            } else {
                $prev = $r[0];
                if ($row % 2) {
                    $bg = "txta";
                    $bi = "imga";
                } else {
                    $bg = "txtb";
                    $bi = "imgb";
                }
                $row++;
                $l = explode($locsep, $r[3]);
                $ico = $r[5] ? "dev/{$r['5']}" : "32/bbox";
                TblRow($bg);
                echo "<th class=\"{$bi}\"><a href=\"Devices-Status.php?dev=" . urlencode($r[0]) . "\"><img src=\"img/{$ico}.png\" title=\"{$conlbl}: {$r['2']}, {$loclbl}: {$l['0']} {$l['1']} {$l['2']}\"></a></th>\n";
                echo "<td><b>" . substr($r[0], 0, $_SESSION['lsiz']) . "</b></td>\n";
                echo "<td>{$curi} ";
                $nif++;
            }
        }
        echo "</td></tr></table>\n";
    }
    ?>
<table class="content" >
<tr class="<?php 
    echo $modgroup[$self];
    ?>
2"><td><?php 
    echo $nif;
    ?>
 Vlans, <?php 
    echo $row;
    ?>
 Devices, <?php 
    echo $srt;
    ?>
</td></tr>
</table>
<p>
<?php 
}
Пример #4
0
TblCell($sdr, "", 'align="right"');
TblCell($sda, "", 'align="right"');
echo "</tr>\n";
TblRow('txtb');
TblCell("{$nonlbl}-SNMP Devices");
TblCell($ndv[0], "", 'align="right"');
TblCell($ndr, "", 'align="right"');
TblCell($nda, "", 'align="right"');
echo "</tr>\n";
TblRow('txta');
TblCell('Nodes');
TblCell($nod[0], "", 'align="right"');
TblCell($nor, "", 'align="right"');
TblCell($noa, "", 'style="border-bottom:solid 1px #444" align="right"');
echo "</tr>\n";
TblRow('txtb');
TblCell($totlbl, '', 'align="right"', '', 'th');
echo "<td></td><td >";
if (isset($_GET['print'])) {
    echo $cul;
} else {
    echo "Currency <select size=\"1\" name=\"cu\" onchange=\"this.form.submit();\">\n";
    echo "<option value=\"u\"" . ($cu == "u" ? " selected" : "") . ">USD\n";
    echo "<option value=\"e\"" . ($cu == "e" ? " selected" : "") . ">EUR\n";
    echo "<option value=\"c\"" . ($cu == "c" ? " selected" : "") . ">CHF\n";
    echo "</select>\n";
}
echo "</td>";
TblCell($tot, '', 'style="border-bottom:double 4px #444" align="right"', '', 'th');
?>
</tr>
Пример #5
0
function DirList($dir,$opt,$lvl){
	
	global $row,$sub,$upllbl,$levlbl,$dellbl,$edilbl,$cfmmsg,$isadmin;

	$tsiz = 0;
	$ed   = '';
	foreach (glob("$dir/*") as $f){
		if ($row % 2){$bg = "txta"; $bi = "imga";}else{$bg = "txtb"; $bi = "imgb";}
		$row++;
		$plen = strlen($dir);
		$t = substr($f,$plen+1);
		TblRow($bg);
		echo "<td class=\"$bi\" width=\"20\" nowrap>";
		$i=0;
		while ($i < $lvl) {
			echo "<img src=\"img/sub.png\">";
			$i++;
		}
		$i=0;
		if(is_dir($f)){
			if($lvl and $opt == "web"){
				echo "<a href=\"?sub=$f&mde=o\"><img src=\"img/16/".(($f == $sub)?'foye':'fogy').".png\" title=\"$upllbl $levlbl $lvl\"></a></td>";
			}else{
				echo "<img src=\"img/16/fogy.png\" title=\"Folder $levlbl $lvl\">";
			}
			echo "</td><td colspan=\"4\">$t";
			if($isadmin){
				echo "<span style=\"float:right\"><a href=\"?del=".urlencode($f)."\"> <img src=\"img/16/bcnl.png\" onclick=\"return confirm('$dellbl, $cfmmsg')\" title=\"$dellbl!\"></a></span>";
			}
			echo "</td></tr>\n";
			$tsiz += DirList("$dir/$t",$opt,$lvl+1);
		}else{
			list($ico,$ed) = FileImg($f);
			echo "$ico</td><td>";
			if($opt == "web"){
				echo "<a href=\"$f\" target=\"window\">$t</a></td>";
			}else{
				echo "$t</td>";
			}
			$siz = filesize($f);
			$tsiz += $siz;
			echo "<td align=\"right\">".DecFix($siz)."</td><td align=\"right\">".date ($_SESSION['date'],filemtime($f))."<td align=\"right\">";
			if($isadmin){
				if($opt == "tftp" and $ed){
					echo "<a href=\"?tft=".urlencode($t)."\"><img src=\"img/16/note.png\" title=\"$edilbl\"></a>";
				}
				echo "<a href=\"?del=".urlencode($f)."\"><img src=\"img/16/bcnl.png\" onclick=\"return confirm('$dellbl, $cfmmsg')\" title=\"$dellbl!\"></a>";
			}
			echo "</td></tr>\n";
		}
	}
	return $tsiz;
}