2012-04-26 Miguel de Dios <miguel.dedios@artica.es>

* operation/agentes/exportdata.php,
	operation/events/events_list.php: cleaned source code style.
	
	* include/functions_events.php,
	include/functions_network_components.php,
	include/functions_api.php: fixed some things, the function
	"events_validate_event" when can't update as validate any event
	return false, into the file "functions_network_components" added
	$config['homedir'] for situations where include in a other path that
	index. And show error when make a bad validate event.
	
	MERGED FROM 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6197 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-04-26 14:42:48 +00:00
parent da5f54ffd8
commit c440b53603
6 changed files with 103 additions and 82 deletions

View File

@ -1,3 +1,18 @@
2012-04-26 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/exportdata.php,
operation/events/events_list.php: cleaned source code style.
* include/functions_events.php,
include/functions_network_components.php,
include/functions_api.php: fixed some things, the function
"events_validate_event" when can't update as validate any event
return false, into the file "functions_network_components" added
$config['homedir'] for situations where include in a other path that
index. And show error when make a bad validate event.
MERGED FROM 4.0.2
2012-04-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/styles/pandora_forms.css

View File

@ -14,6 +14,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
//Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
require_once('functions_agents.php');
@ -4410,7 +4412,7 @@ function set_validate_events($id_event, $trash1, $other, $return_type, $user_in_
returnData('string', array('type' => 'string', 'data' => 'Correct validation'));
}
else {
returnError('error_validate_event', 'Error in validation operation.');
returnError('Error in validation operation.');
}
}
@ -4530,25 +4532,25 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
$sql_post .= " AND id_alert_am = ".$id_alert_am;
if ($id_event != -1)
$sql_post .= " AND id_evento = ".$id_event;
$sql_post .= " AND id_evento = " . $id_event;
if ($id_user_ack != "0")
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
$sql_post .= " AND id_usuario = '" . $id_user_ack . "'";
if ($utimestamp_upper != 0)
$sql_post .= " AND utimestamp >= ".$utimestamp_upper;
$sql_post .= " AND utimestamp >= " . $utimestamp_upper;
if ($utimestamp_bottom != 0)
$sql_post .= " AND utimestamp <= ".$utimestamp_bottom;
$sql_post .= " AND utimestamp <= " . $utimestamp_bottom;
if ($event_view_hr > 0) {
$unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds
$sql_post .= " AND (utimestamp > ".$unixtime . " OR estado = 2)";
$sql_post .= " AND (utimestamp > " . $unixtime . " OR estado = 2)";
}
//Search by tag
if ($tag != "") {
$sql_post .= " AND tags LIKE '%".io_safe_input($tag)."%'";
$sql_post .= " AND tags LIKE '%" . io_safe_input($tag) . "%'";
}
if ($group_rep == 0) {
@ -4557,12 +4559,12 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
if ($filter['total']) {
$sql = "SELECT COUNT(*)
FROM tevento
WHERE 1=1 ".$sql_post;
WHERE 1=1 " . $sql_post;
}
else if ($filter['more_criticity']) {
$sql = "SELECT criticity
FROM tevento
WHERE 1=1 ".$sql_post." ORDER BY criticity DESC LIMIT 1";
WHERE 1=1 " . $sql_post . " ORDER BY criticity DESC LIMIT 1";
}
else {
$sql = "SELECT *,
@ -4570,7 +4572,7 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
(SELECT t2.nombre FROM tgrupo AS t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_name,
(SELECT t2.icon FROM tgrupo AS t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_icon
FROM tevento
WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
WHERE 1=1 " . $sql_post . " ORDER BY utimestamp DESC LIMIT " . $offset . "," . $pagination;
}
break;
case "postgresql":
@ -4580,7 +4582,7 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
(SELECT t2.nombre FROM tgrupo AS t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_name,
(SELECT t2.icon FROM tgrupo AS t2 WHERE t2.id_grupo = tevento.id_grupo) AS group_icon
FROM tevento
WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset;
WHERE 1=1 " . $sql_post . " ORDER BY utimestamp DESC LIMIT " . $pagination . " OFFSET " . $offset;
break;
case "oracle":
//TODO TOTAL
@ -4652,7 +4654,7 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
}
//html_debug_print($filter, true);
$result = db_get_all_rows_sql ($sql);
//html_debug_print($sql);
//html_debug_print($sql, true);
if (($result !== false) && (!$filter['total']) && (!$filter['more_criticity'])) {
//Add the description and image

View File

@ -169,7 +169,7 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
db_process_sql_begin ();
switch($new_status) {
switch ($new_status) {
case 1:
$new_status_string = __('Validated');
break;
@ -183,9 +183,10 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
$comment = str_replace(array("\r\n", "\r", "\n"), '<br>', $comment);
if($comment != '') {
if ($comment != '') {
$commentbox = '<div style="border:1px dotted #CCC; min-height: 10px;">'.$comment.'</div>';
}else {
}
else {
$commentbox = '';
}
@ -196,7 +197,7 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
$comment = '<b>-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox;
$fullevent = events_get_event($event);
if($fullevent['user_comment'] != ''){
if ($fullevent['user_comment'] != '') {
$comment .= '<br>'.$fullevent['user_comment'];
}
@ -209,9 +210,11 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
'id_usuario' => $config['id_user'],
'user_comment' => $comment);
$ret = db_process_sql_update('tevento', $values, array('id_evento' => $event), 'AND', false);
if ($ret === false) {
process_sql_rollback ();
$ret = db_process_sql_update('tevento', $values,
array('id_evento' => $event), 'AND', false);
if (($ret === false) || ($ret === 0)) {
db_process_sql_rollback ();
return false;
}
}
@ -222,6 +225,7 @@ function events_validate_event ($id_event, $similars = true, $comment = '', $new
}
*/
db_process_sql_commit ();
return true;
}

View File

@ -18,12 +18,14 @@
* @subpackage Network components
*/
global $config;
/**
* Include modules functions
*/
include_once ($config['homedir'].'/include/functions_modules.php');
include_once ($config['homedir'].'/include/functions_agents.php');
include_once ($config['homedir'].'/include/functions_users.php');
include_once ($config['homedir'] . 'include/functions_modules.php');
include_once ($config['homedir'] . 'include/functions_agents.php');
include_once ($config['homedir'] . 'include/functions_users.php');
/**
* Get a list of network components.
@ -62,7 +64,6 @@ function network_components_get_network_components ($id_module, $filter = false,
if (isset($filter['offset'])) {
$components = oracle_recode_query ('SELECT ' . $fields . ' FROM tnetwork_component', $filter, 'AND', false);
if ($components != false) {
for ($i=0; $i < count($components); $i++) {
unset($components[$i]['rnum']);
}
@ -76,6 +77,7 @@ function network_components_get_network_components ($id_module, $filter = false,
}
if ($components === false)
return array ();
return $components;
}
@ -241,6 +243,7 @@ function network_components_create_network_component ($name, $type, $id_group, $
if (empty($values['tcp_rcv']))
$values['tcp_rcv'] = " ";
return;
break;
}
if (empty ($name))

View File

@ -462,7 +462,6 @@ $(document).ready (function () {
}
$("select#export_type").trigger('change');
});
$("select#export_type").change (function () {
@ -487,6 +486,5 @@ function submit_group() {
f.action = "index.php?sec=reporting&sec2=operation/agentes/exportdata";
f.form.submit();
}
/* ]]> */
</script>

View File

@ -968,7 +968,8 @@ foreach ($result as $event) {
$string .= '</a></td></tr><tr class="' . $odd . '">';
$odd = ($odd == '')? 'rowOdd' : '';
} else {
}
else {
$string .= '<td align="left" valign="top" width="15%">';
$string .= '<b>' . __('Agent module') . '</b></td><td align="left">';
$string .= '<i>- ' . __('Empty') . ' -</i>';
@ -1122,7 +1123,6 @@ if (!empty ($table->data)) {
html_print_submit_button (__('Update'), 'validate_btn', false, 'class="sub ok"');
}
if (check_acl ($config["id_user"], 0,"IM") == 1) {
html_print_button(__('Delete'), 'delete_button', false, 'submit_delete();', 'class="sub delete"');
?>
<script type="text/javascript">
@ -1134,7 +1134,6 @@ if (!empty ($table->data)) {
<?php
}
echo '</div></form>';
}
else {
echo '<div class="nf">'.__('No events').'</div>';