From 5b392d839d8b1b8ded5611623c709d87605c67d4 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Mon, 23 Apr 2012 14:29:34 +0000
Subject: [PATCH] 2012-04-23 Miguel de Dios <miguel.dedios@artica.es>

	* index.php: fixed notice message php.

	* extensions/update_manager/lib/libupdate_manager.php: fixed into
	the function "um_db_load_settings" the cache of DB, and set to
	translate some untranslate text.

	* include/config_process.php: added for a long time the setting the
	$develop_bypass as global.

	* extensions/update_manager/settings.php, operation/menu.php,
	operation/search_agents.php: cleaned source code style.

	* include/functions_config.php: fixed php noticie message of the
	var "$config['update_manager_installed']" in the first execution
	after intallation.

	MERGED FROM 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6106 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     | 20 +++++++++++++++++++
 .../update_manager/lib/libupdate_manager.php  | 12 ++++++-----
 .../extensions/update_manager/settings.php    |  5 +++--
 pandora_console/include/config_process.php    |  1 +
 pandora_console/include/functions_config.php  | 20 ++++++++++---------
 pandora_console/index.php                     |  4 +++-
 pandora_console/operation/menu.php            |  7 ++++---
 7 files changed, 49 insertions(+), 20 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 6e97fcdb37..0449364a31 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,23 @@
+2012-04-23 Miguel de Dios <miguel.dedios@artica.es>
+	
+	* index.php: fixed notice message php.
+	
+	* extensions/update_manager/lib/libupdate_manager.php: fixed into
+	the function "um_db_load_settings" the cache of DB, and set to
+	translate some untranslate text.
+	
+	* include/config_process.php: added for a long time the setting the
+	$develop_bypass as global.
+	
+	* extensions/update_manager/settings.php, operation/menu.php,
+	operation/search_agents.php: cleaned source code style.
+	
+	* include/functions_config.php: fixed php noticie message of the
+	var "$config['update_manager_installed']" in the first execution
+	after intallation.
+	
+	MERGED FROM 4.0.2
+
 2012-04-23  Sergio Martin <sergio.martin@artica.es>
 
 	* include/functions_networkmap.php
diff --git a/pandora_console/extensions/update_manager/lib/libupdate_manager.php b/pandora_console/extensions/update_manager/lib/libupdate_manager.php
index 82a8001d78..c93c75dc92 100644
--- a/pandora_console/extensions/update_manager/lib/libupdate_manager.php
+++ b/pandora_console/extensions/update_manager/lib/libupdate_manager.php
@@ -20,8 +20,10 @@ require_once ('libupdate_manager_components.php');
 require_once ('libupdate_manager_client.php');
 
 function um_db_load_settings () {
-	$result = db_process_sql('SELECT * FROM '.DB_PREFIX.'tupdate_settings');
-	if($result === false) {
+	db_clean_cache();
+	$result = db_get_all_rows_in_table(DB_PREFIX . 'tupdate_settings');
+	
+	if ($result === false) {
 		echo '<strong>Error reading settings</strong><br />';
 		return NULL;
 	}
@@ -54,7 +56,7 @@ function um_db_update_setting ($key, $value = '') {
 	}
 	
 	if ($result === false) {
-		echo '<strong>Error reading settings</strong> <br />';
+		echo '<strong>' . __('Error reading settings') . '</strong> <br />';
 		return NULL;
 	}
 	
@@ -72,7 +74,7 @@ function um_db_update_setting ($key, $value = '') {
 		}
 		
 		if ($result === false) {
-			echo '<strong>Error updating settings</strong> <br />';
+			echo '<strong>' . __('Error updating settings') . '</strong> <br />';
 			return false;
 		}
 	}
@@ -90,7 +92,7 @@ function um_db_update_setting ($key, $value = '') {
 		}
 		
 		if ($result === false) {
-			echo '<strong>Error creating settings</strong> <br />';
+			echo '<strong>' . __('Error creating settings') . '</strong> <br />';
 			return false;
 		}
 	}
