2012-06-20 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_html.php, include/functions.php: cleaned source
	code style.
	
	* extensions/extension_uploader.php: fixed the upload enterprise
	extension.
	
	Fixes: #3532208
	
	MERGED FROM 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6609 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-06-20 08:28:34 +00:00
parent ffc635780b
commit e7349acfd0
11 changed files with 95 additions and 67 deletions

View File

@ -1,3 +1,15 @@
2012-06-20 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions.php: cleaned source
code style.
* extensions/extension_uploader.php: fixed the upload enterprise
extension.
Fixes: #3532208
MERGED FROM 4.0.2
2012-06-20 Hirofumi Kosaka <kosaka@rworks.jp>
* extensions/net_tools.php: Fixed bug: 'whereis' could find a
@ -47,6 +59,18 @@
of the xml2array function to set it equal to recent
fix in 4.0.2
2012-06-19 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/webchat.js, extensions/pandora_logs.php,
extensions/update_manager/lib/functions.php, operation/tree.php,
operation/agentes/stat_win.php,
godmode/massive/massive_delete_modules.php,
godmode/reporting/reporting_builder.list_items.php,
godmode/reporting/reporting_builder.php: a lot of changes in the
javascript for the crap browser ( = Micro$oft IE9) compatibility.
MERGED FROM 4.0.2
2012-06-19 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.list_items.php: some fixes.

View File

