2013-04-25 Miguel de Dios <miguel.dedios@artica.es>

* extensions/agents_alerts.php, extensions/snmp_explorer.php,
	extensions/insert_data.php, extensions/net_tools.php,
	extensions/resource_exportation.php, extensions/system_info.php,
	extensions/pandora_logs.php, extensions/agents_modules.php,
	godmode/reporting/reporting_builder.item_editor.php,
	godmode/servers/manage_recontask_form.php,
	godmode/setup/gis_step_2.php,
	godmode/massive/massive_standby_alerts.php,
	godmode/massive/massive_operations.php,
	godmode/massive/massive_add_action_alerts.php,
	godmode/massive/massive_add_alerts.php,
	godmode/massive/massive_delete_agents.php,
	godmode/massive/massive_delete_action_alerts.php,
	operation/users/user_edit.php, operation/events/events_list.php,
	operation/integria_incidents/incident.list.php,
	operation/integria_incidents/incident.workunits.php,
	operation/tree.php, general/shortcut_bar.php: cleaned source code
	style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8054 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-04-25 09:08:54 +00:00
parent bc0d3dc06d
commit b2d860d6f6
24 changed files with 122 additions and 95 deletions

View File

@ -1,3 +1,24 @@
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* extensions/agents_alerts.php, extensions/snmp_explorer.php,
extensions/insert_data.php, extensions/net_tools.php,
extensions/resource_exportation.php, extensions/system_info.php,
extensions/pandora_logs.php, extensions/agents_modules.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/servers/manage_recontask_form.php,
godmode/setup/gis_step_2.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_add_alerts.php,
godmode/massive/massive_delete_agents.php,
godmode/massive/massive_delete_action_alerts.php,
operation/users/user_edit.php, operation/events/events_list.php,
operation/integria_incidents/incident.list.php,
operation/integria_incidents/incident.workunits.php,
operation/tree.php, general/shortcut_bar.php: cleaned source code
style.
2013-04-25 Miguel de Dios <miguel.dedios@artica.es>
* general/shortcut_bar.php, general/main_menu.php,

View File

