Exemplo n.º 1
0
function make_where($conn, $arr)
{
    include_once "../report/plugin_filters.php";
    $w = "";
    foreach ($arr as $cat => $scs) {
        $id = GetPluginCategoryID($cat, $conn);
        $w .= "(c.cat_id={$id}";
        $ids = array();
        foreach ($scs as $scat) {
            $ids[] = GetPluginSubCategoryID($scat, $id, $conn);
        }
        if (count($ids) > 0) {
            $w .= " AND c.id in (" . implode(",", $ids) . ")";
        }
        $w .= ") OR ";
    }
    return $w != "" ? "AND (" . preg_replace("/ OR \$/", "", $w) . ")" : "";
}
Exemplo n.º 2
0
foreach ($atoms as $atom) {
    $atom = trim($atom);
    $atom = str_replace("src_ip=", "src=", $atom);
    $atom = str_replace("dst_ip=", "dst=", $atom);
    if (preg_match("/product_type(\\!?\\=)(.+)/", $atom, $matches)) {
        $source_type = $matches[2];
        $a = str_replace("product_type" . $matches[1] . $matches[2], "taxonomy" . $matches[1] . "'" . $source_type . "-0-0'", $a);
    }
    if (preg_match("/(category|event_category)(\\!?\\=)(.+)/", $atom, $matches)) {
        $cat = str_replace("SPACESCAPE", " ", $matches[3]);
        $subcat = "";
        if (preg_match("/([^\\-]+)\\-(.+)/", $cat, $catfound)) {
            $cat = $catfound[1];
            $subcat = $catfound[2];
        }
        $category_id = GetPluginCategoryID($cat, $conn);
        $subcategory_id = GetPluginSubCategoryID($subcat, $category_id, $conn);
        $a = str_replace($matches[1] . $matches[2] . $matches[3], "taxonomy" . $matches[2] . "'-{$category_id}-{$subcategory_id}'", $a);
    }
    if (preg_match("/(plugin|datasource)(\\!?\\=)(.+)/", $atom, $matches)) {
        $plugin_name = str_replace('\\\\', '\\', str_replace('\\"', '"', $matches[3]));
        $query = "select id from plugin where name like '" . $plugin_name . "%' order by id";
        if (!($rs =& $conn->Execute($query))) {
            print $conn->ErrorMsg();
            exit;
        }
        if ($plugin_id = $rs->fields["id"] != "") {
            $plugin_id = $rs->fields["id"];
        } else {
            $plugin_id = $matches[3];
        }