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> 2011-03-22 Raul Mateos <raulofpandora@gmail.com>
* extensions/resource_registration.php, * 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. Cleaned code and updated page disclaimers.
* include/functions_reporting.php: Removed SVN errors in code. * include/functions_reporting.php: Removed SVN errors in code.

View File

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

View File

@ -1,15 +1,17 @@
<?php <?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 // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation for version 2. // as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
function createXMLData($agent, $agentModule, $time, $data) { function createXMLData($agent, $agentModule, $time, $data) {
@ -44,20 +46,19 @@ function mainInsertData() {
global $config; 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"); if (! check_acl ($config['id_user'], 0, "AW") && ! is_user_admin ($config['id_user'])) {
require ("general/noaccess.php"); pandora_audit("ACL Violation", "Trying to access Setup Management");
return; require ("general/noaccess.php");
} return;
}
$save = (bool)get_parameter('save', false);
$id_agent = (string)get_parameter('id_agent', ''); $save = (bool)get_parameter('save', false);
$id_agent_module = (int)get_parameter('id_agent_module', ''); $id_agent = (string)get_parameter('id_agent', '');
$data = (string)get_parameter('data'); $id_agent_module = (int)get_parameter('id_agent_module', '');
$data = (string)get_parameter('data');
$date = (string) get_parameter ('date', date ('Y-m-d')); $date = (string) get_parameter ('date', date ('Y-m-d'));
$time = (string) get_parameter ('time', date ('h:00A')); $time = (string) get_parameter ('time', date ('h:00A'));
if (isset($_FILES['csv'])) { if (isset($_FILES['csv'])) {
@ -73,82 +74,79 @@ function mainInsertData() {
} }
if ($save) { if ($save) {
if (!check_acl($config['id_user'], get_agent_group(get_agent_id($id_agent)), "AW")) { 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.')); print_error_message(__('You haven\'t privileges for insert data in the agent.'));
} }
else { else {
$agent = get_db_row_filter('tagente', array('nombre' => $id_agent)); $agent = get_db_row_filter('tagente', array('nombre' => $id_agent));
$agentModule = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); $agentModule = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
$date2 = str_replace('-', '/', $date); $date2 = str_replace('-', '/', $date);
$time2 = DATE("H:i", strtotime($time)); $time2 = DATE("H:i", strtotime($time));
$date_xml = $date2 . ' ' . $time2 . ':00'; $date_xml = $date2 . ' ' . $time2 . ':00';
if ($csv !== false) {
$file = file($csv['tmp_name']);
if ($csv !== false) { foreach ($file as $line) {
$file = file($csv['tmp_name']); $tokens = explode(';', $line);
foreach ($file as $line) { createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1]));
$tokens = explode(';', $line); }
}
createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1])); else {
} createXMLData($agent, $agentModule, $date_xml, $data);
} }
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>';
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."); $table = null;
echo '</div>'; $table->width = '80%';
$table->style = array();
$table = null; $table->style[0] = 'font-weight: bolder;';
$table->width = '80%';
$table->style = array(); $table->data = array();
$table->style[0] = 'font-weight: bolder;'; $table->data[0][0] = __('Agent');
$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, '', $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) 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>'; . '<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 (); $modules = array ();
if ($id_agent) if ($id_agent)
$modules = get_agent_modules ($id_agent, false, array("delete_pending" => 0)); $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, $table->data[1][1] = print_select ($modules, 'id_agent_module', $id_agent_module, true,
__('Select'), 0, true, false, true, '', ($id_agent === '')); __('Select'), 0, true, false, true, '', ($id_agent === ''));
$table->data[2][0] = __('Data'); $table->data[2][0] = __('Data');
$table->data[2][1] = print_input_text('data', $data, __('Data'), 40, 60, true); $table->data[2][1] = print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date'); $table->data[3][0] = __('Date');
$table->data[3][1] = print_input_text ('date', $date, '', 11, 11, true).' '; $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[3][1] .= print_input_text ('time', $time, '', 7, 7, true);
$table->data[4][0] = __('CSV'); $table->data[4][0] = __('CSV');
$table->data[4][1] = print_input_file('csv', true); $table->data[4][1] = print_input_file('csv', true);
echo "<form method='post' enctype='multipart/form-data'>"; echo "<form method='post' enctype='multipart/form-data'>";
print_table($table); print_table($table);
echo "<div style='text-align: right; width: " . $table->width . "'>"; echo "<div style='text-align: right; width: " . $table->width . "'>";
print_input_hidden('save', 1); print_input_hidden('save', 1);
print_submit_button(__('Save'), 'submit', ($id_agent === ''), 'class="sub next"'); print_submit_button(__('Save'), 'submit', ($id_agent === ''), 'class="sub next"');
echo "</div>"; echo "</div>";
echo "</form>"; echo "</form>";
require_css_file ('datepicker'); require_css_file ('datepicker');
require_jquery_file ('ui.core'); require_jquery_file ('ui.core');
require_jquery_file ('ui.datepicker'); require_jquery_file ('ui.datepicker');
require_jquery_file ('timeentry'); require_jquery_file ('timeentry');
require_jquery_file ('autocomplete'); require_jquery_file ('autocomplete');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
@ -223,9 +221,9 @@ function mainInsertData() {
); );
/* ]]> */ /* ]]> */
</script> </script>
<?php <?php
} }
add_extension_godmode_function('mainInsertData'); add_extension_godmode_function('mainInsertData');
add_godmode_menu_option(__('Insert Data'), 'AW', 'gagente'); add_godmode_menu_option(__('Insert Data'), 'AW', 'gagente');
?> ?>