@ -275,7 +275,7 @@ function print_alerts_summary_modal_window($id, $alerts) {
$actionText = '<div style="margin-left: 10px;"><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div><span class="action_name"><li>' . $action['name'];
if ($action["fires_min"] != $action["fires_max"]){
if ($action["fires_min"] != $action["fires_max"]) {
$actionText .= " (".$action["fires_min"] . " / ". $action["fires_max"] . ")";
}
$actionText .= '</li></span><br /></div>';
@ -283,7 +283,7 @@ function print_alerts_summary_modal_window($id, $alerts) {
$actionText .= '</ul></div>';
}
else {
if(!empty($actionDefault)) {
if (!empty($actionDefault)) {
$actionText = db_get_sql ("SELECT name FROM talert_actions WHERE id = $actionDefault"). " <i>(".__("Default") . ")</i>";
}
}

View File

@ -241,8 +241,8 @@ function mainAgentsModules() {
}
$match = false;
foreach($module['id'] as $module_id){
if(!$match && array_key_exists($module_id,$agent_modules)) {
foreach ($module['id'] as $module_id) {
if (!$match && array_key_exists($module_id,$agent_modules)) {
$status = modules_get_agentmodule_status($module_id);
echo "<td style='text-align: center;'>";
$win_handle = dechex(crc32($module_id.$module["name"]));
@ -250,7 +250,7 @@ function mainAgentsModules() {
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module_id."&label=".base64_encode($module["name"])."&refresh=600','day_".$win_handle."')";
echo '<a href="javascript:'.$link.'">';
switch($status){
switch ($status) {
case 0:
ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
break;

View File

@ -127,7 +127,7 @@ function mainInsertData() {
}
ui_print_error_message($msg);
}
if($done > 0){
if ($done > 0) {
$msg = sprintf(__('Save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']);
if($done > 1) {
$msg .= " ($done)";

View File

@ -164,7 +164,7 @@ function main_net_tools () {
$int_max = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
for ($ax=0; $ax < $int_max; $ax++){
for ($ax=0; $ax < $int_max; $ax++) {
$interface = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
$estado = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
echo "<tr><td>$interface<td>$estado";

View File

@ -17,7 +17,7 @@
function view_logfile ($file_name) {
global $config;
if (!file_exists($file_name)){
if (!file_exists($file_name)) {
echo "<h2 class='error'>".__("Cannot find file"). "(".$file_name;
echo ")</h2>";
}

View File

@ -248,7 +248,7 @@ function output_xml_visual_console($id) {
echo "<width>" . io_safe_output($visual_map['width']) . "</width>\n";
$items = db_get_all_rows_field_filter('tlayout_data', 'id_layout', $visual_map['id']);
if ($items === false) $items = array();
foreach ($items as $item){
foreach ($items as $item) {
echo "<item>\n";
echo "<other_id>" . $item['id'] . "</other_id>\n"; //OLD ID USE FOR parent item
if (!empty($item['label'])) {

View File

@ -148,14 +148,14 @@ function snmp_explorer() {
$errors = array();
$done = 0;
foreach($id_snmp as $id) {
if (isset($interfaces[$id]['ifName']) && $interfaces[$id]['ifName']['value'] != ""){
foreach ($id_snmp as $id) {
if (isset($interfaces[$id]['ifName']) && $interfaces[$id]['ifName']['value'] != "") {
$ifname = $interfaces[$id]['ifName']['value'];
}
else if (isset($interfaces[$id]['ifDescr']) && $interfaces[$id]['ifDescr']['value'] != ""){
else if (isset($interfaces[$id]['ifDescr']) && $interfaces[$id]['ifDescr']['value'] != "") {
$ifname = $interfaces[$id]['ifDescr']['value'];
}
foreach($modules as $module) {
foreach ($modules as $module) {
$oid_array = explode('.',$module);
$oid_array[count($oid_array)-1] = $id;
$oid = implode('.',$oid_array);
@ -252,13 +252,13 @@ function snmp_explorer() {
// Create the interface list for the interface
$interfaces_list = array();
foreach ($interfaces as $interface){
foreach ($interfaces as $interface) {
// Get the interface name, removing " " characters and avoid "blank" interfaces
if (isset($interface['ifName']) && $interface['ifName']['value'] != ""){
$ifname = $interface['ifName']['value'];
if (isset($interface['ifName']) && $interface['ifName']['value'] != "") {
$ifname = $interface['ifName']['value'];
}
else if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != ""){
$ifname = $interface['ifDescr']['value'];
else if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != "") {
$ifname = $interface['ifDescr']['value'];
}
else {
continue;
@ -432,45 +432,45 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
jQuery.post ('ajax.php',
{"page" : "godmode/agentes/agent_manager",
"get_modules_json_for_multiple_snmp": 1,
"id_snmp[]": idSNMP,
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
},
function (data) {
$('#module').empty ();
c = 0;
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val);
$('#module').append ($('<option></option>').html (s).attr ("value", i));
$('#module').fadeIn ('normal');
c++;
});
if(c == 0){
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) {
anyText = 'Any';
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
}
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').removeAttr('disabled');
},
"json"
);
{"page" : "godmode/agentes/agent_manager",
"get_modules_json_for_multiple_snmp": 1,
"id_snmp[]": idSNMP,
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
},
function (data) {
$('#module').empty ();
c = 0;
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val);
$('#module').append ($('<option></option>').html (s).attr ("value", i));
$('#module').fadeIn ('normal');
c++;
});
if (c == 0) {
if (typeof($(document).data('text_for_module')) != 'undefined') {
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true));
}
else {
if (typeof(data['any_text']) != 'undefined') {
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).attr('selected', true));
}
else {
var anyText = $("#any_text").html(); //Trick for catch the translate text.
if (anyText == null) {
anyText = 'Any';
}
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).attr('selected', true));
}
}
}
if (selected != undefined)
$('#module').attr ('value', selected);
$('#module').removeAttr('disabled');
},
"json");
}
/* ]]> */

View File

@ -168,7 +168,7 @@ function show_logfile($file_name, $numLines = 2000) {
function logFilesLines($file_name, $numLines) {
global $config;
if (!file_exists($file_name)){
if (!file_exists($file_name)) {
return '';
}
else {

View File

@ -309,8 +309,8 @@ echo "</div>";
);
}
else {
$('#shotcut_bar').css({height: 20}).animate({ height: '0' }, 900);
$('#shortcut_button').css({height: 40}).animate({ height: '22' }, 900);
$('#shotcut_bar').css({height: 20}).animate({ height: '0' }, 900);
$('#shortcut_button').css({height: 40}).animate({ height: '22' }, 900);
jQuery.post ("ajax.php",
{"page" : "general/shortcut_bar",
"update_shortcut_state": 1,
@ -323,11 +323,12 @@ echo "</div>";
});
});
var id_user = $('#hidden-shortcut_id_user').val();
var id_user = $('#hidden-shortcut_id_user').val();
function shortcut_check_alerts() {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/alerts_status",
"get_alert_fired": 1
{
"page" : "operation/agentes/alerts_status",
"get_alert_fired": 1
},
function (data) {
$('#shortcut_alerts_fired').text(data);

View File

@ -188,7 +188,7 @@ $(document).ready (function () {
update_alerts();
var recursion;
$("#checkbox-recursion").click(function (){
$("#checkbox-recursion").click(function () {
recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change");
});

View File

@ -62,7 +62,7 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
}
}
if(count($module_names) == 1 && $module_names[0] == '0'){
if(count($module_names) == 1 && $module_names[0] == '0') {
$modules_id = agents_common_modules ($id_agents, false, true);
}

View File

@ -78,7 +78,7 @@ if ($delete) {
foreach ($alerts_agent_modules as $alert_agent_module) {
$agent_module_actions = alerts_get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action'));
foreach ($agent_module_actions as $agent_module_action){
foreach ($agent_module_actions as $agent_module_action) {
foreach ($actions as $action) {
if ($agent_module_action['id_alert_action'] == $action) {
$result = alerts_delete_alert_agent_module_action ($agent_module_action['id']);

View File

@ -135,7 +135,7 @@ ui_require_jquery_file ('pandora.controls');
<script type="text/javascript">
$(document).ready (function () {
var recursion;
$("#checkbox-recursion").click(function (){
$("#checkbox-recursion").click(function () {
recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change");
});

View File

@ -141,7 +141,7 @@ $onheader['policies'] = $policiestab;
ui_print_page_header (__('Massive operations'). ' &raquo; '. $options[$option], "images/gm_massive_operations.png", false, "", true, $onheader);
// Checks if the PHP configuration is correctly
if ((get_cfg_var("max_execution_time") != 0) or (get_cfg_var("max_input_time") != -1)){
if ((get_cfg_var("max_execution_time") != 0) or (get_cfg_var("max_input_time") != -1)) {
echo '<div id="notify_conf" class="notify">';
echo __("In order to perform massive operations, PHP needs a correct configuration in timeout parameters. Please, open your PHP configuration file (php.ini) for example: <i>sudo vi /etc/php5/apache2/php.ini;</i><br> And set your timeout parameters to a correct value: <br><i> max_execution_time = 0</i> and <i>max_input_time = -1</i>");
echo '</div>';

View File

@ -185,7 +185,7 @@ $(document).ready (function () {
clear_alert_fields();
var recursion;
$("#checkbox-recursion").click(function (){
$("#checkbox-recursion").click(function () {
recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change");
});

View File

@ -482,7 +482,7 @@ html_print_input_hidden('id_item', $idItem);
// Get group list that user has access
$groups_user = users_get_groups ($config['id_user'], "RW", $own_info['is_admin'], true);
$groups_id = array();
foreach($groups_user as $key => $groups){
foreach ($groups_user as $key => $groups) {
$groups_id[] = $groups['id_grupo'];
}

View File

@ -45,11 +45,11 @@ if (is_ajax ()) {
if (isset ($_GET["update"]) or (isset($_GET["crt"]))) { // Edit mode
$update_recon = true;
if (isset ($_GET["crt"])){
if ($_GET["crt"] != "update"){
if (isset ($_GET["crt"])) {
if ($_GET["crt"] != "update") {
$update_recon = false;
}
else{
else {
$id_rt = get_parameter("upd");
}
}

View File

@ -138,10 +138,11 @@ switch ($action) {
}
else
$errorfill = true;
require_once('gis.php');
return;
}
break;
}
$table->width = '90%';

View File

@ -554,7 +554,7 @@ $(document).ready( function() {
}
// Don't collapse filter if update button has been pushed
if ($("#hidden-open_filter").val() == 'true'){
if ($("#hidden-open_filter").val() == 'true') {
$("#event_control").toggle();
}
@ -807,7 +807,7 @@ $(document).ready( function() {
// Change toggle arrow when it's clicked
$("#tgl_event_control").click(function() {
if ($("#toggle_arrow").attr("src").match(/[^\.]+down\.png/) == null){
if ($("#toggle_arrow").attr("src").match(/[^\.]+down\.png/) == null) {
var params = [];
params.push("get_image_path=1");
params.push("img_src=images/down.png");

View File

@ -22,8 +22,8 @@ global $result_status;
global $result_groups;
global $result_resolutions;
if (isset ($result_status['status'])){
if (isset ($result_status['status'])) {
foreach($result_status['status'] as $st) {
$status[$st['id']] = $st['name'];
}
@ -33,7 +33,7 @@ if (isset ($result_status['status'])){
$status[0] = __('Any');
$status[-10] = __('Not closed');
if (isset ($result_groups['group'])){
if (isset ($result_groups['group'])) {
foreach($result_groups['group'] as $gr) {
$groups[$gr['id']] = $gr['name'];
}
@ -105,7 +105,7 @@ $table->head[10] = __('Action');
$table->align[4] = "center";
$table->align[5] = "center";
if(isset($result['incident'][0]) && is_array($result['incident'][0])){
if(isset($result['incident'][0]) && is_array($result['incident'][0])) {
$incidents = $result['incident'];
}
else {

View File

@ -41,27 +41,27 @@ $form .= "</form>";
ui_toggle($form, __('Add workunit'));
if(isset($result['workunit'][0]) && is_array($result['workunit'][0])){
if (isset($result['workunit'][0]) && is_array($result['workunit'][0])) {
$workunits = $result['workunit'];
}
else {
$workunits = $result;
}
foreach($workunits as $value) {
foreach ($workunits as $value) {
$table->width = "98%";
$table->class = "databox";
$table->colspan[1][0] = 4;
$table->size[0] = "80%";
$table->size[1] = "20%";
$table->data = array();
$table->data[0][0] = $value['id_user']." ".__('said')." ".$value['timestamp'];
$table->data[0][1] = $value['duration']." ".__('Hours')." ".__('Public').": ".$value['public'];
$table->data[0][0] = $value['id_user'] . " " . __('said') . " " . $value['timestamp'];
$table->data[0][1] = $value['duration'] . " " . __('Hours') . " " . __('Public') . ": " . $value['public'];
$table->data[1][0] = $value['description'];
html_print_table($table);
}
?>

View File

@ -336,7 +336,9 @@ if (is_ajax ())
html_print_image ("operation/tree/last_leaf.png", false, array ("style" => 'vertical-align: middle;', "id" => "tree_image_os_" . $row["id_agente"], "pos_tree" => "2" ));
// This line checks for (non-initialized) asyncronous modules
if ($row["estado"] == 0 AND $row["utimestamp"] == 0 AND ($row["id_tipo_modulo"] >= 21 AND $row["id_tipo_modulo"] <= 23)){
if ($row["estado"] == 0 AND $row["utimestamp"] == 0
AND ($row["id_tipo_modulo"] >= 21
AND $row["id_tipo_modulo"] <= 23)) {
$status = STATUS_MODULE_NO_DATA;
$title = __('UNKNOWN');
} // Else checks module status
@ -651,7 +653,7 @@ treeview_printTree($activeTab);
url: <?php echo '"' . ui_get_full_url("ajax.php", false, false, false) . '"'; ?>,
data: "page=<?php echo $_GET['sec2']; ?>&ajax_treeview=1&type=" +
type + "&id=" + div_id + "&less_branchs=" + less_branchs + "&id_father=" + id_father + "&status=" + status + "&search_free=" + search_free + "&server_name=" + server_name,
success: function(msg){
success: function(msg) {
if (msg.length != 0) {
$('#tree_div'+id_father+'_'+type+'_'+div_id).hide();
$('#tree_div'+id_father+'_'+type+'_'+div_id).html(msg);
@ -766,7 +768,7 @@ treeview_printTree($activeTab);
type: "POST",
url: <?php echo '"' . ui_get_full_url("ajax.php", false, false, false) . '"'; ?>,
data: "page=<?php echo $_GET['sec2']; ?>&printTable=1&id_agente=" + id_agent + "&server_name=" + server_name,
success: function(data){
success: function(data) {
$('#cont').html(data);
}
});
@ -779,7 +781,7 @@ treeview_printTree($activeTab);
type: "POST",
url: <?php echo '"' . ui_get_full_url("ajax.php", false, false, false) . '"'; ?>,
data: "page=<?php echo $_GET['sec2']; ?>&printAlertsTable=1&id_module=" + id_module + "&server_name=" + server_name,
success: function(data){
success: function(data) {
$('#cont').html(data);
}
});
@ -790,7 +792,7 @@ treeview_printTree($activeTab);
type: "POST",
url: <?php echo '"' . ui_get_full_url("ajax.php", false, false, false) . '"'; ?>,
data: "page=<?php echo $_GET['sec2']; ?>&printModuleTable=1&id_module=" + id_module + "&server_name=" + server_name,
success: function(data){
success: function(data) {
$('#cont').html(data);
}
});
@ -806,7 +808,7 @@ treeview_printTree($activeTab);
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period,
dataType: "html",
success: function(data){
success: function(data) {
$("#module_details_window").hide ()
.empty ()
.append (data)

View File

@ -35,7 +35,9 @@ $status = get_parameter ("status", -1); // Flag to print action status message
$user_info = get_user_info ($id);
$id = $user_info["id_user"]; //This is done in case there are problems with uppercase/lowercase (MySQL auth has that problem)
if ((!check_acl ($config["id_user"], users_get_groups ($id), "UM")) AND ($id != $config["id_user"])){
if ((!check_acl ($config["id_user"], users_get_groups ($id), "UM"))
AND ($id != $config["id_user"])) {
db_pandora_audit("ACL Violation","Trying to view a user without privileges");
require ("general/noaccess.php");
exit;