2011-03-22 Raul Mateos <raulofpandora@gmail.com>

* extensions/ssh_console.php, extensions/vnc_view.php,
	extensions/update_manager.php, extensions/users_connected.php,
	extensions/extension_uploader.php, extensions/insert_data.php,
	extensions/module_groups.php, extensions/plugin_registration.php:
	Cleaned code and updated page disclaimers.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4120 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2011-03-22 22:11:57 +00:00
parent cf6f219fc5
commit 4f8f77cbab
11 changed files with 324 additions and 306 deletions

View File

@ -1,7 +1,15 @@
2011-03-22 Raul Mateos <raulofpandora@gmail.com>
* extensions/ssh_console.php, extensions/vnc_view.php,
extensions/update_manager.php, extensions/users_connected.php,
extensions/extension_uploader.php, extensions/insert_data.php,
extensions/module_groups.php, extensions/plugin_registration.php:
Cleaned code and updated page disclaimers.
2011-03-22 Raul Mateos <raulofpandora@gmail.com>
* extensions/resource_registration.php,
extensions/resource_exporation.php, extensions/agent_modules.php:
extensions/resource_exportation.php, extensions/agent_modules.php:
Cleaned code and updated page disclaimers.
* include/functions_reporting.php: Removed SVN errors in code.

View File

