Merge branch 'feature/rolling_release' into 'develop'
Feature/rolling release See merge request !151
This commit is contained in:
commit
e71c6070ad
|
@ -0,0 +1,4 @@
|
|||
# Ignorar todo en este directorio
|
||||
*
|
||||
# Excepto este archivo
|
||||
!.gitignore
|
|
@ -26,8 +26,22 @@ if (! file_exists ($config["homedir"] . $license_file)) {
|
|||
$license_file = 'general/license/pandora_info_en.html';
|
||||
}
|
||||
|
||||
if (!$config["minor_release_open"]) {
|
||||
$config["minor_release_open"] = 0;
|
||||
}
|
||||
if (enterprise_installed()) {
|
||||
if (!$config["minor_release_enterprise"]) {
|
||||
$config["minor_release_enterprise"] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
|
||||
echo sprintf(__('Pandora FMS %s - Build %s', $pandora_version, $build_version));
|
||||
if (enterprise_installed()) {
|
||||
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["minor_release_enterprise"]));
|
||||
}
|
||||
else {
|
||||
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["minor_release_open"]));
|
||||
}
|
||||
echo '</a><br />';
|
||||
echo '<a class="white footer">'. __('Page generated at') . ' '. ui_print_timestamp ($time, true, array ("prominent" => "timestamp")); //Always use timestamp here
|
||||
echo '</a>';
|
||||
|
|
|
@ -233,12 +233,21 @@ config_check();
|
|||
//======================================================
|
||||
|
||||
|
||||
|
||||
$check_minor_release_available = false;
|
||||
$pandora_management = check_acl($config['id_user'], 0, "PM");
|
||||
|
||||
$check_minor_release_available = db_check_minor_relase_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');
|
||||
}
|
||||
|
||||
if ($config["alert_cnt"] > 0) {
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
||||
if ($config["alert_cnt"] > 0) {
|
||||
if ($config["alert_cnt"] > 0) {
|
||||
$maintenance_link = 'javascript:';
|
||||
$maintenance_title = __("System alerts detected - Please fix as soon as possible");
|
||||
$maintenance_class = $maintenance_id = 'show_systemalert_dialog white';
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2012 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 for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Only accesible by ajax
|
||||
if (is_ajax ()) {
|
||||
global $config;
|
||||
check_login();
|
||||
|
||||
$updare_rr_open = get_parameter('updare_rr_open', 0);
|
||||
|
||||
if ($updare_rr_open) {
|
||||
$number = get_parameter('number');
|
||||
$dir = $config["homedir"]."/extras/mr";
|
||||
|
||||
$file = "$dir/$number.open.sql";
|
||||
|
||||
$dangerous_query = false;
|
||||
$mr_file = fopen($file, "r");
|
||||
while (!feof($mr_file)) {
|
||||
$line = fgets($mr_file);
|
||||
if ((preg_match("/^drop/", $line)) ||
|
||||
(preg_match("/^truncate table/", $line))) {
|
||||
$dangerous_query = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($dangerous_query) {
|
||||
$error_file = fopen($config["homedir"] . "/extras/mr/error.txt", "w");
|
||||
$message = "The sql file contains a dangerous query";
|
||||
fwrite($error_file, $message);
|
||||
fclose($error_file);
|
||||
}
|
||||
else {
|
||||
if (file_exists($dir) && is_dir($dir)) {
|
||||
if (is_readable($dir)) {
|
||||
if ($config["minor_release_open"] >= $number) {
|
||||
if (!file_exists($dir."/updated") || !is_dir($dir."/updated")) {
|
||||
mkdir($dir."/updated");
|
||||
}
|
||||
$file_dest = "$dir/updated/$number.open.sql";
|
||||
if (copy($file, $file_dest)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$result = db_run_sql_file($file);
|
||||
|
||||
if ($result) {
|
||||
$update_config = update_config_token("minor_release_open", $number);
|
||||
if ($update_config) {
|
||||
$config["minor_release_open"] = $number;
|
||||
}
|
||||
|
||||
if ($config["minor_release_open"] == $number) {
|
||||
if (!file_exists($dir."/updated") || !is_dir($dir."/updated")) {
|
||||
mkdir($dir."/updated");
|
||||
}
|
||||
|
||||
$file_dest = "$dir/updated/$number.open.sql";
|
||||
|
||||
if (copy($file, $file_dest)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$error_file = fopen($config["homedir"] . "/extras/mr/error.txt", "w");
|
||||
$message = "An error occurred while updating the database schema to the minor release " . $number;
|
||||
fwrite($error_file, $message);
|
||||
fclose($error_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$error_file = fopen($config["homedir"] . "/extras/mr/error.txt", "w");
|
||||
$message = "The directory ' . $dir . ' should have read permissions in order to update the database schema";
|
||||
fwrite($error_file, $message);
|
||||
fclose($error_file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$error_file = fopen($config["homedir"] . "/extras/mr/error.txt", "w");
|
||||
$message = "The directory ' . $dir . ' does not exist";
|
||||
fwrite($error_file, $message);
|
||||
fclose($error_file);
|
||||
}
|
||||
}
|
||||
|
||||
echo $message;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -56,7 +56,21 @@ $no_login_msg = "";
|
|||
// Don't change the format, it is parsed by applications
|
||||
switch($info) {
|
||||
case 'version':
|
||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version;
|
||||
if (!$config["minor_release_open"]) {
|
||||
$config["minor_release_open"] = 0;
|
||||
}
|
||||
if (enterprise_installed()) {
|
||||
if (!$config["minor_release_enterprise"]) {
|
||||
$config["minor_release_enterprise"] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["minor_release_enterprise"];
|
||||
}
|
||||
else {
|
||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["minor_release_open"];
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -1315,4 +1315,49 @@ function mysql_db_process_file ($path, $handle_error = true) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Initiates a transaction and run the queries of an sql file
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function db_run_sql_file ($location) {
|
||||
global $config;
|
||||
|
||||
// Load file
|
||||
$commands = file_get_contents($location);
|
||||
|
||||
// Delete comments
|
||||
$lines = explode("\n", $commands);
|
||||
$commands = '';
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if ($line && !preg_match('/^--/', $line) && !preg_match('/^\/\*/', $line)) {
|
||||
$commands .= $line;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert to array
|
||||
$commands = explode(";", $commands);
|
||||
|
||||
// Run commands
|
||||
mysql_db_process_sql_begin(); // Begin transaction
|
||||
foreach ($commands as $command) {
|
||||
if (trim($command)) {
|
||||
$result = mysql_query($command);
|
||||
|
||||
if (!$result) {
|
||||
break; // Error
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($result) {
|
||||
mysql_db_process_sql_commit(); // Save results
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
mysql_db_process_sql_rollback(); // Undo results
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -2667,6 +2667,76 @@ function pandora_setlocale() {
|
|||
str_replace(array_keys($replace_locale), $replace_locale, $user_language));
|
||||
}
|
||||
|
||||
function update_config_token ($cfgtoken, $cfgvalue) {
|
||||
global $config;
|
||||
|
||||
$delete = db_process_sql ("DELETE FROM tconfig WHERE token = '$cfgtoken'");
|
||||
$insert = db_process_sql ("INSERT INTO tconfig (token, value) VALUES ('$cfgtoken', '$cfgvalue')");
|
||||
|
||||
if ($delete && $insert) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function update_conf_minor_release() {
|
||||
global $config;
|
||||
|
||||
$config['minor_release_open'] = db_get_value ('value', 'tconfig', 'token', 'minor_release_open');
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$config['minor_release_enterprise'] = db_get_value ('value', 'tconfig', 'token', 'minor_release_enterprise');
|
||||
}
|
||||
}
|
||||
|
||||
function get_number_of_mr($mode) {
|
||||
global $config;
|
||||
|
||||
$dir = $config["homedir"]."/extras/mr";
|
||||
$mr_size = array();
|
||||
|
||||
if (file_exists($dir) && is_dir($dir)) {
|
||||
if (is_readable($dir)) {
|
||||
if ($mode == 'open') {
|
||||
$files = scandir($dir); // Get all the files from the directory ordered by asc
|
||||
|
||||
if ($files !== false) {
|
||||
$pattern = "/^\d+\.open\.sql$/";
|
||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
||||
$pattern = "/\.open\.sql$/";
|
||||
$replacement = "";
|
||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles);
|
||||
|
||||
foreach ($sqlfiles_num as $num) {
|
||||
$mr_size[] = $num;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (enterprise_installed()) {
|
||||
$files2 = scandir($dir); // Get all the files from the directory ordered by asc
|
||||
|
||||
if ($files2 !== false) {
|
||||
$pattern2 = "/^\d+\.ent\.sql$/";
|
||||
$sqlfiles2 = preg_grep($pattern2, $files2); // Get the name of the correct files
|
||||
|
||||
$pattern2 = "/\.ent\.sql$/";
|
||||
$replacement2 = "";
|
||||
$sqlfiles_num2 = preg_replace($pattern2, $replacement2, $sqlfiles2); // Get the number of the file
|
||||
|
||||
foreach ($sqlfiles_num2 as $num2) {
|
||||
$mr_size[] = $num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $mr_size;
|
||||
}
|
||||
|
||||
function remove_right_zeros ($value) {
|
||||
$is_decimal = explode(".", $value);
|
||||
if (isset($is_decimal[1])) {
|
||||
|
|
|
@ -1672,4 +1672,86 @@ function db_process_file ($path, $handle_error = true) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for minor release files.
|
||||
*
|
||||
* @return bool Return if minor release is available or not
|
||||
*/
|
||||
function db_check_minor_relase_available () {
|
||||
global $config;
|
||||
|
||||
$dir = $config["homedir"]."/extras/mr";
|
||||
|
||||
$have_ent_minor = false;
|
||||
$have_open_minor = false;
|
||||
|
||||
if (file_exists($dir) && is_dir($dir)) {
|
||||
if (is_readable($dir)) {
|
||||
$files = scandir($dir); // Get all the files from the directory ordered by asc
|
||||
if ($files !== false) {
|
||||
// Enterprise installed
|
||||
if (enterprise_installed()) {
|
||||
$pattern = "/^\d+\.open\.sql$/";
|
||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
||||
$pattern = "/\.open\.sql$/";
|
||||
$replacement = "";
|
||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
|
||||
|
||||
$sqlfiles = null;
|
||||
|
||||
if ($sqlfiles_num) {
|
||||
foreach ($sqlfiles_num as $sqlfile_num) {
|
||||
if ($config["minor_release_open"] < $sqlfile_num) {
|
||||
$have_open_minor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pattern2 = "/^\d+\.ent\.sql$/";
|
||||
$sqlfiles2 = preg_grep($pattern2, $files); // Get the name of the correct files
|
||||
$files = null;
|
||||
$pattern2 = "/\.ent\.sql$/";
|
||||
$replacement2 = "";
|
||||
$sqlfiles_num2 = preg_replace($pattern2, $replacement2, $sqlfiles2); // Get the number of the file
|
||||
|
||||
$sqlfiles2 = null;
|
||||
|
||||
if ($sqlfiles_num2) {
|
||||
foreach ($sqlfiles_num2 as $sqlfile_num2) {
|
||||
if ($config["minor_release_enterprise"] < $sqlfile_num2) {
|
||||
$have_ent_minor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$pattern = "/^\d+\.open.sql$/";
|
||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
||||
$files = null;
|
||||
$pattern = "/\.open.sql$/";
|
||||
$replacement = "";
|
||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
|
||||
|
||||
$sqlfiles = null;
|
||||
|
||||
if ($sqlfiles_num) {
|
||||
foreach ($sqlfiles_num as $sqlfile_num) {
|
||||
if ($config["minor_release"] < $sqlfile_num) {
|
||||
$have_open_minor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($have_open_minor || $have_ent_minor) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -36,7 +36,7 @@ if ($develop_bypass != 1) {
|
|||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (filesize("include/config.php") == 0) {
|
||||
include ("install.php");
|
||||
exit;
|
||||
|
@ -100,7 +100,7 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
|
|||
if (sizeof ($_REQUEST))
|
||||
//Some (old) browsers don't like the ?&key=var
|
||||
$query .= '?1=1';
|
||||
|
||||
|
||||
//We don't clean these variables up as they're only being passed along
|
||||
foreach ($_GET as $key => $value) {
|
||||
if ($key == 1)
|
||||
|
@ -111,11 +111,11 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
|
|||
$query .= '&'.$key.'='.$value;
|
||||
}
|
||||
$url = ui_get_full_url($query);
|
||||
|
||||
|
||||
// Prevent HTTP response splitting attacks
|
||||
// http://en.wikipedia.org/wiki/HTTP_response_splitting
|
||||
$url = str_replace ("\n", "", $url);
|
||||
|
||||
|
||||
header ('Location: '.$url);
|
||||
exit; //Always exit after sending location headers
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ echo '<head>' . "\n";
|
|||
//This starts the page head. In the call back function, things from $page['head'] array will be processed into the head
|
||||
ob_start ('ui_process_page_head');
|
||||
|
||||
// Enterprise main
|
||||
// Enterprise main
|
||||
enterprise_include ('index.php');
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
|
@ -172,15 +172,16 @@ $process_login = false;
|
|||
$change_pass = get_parameter_post('renew_password', 0);
|
||||
|
||||
if ($change_pass == 1) {
|
||||
|
||||
|
||||
$password_old = (string) get_parameter_post ('old_password', '');
|
||||
$password_new = (string) get_parameter_post ('new_password', '');
|
||||
$password_confirm = (string) get_parameter_post ('confirm_new_password', '');
|
||||
$id = (string) get_parameter_post ('login', '');
|
||||
|
||||
|
||||
$changed_pass = login_update_password_check ($password_old, $password_new, $password_confirm, $id);
|
||||
}
|
||||
|
||||
$minor_release_message = false;
|
||||
$searchPage = false;
|
||||
$search = get_parameter_get("head_search_keywords");
|
||||
if (strlen($search) > 0) {
|
||||
|
@ -195,40 +196,40 @@ if (strlen($search) > 0) {
|
|||
if (! isset ($config['id_user'])) {
|
||||
if (isset ($_GET["login"])) {
|
||||
include_once('include/functions_db.php'); //Include it to use escape_string_sql function
|
||||
|
||||
|
||||
$config["auth_error"] = ""; //Set this to the error message from the authorization mechanism
|
||||
$nick = get_parameter_post ("nick"); //This is the variable with the login
|
||||
$pass = get_parameter_post ("pass"); //This is the variable with the password
|
||||
$nick = db_escape_string_sql($nick);
|
||||
$pass = db_escape_string_sql($pass);
|
||||
|
||||
|
||||
//Since now, only the $pass variable are needed
|
||||
unset ($_GET['pass'], $_POST['pass'], $_REQUEST['pass']);
|
||||
|
||||
|
||||
// If the auth_code exists, we assume the user has come through the double auth page
|
||||
if (isset ($_POST['auth_code'])) {
|
||||
$double_auth_success = false;
|
||||
|
||||
|
||||
// The double authentication is activated and the user has surpassed the first step (the login).
|
||||
// Now the authentication code provided will be checked.
|
||||
if (isset ($_SESSION['prepared_login_da'])) {
|
||||
if (isset ($_SESSION['prepared_login_da']['id_user'])
|
||||
&& isset ($_SESSION['prepared_login_da']['timestamp'])) {
|
||||
|
||||
|
||||
// The user has a maximum of 5 minutes to introduce the double auth code
|
||||
$dauth_period = SECONDS_2MINUTES;
|
||||
$now = time();
|
||||
$dauth_time = $_SESSION['prepared_login_da']['timestamp'];
|
||||
|
||||
|
||||
if ($now - $dauth_period < $dauth_time) {
|
||||
// Nick
|
||||
$nick = $_SESSION["prepared_login_da"]['id_user'];
|
||||
// Code
|
||||
$code = (string) get_parameter_post ("auth_code");
|
||||
|
||||
|
||||
if (!empty($code)) {
|
||||
$result = validate_double_auth_code($nick, $code);
|
||||
|
||||
|
||||
if ($result === true) {
|
||||
// Double auth success
|
||||
$double_auth_success = true;
|
||||
|
@ -238,7 +239,7 @@ if (! isset ($config['id_user'])) {
|
|||
$login_screen = 'double_auth';
|
||||
// Error message
|
||||
$config["auth_error"] = __("Invalid code");
|
||||
|
||||
|
||||
if (!isset($_SESSION['prepared_login_da']['attempts']))
|
||||
$_SESSION['prepared_login_da']['attempts'] = 0;
|
||||
$_SESSION['prepared_login_da']['attempts']++;
|
||||
|
@ -249,7 +250,7 @@ if (! isset ($config['id_user'])) {
|
|||
$login_screen = 'double_auth';
|
||||
// Error message
|
||||
$config["auth_error"] = __("The code shouldn't be empty");
|
||||
|
||||
|
||||
if (!isset($_SESSION['prepared_login_da']['attempts']))
|
||||
$_SESSION['prepared_login_da']['attempts'] = 0;
|
||||
$_SESSION['prepared_login_da']['attempts']++;
|
||||
|
@ -258,7 +259,7 @@ if (! isset ($config['id_user'])) {
|
|||
else {
|
||||
// Expired login
|
||||
unset ($_SESSION['prepared_login_da']);
|
||||
|
||||
|
||||
// Error message
|
||||
$config["auth_error"] = __('Expired login');
|
||||
}
|
||||
|
@ -266,7 +267,7 @@ if (! isset ($config['id_user'])) {
|
|||
else {
|
||||
// If the code doesn't exist, remove the prepared login
|
||||
unset ($_SESSION['prepared_login_da']);
|
||||
|
||||
|
||||
// Error message
|
||||
$config["auth_error"] = __('Login error');
|
||||
}
|
||||
|
@ -276,10 +277,10 @@ if (! isset ($config['id_user'])) {
|
|||
// Error message
|
||||
$config["auth_error"] = __('Login error');
|
||||
}
|
||||
|
||||
|
||||
// Remove the authenticator code
|
||||
unset ($_POST['auth_code'], $code);
|
||||
|
||||
|
||||
if (!$double_auth_success) {
|
||||
$login_failed = true;
|
||||
require_once ('general/login_page.php');
|
||||
|
@ -313,27 +314,27 @@ if (! isset ($config['id_user'])) {
|
|||
// The auth file can set $config["auth_error"] to an informative error output or reference their internal error messages to it
|
||||
// process_user_login should return false in case of errors or invalid login, the nickname if correct
|
||||
$nick_in_db = process_user_login ($nick, $pass);
|
||||
|
||||
|
||||
$expired_pass = false;
|
||||
|
||||
|
||||
if (($nick_in_db != false) && ((!is_user_admin($nick)
|
||||
|| $config['enable_pass_policy_admin']))
|
||||
&& (defined('PANDORA_ENTERPRISE'))
|
||||
&& ($config['enable_pass_policy'])) {
|
||||
include_once(ENTERPRISE_DIR . "/include/auth/mysql.php");
|
||||
|
||||
|
||||
$blocked = login_check_blocked($nick);
|
||||
|
||||
|
||||
if ($blocked) {
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Password expired", "Password expired: ".$nick, $nick);
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
|
||||
|
||||
//Checks if password has expired
|
||||
$check_status = check_pass_status($nick, $pass);
|
||||
|
||||
|
||||
switch ($check_status) {
|
||||
case PASSSWORD_POLICIES_FIRST_CHANGE: //first change
|
||||
case PASSSWORD_POLICIES_EXPIRED: //pass expired
|
||||
|
@ -343,10 +344,10 @@ if (! isset ($config['id_user'])) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($nick_in_db !== false) && $expired_pass) {
|
||||
//login ok and password has expired
|
||||
|
||||
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Password expired",
|
||||
"Password expired: " . $nick, $nick);
|
||||
|
@ -355,7 +356,7 @@ if (! isset ($config['id_user'])) {
|
|||
}
|
||||
else if (($nick_in_db !== false) && (!$expired_pass)) {
|
||||
//login ok and password has not expired
|
||||
|
||||
|
||||
// Double auth check
|
||||
if ((!isset ($double_auth_success) || !$double_auth_success) && is_double_auth_enabled($nick_in_db)) {
|
||||
// Store this values in the session to know if the user login was correct
|
||||
|
@ -364,14 +365,14 @@ if (! isset ($config['id_user'])) {
|
|||
'timestamp' => time(),
|
||||
'attempts' => 0
|
||||
);
|
||||
|
||||
|
||||
// Load the page to introduce the double auth code
|
||||
$login_screen = 'double_auth';
|
||||
require_once ('general/login_page.php');
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
|
||||
|
||||
//login ok and password has not expired
|
||||
$process_login = true;
|
||||
|
||||
|
@ -384,7 +385,7 @@ if (! isset ($config['id_user'])) {
|
|||
// Avoid the show homepage when the user go to
|
||||
// a specific section of pandora
|
||||
// for example when timeout the sesion
|
||||
|
||||
|
||||
unset ($_GET["sec2"]);
|
||||
$_GET["sec"] = "general/logon_ok";
|
||||
$home_page ='';
|
||||
|
@ -436,24 +437,94 @@ if (! isset ($config['id_user'])) {
|
|||
$_GET["sec"] = "general/logon_ok";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
db_logon ($nick_in_db, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $nick_in_db;
|
||||
$config['id_user'] = $nick_in_db;
|
||||
|
||||
|
||||
if (is_user_admin($config['id_user'])) {
|
||||
$have_minor_releases = db_check_minor_relase_available();
|
||||
|
||||
// PHP configuration values
|
||||
$PHPupload_max_filesize = config_return_in_bytes(ini_get('upload_max_filesize'));
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
$PHPmax_execution_time = ini_get('max_execution_time');
|
||||
|
||||
if ($PHPmax_execution_time !== '0') {
|
||||
set_time_limit(0);
|
||||
}
|
||||
|
||||
$PHPupload_max_filesize_min = config_return_in_bytes('800M');
|
||||
|
||||
if ($PHPupload_max_filesize < $PHPupload_max_filesize_min) {
|
||||
ini_set('upload_max_filesize', config_return_in_bytes('800M'));
|
||||
}
|
||||
|
||||
$PHPmemory_limit_min = config_return_in_bytes('500M');
|
||||
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
||||
ini_set('memory_limit', config_return_in_bytes('500M'));
|
||||
}
|
||||
|
||||
if ($have_minor_releases) {
|
||||
$size_mr_o = get_number_of_mr('open');
|
||||
$size_mr_e = get_number_of_mr('enterprise');
|
||||
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_o = '<?php echo implode(",", $size_mr_o);?>';
|
||||
var n_mr_e = '<?php echo implode(",", $size_mr_e);?>';
|
||||
$(this).dialog("close");
|
||||
apply_minor_release(n_mr_o.split(","), n_mr_e.split(","));
|
||||
},
|
||||
Cancel: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
ini_set('upload_max_filesize', $PHPupload_max_filesize);
|
||||
ini_set('memory_limit', $PHPmemory_limit);
|
||||
|
||||
//==========================================================
|
||||
//-------- SET THE CUSTOM CONFIGS OF USER ------------------
|
||||
|
||||
|
||||
config_user_set_custom_config();
|
||||
//==========================================================
|
||||
|
||||
|
||||
//Remove everything that might have to do with people's passwords or logins
|
||||
unset ($pass, $login_good);
|
||||
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
|
||||
|
||||
$l10n = NULL;
|
||||
if (file_exists ('./include/languages/' . $user_language . '.mo')) {
|
||||
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
|
||||
|
@ -466,7 +537,7 @@ if (! isset ($config['id_user'])) {
|
|||
if ((!is_user_admin($nick) || $config['enable_pass_policy_admin']) && defined('PANDORA_ENTERPRISE')) {
|
||||
$blocked = login_check_blocked($nick);
|
||||
}
|
||||
|
||||
|
||||
if (!$blocked) {
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
login_check_failed($nick); //Checks failed attempts
|
||||
|
@ -489,7 +560,7 @@ if (! isset ($config['id_user'])) {
|
|||
elseif (isset ($_GET["loginhash"])) {
|
||||
$loginhash_data = get_parameter("loginhash_data", "");
|
||||
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
|
||||
|
||||
|
||||
if ($config["loginhash_pwd"] != "" && $loginhash_data == md5($loginhash_user.io_output_password($config["loginhash_pwd"]))) {
|
||||
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $loginhash_user;
|
||||
|
@ -586,12 +657,12 @@ if (license_free() && is_user_admin ($config['id_user']) &&
|
|||
if ($process_login) {
|
||||
/* Call all extensions login function */
|
||||
extensions_call_login_function ();
|
||||
|
||||
|
||||
unset($_SESSION['new_update']);
|
||||
|
||||
|
||||
require_once("include/functions_update_manager.php");
|
||||
enterprise_include_once("include/functions_update_manager.php");
|
||||
|
||||
|
||||
if ($config["autoupdate"] == 1) {
|
||||
if (enterprise_installed()) {
|
||||
$result = update_manager_check_online_enterprise_packages_available();
|
||||
|
@ -601,12 +672,12 @@ if ($process_login) {
|
|||
}
|
||||
if ($result)
|
||||
$_SESSION['new_update'] = 'new';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Set the initial global counter for chat.
|
||||
users_get_last_global_counter('session');
|
||||
|
||||
|
||||
$config['logged'] = true;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -620,7 +691,7 @@ if (isset($_SERVER['HTTP_REFERER']))
|
|||
$chunks = explode('?', $old_page);
|
||||
if (count($chunks) == 2) {
|
||||
$chunks = explode('&', $chunks[1]);
|
||||
|
||||
|
||||
foreach ($chunks as $chunk) {
|
||||
if (strstr($chunk, 'sec=') !== false) {
|
||||
$old_sec = str_replace('sec=', '', $chunk);
|
||||
|
@ -664,7 +735,7 @@ if (is_user_admin ($config['id_user']) &&
|
|||
if (get_parameter ('login', 0) !== 0) {
|
||||
// Display news dialog
|
||||
include_once("general/news_dialog.php");
|
||||
|
||||
|
||||
// Display login help info dialog
|
||||
// If it's configured to not skip this
|
||||
$display_previous_popup = false;
|
||||
|
@ -680,7 +751,7 @@ if (get_parameter ('login', 0) !== 0) {
|
|||
|
||||
include_once("general/login_help_dialog.php");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Header
|
||||
|
@ -726,7 +797,7 @@ if ($searchPage) {
|
|||
}
|
||||
else {
|
||||
if ($page != "") {
|
||||
|
||||
|
||||
$main_sec = get_sec($sec);
|
||||
if ($main_sec == false) {
|
||||
if ($sec == 'extensions')
|
||||
|
@ -740,19 +811,19 @@ else {
|
|||
$sec2 = '';
|
||||
}
|
||||
$page .= '.php';
|
||||
|
||||
|
||||
// Enterprise ACL check
|
||||
if (enterprise_hook ('enterprise_acl',
|
||||
array ($config['id_user'], $main_sec, $sec, true,$sec2)) == false) {
|
||||
|
||||
|
||||
require ("general/noaccess.php");
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$sec = $main_sec;
|
||||
if (file_exists ($page)) {
|
||||
if (! extensions_is_extension ($page)) {
|
||||
|
||||
|
||||
require_once($page);
|
||||
}
|
||||
else {
|
||||
|
@ -761,12 +832,12 @@ else {
|
|||
else
|
||||
extensions_call_main_function (basename ($page));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(__('Sorry! I can\'t find the page!'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//home screen chosen by the user
|
||||
$home_page ='';
|
||||
|
@ -775,9 +846,9 @@ else {
|
|||
$home_page = io_safe_output($user_info['section']);
|
||||
$home_url = $user_info['data_section'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($home_page != '') {
|
||||
switch ($home_page) {
|
||||
case 'Event list':
|
||||
|
@ -809,7 +880,7 @@ else {
|
|||
if (($home_url == '') || ($id_visualc == false)) {
|
||||
$str = 'sec=visualc&sec2=operation/visual_console/index&refr=60';
|
||||
}
|
||||
else
|
||||
else
|
||||
$str = 'sec=visualc&sec2=operation/visual_console/render_view&id='.$id_visualc .'&refr=60';
|
||||
parse_str($str, $res);
|
||||
foreach ($res as $key => $param) {
|
||||
|
@ -825,7 +896,7 @@ else {
|
|||
}
|
||||
if (isset($_GET['sec2'])) {
|
||||
$file = $_GET['sec2'] . '.php';
|
||||
|
||||
|
||||
if (!file_exists ($file)) {
|
||||
unset($_GET['sec2']);
|
||||
require('general/logon_ok.php');
|
||||
|
@ -883,15 +954,15 @@ require('include/php_to_js_values.php');
|
|||
<script type="text/javascript" language="javascript">
|
||||
//Initial load of page
|
||||
$(document).ready(adjustFooter);
|
||||
|
||||
|
||||
//Every resize of window
|
||||
$(window).resize(adjustFooter);
|
||||
|
||||
|
||||
//Every show/hide call may need footer re-layout
|
||||
(function() {
|
||||
var oShow = jQuery.fn.show;
|
||||
var oHide = jQuery.fn.hide;
|
||||
|
||||
|
||||
jQuery.fn.show = function () {
|
||||
var rv = oShow.apply(this, arguments);
|
||||
adjustFooter();
|
||||
|
@ -904,6 +975,62 @@ require('include/php_to_js_values.php');
|
|||
};
|
||||
})();
|
||||
|
||||
function apply_minor_release (n_mr_o, n_mr_e) {
|
||||
var error = false;
|
||||
$.each(n_mr_o, function(i, open_mr) {
|
||||
var params = {};
|
||||
params["updare_rr_open"] = 1;
|
||||
params["number"] = open_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 != "") {
|
||||
alert("Error: " + data);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (error == true) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
var error2 = false;
|
||||
$.each(n_mr_e, function(i, e_mr) {
|
||||
var params = {};
|
||||
params["updare_rr_enterprise"] = 1;
|
||||
params["number"] = e_mr;
|
||||
params["page"] = "enterprise/include/ajax/rolling_release.ajax";
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params,
|
||||
async: false,
|
||||
dataType: "html",
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
success: function (data) {
|
||||
if (data != "") {
|
||||
alert("Error: " + data);
|
||||
error2 = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (error2 == true) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!error && !error2) {
|
||||
alert("Updated finished successfully");
|
||||
}
|
||||
}
|
||||
|
||||
function force_run_register () {
|
||||
run_identification_wizard (1, 0, 0);
|
||||
|
|
|
@ -109,6 +109,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('minor_release_open', 0),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||
|
|
Loading…
Reference in New Issue