2008-08-25 19:51:52 +02:00
|
|
|
<?php
|
2009-06-08 20:26:14 +02:00
|
|
|
|
|
|
|
//Pandora FMS- http://pandorafms.com
|
|
|
|
// ==================================================
|
2011-03-10 11:12:52 +01:00
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
2009-06-08 20:26:14 +02:00
|
|
|
|
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;
|
|
|
|
|
2011-03-10 11:12:52 +01:00
|
|
|
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
2008-08-29 09:54:17 +02:00
|
|
|
$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;
|
|
|
|
|
|
|
|
if (isset ($config['update_manager_installed']))
|
|
|
|
/* Already installed */
|
|
|
|
return;
|
|
|
|
|
|
|
|
load_update_manager_lib ();
|
|
|
|
|
|
|
|
/* SQL installation */
|
2011-03-11 12:17:25 +01:00
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
$sentences = file (EXTENSIONS_DIR.'/update_manager/sql/update_manager.sql');
|
|
|
|
break;
|
|
|
|
case 'postgresql':
|
|
|
|
$sentences = file (EXTENSIONS_DIR.'/update_manager/sql/update_manager.postgreSQL.sql');
|
|
|
|
break;
|
|
|
|
}
|
2008-08-25 19:51:52 +02:00
|
|
|
foreach ($sentences as $sentence) {
|
|
|
|
$success = process_sql ($sentence);
|
|
|
|
if ($success === false)
|
|
|
|
return;
|
|
|
|
}
|
2011-03-11 12:17:25 +01:00
|
|
|
|
2011-03-10 19:44:37 +01:00
|
|
|
$values = array("token" => "update_manager_installed", "value" => 1);
|
2011-03-11 12:17:25 +01:00
|
|
|
process_sql_insert('tconfig', $values);
|
2008-08-25 19:51:52 +02:00
|
|
|
|
2011-03-10 11:12:52 +01:00
|
|
|
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
2008-08-25 19:51:52 +02:00
|
|
|
$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 () {
|
2011-03-10 19:44:37 +01:00
|
|
|
global $config;
|
|
|
|
|
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case "mysql":
|
|
|
|
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`');
|
|
|
|
break;
|
|
|
|
case "postgresql":
|
|
|
|
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"');
|
|
|
|
break;
|
|
|
|
}
|
2008-08-25 19:51:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function pandora_update_manager_main () {
|
|
|
|
global $config;
|
|
|
|
|
2011-02-28 17:49:44 +01:00
|
|
|
if (! check_acl($config['id_user'], 0, "PM")) {
|
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
|
|
|
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;
|
|
|
|
|
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;
|
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_db.php,
extensions/update_manager.php, extensions/plugin_registration.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
godmode/agentes/planned_downtime.php, godmode/servers/recon_script.php,
godmode/snmpconsole/snmp_filters.php, godmode/setup/news.php,
godmode/modules/manage_network_templates_form.php: change the source code
for to use process_sql_insert instead of the SQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4067 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-08 15:43:45 +01:00
|
|
|
|
|
|
|
process_sql_insert('tconfig', array('token' => 'autoupdate', 'value' => 0));
|
2008-10-09 18:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($config["autoupdate"] == 0)
|
|
|
|
return;
|
|
|
|
|
2008-08-25 19:51:52 +02:00
|
|
|
load_update_manager_lib ();
|
|
|
|
|
2011-03-10 11:12:52 +01:00
|
|
|
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
2008-08-25 19:51:52 +02:00
|
|
|
$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);
|
2011-03-10 11:12:52 +01:00
|
|
|
|
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">';
|
2011-03-10 11:12:52 +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;
|
|
|
|
|
|
|
|
load_update_manager_lib ();
|
|
|
|
|
|
|
|
require_once ('update_manager/settings.php');
|
|
|
|
}
|
|
|
|
|
2010-08-31 11:21:45 +02:00
|
|
|
if(isset($config['id_user'])) {
|
2011-02-28 17:49:44 +01:00
|
|
|
if (check_acl($config['id_user'], 0, "PM")) {
|
2010-08-31 11:21:45 +02:00
|
|
|
add_operation_menu_option (__('Update manager'));
|
|
|
|
add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup');
|
|
|
|
add_extension_main_function ('pandora_update_manager_main');
|
|
|
|
add_extension_godmode_function ('pandora_update_manager_godmode');
|
|
|
|
add_extension_login_function ('pandora_update_manager_login');
|
|
|
|
}
|
|
|
|
}
|
2008-08-25 19:51:52 +02:00
|
|
|
|
2011-03-10 11:12:52 +01:00
|
|
|
pandora_update_manager_install ();
|
|
|
|
|
2008-08-25 19:51:52 +02:00
|
|
|
$db = NULL;
|
|
|
|
?>
|