mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Merge branch 'develop' of https://192.168.50.5:8081/artica/pandorafms into develop
This commit is contained in:
commit
abf43a4230
@ -241,6 +241,7 @@ config_check();
|
|||||||
if ($check_minor_release_available) {
|
if ($check_minor_release_available) {
|
||||||
set_pandora_error_for_header('There are one or more minor releases waiting for update, there are required administrator permissions', 'minor release/s available');
|
set_pandora_error_for_header('There are one or more minor releases waiting for update, there are required administrator permissions', 'minor release/s available');
|
||||||
}
|
}
|
||||||
|
echo '<div id="alert_messages" style="display: none"></div>';
|
||||||
|
|
||||||
if ($config["alert_cnt"] > 0) {
|
if ($config["alert_cnt"] > 0) {
|
||||||
$maintenance_link = 'javascript:';
|
$maintenance_link = 'javascript:';
|
||||||
|
@ -103,8 +103,8 @@ $data[2] = '<span id="alerts_loading" class="invisible">';
|
|||||||
$data[2] .= html_print_image('images/spinner.png', true);
|
$data[2] .= html_print_image('images/spinner.png', true);
|
||||||
$data[2] .= '</span>';
|
$data[2] .= '</span>';
|
||||||
$users_profiles = "";
|
$users_profiles = "";
|
||||||
$users_order = array('field' => 'full_name', 'order' => 'ASC');
|
$users_order = array('field' => 'id_user', 'order' => 'ASC');
|
||||||
$data[2] .= html_print_select (users_get_info($users_order), 'users_id[]', '', '', '',
|
$data[2] .= html_print_select (users_get_info($users_order,'id_user'), 'users_id[]', '', '', '',
|
||||||
'', true, true, true, '', false, 'width: 100%');
|
'', true, true, true, '', false, 'width: 100%');
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ $data[2] .= html_print_image('images/spinner.png', true);
|
|||||||
$data[2] .= '</span>';
|
$data[2] .= '</span>';
|
||||||
$users_profiles = "";
|
$users_profiles = "";
|
||||||
$users_order = array('field' => 'id_user', 'order' => 'ASC');
|
$users_order = array('field' => 'id_user', 'order' => 'ASC');
|
||||||
$data[2] .= html_print_select (users_get_info($users_order), 'users_id[]', '', '', '',
|
$data[2] .= html_print_select (users_get_info($users_order,'id_user'), 'users_id[]', '', '', '',
|
||||||
'', true, true, true, '', false, 'width: 100%');
|
'', true, true, true, '', false, 'width: 100%');
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ $baseurl = ui_get_full_url(false, false, false, false);
|
|||||||
var package_updated_successfully = "<?php echo __('Package updated successfully.'); ?>\n";
|
var package_updated_successfully = "<?php echo __('Package updated successfully.'); ?>\n";
|
||||||
var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied on the next login.'); ?>\n";
|
var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied on the next login.'); ?>\n";
|
||||||
var package_not_updated = "<?php echo __('Package not updated.'); ?>\n";
|
var package_not_updated = "<?php echo __('Package not updated.'); ?>\n";
|
||||||
|
var error_in_mr = "<?php echo __('Error in MR file'); ?>\n";
|
||||||
|
var error_in_mr_accept = "<?php echo __('MR not accepted'); ?>\n";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form id="form-offline_update" method="post" enctype="multipart/form-data" class="fileupload_form">
|
<form id="form-offline_update" method="post" enctype="multipart/form-data" class="fileupload_form">
|
||||||
|
@ -40,9 +40,6 @@ if(!enterprise_installed()){
|
|||||||
$open=true;
|
$open=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$memory_limit = ini_get("memory_limit");
|
$memory_limit = ini_get("memory_limit");
|
||||||
$memory_limit = str_replace("M", "", $memory_limit);
|
$memory_limit = str_replace("M", "", $memory_limit);
|
||||||
$memory_limit = (int)$memory_limit;
|
$memory_limit = (int)$memory_limit;
|
||||||
@ -66,7 +63,6 @@ if ($memory_limit < 100) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Translators: Do not translade Update Manager, it's the name of the program */
|
/* Translators: Do not translade Update Manager, it's the name of the program */
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
@ -86,16 +82,15 @@ echo "<span class='loading' style='font-size:18pt;'>";
|
|||||||
echo "<img src='images/wait.gif' />";
|
echo "<img src='images/wait.gif' />";
|
||||||
echo "</span><br><br>";
|
echo "</span><br><br>";
|
||||||
|
|
||||||
echo "<div><b>".__('The last version of package installed is:')."</b></div><br>";
|
echo "<div><b>" . __('The last version of package installed is:') . "</b></div><br>";
|
||||||
echo "<div style='color:#82b92e;font-size:40pt;font-weight:bold;'>".$current_package."</div>";
|
echo "<div style='color:#82b92e;font-size:40pt;font-weight:bold;'>" . $current_package . "</div>";
|
||||||
|
|
||||||
|
|
||||||
echo "<div class='checking_package' style='font-size:18pt;width:100%; text-align: center; display: none;'>";
|
echo "<div class='checking_package' style='font-size:18pt;width:100%; text-align: center; display: none;'>";
|
||||||
echo __('Checking for the newest package.');
|
echo __('Checking for the newest package.');
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
echo "<div class='downloading_package' style='font-size:18pt;width:100%; text-align: center; display: none;'>";
|
echo "<div class='downloading_package' style='font-size:18pt;width:100%; text-align: center; display: none;'>";
|
||||||
echo __('Downloading for the newest package.');
|
echo __('Downloading for the newest package.');
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
echo "<div class='content'></div>";
|
echo "<div class='content'></div>";
|
||||||
@ -103,17 +98,39 @@ echo "<div style='color:#82b92e;font-size:40pt;font-weight:bold;'>".$current_pac
|
|||||||
echo "<div class='progressbar' style='display: none;'><img class='progressbar_img' src='' /></div>";
|
echo "<div class='progressbar' style='display: none;'><img class='progressbar_img' src='' /></div>";
|
||||||
|
|
||||||
|
|
||||||
/* Hello there! :)
|
/* -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Hello there! :)
|
||||||
|
|
||||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
We added some of what seems to be "buggy" messages to the openSource version
|
||||||
|
recently. This is not to force open-source users to move to the enterprise
|
||||||
|
version, this is just to inform people using Pandora FMS open source that it
|
||||||
|
requires skilled people to maintain and keep it running smoothly without
|
||||||
|
professional support. This does not imply open-source version is limited
|
||||||
|
in any way. If you check the recently added code, it contains only warnings
|
||||||
|
and messages, no limitations except one: we removed the option to add custom
|
||||||
|
logo in header. In the Update Manager section, it warns about the 'danger’
|
||||||
|
of applying automated updates without a proper backup, remembering in the
|
||||||
|
process that the Enterprise version comes with a human-tested package.
|
||||||
|
Maintaining an OpenSource version with more than 500 agents is not so
|
||||||
|
easy, that's why someone using a Pandora with 8000 agents should consider
|
||||||
|
asking for support. It's not a joke, we know of many setups with a huge
|
||||||
|
number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||||
|
|
||||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
You can of course remove the warnings, that's why we include the source and
|
||||||
|
do not use any kind of trick. And that's why we added here this comment, to
|
||||||
|
let you know this does not reflect any change in our opensource mentality of
|
||||||
|
does the last 14 years.
|
||||||
|
|
||||||
*/
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
if($open){
|
if($open){
|
||||||
echo "<br><br><div id='updatemodal' class='publienterprisehide' title='Community version' style=''><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/icono_exclamacion_2.png'></div><br>
|
echo "
|
||||||
";
|
<br><br>
|
||||||
|
<div id='updatemodal' class='publienterprisehide' title='Community version' style=''>
|
||||||
|
<img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/icono_exclamacion_2.png'>
|
||||||
|
</div>
|
||||||
|
<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ $check_online_free_packages = (bool)get_parameter('check_online_free_packages');
|
|||||||
$update_last_free_package = (bool)get_parameter('update_last_free_package');
|
$update_last_free_package = (bool)get_parameter('update_last_free_package');
|
||||||
$check_update_free_package = (bool)get_parameter('check_update_free_package');
|
$check_update_free_package = (bool)get_parameter('check_update_free_package');
|
||||||
$install_free_package = (bool)get_parameter('install_free_package');
|
$install_free_package = (bool)get_parameter('install_free_package');
|
||||||
|
$search_minor = (bool)get_parameter('search_minor');
|
||||||
|
|
||||||
if ($upload_file) {
|
if ($upload_file) {
|
||||||
ob_clean();
|
ob_clean();
|
||||||
@ -108,128 +109,137 @@ if ($install_package) {
|
|||||||
global $config;
|
global $config;
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
|
||||||
$package = (string) get_parameter("package");
|
$accept = (bool)get_parameter("accept", false);
|
||||||
$package = trim($package);
|
if ($accept) {
|
||||||
|
$package = (string) get_parameter("package");
|
||||||
$chunks = explode("_", basename($package));
|
$package = trim($package);
|
||||||
$chunks = explode(".", $chunks[1]);
|
|
||||||
$version = $chunks[0];
|
|
||||||
|
|
||||||
// All files extracted
|
|
||||||
$files_total = $package . "/files.txt";
|
|
||||||
// Files copied
|
|
||||||
$files_copied = $package . "/files.copied.txt";
|
|
||||||
$return = array();
|
|
||||||
|
|
||||||
if (file_exists($files_copied)) {
|
|
||||||
unlink($files_copied);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($package)) {
|
|
||||||
|
|
||||||
if ($files_h = fopen($files_total, "r")) {
|
$chunks = explode("_", basename($package));
|
||||||
|
$chunks = explode(".", $chunks[1]);
|
||||||
|
$version = $chunks[0];
|
||||||
|
|
||||||
|
// All files extracted
|
||||||
|
$files_total = $package . "/files.txt";
|
||||||
|
// Files copied
|
||||||
|
$files_copied = $package . "/files.copied.txt";
|
||||||
|
$return = array();
|
||||||
|
|
||||||
|
if (file_exists($files_copied)) {
|
||||||
|
unlink($files_copied);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($package)) {
|
||||||
|
|
||||||
while ($line = stream_get_line($files_h, 65535, "\n")) {
|
if ($files_h = fopen($files_total, "r")) {
|
||||||
$line = trim($line);
|
|
||||||
|
|
||||||
// Tries to move the old file to the directory backup inside the extracted package
|
while ($line = stream_get_line($files_h, 65535, "\n")) {
|
||||||
if (file_exists($config["homedir"] . "/" . $line)) {
|
$line = trim($line);
|
||||||
rename($config["homedir"] . "/" . $line,
|
|
||||||
$package . "/backup/" . $line);
|
// Tries to move the old file to the directory backup inside the extracted package
|
||||||
}
|
if (file_exists($config["homedir"] . "/" . $line)) {
|
||||||
// Tries to move the new file to the Pandora directory
|
rename($config["homedir"] . "/" . $line,
|
||||||
$dirname = dirname($line);
|
$package . "/backup/" . $line);
|
||||||
if (!file_exists($config["homedir"] . "/" . $dirname)) {
|
}
|
||||||
$dir_array = explode("/", $dirname);
|
// Tries to move the new file to the Pandora directory
|
||||||
$temp_dir = "";
|
$dirname = dirname($line);
|
||||||
foreach ($dir_array as $dir) {
|
if (!file_exists($config["homedir"] . "/" . $dirname)) {
|
||||||
$temp_dir .= "/" . $dir;
|
$dir_array = explode("/", $dirname);
|
||||||
if (!file_exists($config["homedir"] . $temp_dir)) {
|
$temp_dir = "";
|
||||||
mkdir($config["homedir"] . $temp_dir);
|
foreach ($dir_array as $dir) {
|
||||||
|
$temp_dir .= "/" . $dir;
|
||||||
|
if (!file_exists($config["homedir"] . $temp_dir)) {
|
||||||
|
mkdir($config["homedir"] . $temp_dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (is_dir($package . "/" . $line)) {
|
||||||
if (is_dir($package . "/" . $line)) {
|
if (!file_exists($config["homedir"] . "/" . $line)) {
|
||||||
if (!file_exists($config["homedir"] . "/" . $line)) {
|
mkdir($config["homedir"] . "/" . $line);
|
||||||
mkdir($config["homedir"] . "/" . $line);
|
file_put_contents($files_copied, $line."\n", FILE_APPEND | LOCK_EX);
|
||||||
file_put_contents($files_copied, $line."\n", FILE_APPEND | LOCK_EX);
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
if (rename($package."/".$line, $config["homedir"]."/".$line)) {
|
||||||
if (rename($package."/".$line, $config["homedir"]."/".$line)) {
|
|
||||||
|
// Append the moved file to the copied files txt
|
||||||
// Append the moved file to the copied files txt
|
if (!file_put_contents($files_copied, $line."\n", FILE_APPEND | LOCK_EX)) {
|
||||||
if (!file_put_contents($files_copied, $line."\n", FILE_APPEND | LOCK_EX)) {
|
|
||||||
|
// If the copy process fail, this code tries to restore the files backed up before
|
||||||
|
if ($files_copied_h = fopen($files_copied, "r")) {
|
||||||
|
while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
|
||||||
|
$line_c = trim($line_c);
|
||||||
|
if (!rename($package."/backup/".$line, $config["homedir"]."/".$line_c)) {
|
||||||
|
$backup_status = __("Some of your files might not be recovered.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!rename($package."/backup/".$line, $config["homedir"]."/".$line)) {
|
||||||
|
$backup_status = __("Some of your files might not be recovered.");
|
||||||
|
}
|
||||||
|
fclose($files_copied_h);
|
||||||
|
} else {
|
||||||
|
$backup_status = __("Some of your old files might not be recovered.");
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($files_h);
|
||||||
|
$return["status"] = "error";
|
||||||
|
$return["message"]= __("Line '$line' not copied to the progress file.")." ".$backup_status;
|
||||||
|
echo json_encode($return);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
// If the copy process fail, this code tries to restore the files backed up before
|
// If the copy process fail, this code tries to restore the files backed up before
|
||||||
if ($files_copied_h = fopen($files_copied, "r")) {
|
if ($files_copied_h = fopen($files_copied, "r")) {
|
||||||
while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
|
while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
|
||||||
$line_c = trim($line_c);
|
$line_c = trim($line_c);
|
||||||
if (!rename($package."/backup/".$line, $config["homedir"]."/".$line_c)) {
|
if (!rename($package."/backup/".$line, $config["homedir"]."/".$line)) {
|
||||||
$backup_status = __("Some of your files might not be recovered.");
|
$backup_status = __("Some of your old files might not be recovered.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!rename($package."/backup/".$line, $config["homedir"]."/".$line)) {
|
|
||||||
$backup_status = __("Some of your files might not be recovered.");
|
|
||||||
}
|
|
||||||
fclose($files_copied_h);
|
fclose($files_copied_h);
|
||||||
} else {
|
}
|
||||||
$backup_status = __("Some of your old files might not be recovered.");
|
else {
|
||||||
|
$backup_status = __("Some of your files might not be recovered.");
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($files_h);
|
fclose($files_h);
|
||||||
$return["status"] = "error";
|
$return["status"] = "error";
|
||||||
$return["message"]= __("Line '$line' not copied to the progress file.")." ".$backup_status;
|
$return["message"]= __("File '$line' not copied.")." ".$backup_status;
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
|
||||||
// If the copy process fail, this code tries to restore the files backed up before
|
|
||||||
if ($files_copied_h = fopen($files_copied, "r")) {
|
|
||||||
while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
|
|
||||||
$line_c = trim($line_c);
|
|
||||||
if (!rename($package."/backup/".$line, $config["homedir"]."/".$line)) {
|
|
||||||
$backup_status = __("Some of your old files might not be recovered.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose($files_copied_h);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$backup_status = __("Some of your files might not be recovered.");
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose($files_h);
|
|
||||||
$return["status"] = "error";
|
|
||||||
$return["message"]= __("File '$line' not copied.")." ".$backup_status;
|
|
||||||
echo json_encode($return);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
fclose($files_h);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$return["status"] = "error";
|
||||||
|
$return["message"]= __("An error ocurred while reading a file.");
|
||||||
|
echo json_encode($return);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
fclose($files_h);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return["status"] = "error";
|
$return["status"] = "error";
|
||||||
$return["message"]= __("An error ocurred while reading a file.");
|
$return["message"]= __("The package does not exist");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
update_manager_enterprise_set_version($version);
|
||||||
$return["status"] = "error";
|
db_pandora_audit("Update Pandora", "Update version: $version of Pandora FMS by ".$config['id_user']);
|
||||||
$return["message"]= __("The package does not exist");
|
|
||||||
|
$return["status"] = "success";
|
||||||
|
echo json_encode($return);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$return["status"] = "error";
|
||||||
|
$return["message"]= __("Package not accepted");
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_manager_enterprise_set_version($version);
|
|
||||||
db_pandora_audit("Update Pandora", "Update version: $version of Pandora FMS by ".$config['id_user']);
|
|
||||||
|
|
||||||
$return["status"] = "success";
|
|
||||||
echo json_encode($return);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($check_install_package) {
|
if ($check_install_package) {
|
||||||
@ -345,99 +355,115 @@ if ($check_online_free_packages) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($search_minor) {
|
||||||
|
$have_minor_releases = db_check_minor_relase_available();
|
||||||
|
|
||||||
|
$return['have_minor'] = false;
|
||||||
|
if ($have_minor_releases) {
|
||||||
|
$return['have_minor'] = true;
|
||||||
|
$size_mr = get_number_of_mr();
|
||||||
|
$return['mr'] = $size_mr;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($return);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($update_last_free_package) {
|
if ($update_last_free_package) {
|
||||||
|
|
||||||
$package = get_parameter('package', '');
|
$package = get_parameter('package', '');
|
||||||
$version = get_parameter('version', '');
|
$version = get_parameter('version', '');
|
||||||
|
$accept = (boolean)get_parameter('accept', false);
|
||||||
$package_url = base64_decode($package);
|
$package_url = base64_decode($package);
|
||||||
|
|
||||||
$params = array('action' => 'get_package',
|
if ($accept) {
|
||||||
|
$params = array('action' => 'get_package',
|
||||||
'license' => $license,
|
'license' => $license,
|
||||||
'limit_count' => $users,
|
'limit_count' => $users,
|
||||||
'current_package' => $current_package,
|
'current_package' => $current_package,
|
||||||
'package' => $package,
|
'package' => $package,
|
||||||
'version' => $config['version'],
|
'version' => $config['version'],
|
||||||
'build' => $config['build']);
|
'build' => $config['build']);
|
||||||
|
|
||||||
$curlObj = curl_init();
|
|
||||||
//curl_setopt($curlObj, CURLOPT_URL, $config['url_updatemanager']);
|
|
||||||
curl_setopt($curlObj, CURLOPT_URL, $package_url);
|
|
||||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
curl_setopt($curlObj, CURLOPT_FOLLOWLOCATION, true);
|
|
||||||
//curl_setopt($curlObj, CURLOPT_POST, true);
|
|
||||||
//curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
|
||||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
|
||||||
if (isset($config['update_manager_proxy_server'])) {
|
|
||||||
curl_setopt($curlObj, CURLOPT_PROXY, $config['update_manager_proxy_server']);
|
|
||||||
}
|
|
||||||
if (isset($config['update_manager_proxy_port'])) {
|
|
||||||
curl_setopt($curlObj, CURLOPT_PROXYPORT, $config['update_manager_proxy_port']);
|
|
||||||
}
|
|
||||||
if (isset($config['update_manager_proxy_user'])) {
|
|
||||||
curl_setopt($curlObj, CURLOPT_PROXYUSERPWD, $config['update_manager_proxy_user'] . ':' . $config['update_manager_proxy_password']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = curl_exec($curlObj);
|
|
||||||
$http_status = curl_getinfo($curlObj, CURLINFO_HTTP_CODE);
|
|
||||||
|
|
||||||
curl_close($curlObj);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($result)) {
|
|
||||||
echo json_encode(array(
|
|
||||||
'in_progress' => false,
|
|
||||||
'message' => __('Fail to update to the last package.')));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
file_put_contents(
|
|
||||||
$config['attachment_store'] . "/downloads/last_package.tgz" , $result);
|
|
||||||
|
|
||||||
echo json_encode(array(
|
$curlObj = curl_init();
|
||||||
'in_progress' => true,
|
curl_setopt($curlObj, CURLOPT_URL, $package_url);
|
||||||
'message' => __('Starting to update to the last package.')));
|
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($curlObj, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
if (isset($config['update_manager_proxy_server'])) {
|
||||||
|
curl_setopt($curlObj, CURLOPT_PROXY, $config['update_manager_proxy_server']);
|
||||||
|
}
|
||||||
|
if (isset($config['update_manager_proxy_port'])) {
|
||||||
|
curl_setopt($curlObj, CURLOPT_PROXYPORT, $config['update_manager_proxy_port']);
|
||||||
|
}
|
||||||
|
if (isset($config['update_manager_proxy_user'])) {
|
||||||
|
curl_setopt($curlObj, CURLOPT_PROXYUSERPWD, $config['update_manager_proxy_user'] . ':' . $config['update_manager_proxy_password']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = curl_exec($curlObj);
|
||||||
|
$http_status = curl_getinfo($curlObj, CURLINFO_HTTP_CODE);
|
||||||
|
|
||||||
$progress_update_status = db_get_value(
|
curl_close($curlObj);
|
||||||
'value', 'tconfig', 'token', 'progress_update_status');
|
|
||||||
|
if (empty($result)) {
|
||||||
|
echo json_encode(array(
|
||||||
|
'in_progress' => false,
|
||||||
if (empty($progress_update_status)) {
|
'message' => __('Fail to update to the last package.')));
|
||||||
db_process_sql_insert('tconfig',
|
|
||||||
array(
|
|
||||||
'value' => 0,
|
|
||||||
'token' => 'progress_update')
|
|
||||||
);
|
|
||||||
|
|
||||||
db_process_sql_insert('tconfig',
|
|
||||||
array(
|
|
||||||
'value' => json_encode(
|
|
||||||
array(
|
|
||||||
'status' => 'in_progress',
|
|
||||||
'message' => ''
|
|
||||||
)),
|
|
||||||
'token' => 'progress_update_status')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_process_sql_update('tconfig',
|
file_put_contents(
|
||||||
array('value' => 0),
|
$config['attachment_store'] . "/downloads/last_package.tgz" , $result);
|
||||||
array('token' => 'progress_update'));
|
|
||||||
|
|
||||||
db_process_sql_update('tconfig',
|
echo json_encode(array(
|
||||||
array('value' => json_encode(
|
'in_progress' => true,
|
||||||
array(
|
'message' => __('Starting to update to the last package.')));
|
||||||
'status' => 'in_progress',
|
|
||||||
'message' => ''
|
|
||||||
|
$progress_update_status = db_get_value(
|
||||||
|
'value', 'tconfig', 'token', 'progress_update_status');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($progress_update_status)) {
|
||||||
|
db_process_sql_insert('tconfig',
|
||||||
|
array(
|
||||||
|
'value' => 0,
|
||||||
|
'token' => 'progress_update')
|
||||||
|
);
|
||||||
|
|
||||||
|
db_process_sql_insert('tconfig',
|
||||||
|
array(
|
||||||
|
'value' => json_encode(
|
||||||
|
array(
|
||||||
|
'status' => 'in_progress',
|
||||||
|
'message' => ''
|
||||||
|
)),
|
||||||
|
'token' => 'progress_update_status')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
db_process_sql_update('tconfig',
|
||||||
|
array('value' => 0),
|
||||||
|
array('token' => 'progress_update'));
|
||||||
|
|
||||||
|
db_process_sql_update('tconfig',
|
||||||
|
array('value' => json_encode(
|
||||||
|
array(
|
||||||
|
'status' => 'in_progress',
|
||||||
|
'message' => ''
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
),
|
array('token' => 'progress_update_status'));
|
||||||
array('token' => 'progress_update_status'));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$return["in_progress"] = false;
|
||||||
|
$return["message"] = __("Package not accepted.");
|
||||||
|
|
||||||
|
echo json_encode($return);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -59,24 +59,14 @@ $(document).ready (function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("a.show_systemalert_dialog").click (function () {
|
$("a.show_systemalert_dialog").click (function () {
|
||||||
|
$('body').append( "<div id='opacidad' style='position:fixed;background:black;opacity:0.6;z-index:1'></div>" );
|
||||||
jQuery.get ("ajax.php",
|
jQuery.get ("ajax.php",
|
||||||
{"page": "operation/system_alert"},
|
{"page": "operation/system_alert"},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
$("#alert_messages").html(data);
|
$("#alert_messages").hide ()
|
||||||
$("#alert_messages").dialog({
|
.empty ()
|
||||||
resizable: false,
|
.append (data)
|
||||||
draggable: true,
|
.show ();
|
||||||
width: 450,
|
|
||||||
modal: true,
|
|
||||||
overlay: {
|
|
||||||
opacity: 0.5,
|
|
||||||
background: "black"
|
|
||||||
},
|
|
||||||
open: function (event, ui) {
|
|
||||||
dialog_open = this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#alert_messages").css('padding','0px');
|
|
||||||
},
|
},
|
||||||
"html"
|
"html"
|
||||||
);
|
);
|
||||||
|
@ -193,40 +193,196 @@ function formatFileSize(bytes) {
|
|||||||
function install_package (package, homeurl) {
|
function install_package (package, homeurl) {
|
||||||
var home_url = (typeof homeurl !== 'undefined') ? homeurl + '/' : '';
|
var home_url = (typeof homeurl !== 'undefined') ? homeurl + '/' : '';
|
||||||
|
|
||||||
var parameters = {};
|
$("<div id='pkg_apply_dialog' class= 'dialog ui-dialog-content'></div>").dialog ({
|
||||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
resizable: true,
|
||||||
parameters['install_package'] = 1;
|
draggable: true,
|
||||||
parameters['package'] = package;
|
modal: true,
|
||||||
|
overlay: {
|
||||||
$('#form-offline_update ul').find('li').removeClass('suc');
|
opacity: 0.5,
|
||||||
$('#form-offline_update ul').find('li').addClass('loading');
|
background: 'black'
|
||||||
|
},
|
||||||
$.ajax({
|
width: 600,
|
||||||
type: 'POST',
|
height: 350,
|
||||||
url: home_url + 'ajax.php',
|
buttons: {
|
||||||
data: parameters,
|
"Apply package": function () {
|
||||||
dataType: "json",
|
$("#pkg_apply_dialog").dialog("close");
|
||||||
success: function (data) {
|
|
||||||
$('#form-offline_update ul').find('li').removeClass('loading');
|
var parameters = {};
|
||||||
if (data.status == "success") {
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
$('#form-offline_update ul').find('li').addClass('suc');
|
parameters['search_minor'] = 1;
|
||||||
$('#form-offline_update ul').find('li').find('p').html(package_updated_successfully)
|
|
||||||
.append("<i>" + if_there_are_any_database_change + "</i>");
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: home_url + 'ajax.php',
|
||||||
|
data: parameters,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data['have_minor']) {
|
||||||
|
$("<div id='mr_dialog2' class='dialog ui-dialog-content' title='Menor release available'></div>").dialog ({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: 'black'
|
||||||
|
},
|
||||||
|
width: 600,
|
||||||
|
height: 350,
|
||||||
|
buttons: {
|
||||||
|
"Apply minor releases": function () {
|
||||||
|
var no_error = apply_minor_release(data['mr']);
|
||||||
|
$("#apply_rr_button").remove();
|
||||||
|
$("#cancel_rr_button").remove();
|
||||||
|
if (no_error) {
|
||||||
|
var parameters = {};
|
||||||
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
|
parameters['install_package'] = 1;
|
||||||
|
parameters['package'] = package;
|
||||||
|
parameters['accept'] = 1;
|
||||||
|
|
||||||
|
$('#form-offline_update ul').find('li').removeClass('suc');
|
||||||
|
$('#form-offline_update ul').find('li').addClass('loading');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: home_url + 'ajax.php',
|
||||||
|
data: parameters,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
$('#form-offline_update ul').find('li').removeClass('loading');
|
||||||
|
if (data.status == "success") {
|
||||||
|
$('#form-offline_update ul').find('li').addClass('suc');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(package_updated_successfully)
|
||||||
|
.append("<i>" + if_there_are_any_database_change + "</i>");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#form-offline_update ul').find('li').addClass('error');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(package_not_updated)
|
||||||
|
.append("<i>"+data.message+"</i>");
|
||||||
|
}
|
||||||
|
$('#form-offline_update ul').find('li').css("cursor", "pointer");
|
||||||
|
$('#form-offline_update ul').find('li').click(function() {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check the status of the update
|
||||||
|
check_install_package(package, homeurl);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#form-offline_update ul').find('li').addClass('error');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(error_in_mr)
|
||||||
|
.append("<i>"+data.message+"</i>");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Cancel": function () {
|
||||||
|
$("#mr_dialog2").dialog("close");
|
||||||
|
$('#form-offline_update ul').find('li').addClass('error');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(error_in_mr_accept)
|
||||||
|
.append("<i>"+data.message+"</i>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('button:contains(Apply minor releases)').attr("id","apply_rr_button");
|
||||||
|
$('button:contains(Cancel)').attr("id","cancel_rr_button");
|
||||||
|
|
||||||
|
var dialog_text = "<div><h3>Do you want to apply minor releases?</h3></br>";
|
||||||
|
dialog_text = dialog_text + "<h2>We recommend launch a planned downtime to this process</h2></br>";
|
||||||
|
dialog_text = dialog_text + "<a href=\"<?php echo $config['homeurl']; ?>index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list\">Planned downtimes</a></div>"
|
||||||
|
|
||||||
|
$('#mr_dialog2').html(dialog_text);
|
||||||
|
$('#mr_dialog2').dialog('open');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#pkg_apply_dialog").dialog("close");
|
||||||
|
|
||||||
|
var parameters = {};
|
||||||
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
|
parameters['install_package'] = 1;
|
||||||
|
parameters['package'] = package;
|
||||||
|
parameters['accept'] = 1;
|
||||||
|
|
||||||
|
$('#form-offline_update ul').find('li').removeClass('suc');
|
||||||
|
$('#form-offline_update ul').find('li').addClass('loading');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: home_url + 'ajax.php',
|
||||||
|
data: parameters,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
$('#form-offline_update ul').find('li').removeClass('loading');
|
||||||
|
if (data.status == "success") {
|
||||||
|
$('#form-offline_update ul').find('li').addClass('suc');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(package_updated_successfully)
|
||||||
|
.append("<i>" + if_there_are_any_database_change + "</i>");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#form-offline_update ul').find('li').addClass('error');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(package_not_updated)
|
||||||
|
.append("<i>"+data.message+"</i>");
|
||||||
|
}
|
||||||
|
$('#form-offline_update ul').find('li').css("cursor", "pointer");
|
||||||
|
$('#form-offline_update ul').find('li').click(function() {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check the status of the update
|
||||||
|
check_install_package(package, homeurl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"Cancel": function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
|
||||||
|
var parameters = {};
|
||||||
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
|
parameters['install_package'] = 1;
|
||||||
|
parameters['package'] = package;
|
||||||
|
parameters['accept'] = 0;
|
||||||
|
|
||||||
|
$('#form-offline_update ul').find('li').removeClass('suc');
|
||||||
|
$('#form-offline_update ul').find('li').addClass('loading');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: home_url + 'ajax.php',
|
||||||
|
data: parameters,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
$('#form-offline_update ul').find('li').removeClass('loading');
|
||||||
|
if (data.status == "success") {
|
||||||
|
$('#form-offline_update ul').find('li').addClass('suc');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(package_updated_successfully)
|
||||||
|
.append("<i>" + if_there_are_any_database_change + "</i>");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#form-offline_update ul').find('li').addClass('error');
|
||||||
|
$('#form-offline_update ul').find('li').find('p').html(package_not_updated)
|
||||||
|
.append("<i>"+data.message+"</i>");
|
||||||
|
}
|
||||||
|
$('#form-offline_update ul').find('li').css("cursor", "pointer");
|
||||||
|
$('#form-offline_update ul').find('li').click(function() {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check the status of the update
|
||||||
|
check_install_package(package, homeurl);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$('#form-offline_update ul').find('li').addClass('error');
|
|
||||||
$('#form-offline_update ul').find('li').find('p').html(package_not_updated)
|
|
||||||
.append("<i>"+data.message+"</i>");
|
|
||||||
}
|
|
||||||
$('#form-offline_update ul').find('li').css("cursor", "pointer");
|
|
||||||
$('#form-offline_update ul').find('li').click(function() {
|
|
||||||
window.location.reload();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var dialog_text = "<div><h3>Do you want to apply the package?</h3></br>";
|
||||||
|
|
||||||
// Check the status of the update
|
$('#pkg_apply_dialog').html(dialog_text);
|
||||||
check_install_package(package, homeurl);
|
$('#pkg_apply_dialog').dialog('open');
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_install_package(package, homeurl) {
|
function check_install_package(package, homeurl) {
|
||||||
@ -295,33 +451,171 @@ function update_last_package(package, version, homeurl) {
|
|||||||
$("#box_online .loading").show();
|
$("#box_online .loading").show();
|
||||||
$("#box_online .download_package").show();
|
$("#box_online .download_package").show();
|
||||||
|
|
||||||
var parameters = {};
|
$("<div id='pkg_apply_dialog' class= 'dialog ui-dialog-content'></div>").dialog ({
|
||||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
resizable: true,
|
||||||
parameters['update_last_free_package'] = 1;
|
draggable: true,
|
||||||
parameters['package'] = package;
|
modal: true,
|
||||||
parameters['version'] = version;
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
jQuery.post(
|
background: 'black'
|
||||||
home_url + "ajax.php",
|
|
||||||
parameters,
|
|
||||||
function (data) {
|
|
||||||
if (data['in_progress']) {
|
|
||||||
$("#box_online .loading").hide();
|
|
||||||
$("#box_online .download_package").hide();
|
|
||||||
|
|
||||||
$("#box_online .content").html(data['message']);
|
|
||||||
|
|
||||||
install_free_package(package, version, homeurl);
|
|
||||||
setTimeout(function () {
|
|
||||||
check_progress_update(homeurl);
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#box_online .content").html(data['message']);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"json"
|
width: 600,
|
||||||
);
|
height: 350,
|
||||||
|
buttons: {
|
||||||
|
"Apply package": function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
|
||||||
|
var parameters = {};
|
||||||
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
|
parameters['search_minor'] = 1;
|
||||||
|
|
||||||
|
jQuery.post(
|
||||||
|
home_url + "ajax.php",
|
||||||
|
parameters,
|
||||||
|
function (data) {
|
||||||
|
$("#box_online .loading").hide();
|
||||||
|
$("#box_online .downloading_package").hide();
|
||||||
|
|
||||||
|
if (data['have_minor']) {
|
||||||
|
$("<div id='mr_dialog2' class='dialog ui-dialog-content' title='Menor release available'></div>").dialog ({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: 'black'
|
||||||
|
},
|
||||||
|
width: 600,
|
||||||
|
height: 350,
|
||||||
|
buttons: {
|
||||||
|
"Apply minor releases": function () {
|
||||||
|
var no_error = apply_minor_release(data['mr']);
|
||||||
|
|
||||||
|
if (no_error) {
|
||||||
|
var parameters2 = {};
|
||||||
|
parameters2['page'] = 'include/ajax/update_manager.ajax';
|
||||||
|
parameters2['update_last_free_package'] = 1;
|
||||||
|
parameters2['package'] = package;
|
||||||
|
parameters2['version'] = version;
|
||||||
|
parameters2['accept'] = 1;
|
||||||
|
|
||||||
|
jQuery.post(
|
||||||
|
home_url + "ajax.php",
|
||||||
|
parameters2,
|
||||||
|
function (data) {
|
||||||
|
if (data['in_progress']) {
|
||||||
|
$("#box_online .loading").hide();
|
||||||
|
$("#box_online .download_package").hide();
|
||||||
|
|
||||||
|
$("#box_online .content").html(data['message']);
|
||||||
|
|
||||||
|
install_free_package(package, version, homeurl);
|
||||||
|
setTimeout(function () {
|
||||||
|
check_progress_update(homeurl);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#box_online .content").html(data['message']);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#box_online .content").html("Error in MR file");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Cancel": function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
$("#box_online .loading").hide();
|
||||||
|
$("#box_online .downloading_package").hide();
|
||||||
|
$("#box_online .content").html("MR not accepted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('button:contains(Apply minor releases)').attr("id","apply_rr_button");
|
||||||
|
$('button:contains(Cancel)').attr("id","cancel_rr_button");
|
||||||
|
|
||||||
|
var dialog_text = "<div><h3>Do you want to apply minor releases?</h3></br>";
|
||||||
|
dialog_text = dialog_text + "<h2>We recommend launch a planned downtime to this process</h2></br>";
|
||||||
|
dialog_text = dialog_text + "<a href=\"<?php echo $config['homeurl']; ?>index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list\">Planned downtimes</a></div>"
|
||||||
|
|
||||||
|
$('#mr_dialog2').html(dialog_text);
|
||||||
|
$('#mr_dialog2').dialog('open');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var parameters2 = {};
|
||||||
|
parameters2['page'] = 'include/ajax/update_manager.ajax';
|
||||||
|
parameters2['update_last_free_package'] = 1;
|
||||||
|
parameters2['package'] = package;
|
||||||
|
parameters2['version'] = version;
|
||||||
|
parameters2['accept'] = 1;
|
||||||
|
|
||||||
|
jQuery.post(
|
||||||
|
home_url + "ajax.php",
|
||||||
|
parameters2,
|
||||||
|
function (data) {
|
||||||
|
if (data['in_progress']) {
|
||||||
|
$("#box_online .loading").hide();
|
||||||
|
$("#box_online .download_package").hide();
|
||||||
|
|
||||||
|
$("#box_online .content").html(data['message']);
|
||||||
|
|
||||||
|
install_free_package(package, version, homeurl);
|
||||||
|
setTimeout(function () {
|
||||||
|
check_progress_update(homeurl);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#box_online .content").html(data['message']);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
"Cancel": function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
|
||||||
|
var parameters = {};
|
||||||
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
|
parameters['update_last_free_package'] = 1;
|
||||||
|
parameters['package'] = package;
|
||||||
|
parameters['version'] = version;
|
||||||
|
parameters['accept'] = 0;
|
||||||
|
|
||||||
|
jQuery.post(
|
||||||
|
home_url + "ajax.php",
|
||||||
|
parameters,
|
||||||
|
function (data) {
|
||||||
|
if (data['in_progress']) {
|
||||||
|
$("#box_online .loading").hide();
|
||||||
|
$("#box_online .download_package").hide();
|
||||||
|
|
||||||
|
$("#box_online .content").html(data['message']);
|
||||||
|
|
||||||
|
install_free_package(package, version, homeurl);
|
||||||
|
setTimeout(function () {
|
||||||
|
check_progress_update(homeurl);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#box_online .content").html(data['message']);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var dialog_text = "<div><h3>Do you want to apply the package?</h3></br>";
|
||||||
|
|
||||||
|
$('#pkg_apply_dialog').html(dialog_text);
|
||||||
|
$('#pkg_apply_dialog').dialog('open');
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_progress_update(homeurl) {
|
function check_progress_update(homeurl) {
|
||||||
@ -410,4 +704,45 @@ function install_free_package(package, version, homeurl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function apply_minor_release (n_mr) {
|
||||||
|
var error = false;
|
||||||
|
$('#mr_dialog2').empty();
|
||||||
|
$.each(n_mr, function(i, mr) {
|
||||||
|
var params = {};
|
||||||
|
params["updare_rr"] = 1;
|
||||||
|
params["number"] = mr;
|
||||||
|
params["page"] = "include/ajax/rolling_release.ajax";
|
||||||
|
|
||||||
|
jQuery.ajax ({
|
||||||
|
data: params,
|
||||||
|
async: false,
|
||||||
|
dataType: "html",
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
success: function (data) {
|
||||||
|
if (data != "") {
|
||||||
|
$('#mr_dialog2').empty();
|
||||||
|
$('#mr_dialog2').html("<h2>" + data + "</h2>");
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#mr_dialog2').append("<p>- Applying DB MR #" + mr + "</p>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#mr_dialog2').append("<h2>Updated finished successfully</h2>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
@ -405,14 +405,18 @@ button.ui-button::-moz-focus-inner {
|
|||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
.ui-dialog .ui-dialog-titlebar {
|
.ui-dialog .ui-dialog-titlebar {
|
||||||
|
display: list-item;
|
||||||
|
text-align: center;
|
||||||
padding: .4em 1em;
|
padding: .4em 1em;
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 12px;
|
||||||
|
height: 37px;
|
||||||
/*margin: 3px;*/
|
/*margin: 3px;*/
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.ui-dialog .ui-dialog-title {
|
.ui-dialog .ui-dialog-title {
|
||||||
float: left;
|
font-family: Nunito;
|
||||||
|
font-size: 13pt;
|
||||||
margin: .1em 0;
|
margin: .1em 0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
@ -421,12 +425,12 @@ button.ui-button::-moz-focus-inner {
|
|||||||
}
|
}
|
||||||
.ui-dialog .ui-dialog-titlebar-close {
|
.ui-dialog .ui-dialog-titlebar-close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: .3em;
|
right: 1em;
|
||||||
width: 21px;
|
width: 21px;
|
||||||
margin: 0px 0 0 0;
|
margin: 0px 0 0 0;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
bottom: 20%;
|
bottom: 30%;
|
||||||
}
|
}
|
||||||
.ui-dialog .ui-dialog-content {
|
.ui-dialog .ui-dialog-content {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -446,8 +450,12 @@ button.ui-button::-moz-focus-inner {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.ui-dialog .ui-dialog-buttonpane button {
|
.ui-dialog .ui-dialog-buttonpane button {
|
||||||
margin: .5em .4em .5em 0;
|
margin: .5em 1em .5em 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
background-color: white;
|
||||||
|
border: 1px solid #82b92e;
|
||||||
|
height:30px;
|
||||||
|
width:90px;
|
||||||
}
|
}
|
||||||
.ui-dialog .ui-resizable-se {
|
.ui-dialog .ui-resizable-se {
|
||||||
width: 12px;
|
width: 12px;
|
||||||
@ -1252,9 +1260,7 @@ body .ui-tooltip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ui-dialog-titlebar .ui-icon-closethick {
|
.ui-dialog-titlebar .ui-icon-closethick {
|
||||||
background-image: url("../../images/close_button_dialog.png");
|
background-image: url("../../images/icono_cerrar.png");
|
||||||
width: 14px;
|
|
||||||
height: 13px;
|
|
||||||
margin-top: -5px;
|
margin-top: -5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3595,8 +3595,10 @@ div.simple_value > a > span.text p
|
|||||||
border-bottom-left-radius: 5px;
|
border-bottom-left-radius: 5px;
|
||||||
z-index:3;
|
z-index:3;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
width:650px;
|
width:750px;
|
||||||
top: 30%;
|
max-width:750px;
|
||||||
|
min-width:750px;
|
||||||
|
top: 20%;
|
||||||
background:white;
|
background:white;
|
||||||
}
|
}
|
||||||
.modalheader{
|
.modalheader{
|
||||||
|
@ -3219,13 +3219,12 @@ table#policy_modules td * {
|
|||||||
-webkit-border-bottom-left-radius: 5px;
|
-webkit-border-bottom-left-radius: 5px;
|
||||||
border-bottom-right-radius: 5px;
|
border-bottom-right-radius: 5px;
|
||||||
border-bottom-left-radius: 5px;
|
border-bottom-left-radius: 5px;
|
||||||
z-index:2;
|
z-index:3;
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
-webkit-transform: translate(-50%, -50%);
|
|
||||||
position:fixed;
|
position:fixed;
|
||||||
width:650px;
|
width:750px;
|
||||||
|
max-width:750px;
|
||||||
|
min-width:750px;
|
||||||
|
top: 20%;
|
||||||
background:white;
|
background:white;
|
||||||
}
|
}
|
||||||
.modalheader{
|
.modalheader{
|
||||||
|
@ -3222,13 +3222,12 @@ table#policy_modules td * {
|
|||||||
-webkit-border-bottom-left-radius: 5px;
|
-webkit-border-bottom-left-radius: 5px;
|
||||||
border-bottom-right-radius: 5px;
|
border-bottom-right-radius: 5px;
|
||||||
border-bottom-left-radius: 5px;
|
border-bottom-left-radius: 5px;
|
||||||
z-index:2;
|
z-index:3;
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
-webkit-transform: translate(-50%, -50%);
|
|
||||||
position:fixed;
|
position:fixed;
|
||||||
width:650px;
|
width:750px;
|
||||||
|
max-width:750px;
|
||||||
|
min-width:750px;
|
||||||
|
top: 20%;
|
||||||
background:white;
|
background:white;
|
||||||
}
|
}
|
||||||
.modalheader{
|
.modalheader{
|
||||||
|
@ -445,8 +445,6 @@ if (! isset ($config['id_user'])) {
|
|||||||
$config['id_user'] = $nick_in_db;
|
$config['id_user'] = $nick_in_db;
|
||||||
|
|
||||||
if (is_user_admin($config['id_user'])) {
|
if (is_user_admin($config['id_user'])) {
|
||||||
$have_minor_releases = db_check_minor_relase_available();
|
|
||||||
|
|
||||||
// PHP configuration values
|
// PHP configuration values
|
||||||
$PHPupload_max_filesize = config_return_in_bytes(ini_get('upload_max_filesize'));
|
$PHPupload_max_filesize = config_return_in_bytes(ini_get('upload_max_filesize'));
|
||||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||||
@ -468,47 +466,6 @@ if (! isset ($config['id_user'])) {
|
|||||||
ini_set('memory_limit', config_return_in_bytes('500M'));
|
ini_set('memory_limit', config_return_in_bytes('500M'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($have_minor_releases) {
|
|
||||||
$size_mr = get_number_of_mr();
|
|
||||||
echo "<div class= 'dialog ui-dialog-content' title='".__("Minor release available")."' id='mr_dialog2'>" . __('') . "</div>";
|
|
||||||
?>
|
|
||||||
<script type="text/javascript" language="javascript">
|
|
||||||
$(document).ready (function () {;
|
|
||||||
$('#mr_dialog2').dialog ({
|
|
||||||
resizable: true,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
overlay: {
|
|
||||||
opacity: 0.5,
|
|
||||||
background: 'black'
|
|
||||||
},
|
|
||||||
width: 600,
|
|
||||||
height: 350,
|
|
||||||
buttons: {
|
|
||||||
"Apply minor releases": function () {
|
|
||||||
var n_mr = '<?php echo implode(",", $size_mr);?>';
|
|
||||||
apply_minor_release(n_mr.split(","));
|
|
||||||
},
|
|
||||||
"Cancel": function () {
|
|
||||||
$(this).dialog("close");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('button:contains(Apply minor releases)').attr("id","apply_rr_button");
|
|
||||||
$('button:contains(Cancel)').attr("id","cancel_rr_button");
|
|
||||||
|
|
||||||
var dialog_text = "<div><h3>Do you want to apply minor releases?</h3></br>";
|
|
||||||
dialog_text = dialog_text + "<h2>We recommend launch a planned downtime to this process</h2></br>";
|
|
||||||
dialog_text = dialog_text + "<a href=\"<?php echo $config['homeurl']; ?>index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list\">Planned downtimes</a></div>"
|
|
||||||
|
|
||||||
$('#mr_dialog2').html(dialog_text);
|
|
||||||
$('#mr_dialog2').dialog('open');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
set_time_limit((int)$PHPmax_execution_time);
|
set_time_limit((int)$PHPmax_execution_time);
|
||||||
ini_set('upload_max_filesize', $PHPupload_max_filesize);
|
ini_set('upload_max_filesize', $PHPupload_max_filesize);
|
||||||
ini_set('memory_limit', $PHPmemory_limit);
|
ini_set('memory_limit', $PHPmemory_limit);
|
||||||
@ -933,7 +890,6 @@ if ($config["pure"] == 0) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div id="alert_messages" style="display: none"></div>';
|
|
||||||
/// Clippy function
|
/// Clippy function
|
||||||
require_once('include/functions_clippy.php');
|
require_once('include/functions_clippy.php');
|
||||||
clippy_start($sec2);
|
clippy_start($sec2);
|
||||||
@ -975,48 +931,6 @@ require('include/php_to_js_values.php');
|
|||||||
return rv;
|
return rv;
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function apply_minor_release (n_mr) {
|
|
||||||
var error = false;
|
|
||||||
$("#apply_rr_button").remove();
|
|
||||||
$("#cancel_rr_button").text("Close");
|
|
||||||
$('#mr_dialog2').empty();
|
|
||||||
$('#mr_dialog2').append("<img id=\"rr_image\" src=\"<?php echo $config['homeurl'] . 'images/spinner.gif'; ?>\">");
|
|
||||||
$.each(n_mr, function(i, mr) {
|
|
||||||
var params = {};
|
|
||||||
params["updare_rr"] = 1;
|
|
||||||
params["number"] = mr;
|
|
||||||
params["page"] = "include/ajax/rolling_release.ajax";
|
|
||||||
|
|
||||||
jQuery.ajax ({
|
|
||||||
data: params,
|
|
||||||
async: false,
|
|
||||||
dataType: "html",
|
|
||||||
type: "POST",
|
|
||||||
url: "ajax.php",
|
|
||||||
success: function (data) {
|
|
||||||
if (data != "") {
|
|
||||||
$('#mr_dialog2').empty();
|
|
||||||
$('#mr_dialog2').html("<h2>" + data + "</h2>");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#mr_dialog2').append("<p>- Applying DB MR #" + mr + "</p>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#rr_image').remove();
|
|
||||||
|
|
||||||
if (!error) {
|
|
||||||
$('#mr_dialog2').append("<h2>Updated finished successfully</h2>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function force_run_register () {
|
function force_run_register () {
|
||||||
run_identification_wizard (1, 0, 0);
|
run_identification_wizard (1, 0, 0);
|
||||||
|
@ -228,7 +228,7 @@ function parse_mysql_dump($url) {
|
|||||||
$file_content = file($url);
|
$file_content = file($url);
|
||||||
$query = "";
|
$query = "";
|
||||||
foreach($file_content as $sql_line) {
|
foreach($file_content as $sql_line) {
|
||||||
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
|
if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) {
|
||||||
$query .= $sql_line;
|
$query .= $sql_line;
|
||||||
if(preg_match("/;[\040]*\$/", $sql_line)) {
|
if(preg_match("/;[\040]*\$/", $sql_line)) {
|
||||||
if (!$result = mysql_query($query)) {
|
if (!$result = mysql_query($query)) {
|
||||||
@ -251,7 +251,7 @@ function parse_mysqli_dump($connection, $url) {
|
|||||||
$file_content = file($url);
|
$file_content = file($url);
|
||||||
$query = "";
|
$query = "";
|
||||||
foreach($file_content as $sql_line) {
|
foreach($file_content as $sql_line) {
|
||||||
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
|
if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) {
|
||||||
$query .= $sql_line;
|
$query .= $sql_line;
|
||||||
if(preg_match("/;[\040]*\$/", $sql_line)) {
|
if(preg_match("/;[\040]*\$/", $sql_line)) {
|
||||||
if (!$result = mysqli_query($connection, $query)) {
|
if (!$result = mysqli_query($connection, $query)) {
|
||||||
|
@ -115,113 +115,57 @@ if ($searchAgents) {
|
|||||||
$userGroups = users_get_groups($config['id_user'], 'AR', false);
|
$userGroups = users_get_groups($config['id_user'], 'AR', false);
|
||||||
$id_userGroups = array_keys($userGroups);
|
$id_userGroups = array_keys($userGroups);
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
||||||
case "mysql":
|
|
||||||
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
|
||||||
INNER JOIN taddress_agent ON
|
INNER JOIN taddress_agent ON
|
||||||
taddress.id_a = taddress_agent.id_a
|
taddress.id_a = taddress_agent.id_a
|
||||||
WHERE taddress.ip LIKE '%$stringSearchSQL%'";
|
WHERE taddress.ip LIKE '%$stringSearchSQL%'";
|
||||||
|
|
||||||
$id = db_get_all_rows_sql($sql);
|
$id = db_get_all_rows_sql($sql);
|
||||||
if($id != ''){
|
if ($id != '') {
|
||||||
$aux = $id[0]['id_agent'];
|
$aux = $id[0]['id_agent'];
|
||||||
$search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
$search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%cd " . $stringSearchSQL . "%%' OR
|
||||||
t2.nombre COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
t2.nombre COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
||||||
t1.id_agente = $aux";
|
t1.id_agente = $aux";
|
||||||
|
|
||||||
if(count($id)>=2){
|
if (count($id) >= 2) {
|
||||||
for ($i = 1; $i < count($id); $i++){
|
for ($i = 1; $i < count($id); $i++) {
|
||||||
$aux = $id[$i]['id_agent'];
|
$aux = $id[$i]['id_agent'];
|
||||||
$search_sql .= " OR t1.id_agente = $aux";
|
$search_sql .= " OR t1.id_agente = $aux";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
$search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
|
||||||
t2.nombre COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
|
||||||
t1.direccion COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
|
||||||
t1.alias COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%'";
|
|
||||||
}
|
}
|
||||||
$sql = "
|
|
||||||
FROM tagente t1
|
|
||||||
INNER JOIN tgrupo t2
|
|
||||||
ON t2.id_grupo = t1.id_grupo
|
|
||||||
WHERE (
|
|
||||||
1 = (
|
|
||||||
SELECT is_admin
|
|
||||||
FROM tusuario
|
|
||||||
WHERE id_user = '" . $config['id_user'] . "'
|
|
||||||
)
|
|
||||||
OR t1.id_grupo IN (
|
|
||||||
" . implode(',', $id_userGroups) . "
|
|
||||||
) OR 0 IN (
|
|
||||||
SELECT id_grupo
|
|
||||||
FROM tusuario_perfil
|
|
||||||
WHERE id_usuario = '" . $config['id_user'] . "'
|
|
||||||
AND id_perfil IN (
|
|
||||||
SELECT id_perfil
|
|
||||||
FROM tperfil WHERE agent_view = 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
AND (
|
|
||||||
".$search_sql."
|
|
||||||
)
|
|
||||||
";
|
|
||||||
break;
|
|
||||||
case "postgresql":
|
|
||||||
case "oracle":
|
|
||||||
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
|
|
||||||
INNER JOIN taddress_agent ON
|
|
||||||
taddress.id_a = taddress_agent.id_a
|
|
||||||
WHERE taddress.ip LIKE '%$stringSearchSQL%'";
|
|
||||||
|
|
||||||
$id = db_get_all_rows_sql($sql);
|
|
||||||
if($id != ''){
|
|
||||||
$aux = $id[0]['id_agent'];
|
|
||||||
$search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%" . strtolower($stringSearchSQL) . "%%' OR
|
|
||||||
t2.nombre COLLATE utf8_general_ci LIKE '%%" . strtolower($stringSearchSQL) . "%%' OR
|
|
||||||
t1.id_agente = $aux";
|
|
||||||
|
|
||||||
if(count($id)>=2){
|
|
||||||
for ($i = 1; $i < count($id); $i++){
|
|
||||||
$aux = $id[$i]['id_agent'];
|
|
||||||
$search_sql .= " OR t1.id_agente = $aux";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$search_sql = " lower(t1.nombre) LIKE '%%" . strtolower($stringSearchSQL) . "%%' OR
|
|
||||||
lower(t2.nombre) LIKE '%%" . strtolower($stringSearchSQL) . "%%' OR
|
|
||||||
lower(t1.direccion) LIKE '%%" . strtolower($stringSearchSQL) . "%%' OR
|
|
||||||
lower(t1.alias) LIKE '%%" . strtolower($stringSearchSQL) . "%%'";
|
|
||||||
}
|
|
||||||
$sql = "
|
|
||||||
FROM tagente t1
|
|
||||||
INNER JOIN tgrupo t2
|
|
||||||
ON t2.id_grupo = t1.id_grupo
|
|
||||||
WHERE (
|
|
||||||
1 = (
|
|
||||||
SELECT is_admin
|
|
||||||
FROM tusuario
|
|
||||||
WHERE id_user = '" . $config['id_user'] . "'
|
|
||||||
)
|
|
||||||
OR t1.id_grupo IN (
|
|
||||||
" . implode(',', $id_userGroups) . "
|
|
||||||
) OR 0 IN (
|
|
||||||
SELECT id_grupo
|
|
||||||
FROM tusuario_perfil
|
|
||||||
WHERE id_usuario = '" . $config['id_user'] . "'
|
|
||||||
AND id_perfil IN (
|
|
||||||
SELECT id_perfil
|
|
||||||
FROM tperfil WHERE agent_view = 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
AND (
|
|
||||||
".$search_sql."
|
|
||||||
)
|
|
||||||
";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
||||||
|
t2.nombre COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
||||||
|
t1.direccion COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%' OR
|
||||||
|
t1.alias COLLATE utf8_general_ci LIKE '%%" . $stringSearchSQL . "%%'";
|
||||||
|
}
|
||||||
|
$sql = "
|
||||||
|
FROM tagente t1
|
||||||
|
INNER JOIN tgrupo t2
|
||||||
|
ON t2.id_grupo = t1.id_grupo
|
||||||
|
WHERE (
|
||||||
|
1 = (
|
||||||
|
SELECT is_admin
|
||||||
|
FROM tusuario
|
||||||
|
WHERE id_user = '" . $config['id_user'] . "'
|
||||||
|
)
|
||||||
|
OR t1.id_grupo IN (
|
||||||
|
" . implode(',', $id_userGroups) . "
|
||||||
|
) OR 0 IN (
|
||||||
|
SELECT id_grupo
|
||||||
|
FROM tusuario_perfil
|
||||||
|
WHERE id_usuario = '" . $config['id_user'] . "'
|
||||||
|
AND id_perfil IN (
|
||||||
|
SELECT id_perfil
|
||||||
|
FROM tperfil WHERE agent_view = 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
AND (
|
||||||
|
".$search_sql."
|
||||||
|
)
|
||||||
|
";
|
||||||
|
|
||||||
$select = "SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias";
|
$select = "SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias";
|
||||||
if ($only_count) {
|
if ($only_count) {
|
||||||
@ -235,25 +179,8 @@ if ($searchAgents) {
|
|||||||
|
|
||||||
$query = $select . $sql;
|
$query = $select . $sql;
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
$query .= $limit;
|
||||||
case "mysql":
|
|
||||||
case "postgresql":
|
|
||||||
$query .= $limit;
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
$set = array();
|
|
||||||
$set['limit'] = $config['block_size'];
|
|
||||||
|
|
||||||
if ($only_count)
|
|
||||||
$set['offset'] = 0;
|
|
||||||
else
|
|
||||||
$set['offset'] = (int) get_parameter('offset');
|
|
||||||
|
|
||||||
$query .= " ORDER BY " . $order['field'] . " " . $order['order'];
|
|
||||||
$query = oracle_recode_query ($query, $set);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents = db_process_sql($query);
|
$agents = db_process_sql($query);
|
||||||
if (empty($agents))
|
if (empty($agents))
|
||||||
$agents = array();
|
$agents = array();
|
||||||
|
@ -34,6 +34,7 @@ foreach ($arrayKeywords as $keyword) {
|
|||||||
array_push($temp, "%" . $keyword . "%");
|
array_push($temp, "%" . $keyword . "%");
|
||||||
}
|
}
|
||||||
$stringSearchSQL = implode(" ", $temp);
|
$stringSearchSQL = implode(" ", $temp);
|
||||||
|
$stringSearchSQL = str_replace('_', '\_', $stringSearchSQL);
|
||||||
|
|
||||||
if ($config['search_category'] == "all")
|
if ($config['search_category'] == "all")
|
||||||
$searchTab = "main";
|
$searchTab = "main";
|
||||||
|
@ -18,7 +18,7 @@ echo "</span>
|
|||||||
<img class='modalclosex cerrar' src='".$config['homeurl']."/images/icono_cerrar.png'>
|
<img class='modalclosex cerrar' src='".$config['homeurl']."/images/icono_cerrar.png'>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
echo "<div style='overflow-y:scroll;height:550px;'>";
|
echo "<div style='overflow-y:auto;height:400px;min-height:400px;max-height:400px;'>";
|
||||||
echo get_pandora_error_for_header();
|
echo get_pandora_error_for_header();
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
@ -32,7 +32,8 @@ echo "<div class='modalokbutton cerrar'>
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(".cerrar").click(function(){
|
$(".cerrar").click(function(){
|
||||||
$("#alert_messages").dialog('close');
|
$("#alert_messages").hide();
|
||||||
|
$( "#opacidad" ).remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
|||||||
# (c) Ártica ST 2014 <info@artica.es>
|
# (c) Ártica ST 2014 <info@artica.es>
|
||||||
# Module for network topology discovery.
|
# Module for network topology discovery.
|
||||||
|
|
||||||
package Recon::Base;
|
package PandoraFMS::Recon::Base;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
@ -11,8 +11,8 @@ use lib '/usr/lib/perl5';
|
|||||||
|
|
||||||
use NetAddr::IP;
|
use NetAddr::IP;
|
||||||
use POSIX qw/ceil/;
|
use POSIX qw/ceil/;
|
||||||
use Recon::NmapParser;
|
use PandoraFMS::Recon::NmapParser;
|
||||||
use Recon::Util;
|
use PandoraFMS::Recon::Util;
|
||||||
use Socket qw/inet_aton/;
|
use Socket qw/inet_aton/;
|
||||||
|
|
||||||
# Some useful OIDs.
|
# Some useful OIDs.
|
||||||
@ -1304,7 +1304,7 @@ sub traceroute_connectivity($$) {
|
|||||||
|
|
||||||
# Perform a traceroute.
|
# Perform a traceroute.
|
||||||
my $nmap_args = '-nsP -PE --traceroute --max-retries '.$self->{'icmp_checks'}.' --host-timeout '.$self->{'icmp_timeout'}.'s -T'.$self->{'recon_timing_template'};
|
my $nmap_args = '-nsP -PE --traceroute --max-retries '.$self->{'icmp_checks'}.' --host-timeout '.$self->{'icmp_timeout'}.'s -T'.$self->{'recon_timing_template'};
|
||||||
my $np = Recon::NmapParser->new();
|
my $np = PandoraFMS::Recon::NmapParser->new();
|
||||||
eval {
|
eval {
|
||||||
$np->parsescan($self->{'nmap'}, $nmap_args, ($host));
|
$np->parsescan($self->{'nmap'}, $nmap_args, ($host));
|
||||||
};
|
};
|
@ -22,7 +22,7 @@
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
package Recon::NmapParser;
|
package PandoraFMS::Recon::NmapParser;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use XML::Twig;
|
use XML::Twig;
|
@ -2,7 +2,7 @@
|
|||||||
# (c) Ártica ST 2016 <info@artica.es>
|
# (c) Ártica ST 2016 <info@artica.es>
|
||||||
# Utility functions for the network topology discovery modules.
|
# Utility functions for the network topology discovery modules.
|
||||||
|
|
||||||
package Recon::Util;
|
package PandoraFMS::Recon::Util;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
@ -37,7 +37,7 @@ use PandoraFMS::DB;
|
|||||||
use PandoraFMS::Core;
|
use PandoraFMS::Core;
|
||||||
use PandoraFMS::ProducerConsumerServer;
|
use PandoraFMS::ProducerConsumerServer;
|
||||||
use PandoraFMS::GIS qw(get_reverse_geoip_sql get_reverse_geoip_file get_random_close_point);
|
use PandoraFMS::GIS qw(get_reverse_geoip_sql get_reverse_geoip_file get_random_close_point);
|
||||||
use Recon::Base;
|
use PandoraFMS::Recon::Base;
|
||||||
|
|
||||||
# Patched Nmap::Parser. See http://search.cpan.org/dist/Nmap-Parser/.
|
# Patched Nmap::Parser. See http://search.cpan.org/dist/Nmap-Parser/.
|
||||||
use PandoraFMS::NmapParser;
|
use PandoraFMS::NmapParser;
|
||||||
@ -156,7 +156,7 @@ sub data_consumer ($$) {
|
|||||||
my @subnets = split(/,/, $task->{'subnet'});
|
my @subnets = split(/,/, $task->{'subnet'});
|
||||||
my @communities = split(/,/, $task->{'snmp_community'});
|
my @communities = split(/,/, $task->{'snmp_community'});
|
||||||
|
|
||||||
my $recon = new Recon::Base(
|
my $recon = new PandoraFMS::Recon::Base(
|
||||||
communities => \@communities,
|
communities => \@communities,
|
||||||
dbh => $dbh,
|
dbh => $dbh,
|
||||||
group_id => $task->{'id_group'},
|
group_id => $task->{'id_group'},
|
||||||
@ -245,7 +245,7 @@ sub exec_recon_script ($$$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# Guess the OS using xprobe2 or nmap.
|
# Guess the OS using xprobe2 or nmap.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub Recon::Base::guess_os($$) {
|
sub PandoraFMS::Recon::Base::guess_os($$) {
|
||||||
my ($self, $device) = @_;
|
my ($self, $device) = @_;
|
||||||
|
|
||||||
# OS detection disabled. Use the device type.
|
# OS detection disabled. Use the device type.
|
||||||
@ -276,7 +276,7 @@ sub Recon::Base::guess_os($$) {
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
# Returns the number of open ports from the given list.
|
# Returns the number of open ports from the given list.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
sub Recon::Base::tcp_scan ($$) {
|
sub PandoraFMS::Recon::Base::tcp_scan ($$) {
|
||||||
my ($self, $host) = @_;
|
my ($self, $host) = @_;
|
||||||
|
|
||||||
my $open_ports = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host | grep open | wc -l`;
|
my $open_ports = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host | grep open | wc -l`;
|
||||||
@ -286,7 +286,7 @@ sub Recon::Base::tcp_scan ($$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# Create network profile modules for the given agent.
|
# Create network profile modules for the given agent.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub Recon::Base::create_network_profile_modules($$$) {
|
sub PandoraFMS::Recon::Base::create_network_profile_modules($$$) {
|
||||||
my ($self, $agent_id, $device) = @_;
|
my ($self, $agent_id, $device) = @_;
|
||||||
|
|
||||||
return unless ($self->{'id_network_profile'} > 0);
|
return unless ($self->{'id_network_profile'} > 0);
|
||||||
@ -312,7 +312,7 @@ sub Recon::Base::create_network_profile_modules($$$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# Connect the given devices in the Pandora FMS database.
|
# Connect the given devices in the Pandora FMS database.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub Recon::Base::connect_agents($$$$$) {
|
sub PandoraFMS::Recon::Base::connect_agents($$$$$) {
|
||||||
my ($self, $dev_1, $if_1, $dev_2, $if_2) = @_;
|
my ($self, $dev_1, $if_1, $dev_2, $if_2) = @_;
|
||||||
|
|
||||||
# Check switch connectivy.
|
# Check switch connectivy.
|
||||||
@ -363,7 +363,7 @@ sub Recon::Base::connect_agents($$$$$) {
|
|||||||
# Create an agent for the given device. Returns the ID of the new (or
|
# Create an agent for the given device. Returns the ID of the new (or
|
||||||
# existing) agent, undef on error.
|
# existing) agent, undef on error.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub Recon::Base::create_agent($$) {
|
sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||||
my ($self, $device) = @_;
|
my ($self, $device) = @_;
|
||||||
|
|
||||||
my @agents = get_db_rows($self->{'dbh'},
|
my @agents = get_db_rows($self->{'dbh'},
|
||||||
@ -461,13 +461,13 @@ sub Recon::Base::create_agent($$) {
|
|||||||
my $community = $self->get_community($device);
|
my $community = $self->get_community($device);
|
||||||
return $agent_id unless defined($community);
|
return $agent_id unless defined($community);
|
||||||
|
|
||||||
my @output = $self->snmp_get_value_array($device, $Recon::Base::IFINDEX);
|
my @output = $self->snmp_get_value_array($device, $PandoraFMS::Recon::Base::IFINDEX);
|
||||||
foreach my $if_index (@output) {
|
foreach my $if_index (@output) {
|
||||||
next unless ($if_index =~ /^[0-9]+$/);
|
next unless ($if_index =~ /^[0-9]+$/);
|
||||||
|
|
||||||
# Check the status of the interface.
|
# Check the status of the interface.
|
||||||
if ($self->{'all_ifaces'} == 0) {
|
if ($self->{'all_ifaces'} == 0) {
|
||||||
my $if_status = $self->snmp_get_value($device, "$Recon::Base::IFOPERSTATUS.$if_index");
|
my $if_status = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFOPERSTATUS.$if_index");
|
||||||
next unless $if_status == 1;
|
next unless $if_status == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ sub Recon::Base::create_agent($$) {
|
|||||||
my $if_desc = ($mac ne '' ? "MAC $mac " : '') . ($ip ne '' ? "IP $ip" : '');
|
my $if_desc = ($mac ne '' ? "MAC $mac " : '') . ($ip ne '' ? "IP $ip" : '');
|
||||||
|
|
||||||
# Get the name of the network interface.
|
# Get the name of the network interface.
|
||||||
my $if_name = $self->snmp_get_value($device, "$Recon::Base::IFNAME.$if_index");
|
my $if_name = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFNAME.$if_index");
|
||||||
$if_name = "if$if_index" unless defined ($if_name);
|
$if_name = "if$if_index" unless defined ($if_name);
|
||||||
$if_name =~ s/"//g;
|
$if_name =~ s/"//g;
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ sub Recon::Base::create_agent($$) {
|
|||||||
'ip_target' => $device,
|
'ip_target' => $device,
|
||||||
'tcp_send' => 1,
|
'tcp_send' => 1,
|
||||||
'snmp_community' => $community,
|
'snmp_community' => $community,
|
||||||
'snmp_oid' => "$Recon::Base::IFOPERSTATUS.$if_index"
|
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOPERSTATUS.$if_index"
|
||||||
);
|
);
|
||||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||||
} else {
|
} else {
|
||||||
@ -523,7 +523,7 @@ sub Recon::Base::create_agent($$) {
|
|||||||
'ip_target' => $device,
|
'ip_target' => $device,
|
||||||
'tcp_send' => 1,
|
'tcp_send' => 1,
|
||||||
'snmp_community' => $community,
|
'snmp_community' => $community,
|
||||||
'snmp_oid' => "$Recon::Base::IFINOCTECTS.$if_index");
|
'snmp_oid' => "$PandoraFMS::Recon::Base::IFINOCTECTS.$if_index");
|
||||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||||
} else {
|
} else {
|
||||||
my %module = (
|
my %module = (
|
||||||
@ -544,7 +544,7 @@ sub Recon::Base::create_agent($$) {
|
|||||||
'ip_target' => $device,
|
'ip_target' => $device,
|
||||||
'tcp_send' => 1,
|
'tcp_send' => 1,
|
||||||
'snmp_community' => $community,
|
'snmp_community' => $community,
|
||||||
'snmp_oid' => "$Recon::Base::IFOUTOCTECTS.$if_index");
|
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOUTOCTECTS.$if_index");
|
||||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||||
} else {
|
} else {
|
||||||
my %module = (
|
my %module = (
|
||||||
@ -561,7 +561,7 @@ sub Recon::Base::create_agent($$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# Delete already existing connections.
|
# Delete already existing connections.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub Recon::Base::delete_connections($) {
|
sub PandoraFMS::Recon::Base::delete_connections($) {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->call('message', "Deleting connections...", 10);
|
$self->call('message', "Deleting connections...", 10);
|
||||||
@ -571,7 +571,7 @@ sub Recon::Base::delete_connections($) {
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
# Print log messages.
|
# Print log messages.
|
||||||
#######################################################################
|
#######################################################################
|
||||||
sub Recon::Base::message($$$) {
|
sub PandoraFMS::Recon::Base::message($$$) {
|
||||||
my ($self, $message, $verbosity) = @_;
|
my ($self, $message, $verbosity) = @_;
|
||||||
|
|
||||||
logger($self->{'pa_config'}, "[Recon task " . $self->{'task_id'} . "] $message", $verbosity);
|
logger($self->{'pa_config'}, "[Recon task " . $self->{'task_id'} . "] $message", $verbosity);
|
||||||
@ -580,7 +580,7 @@ sub Recon::Base::message($$$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# Connect the given hosts to its parent.
|
# Connect the given hosts to its parent.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub Recon::Base::set_parent($$$) {
|
sub PandoraFMS::Recon::Base::set_parent($$$) {
|
||||||
my ($self, $host, $parent) = @_;
|
my ($self, $host, $parent) = @_;
|
||||||
|
|
||||||
return unless ($self->{'parent_detection'} == 1);
|
return unless ($self->{'parent_detection'} == 1);
|
||||||
@ -615,7 +615,7 @@ sub Recon::Base::set_parent($$$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# Update recon task status.
|
# Update recon task status.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub Recon::Base::update_progress ($$) {
|
sub PandoraFMS::Recon::Base::update_progress ($$) {
|
||||||
my ($self, $progress) = @_;
|
my ($self, $progress) = @_;
|
||||||
|
|
||||||
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ? WHERE id_rt = ?', time (), $progress, $self->{'task_id'});
|
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ? WHERE id_rt = ?', time (), $progress, $self->{'task_id'});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user