diff --git a/pandora_console/extensions/update_manager/settings.php b/pandora_console/extensions/update_manager/settings.php
index a71b8b390c..a9853d3290 100644
--- a/pandora_console/extensions/update_manager/settings.php
+++ b/pandora_console/extensions/update_manager/settings.php
@@ -25,7 +25,7 @@ if (! check_acl ($config['id_user'], 0, 'PM')) {
 include_once ("extensions/update_manager/lib/functions.php");
 
 um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
-			$config['dbpass'], $config['dbname']);
+	$config['dbpass'], $config['dbname']);
 
 $update_settings = (bool) get_parameter_post ('update_settings');
 
@@ -55,9 +55,10 @@ if ($update_settings) {
 		update_pandora_update_conf();
 	}
 	
-	echo "<h3 class=suc>".__('Update manager settings updated')."</h3>";
+	echo "<h3 class=suc>" . __('Update manager settings updated') . "</h3>";
 }
 
+$settings = null;
 $settings = um_db_load_settings ();
 
 echo '<form method="post">';
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 51bd7a3114..94f947bb47 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -27,6 +27,7 @@ $pandora_version = 'v5.0-dev';
 
 date_default_timezone_set("Europe/Berlin");
 
+global $develop_bypass;
 /* Help to debug problems. Override global PHP configuration */
 if (!isset($develop_bypass)) $develop_bypass = 0;
 
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 59fbf440e2..59e569c80a 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -770,15 +770,17 @@ function config_check (){
 		}
 	}
 	else {
-		if ($config['update_manager_installed'] == 1) {
-			require_once("extensions/update_manager/lib/functions.ajax.php");
-			
-			$result_check_keygen = check_keygen_online();
-			
-			if (!empty($result_check_keygen)) {
-				$config["alert_cnt"]++;
-				$_SESSION["alert_msg"] .= $result_check_keygen;
-			}		
+		if (isset($config['update_manager_installed'])) {
+			if ($config['update_manager_installed'] == 1) {
+				require_once("extensions/update_manager/lib/functions.ajax.php");
+				
+				$result_check_keygen = check_keygen_online();
+				
+				if (!empty($result_check_keygen)) {
+					$config["alert_cnt"]++;
+					$_SESSION["alert_msg"] .= $result_check_keygen;
+				}
+			}
 		}
 	}
 }
diff --git a/pandora_console/index.php b/pandora_console/index.php
index 4d773dbc2e..f5779e27aa 100644
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -281,7 +281,9 @@ if ($process_login) {
 //Get old parameters before navigation.
 $old_sec = '';
 $old_sec2 = '';
-$old_page = $_SERVER['HTTP_REFERER'];
+$old_page = '';
+if (isset($_SERVER['HTTP_REFERER']))
+	$old_page = $_SERVER['HTTP_REFERER'];
 $chunks = explode('?', $old_page);
 if (count($chunks) == 2) {
 	$chunks = explode('&', $chunks[1]);
diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php
index 61f98a4bb4..2e74bd28cf 100644
--- a/pandora_console/operation/menu.php
+++ b/pandora_console/operation/menu.php
@@ -191,9 +191,10 @@ if (check_acl ($config['id_user'], 0, "AR")) {
 	
 	$sub["godmode/reporting/graphs"]["text"] = __('Custom graphs');	
 	//Set godomode path
-	$sub["godmode/reporting/graphs"]["subsecs"] = array("operation/reporting/graph_viewer",
-														"godmode/reporting/graph_builder");
-														
+	$sub["godmode/reporting/graphs"]["subsecs"] = array(
+		"operation/reporting/graph_viewer",
+		"godmode/reporting/graph_builder");
+	
 	$sub["operation/agentes/exportdata"]["text"] = __('Export data');
 	$sub["operation/agentes/exportdata"]["subsecs"] =  array("operation/agentes/exportdata");