2008-08-25 Sancho lerena <slerena@artica.es>

* extensions/update_manager: Added update manager client for
        PandoraFMS.

        * operation/reporting/custom_reporting.php: Moved PDF link.

        * operation/reporting/reporting_viewer_pdf.php: Moved to enterprise
        version.

        * godmode/agentes/agent_disk_conf_editor.php: Moved to enterprise
        version.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1034 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-08-25 17:51:52 +00:00
parent 3976f04f63
commit ee949b4d8b
6 changed files with 132 additions and 164 deletions

View File

@ -1,3 +1,16 @@
2008-08-25 Sancho lerena <slerena@artica.es>
* extensions/update_manager: Added update manager client for
PandoraFMS.
* operation/reporting/custom_reporting.php: Moved PDF link.
* operation/reporting/reporting_viewer_pdf.php: Moved to enterprise
version.
* godmode/agentes/agent_disk_conf_editor.php: Moved to enterprise
version.
2008-08-25 Evi Vanoost <vanooste@rcbi.rochester.edu>
* godmode/agentes/modificar_agente.php: Updated delete routine to

View File

@ -0,0 +1,112 @@
<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2008 Esteban Sanchez, estebans@artica.es
// Copyright (c) 2008 Artica Soluciones Tecnologicas S.L, info@artica.es
// 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; version 2
// of the License, or (at your option) any later version.
// 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.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
function load_update_manager_lib () {
set_time_limit (0);
require_once ('update_manager/load_updatemanager.php');
}
function pandora_update_manager_install () {
global $config;
global $db;
if (isset ($config['update_manager_installed']))
/* Already installed */
return;
load_update_manager_lib ();
/* SQL installation */
$sentences = file (EXTENSIONS_DIR.'/update_manager/sql/update_manager.sql');
foreach ($sentences as $sentence) {
$success = process_sql ($sentence);
if ($success === false)
return;
}
$sql = 'INSERT INTO `tconfig` (`token`, `value` ) VALUES ("update_manager_installed", 1)';
process_sql ($sql);
$db =& um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
$config['dbpass'], $config['dbname']);
um_db_update_setting ('updating_code_path',
dirname ($_SERVER['SCRIPT_FILENAME']));
um_db_update_setting ('dbname', $config['dbname']);
um_db_update_setting ('dbuser', $config['dbuser']);
um_db_update_setting ('dbpass', $config['dbpass']);
um_db_update_setting ('dbhost', $config['dbhost']);
}
function pandora_update_manager_uninstall () {
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`');
process_sql ('DROP TABLE `tupdate_package`');
}
function pandora_update_manager_main () {
global $config;
global $db;
load_update_manager_lib ();
require_once ('update_manager/main.php');
}
function pandora_update_manager_login () {
global $config;
global $db;
load_update_manager_lib ();
$db =& um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
$config['dbpass'], $config['dbname']);
$settings = um_db_load_settings ();
$user_key = exec ($settings->keygen_path);
$package = um_client_check_latest_update ($settings, $user_key);
if (is_object ($package)) {
echo '<div class="notify">';
echo '<img src="images/information.png" /> ';
echo __('There\'s a new update for Pandora');
echo '. <a href="index.php?sec=extensions&sec2=extensions/update_manager">';
echo __('More info');
echo '</a>';
echo '</div>';
}
}
function pandora_update_manager_godmode () {
global $config;
global $db;
load_update_manager_lib ();
require_once ('update_manager/settings.php');
}
add_operation_menu_option (__('Update manager'));
add_godmode_menu_option (__('Update manager settings'), 'PM');
add_extension_main_function ('pandora_update_manager_main');
add_extension_godmode_function ('pandora_update_manager_godmode');
add_extension_login_function ('pandora_update_manager_login');
$db = NULL;
pandora_update_manager_install ();
?>

View File

@ -1,94 +1,10 @@
<?php
<?PHP
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
echo "<h3>This feature is not included on OpenSource version. Please visit our website to learn more about the advanced features of <a href='http://pandorafms.com'>Pandora FMS Enterprise edition</a></h3>";
// 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.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require("include/config.php");
if (! give_acl ($config['id_user'], 0, "AW")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access agent manager");
require ("general/noaccess.php");
return;
}
// Saves the configuration and the md5 hash
function save_config ($agent_config) {
global $agent_md5, $config;
$agent_config = unsafe_string ($agent_config);
// Save configuration
$file = fopen ($config["remote_config"]."/".$agent_md5.".conf", "wb");
fwrite ($file, $agent_config);
fclose ($file);
// Save configuration md5
$config_md5 = md5 ($agent_config);
$file = fopen ($config["remote_config"]."/".$agent_md5.".md5", "wb");
fwrite ($file, $config_md5);
fclose ($file);
}
// Update configuration
if (isset ($_POST["disk_conf"])) {
save_config (str_replace ("\r\n", "\n", $_POST["disk_conf"]));
echo "<h3 class='suc'>".__('Agent successfully updated')."</h3>";
}
// Read configuration file
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf";
$file = fopen ($file_name, "rb");
$agent_config = fread ($file, filesize($file_name));
fclose ($file);
// Display it
echo '<form name="update" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">';
echo '<table width="650" cellpadding="4" cellspacing="4" class="databox_color">';
echo '<tr>';
echo '<td class="datos"><b>'.__('Agent name').'</b></td>';
echo '<td class="datos">';
echo '<input disabled type="text" name="agente" size=30 value="'.$nombre_agente.'">';
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
echo '<img src="images/lupa.png" border="0" align="middle" alt="">';
echo '</a>';
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'">';
echo '<img src="images/cog.png" border="0" align="middle" alt="">';
echo '</a>';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="datos2" colspan="2">';
echo '<textarea class="conf_editor" name="disk_conf">';
echo $agent_config;
echo '</textarea>';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<table width="650"><tr><td align="right">';
echo '<tr>';
echo '<td align="right">';
echo '<input name="updbutton" type="submit" class="sub upd" value="'.__('Update').'">';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</form>';
// Footer
echo "</div><div id='foot'>";
include ("general/footer.php");
echo "</div>";
// Footer
echo "</div><div id='foot'>";
include ("general/footer.php");
echo "</div>";
?>

View File

@ -26,7 +26,7 @@ global $build_version;
global $pandora_version;
// Set to 1 to do not check for installer or config file (for development!).
$develop_bypass = 0;
$develop_bypass = 1;
if ($develop_bypass != 1){
// If no config file, automatically try to install

View File

@ -37,7 +37,6 @@ $table->head = array ();
$table->head[0] = __('Report name');
$table->head[1] = __('Description');
$table->head[2] = __('HTML');
$table->head[3] = __('PDF');
$table->align = array ();
$table->align[2] = 'center';
$table->align[3] = 'center';
@ -50,8 +49,6 @@ foreach ($reports as $report) {
$data[1] = $report['description'];
$data[2] = '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'">
<img src="images/reporting.png"></a>';
$data[3] = '<a href="operation/reporting/reporting_viewer_pdf.php?id_report='.$report['id_report'].'" '.
'target="_new"><img src="images/pdf.png"></a>';
array_push ($table->data, $data);
}

View File

@ -1,70 +0,0 @@
<?php
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
// Please see http://pandora.sourceforge.net 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.
// 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.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require ("../../include/config.php");
require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php");
require_once ("../../include/functions_reporting_pdf.php");
if (! isset ($_SESSION["id_usuario"])) {
session_start ();
session_write_close ();
}
// Session check
check_login ();
// Login check
global $REMOTE_ADDR;
$config['id_user'] = $_SESSION["id_usuario"];
if (comprueba_login ()) {
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation", "Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
if (! give_acl ($config["id_user"], 0, "AR") && ! dame_admin ($config["id_user"])) {
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation", "Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
$id_report = (int) get_parameter ('id_report');
if (! $id_report) {
audit_db ($config["id_user"], $REMOTE_ADDR, "HACK Attempt", "Trying to access graph viewer withoud ID");
include ("general/noaccess.php");
exit;
}
$report = get_db_row ("treport", "id_report", $id_report);
if ($report['id_user'] != $config["id_user"] && ! give_acl ($config["id_user"], $report['id_group'], 'AR')) {
echo "<h2>No access without report type</h2>";
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation", "Trying to access unauthorized report");
exit;
}
include ('../../include/pdf/class.ezpdf.php');
require ('../../include/functions_reporting.php');
get_pdf_report ($report);
?>