287 lines
8.0 KiB
PHP
287 lines
8.0 KiB
PHP
<?php
|
|
|
|
// 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; 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.
|
|
|
|
check_login ();
|
|
|
|
if (! check_acl ($config['id_user'], 0, "PM")) {
|
|
db_pandora_audit("ACL Violation",
|
|
"Trying to access extensions list");
|
|
include ("general/noaccess.php");
|
|
exit;
|
|
}
|
|
|
|
// Header
|
|
ui_print_page_header (__('Extensions'). " » ". __('Defined extensions'), "images/extensions.png", false, "", true, "" );
|
|
|
|
if (sizeof ($config['extensions']) == 0) {
|
|
$extensions = extensions_get_extension_info();
|
|
if (empty($extensions)) {
|
|
echo '<h3>'.__('There are no extensions defined').'</h3>';
|
|
return;
|
|
}
|
|
}
|
|
|
|
$enterprise = (bool)get_parameter('enterprise', 0);
|
|
$delete = get_parameter ("delete", "");
|
|
$enabled = get_parameter("enabled", "");
|
|
$disabled = get_parameter("disabled", "");
|
|
|
|
|
|
if ($delete != "") {
|
|
if ($enterprise) {
|
|
if (!file_exists($config["homedir"]."/enterprise/extensions/ext_backup")) {
|
|
mkdir($config["homedir"]."/enterprise/extensions/ext_backup");
|
|
}
|
|
}
|
|
else {
|
|
if (!file_exists($config["homedir"]."/extensions/ext_backup")) {
|
|
mkdir($config["homedir"]."/extensions/ext_backup");
|
|
}
|
|
}
|
|
|
|
if ($enterprise) {
|
|
$source = $config["homedir"]."/enterprise/extensions/" . $delete;
|
|
$endFile = $config["homedir"]."/enterprise/extensions/ext_backup/" . $delete;
|
|
}
|
|
else {
|
|
$source = $config["homedir"]."/extensions/" . $delete;
|
|
$endFile = $config["homedir"]."/extensions/ext_backup/" . $delete;
|
|
}
|
|
|
|
|
|
rename($source, $endFile);
|
|
|
|
?>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var href = location.href.replace(/&enterprise=(0|1)&delete=.*/g, "");
|
|
location = href;
|
|
}
|
|
);
|
|
</script>
|
|
<?php
|
|
}
|
|
|
|
|
|
if ($enabled != '') {
|
|
if ($enterprise) {
|
|
$endFile = $config["homedir"]."/enterprise/extensions/" . $enabled;
|
|
$source= $config["homedir"]."/enterprise/extensions/disabled/" . $enabled;
|
|
}
|
|
else {
|
|
$endFile = $config["homedir"]."/extensions/" . $enabled;
|
|
$source = $config["homedir"]."/extensions/disabled/" . $enabled;
|
|
}
|
|
|
|
rename($source, $endFile);
|
|
|
|
?>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var href = location.href.replace(/&enterprise=(0|1)&enabled=.*/g, "");
|
|
location = href;
|
|
}
|
|
);
|
|
</script>
|
|
<?php
|
|
}
|
|
|
|
if ($disabled != '') {
|
|
if ($enterprise) {
|
|
if (!file_exists($config["homedir"]."/enterprise/extensions/disabled")) {
|
|
mkdir($config["homedir"]."/enterprise/extensions/disabled");
|
|
}
|
|
}
|
|
else {
|
|
if (!file_exists($config["homedir"]."/extensions/disabled")) {
|
|
mkdir($config["homedir"]."/extensions/disabled");
|
|
}
|
|
}
|
|
|
|
if ($enterprise) {
|
|
$source = $config["homedir"]."/enterprise/extensions/" . $disabled;
|
|
$endFile = $config["homedir"]."/enterprise/extensions/disabled/" . $disabled;
|
|
}
|
|
else {
|
|
$source = $config["homedir"]."/extensions/" . $disabled;
|
|
$endFile = $config["homedir"]."/extensions/disabled/" . $disabled;
|
|
}
|
|
|
|
|
|
rename($source, $endFile);
|
|
|
|
?>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var href = location.href
|
|
href = href.replace(/&enterprise=(0|1)&disabled=.*/g, "");
|
|
location = href;
|
|
}
|
|
);
|
|
</script>
|
|
<?php
|
|
}
|
|
|
|
$extensions = extensions_get_extension_info();
|
|
|
|
$table->width = '98%';
|
|
|
|
$table->head = array();
|
|
$table->head[] = __('File');
|
|
$table->head[] = __('Version');
|
|
$table->head[] = __("Enterprise");
|
|
$table->head[] = __("Godmode Function");
|
|
$table->head[] = __("Godmode Menu");
|
|
$table->head[] = __("Operation Menu");
|
|
$table->head[] = __("Operation Function");
|
|
$table->head[] = __("Login Function");
|
|
$table->head[] = __("Agent operation tab");
|
|
$table->head[] = __("Agent godmode tab");
|
|
$table->head[] = __("Operation");
|
|
|
|
$table->width = array();
|
|
$table->width[] = '30%';
|
|
$table->width[] = '30%';
|
|
|
|
$table->align = array();
|
|
$table->align[] = 'left';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
$table->align[] = 'center';
|
|
|
|
$table->data = array();
|
|
foreach ($extensions as $file => $extension) {
|
|
$data = array();
|
|
|
|
$on = html_print_image("images/dot_green.png", true);
|
|
$off = html_print_image("images/dot_red.png", true);
|
|
if (!$extension['enabled']) {
|
|
$on = html_print_image("images/dot_green.disabled.png", true);
|
|
$off = html_print_image("images/dot_red.disabled.png", true);
|
|
$data[] = '<i style="color: grey;">' . $file . '</i>';
|
|
|
|
//Get version of this extensions
|
|
if ($config['extensions'][$file]['operation_menu']) {
|
|
$data[] = $config['extensions'][$file]['operation_menu']['version'];
|
|
} else if ($config['extensions'][$file]['godmode_menu']) {
|
|
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
|
|
} else if ($config['extensions'][$file]['extension_ope_tab']) {
|
|
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
|
|
} else if ($config['extensions'][$file]['extension_god_tab']) {
|
|
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
|
|
} else {
|
|
$data[] = __('N/A');
|
|
}
|
|
}
|
|
else {
|
|
$data[] = $file;
|
|
|
|
//Get version of this extension
|
|
if ($config['extensions'][$file]['operation_menu']) {
|
|
$data[] = $config['extensions'][$file]['operation_menu']['version'];
|
|
} else if ($config['extensions'][$file]['godmode_menu']) {
|
|
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
|
|
} else if (isset($config['extensions'][$file]['extension_ope_tab'])) {
|
|
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
|
|
} else if ($config['extensions'][$file]['extension_god_tab']) {
|
|
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
|
|
} else {
|
|
$data[] = __('N/A');
|
|
}
|
|
}
|
|
|
|
if ($extension['enterprise']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
if ($extension['godmode_function']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
if ($extension['godmode_menu']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
if ($extension['operation_menu']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
if ($extension['operation_function']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
if ($extension['login_function']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
if ($extension['extension_ope_tab']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
if ($extension['extension_god_tab']) {
|
|
$data[] = $on;
|
|
}
|
|
else {
|
|
$data[] = $off;
|
|
}
|
|
|
|
//Avoid to delete or disabled update_manager
|
|
if ($file != "update_manager.php") {
|
|
if (!$extension['enabled']) {
|
|
$data[] = '<a title="' . __('Delete') . '" href="index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise=' . (int)$extension['enterprise'] . '&delete='.$file.'" class="mn">' . html_print_image("images/cross.disabled.png", true) . '</a>' .
|
|
' <a title="' . __('Enable') . '" href="index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise=' . (int)$extension['enterprise'] . '&enabled='.$file.'" class="mn">' . html_print_image("images/lightbulb_off.png", true) . '</a>';
|
|
}
|
|
else {
|
|
$data[] = '<a title="' . __('Delete') . '" href="index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise=' . (int)$extension['enterprise'] . '&delete='.$file.'" class="mn">' . html_print_image("images/cross.png", true) . '</a>' .
|
|
' <a title="' . __('Disable') . '" href="index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise=' . (int)$extension['enterprise'] . '&disabled='.$file.'" class="mn">' . html_print_image("images/lightbulb.png", true) . '</a>';
|
|
}
|
|
}
|
|
else {
|
|
$data[] = "";
|
|
}
|
|
|
|
$table->data[] = $data;
|
|
}
|
|
html_print_table ($table);
|
|
?>
|