2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/incidents/incident.php, operation/agentes/status_monitor.php, operation/agentes/datos_agente.php, operation/servers/view_server.php, operation/snmpconsole/snmp_view.php, operation/events/events_rss.php, operation/events/events_list.php, operation/events/events_marquee.php, operation/search_users.php, mobile/operation/agents/monitor_status.php, mobile/operation/agents/view_agents.php, mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php, mobile/include/functions_web.php, godmode/admin_access_logs.php, godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php, godmode/reporting/reporting_builder.list_items.php: changed and addded in the source, the SQL queries for the "LIMIT x, x" to "LIMIT x OFFSET x", that it is standard for PostgreSQL. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4080 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3356b90afd
commit
2b23573f9a
|
@ -1,3 +1,19 @@
|
|||
2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* install.php, operation/incidents/incident.php,
|
||||
operation/agentes/status_monitor.php, operation/agentes/datos_agente.php,
|
||||
operation/servers/view_server.php, operation/snmpconsole/snmp_view.php,
|
||||
operation/events/events_rss.php, operation/events/events_list.php,
|
||||
operation/events/events_marquee.php, operation/search_users.php,
|
||||
mobile/operation/agents/monitor_status.php,
|
||||
mobile/operation/agents/view_agents.php,
|
||||
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
|
||||
mobile/include/functions_web.php, godmode/admin_access_logs.php,
|
||||
godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php,
|
||||
godmode/reporting/reporting_builder.list_items.php: changed and addded in
|
||||
the source, the SQL queries for the "LIMIT x, x" to "LIMIT x OFFSET x", that
|
||||
it is standard for PostgreSQL.
|
||||
|
||||
2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_reporting.php, include/functions.php,
|
||||
|
|
|
@ -119,7 +119,14 @@ $url = "index.php?sec=godmode&sec2=godmode/admin_access_logs&tipo_log=".$tipo_lo
|
|||
|
||||
pagination ($count, $url);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC LIMIT %d, %d", $filter, $offset, $config["block_size"]);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC LIMIT %d OFFSET %d", $filter, $config["block_size"], $offset);
|
||||
break;
|
||||
}
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if (empty ($result)) {
|
||||
|
|
|
@ -182,20 +182,45 @@ if ($ag_group > 0) {
|
|||
$ag_group, $search_sql);
|
||||
$total_agents = get_db_sql ($sql);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo = %d
|
||||
%s
|
||||
ORDER BY %s %s LIMIT %d, %d',
|
||||
$ag_group, $search_sql, $order['field'], $order['order'], $offset, $config["block_size"]);
|
||||
} else {
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo = %d
|
||||
%s
|
||||
ORDER BY %s %s LIMIT %d OFFSET %d',
|
||||
$ag_group, $search_sql, $order['field'], $order['order'], $config["block_size"], $offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// Admin user get ANY group, even if they doesnt exist
|
||||
if (check_acl ($config['id_user'], 0, "PM")){
|
||||
$sql = sprintf ('SELECT COUNT(*) FROM tagente WHERE 1=1 %s', $search_sql);
|
||||
$total_agents = get_db_sql ($sql);
|
||||
$sql = sprintf ('SELECT * FROM tagente WHERE 1=1 %s ORDER BY %s %s LIMIT %d, %d', $search_sql, $order['field'], $order['order'], $offset, $config["block_size"]);
|
||||
} else {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente WHERE 1=1 %s
|
||||
ORDER BY %s %s LIMIT %d, %d', $search_sql, $order['field'], $order['order'], $offset, $config["block_size"]);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente WHERE 1=1 %s
|
||||
ORDER BY %s %s LIMIT %d OFFSET %d', $search_sql, $order['field'], $order['order'], $config["block_size"], $offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$sql = sprintf ('SELECT COUNT(*)
|
||||
FROM tagente
|
||||
|
@ -205,6 +230,8 @@ if ($ag_group > 0) {
|
|||
$search_sql);
|
||||
$total_agents = get_db_sql ($sql);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
|
@ -212,6 +239,17 @@ if ($ag_group > 0) {
|
|||
ORDER BY %s %s LIMIT %d, %d',
|
||||
implode (',', array_keys (get_user_groups ())),
|
||||
$search_sql, $order['field'], $order['order'], $offset, $config["block_size"]);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente
|
||||
WHERE id_grupo IN (%s)
|
||||
%s
|
||||
ORDER BY %s %s LIMIT %d OFFSET %d',
|
||||
implode (',', array_keys (get_user_groups ())),
|
||||
$search_sql, $order['field'], $order['order'], $config["block_size"], $offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,8 @@ if ($delete_action) {
|
|||
// Header
|
||||
print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
||||
// If user tries to delete an action of others groups
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||
$own_groups = array_keys(get_user_groups($config['id_user'], "LM"));
|
||||
|
@ -227,7 +228,8 @@ if ($delete_action) {
|
|||
exit;
|
||||
}
|
||||
}
|
||||
}else
|
||||
}
|
||||
else
|
||||
// Header
|
||||
print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ switch ($config["dbtype"]) {
|
|||
FROM treport_content
|
||||
WHERE ' . $where . ' AND id_report = ' . $idReport . '
|
||||
ORDER BY "order"
|
||||
LIMIT ' . $offset . ', ' . $config["block_size"]);
|
||||
LIMIT ' . $config["block_size"] . ' OFFSET ' . $offset);
|
||||
break;
|
||||
}
|
||||
$countItems = get_db_sql('SELECT COUNT(id_rc) FROM treport_content WHERE ' . $where . ' AND id_report = ' . $idReport);
|
||||
|
|
|
@ -312,15 +312,14 @@ function install_step1_licence() {
|
|||
if (!file_exists("COPYING")){
|
||||
echo "<div class='warn'><b>Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file.</b>";
|
||||
echo "</div>";
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
echo "<form method=post action='install.php?step=2'>";
|
||||
echo "<textarea name='gpl2' cols=50 rows=17>";
|
||||
echo file_get_contents ("COPYING");
|
||||
echo "</textarea>";
|
||||
echo "<p>";
|
||||
echo "<input type=submit value='Yes, I accept licence terms'>";
|
||||
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
|
|
|
@ -71,7 +71,8 @@ function footer() {
|
|||
|
||||
if (isset($_SERVER['REQUEST_TIME'])) {
|
||||
$time = $_SERVER['REQUEST_TIME'];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$time = get_system_time ();
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -144,7 +144,14 @@ class MonitorStatus {
|
|||
$total = get_db_value_sql('SELECT COUNT(*) ' . $sql);
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$rows = get_db_all_rows_sql($selectSQL . $sql . ' LIMIT ' . $this->offset . ', ' . $this->system->getPageSize());
|
||||
break;
|
||||
case "postgresql":
|
||||
$rows = get_db_all_rows_sql($selectSQL . $sql . ' LIMIT ' . $this->system->getPageSize() . ' OFFSET ' . $this->offset);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($rows === false) $rows = array();
|
||||
|
||||
|
|
|
@ -351,24 +351,6 @@ class ViewAgent {
|
|||
$template = safe_output(get_alert_template ($alert['id_alert_template']));
|
||||
$data[] = printTruncateText(safe_output($template['name']), 20, true, true);
|
||||
|
||||
// $actions = get_alert_agent_module_actions ($alert['id'], false, false);
|
||||
// if (!empty($actions)){
|
||||
// $actionText = '<ul class="action_list">';
|
||||
// foreach ($actions as $action) {
|
||||
// $actionText .= '<li><div><span class="action_name">' . $action['name'];
|
||||
// if ($action["fires_min"] != $action["fires_max"]){
|
||||
// $actionText .= " (".$action["fires_min"] . " / ". $action["fires_max"] . ")";
|
||||
// }
|
||||
// $actionText .= '</li></span><br></div>';
|
||||
// }
|
||||
// $actionText .= '</div></ul>';
|
||||
// }
|
||||
// else {
|
||||
// if ($actionDefault != "")
|
||||
// $actionText = get_db_sql ("SELECT name FROM talert_actions WHERE id = $actionDefault"). " <i>(".__("Default") . ")</i>";
|
||||
// }
|
||||
//
|
||||
// $data[] = $actionText;
|
||||
$data[] = print_timestamp ($alert["last_fired"], true, array('units' => 'tiny'));
|
||||
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
|
@ -377,10 +359,12 @@ class ViewAgent {
|
|||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
} elseif ($alert["disabled"] > 0) {
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
$title = __('Alert disabled');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = __('Alert not fired');
|
||||
}
|
||||
|
@ -391,17 +375,6 @@ class ViewAgent {
|
|||
$table->data[] = $data;
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
// echo "<h3 class='title_h3'>" . __('Alerts compound') . "</h3>";
|
||||
//
|
||||
// $alertsCombined = get_agent_alerts_compound(array($this->idAgent));
|
||||
//
|
||||
// $table->data = array();
|
||||
// foreach ($alertsCombined as $alert) {
|
||||
// $data = array();
|
||||
//
|
||||
// $table->data[] = $data;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,7 +388,7 @@ class viewGraph {
|
|||
$this->system = $system;
|
||||
$this->idAgentModule = $idAgentModule;
|
||||
$this->agentModule = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $this->idAgentModule));
|
||||
//$this->system->debug($this->agentModule);
|
||||
|
||||
$this->period = $this->system->getRequest('period', 86400);
|
||||
$this->offset = $this->system->getRequest("offset", 0);
|
||||
|
||||
|
@ -493,7 +466,14 @@ class viewGraph {
|
|||
|
||||
$count = get_db_value_sql($sql_count);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = 'SELECT * ' . $sql_body . ' LIMIT ' . $this->offset . ',' . $this->system->getPageSize();
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = 'SELECT * ' . $sql_body . ' LIMIT ' . $this->system->getPageSize() . ' OFFSET ' . $this->offset;
|
||||
break;
|
||||
}
|
||||
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
|
|
|
@ -69,10 +69,12 @@ class ViewAlerts {
|
|||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
} elseif ($alert["disabled"] > 0) {
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
$title = __('Alert disabled');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = __('Alert not fired');
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ class EventsView {
|
|||
|
||||
function show() {
|
||||
global $config;
|
||||
|
||||
$config['text_char_long'] = 12;
|
||||
|
||||
$offset = $this->system->getRequest("offset", 0);
|
||||
|
@ -119,7 +120,14 @@ class EventsView {
|
|||
|
||||
$sql_count = str_replace('*', 'COUNT(*)', $sql);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = $sql . sprintf(' LIMIT %d,%d', $offset, $this->system->getPageSize());
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = $sql . sprintf(' LIMIT %d OFFSET %d', $this->system->getPageSize(), $offset);
|
||||
break;
|
||||
}
|
||||
|
||||
$count = get_db_value_sql($sql_count);
|
||||
|
||||
|
|
|
@ -98,7 +98,14 @@ $sql_count = "SELECT count(*) " . $sql_body;
|
|||
|
||||
$count = get_db_value_sql($sql_count);
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql .= " LIMIT " . $offset . "," . $block_size;
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql .= " LIMIT " . $block_size . " OFFSET " . $offset;
|
||||
break;
|
||||
}
|
||||
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
if ($result === false) {
|
||||
|
|
|
@ -216,6 +216,8 @@ $sql .= " ORDER BY tagente.id_grupo, tagente.nombre";
|
|||
|
||||
// Build final SQL sentences
|
||||
$count = get_db_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo)".$sql);
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT tagente_modulo.id_agente_modulo,
|
||||
tagente.intervalo AS agent_interval,
|
||||
tagente.nombre AS agent_name,
|
||||
|
@ -230,6 +232,24 @@ $sql = "SELECT tagente_modulo.id_agente_modulo,
|
|||
tagente_estado.datos,
|
||||
tagente_estado.estado,
|
||||
tagente_estado.utimestamp AS utimestamp".$sql." LIMIT ".$offset.",".$config["block_size"];
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT tagente_modulo.id_agente_modulo,
|
||||
tagente.intervalo AS agent_interval,
|
||||
tagente.nombre AS agent_name,
|
||||
tagente_modulo.nombre AS module_name,
|
||||
tagente_modulo.id_agente_modulo,
|
||||
tagente_modulo.history_data,
|
||||
tagente_modulo.flag AS flag,
|
||||
tagente.id_grupo AS id_group,
|
||||
tagente.id_agente AS id_agent,
|
||||
tagente_modulo.id_tipo_modulo AS module_type,
|
||||
tagente_modulo.module_interval,
|
||||
tagente_estado.datos,
|
||||
tagente_estado.estado,
|
||||
tagente_estado.utimestamp AS utimestamp".$sql." LIMIT " . $config["block_size"] . " OFFSET " . $offset;
|
||||
break;
|
||||
}
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($count > $config["block_size"]) {
|
||||
|
|
|
@ -244,16 +244,37 @@ echo '<div id="steps_clean"> </div>';
|
|||
echo '</div>';
|
||||
|
||||
if ($group_rep == 0) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT *
|
||||
FROM tevento
|
||||
WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT *
|
||||
FROM tevento
|
||||
WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT *, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
|
||||
FROM tevento
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY evento, id_agentmodule
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT *, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
|
||||
FROM tevento
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY evento, id_agentmodule
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$pagination." OFFSET ".$offset;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Extract the events by filter (or not) from db
|
||||
|
|
|
@ -57,8 +57,14 @@ if (!check_acl ($config["id_user"], 0, "PM")) {
|
|||
$sql_group_filter .= " AND id_grupo != 0";
|
||||
}
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT evento, timestamp, id_agente FROM tevento WHERE 1=1 $sql_group_filter ORDER BY utimestamp DESC LIMIT 0 , $MAX_MARQUEE_EVENTS";
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT evento, timestamp, id_agente FROM tevento WHERE 1=1 $sql_group_filter ORDER BY utimestamp DESC LIMIT $MAX_MARQUEE_EVENTS OFFSET 0";
|
||||
break;
|
||||
}
|
||||
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
foreach ($result as $row) {
|
||||
|
|
|
@ -157,6 +157,8 @@ if ($id_event != -1)
|
|||
if(!check_acl($user, 0, "PM"))
|
||||
$sql_post .= " AND tevento.event_type <> 'system'";
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql="SELECT tevento.id_evento AS event_id,
|
||||
tevento.id_agente AS id_agent,
|
||||
tevento.id_usuario AS validated_by,
|
||||
|
@ -168,6 +170,21 @@ $sql="SELECT tevento.id_evento AS event_id,
|
|||
FROM tevento
|
||||
WHERE 1 = 1" . $sql_post . "
|
||||
ORDER BY utimestamp DESC LIMIT 0 , 30";
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql="SELECT tevento.id_evento AS event_id,
|
||||
tevento.id_agente AS id_agent,
|
||||
tevento.id_usuario AS validated_by,
|
||||
tevento.id_grupo AS id_group,
|
||||
tevento.estado AS validated,
|
||||
tevento.evento AS event_descr,
|
||||
tevento.utimestamp AS unix_timestamp,
|
||||
tevento.event_type AS event_type
|
||||
FROM tevento
|
||||
WHERE 1 = 1" . $sql_post . "
|
||||
ORDER BY utimestamp DESC LIMIT 30 OFFSET 0";
|
||||
break;
|
||||
}
|
||||
|
||||
$result= get_db_all_rows_sql ($sql);
|
||||
|
||||
|
|
|
@ -181,9 +181,18 @@ $groups = get_user_groups ($config["id_user"], "IR");
|
|||
|
||||
//Select incidencts where the user has access to ($groups from
|
||||
//get_user_groups), array_keys for the id, implode to pass to SQL
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT * FROM tincidencia
|
||||
WHERE id_grupo IN (".implode (",",array_keys ($groups)).")" . $filter . "
|
||||
ORDER BY actualizacion DESC LIMIT ".$offset.",".$config["block_size"];
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT * FROM tincidencia
|
||||
WHERE id_grupo IN (".implode (",",array_keys ($groups)).")" . $filter . "
|
||||
ORDER BY actualizacion DESC LIMIT ".$config["block_size"]." OFFSET ".$offset;
|
||||
break;
|
||||
}
|
||||
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
if (empty ($result)) {
|
||||
|
|
|
@ -143,7 +143,8 @@ if ($searchUsers) {
|
|||
|
||||
if(!$users_id) {
|
||||
$user_condition = "";
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
// Condition with the visible agents
|
||||
$user_condition = " AND id_user IN (\"".implode('","',$users_id)."\")";
|
||||
}
|
||||
|
@ -200,7 +201,8 @@ else {
|
|||
$profileCell = print_image ("images/user_suit.png", true,
|
||||
array ("alt" => __('Admin'),
|
||||
"title" => __('Administrator'))).' ';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$profileCell = print_image ("images/user_green.png", true,
|
||||
array ("alt" => __('User'),
|
||||
"title" => __('Standard User'))).' ';
|
||||
|
@ -214,7 +216,8 @@ else {
|
|||
$profileCell .= get_group_name ($row["id_grupo"]);
|
||||
$profileCell .= "<br />";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$profileCell .= __('The user doesn\'t have any assigned profile/group');
|
||||
}
|
||||
$profileCell .= "</span></a>";
|
||||
|
|
|
@ -65,7 +65,8 @@ foreach ($servers as $server) {
|
|||
|
||||
if ($server['status'] == 0) {
|
||||
$data[1] = print_status_image (STATUS_SERVER_DOWN, '', true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$data[1] = print_status_image (STATUS_SERVER_OK, '', true);
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,14 @@ if (isset ($_POST["updatebt"])) {
|
|||
}
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d,%d",$offset,$pagination);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d OFFSET %d", $pagination, $offset);
|
||||
break;
|
||||
}
|
||||
$traps = get_db_all_rows_sql ($sql);
|
||||
|
||||
// No traps
|
||||
|
@ -150,7 +157,14 @@ foreach ($traps as $trap) {
|
|||
}
|
||||
|
||||
//Make query to extract traps of DB.
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC LIMIT %d,%d";
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT * FROM ttrap %s ORDER BY timestamp DESC LIMIT %d OFFSET %d";
|
||||
break;
|
||||
}
|
||||
$whereSubquery = 'WHERE 1=1';
|
||||
|
||||
if ($filter_agent != '') {
|
||||
|
@ -214,8 +228,14 @@ if ($filter_severity != -1) {
|
|||
if ($filter_status != -1)
|
||||
$whereSubquery .= ' AND status = ' . $filter_status;
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf($sql, $whereSubquery, $offset, $pagination);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf($sql, $whereSubquery, $pagination, $offset);
|
||||
break;
|
||||
}
|
||||
|
||||
$traps = get_db_all_rows_sql($sql);
|
||||
|
||||
|
|
Loading…
Reference in New Issue