'id_module_group', 'order' => 'ASC'); switch ($sortField) { case 'name': switch ($sort) { case 'up': $selectNameUp = $selected; switch ($config["dbtype"]) { case "mysql": case "postgresql": $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC'); break; case "oracle": $order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'ASC'); break; } break; case 'down': $selectNameDown = $selected; switch ($config["dbtype"]) { case "mysql": case "postgresql": $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC'); break; case "oracle": $order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'DESC'); break; } break; } break; case 'type': switch ($sort) { case 'up': $selectTypeUp = $selected; $order[] = array('field' => 'tagente_modulo.id_tipo_modulo', 'order' => 'ASC'); break; case 'down': $selectTypeDown = $selected; $order[] = array('field' => 'tagente_modulo.id_tipo_modulo', 'order' => 'DESC'); break; } break; case 'interval': switch ($sort) { case 'up': $selectIntervalUp = $selected; $order[] = array('field' => 'tagente_modulo.module_interval', 'order' => 'ASC'); break; case 'down': $selectIntervalDown = $selected; $order[] = array('field' => 'tagente_modulo.module_interval', 'order' => 'DESC'); break; } break; case 'timestamp': switch ($sort) { case 'up': $selectTimestampUp = $selected; $order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC'); break; case 'down': $selectTimestampDown = $selected; $order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC'); break; } break; case 'data': switch ($sort) { case 'up': $selectDataUp = $selected; $order[] = array('field' => 'tagente_estado.datos', 'order' => 'ASC'); break; case 'down': $selectDataDown = $selected; $order[] = array('field' => 'tagente_estado.datos', 'order' => 'DESC'); break; } break; break; default: $selectNameUp = $selected; $selectNameDown = ''; $selectTypeUp = ''; $selectTypeDown = ''; $selectIntervalUp = ''; $selectIntervalDown = ''; $selectTimestampUp = ''; $selectTimestampDown = ''; switch ($config["dbtype"]) { case "mysql": case "postgresql": $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC'); break; case "oracle": $order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'ASC'); break; } break; } // TODO: clean extra_sql $extra_sql = ''; // Build the order sql if (!empty($order)) { $order_sql = ' ORDER BY '; } $first = true; foreach ($order as $ord) { if ($first) { $first = false; } else { $order_sql .= ','; } $order_sql .= $ord['field'].' '.$ord['order']; } // Filter form $table->width = "98%"; $table->cellpadding = 4; $table->cellspacing = 4; $table->class = "databox"; $table->size[0] = "230px"; $table->head = array (); $table->data = array (); $table->data[0][0] = __('Search').':'; $table->data[0][0] .= html_print_input_text ('search_string', $search_string, '', 15, 255, true); $table->data[0][1] = html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"', true); echo "
"; html_print_table($table); echo "
"; unset($table); // Get limit and offset parameters $limit = (int) $config["block_size"]; $offset = (int) get_parameter ('offset'); $params = implode(',', array ('*')); $is_extra_sql = (int)$is_extra; $where = sprintf("(tagente_modulo.id_policy_module = 0 AND disabled = 0 AND tagente_estado.utimestamp !=0 AND tagente_modulo.id_agente = %s AND delete_pending = 0)", $id_agente); $search_string_entities = io_safe_input($search_string); $basic_where = sprintf(" tagente_estado.utimestamp !=0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND (nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities); switch ($config["dbtype"]) { case "postgresql": $limit_sql = " LIMIT $limit OFFSET $offset "; case "mysql": if (!isset($limit_sql)) { $limit_sql = " LIMIT $offset, $limit "; } $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC'); $sql = sprintf("SELECT %s FROM tagente_modulo, tagente_estado WHERE %s (%s %s) %s %s", $params, $basic_where, $extra_sql, $where, $order_sql, $limit_sql); $modules = db_get_all_rows_sql($sql); break; case "oracle": $order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'ASC'); $set = array(); $set['limit'] = $limit; $set['offset'] = $offset; $sql = sprintf("SELECT %s FROM tagente_modulo, tagente_estado WHERE %s (%s %s) %s", $params, $basic_where, $extra_sql, $where, $order_sql); $modules = oracle_recode_query ($sql, $set, 'AND', false); break; } $sql_total_modules = sprintf("SELECT count(*) FROM tagente_modulo, tagente_estado WHERE %s (%s %s)", $basic_where, $extra_sql, $where); $total_modules = db_get_value_sql($sql_total_modules); $total_modules = isset ($total_modules) ? $total_modules : 0; if ($modules === false) { echo "
".__('This agent doesn\'t have any module')."
"; return; } // Prepare pagination ui_pagination ($total_modules, ui_get_url_refresh (array ('id_agente' => $id_agente, 'tab' => 'data','sort_field' => $sortField, 'sort' => $sort, 'search_string' => urlencode($search_string)))); $isFunctionPolicies = enterprise_include_once ('include/functions_policies.php'); echo ""; echo ""; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $texto=''; $last_modulegroup = 0; $color = 1; $write = check_acl ($config['id_user'], $agent['id_grupo'], "AW"); foreach ($modules as $module) { // Calculate table line color if ($color == 1) { $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } if ($module["id_module_group"] != $last_modulegroup ) { // Render module group names (fixed code) $nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]); $last_modulegroup = $module["id_module_group"]; $colspan = 9 + (int)$isFunctionPolicies; echo ""; } // Begin to render data ... echo ""; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($module["id_policy_module"] != 0) { $linked = policies_is_module_linked($module['id_agente_modulo']); $id_policy = db_get_value_sql('SELECT id_policy FROM tpolicy_modules WHERE id = '.$module["id_policy_module"]); $name_policy = db_get_value_sql('SELECT name FROM tpolicies WHERE id = '.$id_policy); $policyInfo = policies_info_module_policy($module["id_policy_module"]); $adopt = false; if (policies_is_module_adopt($module['id_agente_modulo'])) { $adopt = true; } if ($linked) { if ($adopt) { $img = 'images/policies_brick.png'; $title = __('(Adopt) ') . $name_policy; } else { $img = 'images/policies.png'; $title = $name_policy; } } else { if ($adopt) { $img = 'images/policies_not_brick.png'; $title = __('(Unlinked) (Adopt) ') . $name_policy; } else { $img = 'images/unlinkpolicy.png'; $title = __('(Unlinked) ') . $name_policy; } } echo ""; } else { echo ""; } } $nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]); if ($nombre_grupomodulo != "") { if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group $label_group = -1; $last_label = $nombre_grupomodulo; $texto = $texto. " "; } } $nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]); echo ""; } else { echo ""; } if ($module["id_tipo_modulo"] == 24) { // Log4x echo ""; echo ""; switch($module["datos"]){ case 10: echo ""; break; case 20: echo ""; break; case 30: echo ""; break; case 40: echo ""; break; case 50: echo ""; break; case 60: echo ""; break; } } else if (($module["id_tipo_modulo"] == 100) OR ($module['history_data'] == 0)) { echo ""; $handle = "stat".$nombre_tipo_modulo."_".$module["id_agente_modulo"]; $url = 'include/procesos.php?agente='.$module["id_agente_modulo"]; $win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"])); echo ""; } echo ""; } echo '
".__('F.')."".__('P.')."".__('Module name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . ''; echo "".__('Type') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . ''; echo "".__('int') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . ''; echo "".__('Description') . "".__('Data') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . ''; echo "".__('Graph')."".__('Raw Data')."".__('Timestamp') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectTimestampUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectTimestampDown, "alt" => "down")) . ''; echo "
".$nombre_grupomodulo."
"; // Render network exec module button, only when // Agent Write for this module and group, is given // Is a network module // Has flag = 0 if ($write && $module["id_modulo"] > 1 && $module["id_tipo_modulo"] < 100) { if ($module["flag"] == 0) { echo "" . html_print_image('images/target.png', true, array("border" => '0', "alt" => __('Force'))) . ""; } else { echo "" . html_print_image('images/refresh.png', true, array("border" => '0', "alt" => '')) . ""; } } echo ""; echo'' . html_print_image($img,true, array('title' => $title)) . ''; echo " ".$nombre_grupomodulo.""; ui_print_string_substr ($module["nombre"], 35, false, 10); echo " "; ui_print_moduletype_icon ($module["id_tipo_modulo"]); echo ""; if ($module["module_interval"] != 0){ echo $module["module_interval"]; $real_interval = $module["module_interval"]; } else { echo $intervalo_agente; $real_interval = $intervalo_agente; } if (($module["id_tipo_modulo"] != 3) AND ($module["id_tipo_modulo"] != 10) AND ($module["id_tipo_modulo"] != 17) AND ($module["id_tipo_modulo"] != 23)) { echo ""; echo ui_print_truncate_text(io_safe_output($module["descripcion"]), 'description', false); echo "  x".__('TRACE')."".__('DEBUG')."".__('INFO')."".__('WARN')."".__('ERROR')."".__('FATAL').""; echo substr(io_safe_output($module["datos"]),0,12); } else { $graph_type = return_graphtype ($module["id_tipo_modulo"]); if ((is_numeric($module["datos"])) && ($module["id_tipo_modulo"] != 23)) { echo ""; echo format_for_graph($module["datos"] ); } else { if (strlen($module["datos"]) > 0 ) $colspan = /*2*/ 1; else $colspan= 1; echo ""; io_safe_output(io_safe_output($module["datos"]), 45, false); } echo ""; $graph_label = io_safe_output($module["nombre"]); echo "" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . " "; $link ="winopeng(" . "'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1WEEK . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','week_".$win_handle."')"; echo '' . html_print_image("images/grafica_w.png", true, array("border" => '0', "alt" => '')) . ' '; $link ="winopeng(" . "'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1DAY . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','day_".$win_handle."')"; echo '' . html_print_image("images/grafica_d.png", true, array("border" => '0', "alt" => '')) . ' '; $link ="winopeng(" . "'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1HOUR . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','hour_".$win_handle."')"; echo '' . html_print_image("images/grafica_h.png", true, array("border" => '0', "alt" => "")) . ''; } if ($module['history_data'] == 1) { // RAW Table data echo ""; echo "" . html_print_image('images/data_m.png', true, array("border" => '0', "alt" => '')) . "  "; echo "" . html_print_image('images/data_w.png', true, array("border" => '0', "alt" => '')) . "  "; echo "" . html_print_image('images/data_d.png', true, array("border" => '0', "alt" => '')) . ""; } else { echo ""; if ($module["utimestamp"] != 0){ $seconds = get_system_time () - $module["utimestamp"]; if ($module['id_tipo_modulo'] < 21 && $module["module_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["module_interval"] * 2)) { echo ''; } else { echo ''; } } ui_print_timestamp ($module["utimestamp"], false); echo ''; echo "
'; ?>