mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* extensions/agents_alerts.php, extensions/net_tools.php, extensions/ssh_gateway.php, extensions/update_manager/lib/libupdate_manager_components.php, extensions/update_manager/lib/libupdate_manager_updates.php, general/main_menu.php: cleaned source code style and added into some strings the call to translation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6758 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f5ac7cc261
commit
ae4a12872c
@ -1,3 +1,12 @@
|
||||
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* extensions/agents_alerts.php, extensions/net_tools.php,
|
||||
extensions/ssh_gateway.php,
|
||||
extensions/update_manager/lib/libupdate_manager_components.php,
|
||||
extensions/update_manager/lib/libupdate_manager_updates.php,
|
||||
general/main_menu.php: cleaned source code style and added into some
|
||||
strings the call to translation.
|
||||
|
||||
2012-07-09 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* operation/extensions.php
|
||||
|
@ -287,10 +287,12 @@ function print_alerts_summary_modal_window($id, $alerts) {
|
||||
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');
|
||||
}
|
||||
@ -317,7 +319,6 @@ ui_require_jquery_file('pandora');
|
||||
|
||||
<script type="text/javascript">
|
||||
function show_alerts_details(id) {
|
||||
|
||||
$("#alerts_details_"+id).dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
@ -325,9 +326,9 @@ ui_require_jquery_file('pandora');
|
||||
height: 280,
|
||||
width: 800,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
bgiframe: jQuery.browser.msie
|
||||
});
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ function main_net_tools () {
|
||||
$community = get_parameter ("community","public");
|
||||
|
||||
switch($operation) {
|
||||
case 1:
|
||||
case 1:
|
||||
$traceroute = whereis_the_command ('traceroute');
|
||||
if (empty($traceroute)) {
|
||||
ui_print_error_message(__('Traceroute executable does not exist.'));
|
||||
@ -84,95 +84,89 @@ function main_net_tools () {
|
||||
echo system ("$traceroute $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
break;
|
||||
case 2:
|
||||
$ping = whereis_the_command ('ping');
|
||||
if (empty($ping)) {
|
||||
ui_print_error_message(__('Ping executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Ping to "). $ip. "</h3>";
|
||||
ui_print_error_message(__('Ping executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Ping to "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$ping -c 5 $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
$nmap = whereis_the_command ('nmap');
|
||||
if (empty($nmap)) {
|
||||
ui_print_error_message(__('Nmap executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$nmap -F $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
|
||||
ui_print_error_message(__('Nmap executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("$nmap -F $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
|
||||
|
||||
$dig = whereis_the_command ('dig');
|
||||
if (empty($dig)) {
|
||||
ui_print_error_message(__('Dig executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
ui_print_error_message(__('Dig executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("dig $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
}
|
||||
|
||||
$whois = whereis_the_command ('whois');
|
||||
if (empty($whois)) {
|
||||
ui_print_error_message(__('Whois executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
ui_print_error_message(__('Whois executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("whois $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
echo "<h3>".__("SNMP information for "). $ip. "</h3>";
|
||||
|
||||
$snmpget = whereis_the_command ('snmpget');
|
||||
if (empty($snmpget)) {
|
||||
ui_print_error_message(__('SNMPget executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h4>Uptime</h4>";
|
||||
echo "<pre>";
|
||||
echo exec ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
||||
echo "</pre>";
|
||||
echo "<h4>Device info</h4>";
|
||||
echo "<pre>";
|
||||
ui_print_error_message(__('SNMPget executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h4>" . __("Uptime") . "</h4>";
|
||||
echo "<pre>";
|
||||
echo exec ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
||||
echo "</pre>";
|
||||
echo "<h4>" . __("Device info") . "</h4>";
|
||||
echo "<pre>";
|
||||
|
||||
echo system ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
||||
echo "</pre>";
|
||||
echo system ("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h4>Interface Information</h4>";
|
||||
echo "<table class=databox>";
|
||||
echo "<tr><th>".__("Interface");
|
||||
echo "<th>".__("Status");
|
||||
echo "<h4>Interface Information</h4>";
|
||||
echo "<table class=databox>";
|
||||
echo "<tr><th>".__("Interface");
|
||||
echo "<th>".__("Status");
|
||||
|
||||
$int_max = exec ("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
|
||||
$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++){
|
||||
$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";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
break;
|
||||
}
|
||||
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";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
?>
|
@ -33,16 +33,14 @@ function ssh_gateway () {
|
||||
$USER = "<auto>";
|
||||
|
||||
$id_agente = get_parameter ("id_agente");
|
||||
$ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
|
||||
$ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
|
||||
|
||||
if ($HOST == "")
|
||||
$HOST = $ip;
|
||||
|
||||
if (($HOST == "") OR ($USER == "")){
|
||||
|
||||
if ($COMMIT == 1){
|
||||
if (($HOST == "") OR ($USER == "")) {
|
||||
if ($COMMIT == 1) {
|
||||
echo "<h3 class=error>".__("You need to specify a user and a host address")."</h3>";
|
||||
|
||||
}
|
||||
|
||||
echo "<form method=post>";
|
||||
@ -52,10 +50,11 @@ function ssh_gateway () {
|
||||
echo "<td>".__("User")."<td><input type=text size=25 value='$USER' name=user>";
|
||||
echo "<tr><td>";
|
||||
echo __("Connect mode")."<td><select name=mode>";
|
||||
if ($MODE == "telnet"){
|
||||
if ($MODE == "telnet") {
|
||||
echo "<option>telnet";
|
||||
echo "<option>ssh";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "<option>ssh";
|
||||
echo "<option>telnet";
|
||||
}
|
||||
@ -72,9 +71,7 @@ function ssh_gateway () {
|
||||
else
|
||||
echo "<iframe style='border: 0px' src='http://".$SERVER_ADDR.":8023/anyterm.html?param=$HOST' width='100%' height=550>";
|
||||
|
||||
echo "</iframe>";
|
||||
echo "</iframe>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -121,15 +121,15 @@ function um_component_database_get_table_fields ($table_name) {
|
||||
break;
|
||||
case "oracle":
|
||||
$result = db_process_sql("SELECT cols1.column_name as Fields, cols1.data_type as Type,
|
||||
CASE WHEN (cols1.nullable = 'Y') THEN 'YES' ELSE 'NO' END as \"Null\",
|
||||
cols1.data_default as \"Default\", '' as Extra
|
||||
FROM user_tab_columns cols1
|
||||
WHERE cols1.table_name ='".$table_name."'
|
||||
AND cols1.column_name NOT IN (select distinct usr.column_name
|
||||
from user_cons_columns usr, user_constraints co
|
||||
where usr.constraint_name = co.constraint_name and
|
||||
constraint_type = 'P' and co.table_name = '" . $table_name . "')
|
||||
order by cols1.column_id");
|
||||
CASE WHEN (cols1.nullable = 'Y') THEN 'YES' ELSE 'NO' END as \"Null\",
|
||||
cols1.data_default as \"Default\", '' as Extra
|
||||
FROM user_tab_columns cols1
|
||||
WHERE cols1.table_name ='".$table_name."'
|
||||
AND cols1.column_name NOT IN (select distinct usr.column_name
|
||||
from user_cons_columns usr, user_constraints co
|
||||
where usr.constraint_name = co.constraint_name and
|
||||
constraint_type = 'P' and co.table_name = '" . $table_name . "')
|
||||
order by cols1.column_id");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -144,53 +144,54 @@ function um_db_create_update ($type, $component_name, $id_package, $update, $db_
|
||||
'component' => $component_name,
|
||||
'id_update_package' => $id_package);
|
||||
switch ($type) {
|
||||
case 'code':
|
||||
$filepath = realpath ($component->path.'/'.$update->filename);
|
||||
$values['svn_version'] = um_file_get_svn_revision ($filepath);
|
||||
case 'binary':
|
||||
$last_update = um_update_get_last_from_filename ($component_name, $update->filename);
|
||||
$filepath = realpath ($component->path.'/'.$update->filename);
|
||||
$values['checksum'] = md5_file ($filepath);
|
||||
if ($last_update && $last_update->checksum == $values['checksum']) {
|
||||
case 'code':
|
||||
$filepath = realpath ($component->path.'/'.$update->filename);
|
||||
$values['svn_version'] = um_file_get_svn_revision ($filepath);
|
||||
case 'binary':
|
||||
$last_update = um_update_get_last_from_filename ($component_name, $update->filename);
|
||||
$filepath = realpath ($component->path.'/'.$update->filename);
|
||||
$values['checksum'] = md5_file ($filepath);
|
||||
if ($last_update && $last_update->checksum == $values['checksum']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Add relative path if has one */
|
||||
if ($component->relative_path != '') {
|
||||
$values['filename'] = $component->relative_path.$update->filename;
|
||||
}
|
||||
else {
|
||||
$values['filename'] = $update->filename;
|
||||
}
|
||||
$values['data'] = um_file_uuencode ($filepath);
|
||||
if ($last_update && $last_update->checksum != '')
|
||||
$values['previous_checksum'] = $last_update->checksum;
|
||||
|
||||
break;
|
||||
case 'db_data':
|
||||
if ($db_data === NULL)
|
||||
return false;
|
||||
$component_db = um_db_get_component_db ($update->id_component_db);
|
||||
$field = $component_db->field_name;
|
||||
$values['db_field_value'] = $db_data->$field;
|
||||
$values['id_component_db'] = $update->id_component_db;
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$values['data'] = um_data_encode('INSERT INTO `'.$component_db->table_name.'` (`'.implode('`,`', array_keys (get_object_vars ($db_data))).'`) VALUES (\''.implode('\',\'', get_object_vars ($db_data)).'\')');
|
||||
break;
|
||||
case "postgresql":
|
||||
$values['data'] = um_data_encode('INSERT INTO "'.$component_db->table_name.'" ("'.implode('", "', array_keys (get_object_vars ($db_data))).'") VALUES (\''.implode('\',\'', get_object_vars ($db_data)).'\')');
|
||||
break;
|
||||
case "oracle":
|
||||
$values['data'] = um_data_encode('INSERT INTO '.$component_db->table_name.' ('.implode(', ', array_keys (get_object_vars ($db_data))).') VALUES (\''.implode('\',\'', get_object_vars ($db_data)).'\')');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'db_schema':
|
||||
$values['data'] = um_data_encode($update->data);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Add relative path if has one */
|
||||
if ($component->relative_path != '') {
|
||||
$values['filename'] = $component->relative_path.$update->filename;
|
||||
} else {
|
||||
$values['filename'] = $update->filename;
|
||||
}
|
||||
$values['data'] = um_file_uuencode ($filepath);
|
||||
if ($last_update && $last_update->checksum != '')
|
||||
$values['previous_checksum'] = $last_update->checksum;
|
||||
|
||||
break;
|
||||
case 'db_data':
|
||||
if ($db_data === NULL)
|
||||
return false;
|
||||
$component_db = um_db_get_component_db ($update->id_component_db);
|
||||
$field = $component_db->field_name;
|
||||
$values['db_field_value'] = $db_data->$field;
|
||||
$values['id_component_db'] = $update->id_component_db;
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$values['data'] = um_data_encode('INSERT INTO `'.$component_db->table_name.'` (`'.implode('`,`', array_keys (get_object_vars ($db_data))).'`) VALUES (\''.implode('\',\'', get_object_vars ($db_data)).'\')');
|
||||
break;
|
||||
case "postgresql":
|
||||
$values['data'] = um_data_encode('INSERT INTO "'.$component_db->table_name.'" ("'.implode('", "', array_keys (get_object_vars ($db_data))).'") VALUES (\''.implode('\',\'', get_object_vars ($db_data)).'\')');
|
||||
break;
|
||||
case "oracle":
|
||||
$values['data'] = um_data_encode('INSERT INTO '.$component_db->table_name.' ('.implode(', ', array_keys (get_object_vars ($db_data))).') VALUES (\''.implode('\',\'', get_object_vars ($db_data)).'\')');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'db_schema':
|
||||
$values['data'] = um_data_encode($update->data);
|
||||
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
$result = db_process_sql_insert(DB_PREFIX.'tupdate', $values);
|
||||
|
@ -25,13 +25,14 @@ require ("operation/menu.php");
|
||||
|
||||
//Check all enterprise ACL used in godmenu items to print menu headers
|
||||
if (check_acl ($config['id_user'], 0, "AW") ||
|
||||
check_acl ($config['id_user'], 0, "PM") ||
|
||||
check_acl ($config['id_user'], 0, "LM") ||
|
||||
check_acl ($config['id_user'], 0, "UM") ||
|
||||
check_acl ($config['id_user'], 0, "LW") ||
|
||||
check_acl ($config['id_user'], 0, "IW") ||
|
||||
check_acl ($config['id_user'], 0, "DW")) {
|
||||
echo '<div class="tit bg3">:: '.__('Administration').' ::</div>';
|
||||
check_acl ($config['id_user'], 0, "PM") ||
|
||||
check_acl ($config['id_user'], 0, "LM") ||
|
||||
check_acl ($config['id_user'], 0, "UM") ||
|
||||
check_acl ($config['id_user'], 0, "LW") ||
|
||||
check_acl ($config['id_user'], 0, "IW") ||
|
||||
check_acl ($config['id_user'], 0, "DW")) {
|
||||
|
||||
echo '<div class="tit bg3">:: '.__('Administration').' ::</div>';
|
||||
}
|
||||
|
||||
require ("godmode/menu.php");
|
||||
|
Loading…
x
Reference in New Issue
Block a user