2008-08-25 19:51:52 +02:00
|
|
|
<?php
|
2009-06-08 20:26:14 +02:00
|
|
|
|
|
|
|
//Pandora FMS- http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
|
|
|
|
2008-08-25 19:51:52 +02:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2009-06-08 20:26:14 +02:00
|
|
|
// as published by the Free Software Foundation for version 2.
|
2008-08-25 19:51:52 +02:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
function load_update_manager_lib () {
|
|
|
|
set_time_limit (0);
|
|
|
|
require_once ('update_manager/load_updatemanager.php');
|
|
|
|
}
|
|
|
|
|
2008-08-29 09:54:17 +02:00
|
|
|
function update_settings_database_connection () {
|
|
|
|
global $config;
|
|
|
|
global $db;
|
|
|
|
|
|
|
|
$db =& um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
|
|
|
$config['dbpass'], $config['dbname']);
|
|
|
|
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']);
|
|
|
|
}
|
|
|
|
|
2008-08-25 19:51:52 +02:00
|
|
|
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;
|
|
|
|
}
|
2008-09-02 13:16:44 +02:00
|
|
|
$sql = 'INSERT INTO `tconfig` (`token`, `value`)
|
|
|
|
VALUES ("update_manager_installed", 1)';
|
2008-08-25 19:51:52 +02:00
|
|
|
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']));
|
2008-08-29 09:54:17 +02:00
|
|
|
update_settings_database_connection ();
|
2008-08-25 19:51:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2009-10-26 Ramon Novoa <rnovoa@artica.es>
* extensions/update_manager.php,
operation/incidents/incident.php,
operation/menu.php,
godmode/setup/links.php,
godmode/users/configure_user.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/agent_manager.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graphs.php,
godmode/reporting/graph_builder.php,
godmode/alerts/alert_templates.php,
godmode/menu.php: Several ACL related fixes.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2053 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-10-26 19:51:29 +01:00
|
|
|
if (! give_acl ($config['id_user'], 0, "PM")) {
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-25 19:51:52 +02:00
|
|
|
load_update_manager_lib ();
|
2008-08-29 09:54:17 +02:00
|
|
|
update_settings_database_connection ();
|
2008-08-25 19:51:52 +02:00
|
|
|
|
|
|
|
require_once ('update_manager/main.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
function pandora_update_manager_login () {
|
|
|
|
global $config;
|
|
|
|
global $db;
|
|
|
|
|
2008-10-09 18:56:31 +02:00
|
|
|
// If first time, make the first autoupdate and disable it in DB
|
|
|
|
if (!isset($config["autoupdate"])){
|
|
|
|
$config["autoupdate"] = 1;
|
|
|
|
process_sql ("INSERT INTO tconfig (token,value) VALUES ('autoupdate', 0)");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config["autoupdate"] == 0)
|
|
|
|
return;
|
|
|
|
|
2008-08-25 19:51:52 +02:00
|
|
|
load_update_manager_lib ();
|
|
|
|
|
|
|
|
$db =& um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
|
|
|
$config['dbpass'], $config['dbname']);
|
|
|
|
$settings = um_db_load_settings ();
|
2008-08-28 18:21:21 +02:00
|
|
|
|
2008-09-02 13:16:44 +02:00
|
|
|
$user_key = get_user_key ($settings);
|
2008-08-25 19:51:52 +02:00
|
|
|
|
|
|
|
$package = um_client_check_latest_update ($settings, $user_key);
|
|
|
|
|
|
|
|
if (is_object ($package)) {
|
|
|
|
echo '<div class="notify">';
|
2009-02-13 21:23:44 +01:00
|
|
|
echo '<img src="images/information.png" alt="info" /> ';
|
2008-08-25 19:51:52 +02:00
|
|
|
echo __('There\'s a new update for Pandora');
|
2009-02-09 Evi Vanoost <vanooste@rcbi.rochester.edu>
* general/header.php, general/footer.php: Made it comply with standards
* general/main_menu.php: Fixed some typo's.
* include/javascript/jquery.pandora.js: This was loading an extension
that has a separate file already
* include/functions.php: Added process_page_head and process_page_body
these are callback functions for ob_start and add functionality like
conditional loading and external scripts in the correct places. Also adds
override functionality to certain items (like refresh) from anywhere
* include/javascript/time_en.js: Added as a placeholder
* extensions/update_manager.php: Fixed some typos
* operation/agentes/exportdata.php, operation/agentes/networkmap.php,
operation/events/events.php, operation/extensions.php,
operation/incidents/incident_detail.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php,
godmode/groups/configure_group.php, godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, godmode/reporting/reporting_builder.php
godmode/snmpconsole/snmp_alert.php: Changed javascript, css and jquery
loading to the new buffer callback handlers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1436 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-02-09 19:41:54 +01:00
|
|
|
echo '. <a href="index.php?sec=extensions&sec2=extensions/update_manager">';
|
2008-08-25 19:51:52 +02:00
|
|
|
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'));
|
2009-12-27 22:50:32 +01:00
|
|
|
add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup');
|
2008-08-25 19:51:52 +02:00
|
|
|
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 ();
|
|
|
|
?>
|