@ -1,15 +1,17 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function extension_uploader_extensions() {
@ -59,9 +61,9 @@ function extension_uploader_extensions() {
echo "<form method='post' enctype='multipart/form-data'>";
print_table($table);
echo "<div style='text-align: right; width: " . $table->width . "'>";
print_input_hidden('upload', 1);
print_submit_button(__('Upload'), 'submit', false, 'class="sub add"');
echo "</div>";
print_input_hidden('upload', 1);
print_submit_button(__('Upload'), 'submit', false, 'class="sub add"');
echo "</div>";
echo "</form>";
}

View File

@ -1,15 +1,17 @@
<?php
//Pandora FMS- http://pandorafms.com
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function createXMLData($agent, $agentModule, $time, $data) {
@ -44,20 +46,19 @@ function mainInsertData() {
global $config;
print_page_header (__("Insert data"), "images/extensions.png", false, "", true, "");
print_page_header (__("Insert data"), "images/extensions.png", false, "", true, "");
if (! check_acl ($config['id_user'], 0, "AW") && ! is_user_admin ($config['id_user'])) {
pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
$save = (bool)get_parameter('save', false);
$id_agent = (string)get_parameter('id_agent', '');
$id_agent_module = (int)get_parameter('id_agent_module', '');
$data = (string)get_parameter('data');
if (! check_acl ($config['id_user'], 0, "AW") && ! is_user_admin ($config['id_user'])) {
pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
$save = (bool)get_parameter('save', false);
$id_agent = (string)get_parameter('id_agent', '');
$id_agent_module = (int)get_parameter('id_agent_module', '');
$data = (string)get_parameter('data');
$date = (string) get_parameter ('date', date ('Y-m-d'));
$time = (string) get_parameter ('time', date ('h:00A'));
if (isset($_FILES['csv'])) {
@ -73,82 +74,79 @@ function mainInsertData() {
}
if ($save) {
if (!check_acl($config['id_user'], get_agent_group(get_agent_id($id_agent)), "AW")) {
print_error_message(__('You haven\'t privileges for insert data in the agent.'));
}
else {
$agent = get_db_row_filter('tagente', array('nombre' => $id_agent));
$agentModule = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
$date2 = str_replace('-', '/', $date);
$time2 = DATE("H:i", strtotime($time));
$date_xml = $date2 . ' ' . $time2 . ':00';
if ($csv !== false) {
$file = file($csv['tmp_name']);
foreach ($file as $line) {
$tokens = explode(';', $line);
createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1]));
}
}
else {
createXMLData($agent, $agentModule, $date_xml, $data);
}
}
}
echo '<div class="notify">';
echo __("Please check that the directory \"/var/spool/pandora/data_in\" is writeable by the apache user. <br /><br />The CSV file format is date;value&lt;newline&gt;date;value&lt;newline&gt;... The date in CSV is in format Y/m/d H:i:s.");
echo '</div>';
$table = null;
$table->width = '80%';
$table->style = array();
$table->style[0] = 'font-weight: bolder;';
$table->data = array();
$table->data[0][0] = __('Agent');
if ($save) {
if (!check_acl($config['id_user'], get_agent_group(get_agent_id($id_agent)), "AW")) {
print_error_message(__('You haven\'t privileges for insert data in the agent.'));
}
else {
$agent = get_db_row_filter('tagente', array('nombre' => $id_agent));
$agentModule = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
$date2 = str_replace('-', '/', $date);
$time2 = DATE("H:i", strtotime($time));
$date_xml = $date2 . ' ' . $time2 . ':00';
if ($csv !== false) {
$file = file($csv['tmp_name']);
foreach ($file as $line) {
$tokens = explode(';', $line);
createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1]));
}
}
else {
createXMLData($agent, $agentModule, $date_xml, $data);
}
}
}
echo '<div class="notify">';
echo __("Please check that the directory \"/var/spool/pandora/data_in\" is writeable by the apache user. <br /><br />The CSV file format is date;value&lt;newline&gt;date;value&lt;newline&gt;... The date in CSV is in format Y/m/d H:i:s.");
echo '</div>';
$table = null;
$table->width = '80%';
$table->style = array();
$table->style[0] = 'font-weight: bolder;';
$table->data = array();
$table->data[0][0] = __('Agent');
$table->data[0][1] = print_input_text_extended ('id_agent', $id_agent, 'text_id_agent', '', 30, 100, false, '',
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true)
. '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search") . '</span></a>';
$table->data[1][0] = __('Module');
$table->data[1][0] = __('Module');
$modules = array ();
if ($id_agent)
$modules = get_agent_modules ($id_agent, false, array("delete_pending" => 0));
$table->data[1][1] = print_select ($modules, 'id_agent_module', $id_agent_module, true,
__('Select'), 0, true, false, true, '', ($id_agent === ''));
$table->data[2][0] = __('Data');
$table->data[2][1] = print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date');
$table->data[3][1] = print_input_text ('date', $date, '', 11, 11, true).' ';
$table->data[2][0] = __('Data');
$table->data[2][1] = print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date');
$table->data[3][1] = print_input_text ('date', $date, '', 11, 11, true).' ';
$table->data[3][1] .= print_input_text ('time', $time, '', 7, 7, true);
$table->data[4][0] = __('CSV');
$table->data[4][1] = print_input_file('csv', true);
echo "<form method='post' enctype='multipart/form-data'>";
print_table($table);
echo "<div style='text-align: right; width: " . $table->width . "'>";
print_input_hidden('save', 1);
print_submit_button(__('Save'), 'submit', ($id_agent === ''), 'class="sub next"');
echo "</div>";
echo "</form>";
require_css_file ('datepicker');
$table->data[4][0] = __('CSV');
$table->data[4][1] = print_input_file('csv', true);
echo "<form method='post' enctype='multipart/form-data'>";
print_table($table);
echo "<div style='text-align: right; width: " . $table->width . "'>";
print_input_hidden('save', 1);
print_submit_button(__('Save'), 'submit', ($id_agent === ''), 'class="sub next"');
echo "</div>";
echo "</form>";
require_css_file ('datepicker');
require_jquery_file ('ui.core');
require_jquery_file ('ui.datepicker');
require_jquery_file ('timeentry');
require_jquery_file ('autocomplete');
?>
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
@ -223,9 +221,9 @@ function mainInsertData() {
);
/* ]]> */
</script>
<?php
<?php
}
add_extension_godmode_function('mainInsertData');
add_godmode_menu_option(__('Insert Data'), 'AW', 'gagente');
?>
?>

View File

