Exemple #1
0
/**
 * 导入组件,比如import("Lib.File.Image");
 * @author linyh
 * @param $className
 * @return bool 是否成功导入
 */
function import($className)
{
    static $cacheClass;
    if (strstr($className, '.') === false) {
        $className = getConfig("classHash", $className);
    }
    // 检查是否导入过
    if (isset($cacheClass[$className])) {
        return true;
    }
    $sEach = explode(".", $className);
    // 检查是否符合要求
    foreach ($sEach as $v) {
        if (!validateVar($v)) {
            trigger_error("需要导入的路径{$v}不符合变量名定义", E_USER_ERROR);
        }
    }
    // 最后一个点之后的内容大小写不变,其他的都变成小写
    $componentPath = '';
    for ($i = 0; $i < sizeof($sEach) - 1; $i++) {
        $componentPath .= strtolower($sEach[$i]) . '/';
    }
    $componentPath .= $sEach[$i] . ".class.php";
    // 按照物理路径导入
    if (require $componentPath) {
        $cacheClass[$className] = true;
        return true;
    } else {
        trigger_error("需要导入的类{$className}未找到:{$componentPath}", E_USER_WARNING);
        return false;
    }
}
Exemple #2
0
<body>

<?php 
require_once 'ossim_conf.inc';
require_once 'classes/Sensor.inc';
/* get conf */
$conf = $GLOBALS["CONF"];
$graph_ntop = $conf->get_conf("graph_link");
$tune = validateVar($_GET['tune']);
$ip = validateVar($_GET['host'], OSS_IP);
$end = validateVar($_GET['end']);
$start = validateVar($_GET['start']);
$zoom = 1;
if ($tune) {
    $hwparam = validateVar($_GET['hwparam']);
    $hwvalue = validateVar($_GET['hwvalue']);
    $what = "tune&hwparam={$hwparam}&hwvalue={$hwvalue}";
} else {
    $what = "anomaly";
}
$param = "{$graph_ntop}?what={$what}&ip={$ip}&start={$start}&end={$end}&zoom={$zoom}&file=";
/* Graphs init */
$htable = array("image_pktSent" => $param . "pktSent", "image_bytesSent" => $param . "bytesSent", "image_bytesSentLoc" => $param . "bytesSentLoc", "image_udpSentLoc" => $param . "udpSentLoc", "image_totCSP" => $param . "totContactedSentPeers", "image_IP_NBios_IPSentBytes" => $param . "IP_NBios-IPSentBytes", "image_pktRcvd" => $param . "pktRcvd", "image_bytesRcvd" => $param . "bytesRcvd", "image_bytesSentRem" => $param . "bytesSentRem", "image_bytesRcvdFromRem" => $param . "bytesRcvdFromRem", "image_tcpSentRem" => $param . "tcpSentRem", "image_udpSentRem" => $param . "udpSentRem", "image_icmpSent" => $param . "icmpSent", "image_tcpRcvdFromRem" => $param . "tcpRcvdFromRem", "image_udpRcvdFromRem" => $param . "udpRcvdFromRem", "image_synPktsSent" => $param . "synPktsSent", "image_web_sessions" => $param . "web_sessions", "image_totContactedRcvdPeers" => $param . "totContactedRcvdPeers", "image_IP_HTTPSentBytes" => $param . "IP_HTTPSentBytes", "image_IP_HTTPRcvdBytes" => $param . "IP_HTTPRcvdBytes", "image_IP_DNSSentBytes" => $param . "IP_DNSSentBytes", "image_IP_DNSRcvdBytes" => $param . "IP_DNSRcvdBytes", "image_IP_DHCP-BOOTPSentBytes" => $param . "IP_DHCP-BOOTPSentBytes");
?>

<div style="font-size: 11pt; font-weight: bold; background-color: #eee;
  color: black;
  border-style: solid;
  border-color: #ddd;
  border-width: 1px;
  padding: 3px;