Пример #1
0
        $icon = $iconbg != '' && $iconbg != 'transparent' ? $icon . "#" . $iconbg : $icon;
        $params = array($name, $url, $type, $type_name, $iconsize, $icon, $ri_id);
        $icon_query = ", icon= ?";
    } else {
        $params = array($name, $url, $type, $type_name, $iconsize, $ri_id);
        $icon_query = '';
    }
    $update_status = FALSE;
    if ($ri_id != '' && $name != '') {
        $query = "UPDATE risk_indicators set name= ?, url = ?, type= ?, type_name= ?, size= ? " . $icon_query . " WHERE id= ?";
        $conn->Execute($query, $params);
        $update_status = TRUE;
    }
}
foreach ($delete_list as $idb) {
    $host_types = array("host", "server", "sensor");
    list($name, $sensor, $type, $ips, $in_assets) = get_assets($conn, $idb[2], $idb[1], $host_types);
    $type = fix_type($type);
    $query = "DELETE FROM bp_asset_member WHERE member = UNHEX(?) AND type = ?";
    $params = array($name, $type);
    $conn->Execute($query, $params);
    $query = "DELETE FROM risk_indicators WHERE id= ?";
    $conn->Execute($query, array($idb[0]));
    $update_status == TRUE;
}
if ($update_status == TRUE) {
    $data['data'] = 'refresh_indicators();';
}
echo json_encode($data);
shell_exec('/usr/bin/sudo /usr/share/ossim/scripts/framework-restart > /dev/null 2>/dev/null &');
$db->close();
Пример #2
0
        exit;
    }
    $sql = "SELECT last_insert_id() AS id";
    $rs = $conn->Execute($sql);
    if (!$rs) {
        Av_exception::write_log(Av_exception::DB_ERROR, $conn->ErrorMsg());
        exit;
    }
    if (!$rs->EOF) {
        $id = $rs->fields['id'];
        echo "OK###drawRect('{$id}','{$url}',100,100,50,50);\n";
    }
} else {
    $icon = $iconbg != '' && $iconbg != 'transparent' ? $chosen_icon . "#" . $iconbg : $chosen_icon;
    if (!empty($asset_type)) {
        $asset_type_aux = fix_type($asset_type);
        $params = array($asset_id, $asset_type_aux);
        $sql = "SELECT HEX(member), type FROM bp_asset_member WHERE member = UNHEX(?) AND type = ?";
        $rs = $conn->Execute($sql, $params);
        if (!$rs) {
            Av_exception::write_log(Av_exception::DB_ERROR, $conn->ErrorMsg());
            exit;
        }
        if ($rs->RecordCount() == "0") {
            // check if asset exist
            $sql = "INSERT INTO bp_asset_member (id, member, type) VALUES (0, UNHEX(?), ?)";
            $rs = $conn->Execute($sql, $params);
            if (!$rs) {
                Av_exception::write_log(Av_exception::DB_ERROR, $conn->ErrorMsg());
                exit;
            }