@ -19,25 +19,32 @@ function extension_uploader_extensions() {
if (!check_acl($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation",
"Trying to access Group Management");
"Trying to access Group Management");
require ("general/noaccess.php");
return;
}
ui_print_page_header (__("Uploader extension"), "images/extensions.png", false, "", true, "");
ui_print_page_header (__("Uploader extension"),
"images/extensions.png", false, "", true, "");
$upload = (bool)get_parameter('upload', 0);
$upload_enteprise = (bool)get_parameter('upload_enterprise', 0);
if ($upload) {
$error = $_FILES['extension']['error'];
if ($error == 0) {
if ($error == 0) {
$zip = new ZipArchive;
$tmpName = $_FILES['extension']['tmp_name'];
$pathname = $config['homedir'] . '/' . EXTENSIONS_DIR . '/';
if ($upload_enteprise) {
$pathname = $config['homedir'] . '/' . ENTERPRISE_DIR . '/' . EXTENSIONS_DIR . '/';
}
else {
$pathname = $config['homedir'] . '/' . EXTENSIONS_DIR . '/';
}
if ($zip->open($tmpName) === true) {
$result = $zip->extractTo($pathname);
@ -57,7 +64,7 @@ function extension_uploader_extensions() {
ui_print_result_message ($result, __('Success to upload extension'),
__('Fail to upload extension'));
}
$table = null;
$table->width = '98%';
@ -65,6 +72,10 @@ function extension_uploader_extensions() {
$table->data[0][0] = __('Upload extension');
$table->data[0][1] = html_print_input_file('extension', true) .
ui_print_help_tip (__("Upload the extension as a zip file."), true);
if (enterprise_installed()) {
$table->data[0][2] = __('Upload enterprise extension') . "&nbsp;" .
html_print_checkbox('upload_enterprise', 1, false, true);
}
echo "<form method='post' enctype='multipart/form-data'>";
html_print_table($table);

View File

@ -39,18 +39,18 @@ function view_logfile ($file_name) {
function pandoralogs_extension_main () {
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" );
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
view_logfile ($config["homedir"]."/pandora_console.log");
view_logfile ("/var/log/pandora/pandora_server.log");
view_logfile ("/var/log/pandora/pandora_server.error");

View File

@ -395,17 +395,15 @@ $(document).ready (function () {
}
else {
$(".select_agents_row_2").css('display', '');
}
}
}
);
$("#form_modules input[name=selection_mode]").change (function () {
console.log(this.value);
selector = this.value;
clean_lists();
if(selector == 'agents') {
$(".select_modules_row").css('display', 'none');
$(".select_agents_row").css('display', '');
@ -415,7 +413,7 @@ $(document).ready (function () {
$(".select_modules_row").css('display', '');
}
});
$("#groups_select").change (
function () {
$('#checkbox-force_group').attr('checked', false);
@ -430,7 +428,7 @@ $(document).ready (function () {
$('input[type=checkbox]').removeAttr('disabled');
$(".select_agents_row_2").css('display', '');
}
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
@ -439,7 +437,7 @@ $(document).ready (function () {
},
function (data, status) {
$("#id_agents").html('');
jQuery.each (data, function (id, value) {
option = $("<option></option>").attr ("value", value["id_agente"]).html (value["nombre"]);
$("#id_agents").append (option);

View File

@ -298,6 +298,7 @@ foreach ($items as $item) {
}
else {
$module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$row[3] =
ui_print_truncate_text(io_safe_output($module_name_db), 'module_small');
}
@ -392,8 +393,6 @@ function added_ids_sorted_items_to_hidden_input() {
$("input[name='ids_items_to_sort']").val(ids);
console.log(ids);
if (ids == '') {
alert("<?php echo __("Please select any item to order");?>");
@ -414,6 +413,5 @@ function only_numbers(name) {
}
$("input[name='" + name + "']").val(value);
}
</script>

View File

@ -46,7 +46,6 @@ switch ($action) {
case 'sort_items':
switch ($activeTab) {
case 'list_items':
$resultOperationDB = null;
$position_to_sort = (int)get_parameter('position_to_sort', 1);
$ids_serialize = (string)get_parameter('ids_items_to_sort', '');
@ -171,7 +170,7 @@ switch ($action) {
__('Successfully deleted'),
__('Could not be deleted'));
}
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$return_all_group = true;
@ -229,24 +228,23 @@ switch ($action) {
}
$data = array ();
if (check_acl ($config["id_user"], $report["id_group"], "AW")) {
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='.
$report['id_report'].'">'.$report['name'].'</a>';
} else {
}
else {
$data[0] = $report['name'];
}
$data[1] = $report['description'];
$data[2] = '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'">' .
html_print_image("images/reporting.png", true) . '</a>';
html_print_image("images/reporting.png", true) . '</a>';
$data[3] = '<a href="ajax.php?page=operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway
//Calculate dinamically the number of the column
$next = 4;
if (enterprise_hook ('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) {
@ -259,10 +257,10 @@ switch ($action) {
$data[$next] = __('Yes');
else
$data[$next] = __('No');
$next++;
$data[$next] = ui_print_group_icon($report['id_group'], true);
$next++;
@ -270,7 +268,7 @@ switch ($action) {
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
$data[$next] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit')));
$data[$next] .= '</form>';
$data[$next] .= '&nbsp;&nbsp;<form method="post" style="display:inline" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
$data[$next] .= html_print_input_hidden ('action','delete_report', true);
@ -280,10 +278,11 @@ switch ($action) {
}
array_push ($table->data, $data);
}
html_print_table ($table);
} else {
}
else {
echo "<div class='nf'>".__('There are no defined reportings')."</div>";
}
@ -427,7 +426,7 @@ switch ($action) {
$values['id_agent'] = get_parameter('id_agent');
$values['id_gs'] = get_parameter('id_custom_graph');
$values['id_agent_module'] = '';
if (isset($values['type'])) {
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent'))
@ -437,7 +436,7 @@ switch ($action) {
}
else
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong');
$values['monday'] = get_parameter('monday', 0);
$values['tuesday'] = get_parameter('tuesday', 0);
@ -518,7 +517,7 @@ switch ($action) {
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$values['style'] = io_safe_input(json_encode($style));
if ($good_format){
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
}
@ -582,7 +581,7 @@ switch ($action) {
$values['text'] = get_parameter('text');
$good_format = true;
}
$values['id_agent'] = get_parameter('id_agent');
$values['id_gs'] = get_parameter('id_custom_graph');
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent'))
@ -601,9 +600,9 @@ switch ($action) {
}
else{
$values['only_display_wrong'] = $only_display_wrong_tmp;
}
}
break;
}
}
$values['monday'] = get_parameter('monday', 0);
$values['tuesday'] = get_parameter('tuesday', 0);
$values['wednesday'] = get_parameter('wednesday', 0);
@ -620,8 +619,8 @@ switch ($action) {
case "oracle":
$values['time_from'] = '#to_date(\'' . get_parameter('time_from') . '\',\'hh24:mi\')';
$values['time_to'] = '#to_date(\'' . get_parameter('time_to') . '\', \'hh24:mi\')';
break;
}
break;
}
$values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent',0);
$values['show_resume'] = get_parameter ('checkbox_show_resume',0);
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown',0);
@ -833,14 +832,14 @@ switch ($action) {
break;
}
//db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem));
switch ($dir) {
case 'up':
$newOrder = $oldOrder - 1;
break;
case 'down':
$newOrder = $oldOrder + 1;
break;
break;
}
db_process_sql_begin();

View File

@ -32,7 +32,7 @@ function check_refererer() {
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
}
// If refresh is performed then dont't check referer
// This is done due to problems with HTTP_REFERER var when metarefresh is performed
if ($config["refr"] > 0)

View File

@ -130,20 +130,20 @@ function html_print_select_style ($fields, $name, $selected = '', $style='', $sc
if (!empty ($disabled)) {
$attributes .= ' disabled="disabled"';
}
$output .= '<select style="'.$style.'" id="'.$id.'" name="'.$name.'"'.$attributes.'>';
if ($nothing != '' || empty ($fields)) {
if ($nothing == '') {
$nothing = __('None');
}
}
$output .= '<option value="'.$nothing_value.'"';
if ($nothing_value == $selected) {
$output .= ' selected="selected"';
}
$output .= '>'.$nothing.'</option>';
}
if (!empty ($fields)) {
if ($sort !== false) {
asort ($fields);
@ -169,12 +169,12 @@ function html_print_select_style ($fields, $name, $selected = '', $style='', $sc
}
}
}
$output .= "</select>";
if ($return)
return $output;
echo $output;
}
@ -1171,7 +1171,7 @@ function html_print_checkbox_extended ($name, $value, $checked, $disabled, $scri
*/
function html_print_checkbox ($name, $value, $checked = false, $return = false, $disabled = false, $script = '') {
$output = html_print_checkbox_extended ($name, $value, (bool) $checked, $disabled, $script, '', true);
if ($return === false)
echo $output;
@ -1217,7 +1217,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src
}
return io_safe_input($src);
}
$output = '<img src="'.io_safe_input ($src).'" '; //safe input necessary to strip out html entities correctly
$style = '';

View File

@ -41,7 +41,6 @@ function get_last_global_counter() {
async: false,
success: function(data) {
if (data['correct'] == 1) {
console.log(global_counter_chat+" < "+data['global_counter']);
global_counter_chat = data['global_counter'];
}
}

View File

@ -76,22 +76,21 @@ window.onload = function() {
d.termNumber = 1;
xMoveTo(d, visibleMargin - menuW, 0);
xShow(d);
// If navigator is IE then call attachEvent, else call addEventListener
if ('\v'=='v')
document.getElementById('show_menu').attachEvent('onclick', docOnMousemoveIn);
else
document.getElementById('show_menu').addEventListener('click', docOnMousemoveIn, false);
// Hack to repeat the init process to period select
var periodSelectId = $('[name="period"]').attr('class');
period_select_init(periodSelectId);
$("#graph_menu_arrow").click(function(){
console.log($("#graph_menu_arrow").attr("src").indexOf("hide"));
if ($("#graph_menu_arrow").attr("src").indexOf("hide") == -1){
$("#graph_menu_arrow").attr("src", <?php echo '"' . $config['homeurl'] . '"'; ?> + "/images/graphmenu_arrow_hide.png");
}
@ -99,14 +98,14 @@ window.onload = function() {
$("#graph_menu_arrow").attr("src", <?php echo '"' . $config['homeurl'] . '"'; ?> + "/images/graphmenu_arrow.png");
}
});
};
function docOnMousemoveIn(evt) {
var e = new xEvent(evt);
var d = getTermEle(e.target);
// if (!tnActive) { // no def is active
// if (d) { // mouse is over a term, activate its def
if (showed == 0) {

View File

@ -1020,8 +1020,8 @@ printTree_($activeTab);
<script language="javascript" type="text/javascript">
status = $('#status').val();
search_free = $('#text-search_free').val();
var status = $('#status').val();
var search_free = $('#text-search_free').val();
/**
* loadSubTree asincronous load ajax the agents or modules (pass type, id to search and binary structure of branch),
* change the [+] or [-] image (with same more or less div id) of tree and anime (for show or hide)