@ -1,18 +1,20 @@
<?php
/**
* Pandora FMS- http://pandorafms.com
* ==================================================
* Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
if (is_ajax ()) {
@ -34,7 +36,7 @@ if (is_ajax ()) {
if ($module_group == $module['id_module_group']) {
if ($alert["times_fired"] > 0) {
echo '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
echo '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
$agent = get_db_row('tagente', 'id_agente', $module['id_agente']);
echo '<strong>' . __('Agent').': </strong>';
echo safe_output($agent['nombre']) . '<br />';

View File

@ -1,25 +1,26 @@
<?php
//Pandora FMS- http://pandorafms.com
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function pluginreg_extension_main () {
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
print_page_header (__('Plugin registration'), "images/extensions.png", false, "", true, "" );
@ -45,20 +46,20 @@ function pluginreg_extension_main () {
if ($zip) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_open($zip, $zip_entry, "r")) {
if (zip_entry_name($zip_entry) == "plugin_definition.ini"){
$basepath = $config["attachment_store"];
} else {
$basepath = $config["plugin_store"];
}
$filename = $basepath . "/". zip_entry_name($zip_entry);
$fp = fopen($filename, 'w');
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
fwrite($fp, $buf);
fclose($fp);
chmod ($filename, 0755);
zip_entry_close($zip_entry);
}
if (zip_entry_open($zip, $zip_entry, "r")) {
if (zip_entry_name($zip_entry) == "plugin_definition.ini"){
$basepath = $config["attachment_store"];
} else {
$basepath = $config["plugin_store"];
}
$filename = $basepath . "/". zip_entry_name($zip_entry);
$fp = fopen($filename, 'w');
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
fwrite($fp, $buf);
fclose($fp);
chmod ($filename, 0755);
zip_entry_close($zip_entry);
}
}
zip_close($zip);
}
@ -74,7 +75,7 @@ function pluginreg_extension_main () {
$file_exec_path = $exec_path;
if (isset($ini_array["plugin_definition"]["execution_command"]) && ($ini_array["plugin_definition"]["execution_command"] != "")){
$exec_path = $ini_array["plugin_definition"]["execution_command"] . " " . $config["plugin_store"] . "/" . $ini_array["plugin_definition"]["filename"];
$exec_path = $ini_array["plugin_definition"]["execution_command"] . " " . $config["plugin_store"] . "/" . $ini_array["plugin_definition"]["filename"];
}
if (isset($ini_array["plugin_definition"]["execution_postcommand"]) && ($ini_array["plugin_definition"]["execution_postcommand"] != "")){

View File

@ -1,15 +1,17 @@
<?php
//Pandora FMS- http://pandorafms.com
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
add_extension_opemode_tab_agent ('ssh_console','SSH Console','extensions/ssh_console/ssh.png',"main_ssh_console");
@ -23,9 +25,9 @@ function main_ssh_console () {
?>
<div>
<APPLET CODE="com.mindbright.application.MindTerm.class" style="border: 2px;" ARCHIVE="extensions/ssh_console/mindterm.jar" WIDTH=720 HEIGHT=500>
<PARAM NAME="sepframe" value="false">
<PARAM NAME="debug" value="false">
<applet code="com.mindbright.application.MindTerm.class" style="border: 2px;" archive="extensions/ssh_console/mindterm.jar" width="720" height="500">
<param name="sepframe" value="false">
<param name="debug" value="false">
<param name="verbose" value="false">
<param name="bg-color" value="black">
<param name="fg-color" value="white">
@ -33,12 +35,11 @@ function main_ssh_console () {
<param name="save-lines" value="2000">
<param name="menus" value="pop2"5>
<param name="exit-on-logout" value="true">
<PARAM NAME="server" value="<?PHP echo $ip; ?>">
<param name="server" value="<?PHP echo $ip; ?>">
</applet>
</div>
<?php
}
?>

View File

@ -1,15 +1,17 @@
<?php
//Pandora FMS- http://pandorafms.com
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function getPandoraDiagnostic(&$systemInfo) {
@ -147,7 +149,7 @@ function show_logfile($file_name, $numLines = 2000) {
else {
echo "<h2>" . $file_name . "</h2>";
echo "<textarea style='width: 95%; height: 200px;' name='$file_name'>";
echo shell_exec('tail -n ' . $numLines . ' ' . $file_name);
echo shell_exec('tail -n ' . $numLines . ' ' . $file_name);
echo "</textarea>";
}
}
@ -164,7 +166,7 @@ function logFilesLines($file_name, $numLines) {
return '';
}
else {
return shell_exec('tail -n ' . $numLines . ' ' . $file_name);
return shell_exec('tail -n ' . $numLines . ' ' . $file_name);
}
}
}
@ -227,104 +229,104 @@ function show_array($title, $anchor, $array = array()) {
function mainSystemInfo() {
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
$show = (bool) get_parameter('show');
$generate = (bool) get_parameter('generate');
$pandora_diag = (bool) get_parameter('pandora_diag', 0);
$system_info = (bool) get_parameter('system_info', 0);
$log_info = (bool) get_parameter('log_info', 0);
$log_num_lines = (int) get_parameter('log_num_lines', 2000);
print_page_header (__("System Info"), "images/extensions.png", false, "", true, "" );
echo '<div class="notify">';
echo __("This extension can run as PHP script in a shell for extract more information, but it must be run as root or across sudo. For example: <i>sudo php /var/www/pandora_console/extensions/system_info.php -d -s -c</i>");
echo '</div>';
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
$show = (bool) get_parameter('show');
$generate = (bool) get_parameter('generate');
$pandora_diag = (bool) get_parameter('pandora_diag', 0);
$system_info = (bool) get_parameter('system_info', 0);
$log_info = (bool) get_parameter('log_info', 0);
$log_num_lines = (int) get_parameter('log_num_lines', 2000);
print_page_header (__("System Info"), "images/extensions.png", false, "", true, "" );
echo '<div class="notify">';
echo __("This extension can run as PHP script in a shell for extract more information, but it must be run as root or across sudo. For example: <i>sudo php /var/www/pandora_console/extensions/system_info.php -d -s -c</i>");
echo '</div>';
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
echo "<form method='post'>";
$table = null;
$table->width = '80%';
$table->align = array();
$table->align[1] = 'right';
$table = null;
$table->width = '80%';
$table->align = array();
$table->align[1] = 'right';
if ($pandora_diag) {
$table->data[0][0] = '<a href="#diag_info">' . __('Pandora Diagnostic info') . "</a>";
$table->data[0][0] = '<a href="#diag_info">' . __('Pandora Diagnostic info') . "</a>";
}
else {
$table->data[0][0] = __('Pandora Diagnostic info');
}
$table->data[0][1] = print_checkbox('pandora_diag', 1, $pandora_diag, true);
if ($system_info) {
$table->data[0][1] = print_checkbox('pandora_diag', 1, $pandora_diag, true);
if ($system_info) {
$table->data[1][0] = '<a href="#system_info">' . __('System info') . '</a>';
}
else {
$table->data[1][0] = __('System info');
}
$table->data[1][1] = print_checkbox('system_info', 1, $system_info, true);
if ($log_info) {
}
else {
$table->data[1][0] = __('System info');
}
$table->data[1][1] = print_checkbox('system_info', 1, $system_info, true);
if ($log_info) {
$table->data[2][0] = '<a href="#log_info">' . __('Log Info') . '</a>';
}
else {
$table->data[2][0] = __('Log Info');
}
$table->data[2][1] = print_checkbox('log_info', 1, $log_info, true);
}
else {
$table->data[2][0] = __('Log Info');
}
$table->data[2][1] = print_checkbox('log_info', 1, $log_info, true);
$table->data[3][0] = __('Number lines of log');
$table->data[3][1] = print_input_text('log_num_lines', $log_num_lines, __('Number lines of log'), 5, 10, true);
print_table($table);
echo "<div style='width: " . $table->width . "; text-align: right;'>";
//print_submit_button(__('Show'), 'show', false, 'class="sub next"');
print_submit_button(__('Generate file'), 'generate', false, 'class="sub next"');
echo "</div>";
echo "</form>";
if ($show) {
if ($pandora_diag) {
$info = array();
getPandoraDiagnostic($info);
show_array(__('Pandora Diagnostic info'), 'diag_info', $info);
}
if ($system_info) {
$info = array();
getSystemInfo($info);
show_array(__('System info'), 'system_info', $info);
}
if ($log_info) {
echo "<h1><a name='log_info'>" . __('Log Info') . "</a></h1>";
getLastLog($log_num_lines);
}
}
elseif ($generate) {
$table->data[3][1] = print_input_text('log_num_lines', $log_num_lines, __('Number lines of log'), 5, 10, true);
print_table($table);
echo "<div style='width: " . $table->width . "; text-align: right;'>";
//print_submit_button(__('Show'), 'show', false, 'class="sub next"');
print_submit_button(__('Generate file'), 'generate', false, 'class="sub next"');
echo "</div>";
echo "</form>";
if ($show) {
if ($pandora_diag) {
$info = array();
getPandoraDiagnostic($info);
show_array(__('Pandora Diagnostic info'), 'diag_info', $info);
}
if ($system_info) {
$info = array();
getSystemInfo($info);
show_array(__('System info'), 'system_info', $info);
}
if ($log_info) {
echo "<h1><a name='log_info'>" . __('Log Info') . "</a></h1>";
getLastLog($log_num_lines);
}
}
elseif ($generate) {
$tempDirSystem = sys_get_temp_dir();
$nameDir = 'dir_' . uniqid();
$tempDir = $tempDirSystem . '/' . $nameDir . '/';
mkdir($tempDir);
$zipArchive = $config['attachment_store'] . '/last_info.zip';
@unlink($zipArchive);
if ($config['https']) {
$zipArchive = $config['attachment_store'] . '/last_info.zip';
@unlink($zipArchive);
if ($config['https']) {
$http = 'https://';
}
else {
$http = "http://";
}
$http = "http://";
}
$url = '<a href="' .$http.$_SERVER['HTTP_HOST'].$config["homeurl"].'/attachment/last_info.zip">' . __('System info file zipped') . '</a>';
echo '<b>' . __('File:') . '</b> ' . $url;
$zip = new ZipArchive;
if ($zip->open($zipArchive, ZIPARCHIVE::CREATE) === true) {
if ($pandora_diag) {
if ($zip->open($zipArchive, ZIPARCHIVE::CREATE) === true) {
if ($pandora_diag) {
$systemInfo = array();
getPandoraDiagnostic($systemInfo);
@ -351,10 +353,9 @@ function mainSystemInfo() {
}
if ($system_info) {
$info = array();
getSystemInfo($info);
$info = array();
getSystemInfo($info);
$file = fopen($tempDir . 'system_info.txt', 'w');
if ($file !== false) {
@ -375,11 +376,11 @@ function mainSystemInfo() {
}
$zip->addFile($tempDir . 'system_info.txt', 'system_info.txt');
}
if ($log_info) {
file_put_contents($tempDir . 'pandora_console.log.lines_' . $log_num_lines, getLastLinesLog($config["homedir"]."/pandora_console.log", $log_num_lines));
$zip->addFile($tempDir . 'pandora_console.log.lines_' . $log_num_lines, 'pandora_console.log.lines_' . $log_num_lines);
}
if ($log_info) {
file_put_contents($tempDir . 'pandora_console.log.lines_' . $log_num_lines, getLastLinesLog($config["homedir"]."/pandora_console.log", $log_num_lines));
$zip->addFile($tempDir . 'pandora_console.log.lines_' . $log_num_lines, 'pandora_console.log.lines_' . $log_num_lines);
file_put_contents($tempDir . 'pandora_server.log.lines_' . $log_num_lines, getLastLinesLog("/var/log/pandora/pandora_server.log", $log_num_lines));
$zip->addFile($tempDir . 'pandora_server.log.lines_' . $log_num_lines, 'pandora_server.log.lines_' . $log_num_lines);
file_put_contents($tempDir . 'pandora_server.error.lines_' . $log_num_lines, getLastLinesLog("/var/log/pandora/pandora_server.error", $log_num_lines));
@ -392,28 +393,28 @@ function mainSystemInfo() {
$zip->addFile($tempDir . 'pandora_server.conf.lines_' . $log_num_lines, 'pandora_server.conf.lines_' . $log_num_lines);
file_put_contents($tempDir . 'syslog.lines_' . $log_num_lines, getLastLinesLog("/var/log/syslog", $log_num_lines));
$zip->addFile($tempDir . 'syslog.lines_' . $log_num_lines, 'syslog.lines_' . $log_num_lines);
}
}
$zip->close();
}
//
// if ($pandora_diag) {
// $info = array();
// getPandoraDiagnostic($info);
// show_array(__('Pandora Diagnostic info'), 'diag_info', $info);
// }
//
// if ($system_info) {
// $info = array();
// getSystemInfo($info);
// show_array(__('System info'), 'system_info', $info);
// }
//
// if ($log_info) {
// echo "<h1><a name='log_info'>" . __('Log Info') . "</a></h1>";
// getLastLog($log_num_lines);
// }
}
}
//
// if ($pandora_diag) {
// $info = array();
// getPandoraDiagnostic($info);
// show_array(__('Pandora Diagnostic info'), 'diag_info', $info);
// }
//
// if ($system_info) {
// $info = array();
// getSystemInfo($info);
// show_array(__('System info'), 'system_info', $info);
// }
//
// if ($log_info) {
// echo "<h1><a name='log_info'>" . __('Log Info') . "</a></h1>";
// getLastLog($log_num_lines);
// }
}
}
function consoleMode() {
@ -629,4 +630,4 @@ else {
consoleMode();
}
?>
?>

View File

@ -1,15 +1,17 @@
<?php
//Pandora FMS- http://pandorafms.com
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function load_update_manager_lib () {
@ -74,7 +76,7 @@ function pandora_update_manager_uninstall () {
process_sql ('DROP TABLE `tupdate_package`');
break;
case "postgresql":
process_sql ('DELETE FROM "tconfig" WHERE "token" = \'update_manager_installed\'');
process_sql ('DELETE FROM "tconfig" WHERE "token" = \'update_manager_installed\'');
process_sql ('DROP TABLE "tupdate_settings"');
process_sql ('DROP TABLE "tupdate_journal"');
process_sql ('DROP TABLE "tupdate"');

View File

@ -1,15 +1,17 @@
<?php
//Pandora FMS- http://pandorafms.com
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function users_extension_main() {
@ -46,46 +48,46 @@ function users_extension_main_god ($god = true) {
echo "<div class='nf'>".__('No other users connected')."</div>";
}
else {
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = 600;
$table->class = "databox";
$table->size = array ();
$table->data = array ();
$table->head = array ();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = 600;
$table->class = "databox";
$table->size = array ();
$table->data = array ();
$table->head = array ();
$table->head[0] = __('User');
$table->head[1] = __('IP');
$table->head[2] = __('Date');
$table->head[0] = __('User');
$table->head[1] = __('IP');
$table->head[2] = __('Date');
$rowPair = true;
$iterator = 0;
$rowPair = true;
$iterator = 0;
// Get data
foreach ($rows as $row) {
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
else
$table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair;
$iterator++;
// Get data
foreach ($rows as $row) {
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
else
$table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair;
$iterator++;
$data = array ();
$data[0] = '<a href="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;id='.$row["id_usuario"].'">'.$row["id_usuario"].'</a>';
$data[1] = $row["ip_origen"];
$data[2] = $row["fecha"];
array_push ($table->data, $data);
$data = array ();
$data[0] = '<a href="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;id='.$row["id_usuario"].'">'.$row["id_usuario"].'</a>';
$data[1] = $row["ip_origen"];
$data[2] = $row["fecha"];
array_push ($table->data, $data);
}
print_table ($table);
}
print_table ($table);
}
}
add_godmode_menu_option (__('Users connected'), 'UM','gusuarios',"users/icon.png");
if (isset($config["id_user"])) {
if (check_acl ($config["id_user"], 0, "UM")) {
add_operation_menu_option(__('Users connected'), 'usuarios',"users/icon.png");
}
if (check_acl ($config["id_user"], 0, "UM")) {
add_operation_menu_option(__('Users connected'), 'usuarios',"users/icon.png");
}
}
add_extension_godmode_function('users_extension_main_god');

View File

@ -2,26 +2,27 @@
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function vnc_view() {
$idAgent = (int)get_parameter('id_agente', 0);
$ipAgent = get_db_value('direccion', 'tagente', 'id_agente', $idAgent);
echo '<APPLET CODE="VncViewer.class" ARCHIVE="extensions/vnc/VncViewer.jar" WIDTH=750 HEIGHT=800>';
echo '<applet code="VncViewer.class" archive="extensions/vnc/VncViewer.jar" width="750" height="800">';
echo '<param name="Host" value="'.$ipAgent.'">';
echo '<param name="Port" value="5901">';
echo '<PARAM NAME="Scaling factor" VALUE=75>';
echo '</APPLET>';
echo '<param name="Scaling factor" value="75">';
echo '</applet>';
/* <iframe width="95%" height="500px" src="http://<?php echo $ipAgent;?>:5801"></iframe> */
}

View File

@ -6,12 +6,12 @@
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**