View File

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

View File

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

View File

@ -1,15 +1,17 @@
<?php <?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 // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation for version 2. // as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
add_extension_opemode_tab_agent ('ssh_console','SSH Console','extensions/ssh_console/ssh.png',"main_ssh_console"); 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> <div>
<APPLET CODE="com.mindbright.application.MindTerm.class" style="border: 2px;" ARCHIVE="extensions/ssh_console/mindterm.jar" WIDTH=720 HEIGHT=500> <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="sepframe" value="false">
<PARAM NAME="debug" value="false"> <param name="debug" value="false">
<param name="verbose" value="false"> <param name="verbose" value="false">
<param name="bg-color" value="black"> <param name="bg-color" value="black">
<param name="fg-color" value="white"> <param name="fg-color" value="white">
@ -33,12 +35,11 @@ function main_ssh_console () {
<param name="save-lines" value="2000"> <param name="save-lines" value="2000">
<param name="menus" value="pop2"5> <param name="menus" value="pop2"5>
<param name="exit-on-logout" value="true"> <param name="exit-on-logout" value="true">
<PARAM NAME="server" value="<?PHP echo $ip; ?>"> <param name="server" value="<?PHP echo $ip; ?>">
</applet> </applet>
</div> </div>
<?php <?php
} }
?> ?>

View File

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

View File

@ -1,15 +1,17 @@
<?php <?php
//Pandora FMS- http://pandorafms.com // Pandora FMS - http://pandorafms.com
// ================================================== // ==================================================
// Copyright (c) 2005-2011 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 // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation for version 2. // as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
function load_update_manager_lib () { function load_update_manager_lib () {
@ -74,7 +76,7 @@ function pandora_update_manager_uninstall () {
process_sql ('DROP TABLE `tupdate_package`'); process_sql ('DROP TABLE `tupdate_package`');
break; break;
case "postgresql": 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_settings"');
process_sql ('DROP TABLE "tupdate_journal"'); process_sql ('DROP TABLE "tupdate_journal"');
process_sql ('DROP TABLE "tupdate"'); process_sql ('DROP TABLE "tupdate"');

View File

@ -1,15 +1,17 @@
<?php <?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 // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation for version 2. // as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
function users_extension_main() { function users_extension_main() {
@ -46,46 +48,46 @@ function users_extension_main_god ($god = true) {
echo "<div class='nf'>".__('No other users connected')."</div>"; echo "<div class='nf'>".__('No other users connected')."</div>";
} }
else { else {
$table->cellpadding = 4; $table->cellpadding = 4;
$table->cellspacing = 4; $table->cellspacing = 4;
$table->width = 600; $table->width = 600;
$table->class = "databox"; $table->class = "databox";
$table->size = array (); $table->size = array ();
$table->data = array (); $table->data = array ();
$table->head = array (); $table->head = array ();
$table->head[0] = __('User'); $table->head[0] = __('User');
$table->head[1] = __('IP'); $table->head[1] = __('IP');
$table->head[2] = __('Date'); $table->head[2] = __('Date');
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
// Get data // Get data
foreach ($rows as $row) { foreach ($rows as $row) {
if ($rowPair) if ($rowPair)
$table->rowclass[$iterator] = 'rowPair'; $table->rowclass[$iterator] = 'rowPair';
else else
$table->rowclass[$iterator] = 'rowOdd'; $table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair; $rowPair = !$rowPair;
$iterator++; $iterator++;
$data = array (); $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[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[1] = $row["ip_origen"];
$data[2] = $row["fecha"]; $data[2] = $row["fecha"];
array_push ($table->data, $data); array_push ($table->data, $data);
}
print_table ($table);
} }
print_table ($table);
}
} }
add_godmode_menu_option (__('Users connected'), 'UM','gusuarios',"users/icon.png"); add_godmode_menu_option (__('Users connected'), 'UM','gusuarios',"users/icon.png");
if (isset($config["id_user"])) { if (isset($config["id_user"])) {
if (check_acl ($config["id_user"], 0, "UM")) { if (check_acl ($config["id_user"], 0, "UM")) {
add_operation_menu_option(__('Users connected'), 'usuarios',"users/icon.png"); add_operation_menu_option(__('Users connected'), 'usuarios',"users/icon.png");
} }
} }
add_extension_godmode_function('users_extension_main_god'); add_extension_godmode_function('users_extension_main_god');

View File

@ -2,26 +2,27 @@
// 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 // Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation for version 2. // as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
function vnc_view() { function vnc_view() {
$idAgent = (int)get_parameter('id_agente', 0); $idAgent = (int)get_parameter('id_agente', 0);
$ipAgent = get_db_value('direccion', 'tagente', 'id_agente', $idAgent); $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="Host" value="'.$ipAgent.'">';
echo '<param name="Port" value="5901">'; echo '<param name="Port" value="5901">';
echo '<PARAM NAME="Scaling factor" VALUE=75>'; echo '<param name="Scaling factor" value="75">';
echo '</APPLET>'; echo '</applet>';
/* <iframe width="95%" height="500px" src="http://<?php echo $ipAgent;?>:5801"></iframe> */ /* <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 // Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or // 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 // as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
/** /**