From 5aeff7da558f3c87fa06b8ce82f301d6c50ecb62 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 21 Dec 2009 15:23:32 +0000 Subject: [PATCH] 2009-12-21 Miguel de Dios * install.php: clean source code. * operation/agentes/datos_agente.php: fix bug, there was a wrong copy&paste, now there is correct parameters. Fixes: 2916332 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2226 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 +++ pandora_console/install.php | 69 +++++++++++-------- .../operation/agentes/datos_agente.php | 3 +- 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index af686862ad..e3406810a5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2009-12-21 Miguel de Dios + + * install.php: clean source code. + + * operation/agentes/datos_agente.php: fix bug, there was a wrong copy&paste, + now there is correct parameters. + Fixes: 2916332 + 2009-12-18 Sancho lerena * pandora_console.spec: Ypdated build. diff --git a/pandora_console/install.php b/pandora_console/install.php index 9b5dbe883b..7d860e65af 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -43,7 +43,8 @@ function check_extension ( $ext, $label ){ if (!extension_loaded($ext)){ echo ""; return 1; - } else { + } + else { echo ""; return 0; } @@ -57,7 +58,8 @@ function check_include ( $ext, $label ){ if (!include($ext)){ echo ""; return 1; - } else { + } + else { echo ""; return 0; } @@ -71,7 +73,8 @@ function check_exists ( $file, $label ){ if (!file_exists ($file)){ echo " "; return 1; - } else { + } + else { echo " "; return 0; } @@ -85,7 +88,8 @@ function check_generic ( $ok, $label ){ if ($ok == 0 ){ echo " "; return 1; - } else { + } + else { echo " "; return 0; } @@ -101,7 +105,8 @@ function check_writable ( $fullpath, $label ){ echo " "; echo ""; return 0; - } else { + } + else { echo " "; echo ""; return 1; @@ -122,14 +127,17 @@ function check_variable ( $var, $value, $label, $mode ){ if ($var >= $value){ echo " "; return 0; - } else { + } + else { echo " "; return 1; } - } elseif ($var == $value){ - echo " "; - return 0; - } else { + } + elseif ($var == $value){ + echo " "; + return 0; + } + else { echo " "; return 1; } @@ -154,15 +162,16 @@ function parse_mysql_dump($url){ } } return 1; - } else { - return 0; } + else + return 0; } function random_name ($size){ $temp = ""; for ($a=0;$a< $size;$a++) $temp = $temp. chr(rand(122,97)); + return $temp; } @@ -206,9 +215,10 @@ function install_step1() {
"; - if ($writable == 0) + if ($writable == 0) { echo " "; + } else echo "
ERROR:You need to setup permissions to be able to write in ./include directory
"; echo " @@ -257,7 +267,8 @@ function install_step2() { will not be able to finish your installation.
Ignore it. Force install Step #3"; - } else { + } + else { echo " "; } @@ -353,7 +364,8 @@ function install_step4() { $dbuser = ""; $dbhost = ""; $dbname = ""; - } else { + } + else { $dbpassword = $_POST["pass"]; $dbuser = $_POST["user"]; $dbhost = $_POST["host"]; @@ -377,6 +389,7 @@ function install_step4() { $step2=0; $step3=0; $step4=0; $step5=0; $step6=0; $step7=0; + echo "

Pandora FMS Console installation wizard. Step #4 of 4

@@ -386,7 +399,8 @@ function install_step4() { "; if (! mysql_connect ($dbhost,$dbuser,$dbpassword)) { check_generic ( 0, "Connection with Database"); - } else { + } + else { check_generic ( 1, "Connection with Database"); // Drop database if needed @@ -396,7 +410,7 @@ function install_step4() { // Create schema $step1 = mysql_query ("CREATE DATABASE $dbname"); check_generic ($step1, "Creating database '$dbname'"); - if ($step1 == 1){ + if ($step1 == 1) { $step2 = mysql_select_db($dbname); check_generic ($step2, "Opening database '$dbname'"); @@ -422,15 +436,15 @@ function install_step4() { $cfgout = fopen ($pandora_config,"w"); $config_contents = fread ($cfgin, filesize("include/config.inc.php")); $config_new = ''; + // Begin of automatic config file + $config["dbname"]="'.$dbname.'"; // MySQL DataBase name + $config["dbuser"]="pandora"; // DB User + $config["dbpass"]="'.$random_password.'"; // DB Password + $config["dbhost"]="'.$dbhost.'"; // DB Host + $config["homedir"]="'.$path.'"; // Config homedir + $config["homeurl"]="'.$url.'"; // Base URL + // End of automatic config file + ?>'; $step7 = fputs ($cfgout, $config_new); $step7 = $step7 + fputs ($cfgout, $config_contents); if ($step7 > 0) @@ -454,7 +468,8 @@ $config["homeurl"]="'.$url.'"; // Base URL if ($everything_ok == 1) { echo "

"; - } else { + } + else { echo "
There were some problems. Installation was not completed.

Please correct failures before trying again. diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index dff168541c..42ea3a0727 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -23,6 +23,7 @@ check_login(); $module_id = get_parameter_get ("id", 0); $period = get_parameter ("period", 86400); $group = get_agentmodule_group ($module_id); +$agentId = get_parameter('id_agente'); if (! give_acl ($config['id_user'], $group, "AR") || $module_id == 0) { audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", @@ -69,7 +70,7 @@ if ($result === false) { echo "

".__('Received data from')." ".get_agentmodule_agent_name ($module_id)." / ".get_agentmodule_name ($module_id)."

"; echo "

" . __("From the last") . " " . human_time_description ($period) ."

"; -echo "
"; +echo ""; echo __("Choose a time from now") . ": "; $intervals = array (); $intervals[3600] = human_time_description_raw (3600); // 1 hour