From 0956132e397d68f005ee1c93d89a91b984a89d68 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Mon, 19 Jan 2015 13:18:23 +0100
Subject: [PATCH 01/29] changed the way of returning the data in the all_agents
 api function.

---
 pandora_console/include/functions_api.php | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 8b2c2b4b41..eac7fb1e14 100755
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -1007,25 +1007,28 @@ function api_set_delete_agent($id, $thrash1, $thrast2, $thrash3) {
 }
 
 /**
- * Get all agents, and print all the result like a csv.
+ * Get all agents, and print all the result like a csv or other type for example json.
  * 
  * @param $thrash1 Don't use.
  * @param $thrash2 Don't use.
  * @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator> in this order
  *  and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
- *  example:
+ *  example for CSV:
  *  
  *  api.php?op=get&op2=all_agents&return_type=csv&other=1|2|warning|j|2|~&other_mode=url_encode_separator_|
  * 
- * @param $thrash3 Don't use.
+ *  example for JSON:
+ * 
+ * 	api.php?op=get&op2=all_agents&return_type=json&other=1|2|warning|j|2|~&other_mode=url_encode_separator_|
+ * 
+ * @param $returnType.
  */
-function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
+function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
 	if (defined ('METACONSOLE')) {
 		return;
 	}
-	
 	$where = '';
-	
+
 	if (isset($other['data'][0])) {
 		// Filter by SO
 		if ($other['data'][0] != "") {
@@ -1138,7 +1141,7 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
 	if (count($result_agents) > 0 and $result_agents !== false) {
 		$data = array('type' => 'array', 'data' => $result_agents);
 		
-		returnData('csv', $data, $separator);
+		returnData($returnType, $data, $separator);
 	}
 	else {
 		returnError('error_all_agents', 'No agents retrieved.');

From 99786a5a1615b7cb4910838939f6d2b1886be0fd Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Mon, 19 Jan 2015 14:35:56 +0100
Subject: [PATCH 02/29] Fixed the custom config values for user in the first
 login.

---
 pandora_console/include/config_process.php   | 28 ++-------------
 pandora_console/include/functions_config.php | 35 ++++++++++++++++--
 pandora_console/index.php                    | 38 ++++++++++++--------
 3 files changed, 58 insertions(+), 43 deletions(-)

diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 90a7916637..61ff814fac 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -115,6 +115,7 @@ require_once ($ownDir. 'functions_config.php');
 
 date_default_timezone_set("Europe/Madrid");
 
+
 config_process_config();
 
 if (!isset($config["homeurl_static"])) {
@@ -142,32 +143,9 @@ else {
 $config["global_block_size"] = $config["block_size"];
 $config["global_flash_charts"] = $config["flash_charts"];
 
+
 if (isset ($config['id_user'])) {
-	$userinfo = get_user_info ($config['id_user']);
-	
-	// Refresh the last_connect info in the user table 
-	// if last update was more than 5 minutes ago
-	if($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
-		update_user($config['id_user'], array('last_connect' => time()));
-	}
-	
-	// If block_size or flash_chart are provided then override global settings
-	if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
-		$config["block_size"] = $userinfo["block_size"];
-	
-	if ($userinfo["flash_chart"] != -1)
-		$config["flash_charts"] = $userinfo["flash_chart"];
-	
-	// Each user could have it's own timezone)
-	if (isset($userinfo["timezone"])) {
-		if ($userinfo["timezone"] != "") {
-			date_default_timezone_set($userinfo["timezone"]);
-		}
-	}
-	
-	if (defined('METACONSOLE')) {
-		$config['metaconsole_access'] = $userinfo["metaconsole_access"];
-	}
+	config_user_set_custom_config();
 } 
 
 // Check if inventory_changes_blacklist is setted, if not create it
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index daf12e9367..b70b998439 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -1414,8 +1414,8 @@ function config_check () {
 
 function config_return_in_bytes($val) {
 	$val = trim($val);
-	$last = strtolower($val[strlen($val)-1]);
-	switch($last) {
+	$last = strtolower($val[strlen($val) - 1]);
+	switch ($last) {
 		// The 'G' modifier is available since PHP 5.1.0
 		case 'g':
 			$val *= 1024;
@@ -1424,8 +1424,37 @@ function config_return_in_bytes($val) {
 		case 'k':
 			$val *= 1024;
 	}
-
+	
 	return $val;
 }
 
+function config_user_set_custom_config() {
+	global $config;
+	
+	$userinfo = get_user_info ($config['id_user']);
+	
+	// Refresh the last_connect info in the user table 
+	// if last update was more than 5 minutes ago
+	if ($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
+		update_user($config['id_user'], array('last_connect' => time()));
+	}
+	
+	// If block_size or flash_chart are provided then override global settings
+	if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
+		$config["block_size"] = $userinfo["block_size"];
+	
+	if ($userinfo["flash_chart"] != -1)
+		$config["flash_charts"] = $userinfo["flash_chart"];
+	
+	// Each user could have it's own timezone)
+	if (isset($userinfo["timezone"])) {
+		if ($userinfo["timezone"] != "") {
+			date_default_timezone_set($userinfo["timezone"]);
+		}
+	}
+	
+	if (defined('METACONSOLE')) {
+		$config['metaconsole_access'] = $userinfo["metaconsole_access"];
+	}
+}
 ?>
diff --git a/pandora_console/index.php b/pandora_console/index.php
index a92726bb30..2610bd9996 100755
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -69,6 +69,7 @@ if ((! file_exists ("include/config.php")) || (! is_readable ("include/config.ph
 session_start ();
 require_once ("include/config.php");
 
+
 // If metaconsole activated, redirect to it
 if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
 	header ("Location: " . $config['homeurl'] . "enterprise/meta");
@@ -177,34 +178,34 @@ if (! isset ($config['id_user'])) {
 		$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;
@@ -214,7 +215,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']++;
@@ -225,7 +226,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']++;
@@ -234,7 +235,7 @@ if (! isset ($config['id_user'])) {
 					else {
 						// Expired login
 						unset ($_SESSION['prepared_login_da']);
-
+						
 						// Error message
 						$config["auth_error"] = __('Expired login');
 					}
@@ -242,7 +243,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');
 				}
@@ -252,10 +253,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');
@@ -328,14 +329,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;
 			
@@ -395,6 +396,13 @@ if (! isset ($config['id_user'])) {
 			db_logon ($nick_in_db, $_SERVER['REMOTE_ADDR']);
 			$_SESSION['id_usuario'] = $nick_in_db;
 			$config['id_user'] = $nick_in_db;
+			
+			//==========================================================
+			//-------- 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);
 			

From ad26957cef06b33a9a0f9b589955b623b259893a Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Mon, 19 Jan 2015 15:17:58 +0100
Subject: [PATCH 03/29] Fixed the lost parameters when the user has a homepage
 and he tries to access a pandora section (for example lost session). TICKET:
 #1630

---
 pandora_console/index.php | 110 +++++++++++++++++++++-----------------
 1 file changed, 60 insertions(+), 50 deletions(-)

diff --git a/pandora_console/index.php b/pandora_console/index.php
index 2610bd9996..e2da6283e3 100755
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -342,57 +342,65 @@ if (! isset ($config['id_user'])) {
 			
 			echo "<script type='text/javascript'>var process_login_ok = 1;</script>";
 			
-			unset ($_GET["sec2"]);
-			$_GET["sec"] = "general/logon_ok";
-			$home_page ='';
-			if (isset($nick)) {
-				$user_info = users_get_user_by_id($nick);
-				$home_page = io_safe_output($user_info['section']);
-				$home_url = $user_info['data_section'];
-				if ($home_page != '') {
-					switch($home_page) {
-						case 'Event list':
-							$_GET["sec"] = "eventos";
-							$_GET["sec2"] = "operation/events/events";
-							break;
-						case 'Group view':
-							$_GET["sec"] = "estado";
-							$_GET["sec2"] = "operation/agentes/group_view";
-							break;
-						case 'Alert detail':
-							$_GET["sec"] = "estado";
-							$_GET["sec2"] = "operation/agentes/alerts_status";
-							break;
-						case 'Tactical view':
-							$_GET["sec"] = "estado";
-							$_GET["sec2"] = "operation/agentes/tactical";
-							break;
-						case 'Default':
-							$_GET["sec"] = "general/logon_ok";
-							break;
-						case 'Dashboard':
-							$_GET["sec"] = "dashboard";
-							$_GET["sec2"] = ENTERPRISE_DIR.'/dashboard/main_dashboard';
-							$id_dashboard_select =
-								db_get_value('id', 'tdashboard', 'name', $home_url);
-							$_GET['id_dashboard_select'] = $id_dashboard_select;
-							break;
-						case 'Visual console':
-							$_GET["sec"] = "visualc";
-							$_GET["sec2"] = "operation/visual_console/index";
-							break;
-						case 'Other':
-							$home_url = io_safe_output($home_url);
-							parse_str ($home_url, $res);
-							$_GET["sec"] = $res["sec"];
-							$_GET["sec2"] = $res["sec2"];
-							break;
+			if (!isset($_GET["sec2"]) && !isset($_GET["sec"])) {
+				// 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 ='';
+				if (isset($nick)) {
+					$user_info = users_get_user_by_id($nick);
+					$home_page = io_safe_output($user_info['section']);
+					$home_url = $user_info['data_section'];
+					if ($home_page != '') {
+						switch ($home_page) {
+							case 'Event list':
+								$_GET["sec"] = "eventos";
+								$_GET["sec2"] = "operation/events/events";
+								break;
+							case 'Group view':
+								$_GET["sec"] = "estado";
+								$_GET["sec2"] = "operation/agentes/group_view";
+								break;
+							case 'Alert detail':
+								$_GET["sec"] = "estado";
+								$_GET["sec2"] = "operation/agentes/alerts_status";
+								break;
+							case 'Tactical view':
+								$_GET["sec"] = "estado";
+								$_GET["sec2"] = "operation/agentes/tactical";
+								break;
+							case 'Default':
+								$_GET["sec"] = "general/logon_ok";
+								break;
+							case 'Dashboard':
+								$_GET["sec"] = "dashboard";
+								$_GET["sec2"] = ENTERPRISE_DIR.'/dashboard/main_dashboard';
+								$id_dashboard_select =
+									db_get_value('id', 'tdashboard', 'name', $home_url);
+								$_GET['id_dashboard_select'] = $id_dashboard_select;
+								break;
+							case 'Visual console':
+								$_GET["sec"] = "visualc";
+								$_GET["sec2"] = "operation/visual_console/index";
+								break;
+							case 'Other':
+								$home_url = io_safe_output($home_url);
+								parse_str ($home_url, $res);
+								$_GET["sec"] = $res["sec"];
+								$_GET["sec2"] = $res["sec2"];
+								break;
+						}
+					}
+					else {
+						$_GET["sec"] = "general/logon_ok";
 					}
 				}
-				else {
-					$_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;
@@ -491,8 +499,8 @@ if ($process_login) {
 	
 	require_once("include/functions_update_manager.php");
 	enterprise_include_once("include/functions_update_manager.php");
-
-	if ($config["autoupdate"] == 1) {	
+	
+	if ($config["autoupdate"] == 1) {
 		if (enterprise_installed()) {
 			$result = update_manager_check_online_enterprise_packages_available();
 		}
@@ -631,6 +639,8 @@ else {
 			$home_url = $user_info['data_section'];
 		}
 		
+		
+		
 		if ($home_page != '') {
 			switch ($home_page) {
 				case 'Event list':

From 863739eb7b526126589272986b81fd768eead769 Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Tue, 20 Jan 2015 00:01:37 +0100
Subject: [PATCH 04/29] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_console/pandoradb_data.sql             | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index f3e8861e48..c961229f3e 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 6.0dev-150119
+Version: 6.0dev-150120
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index 699ff5055d..a4427063b0 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150119"
+pandora_version="6.0dev-150120"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 993db12926..6e9a4c102b 100644
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '6.0dev';
-use constant AGENT_BUILD => '150119';
+use constant AGENT_BUILD => '150120';
 
 # Commands to retrieve total memory information in kB
 use constant TOTALMEMORY_CMDS => {
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 2e7669fa64..161822a9a5 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150119
+%define release     150120
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 880644271a..8c49f520ba 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150119
+%define release     150120
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index a1d97b96b2..183945aff5 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{150119}
+{150120}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 044bd96b8e..31d0f76af5 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("6.0dev(Build 150119)")
+#define PANDORA_VERSION ("6.0dev(Build 150120)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index a3bad84e85..b65334b9a3 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(6.0dev(Build 150119))"
+      VALUE "ProductVersion", "(6.0dev(Build 150120))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 1779be9a77..d13264220e 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 6.0dev-150119
+Version: 6.0dev-150120
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index e0ac67cb67..9c84905f08 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150119"
+pandora_version="6.0dev-150120"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 61ff814fac..3e82b45fcd 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
 /**
  * Pandora build version and version 
  */
-$build_version = 'PC150119';
+$build_version = 'PC150120';
 $pandora_version = 'v6.0dev';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 692dfdbde6..0cc55a1489 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -63,7 +63,7 @@
 		<div style='height: 10px'>
 			<?php
 $version = '6.0dev';
-$build = '150119';
+$build = '150120';
 			$banner = "v$version Build $build";
 			
 			error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 0ea55d066b..1447edf1f2 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150119
+%define release     150120
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index f720a7a922..56d900d7bb 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150119
+%define release     150120
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 820b0763f8..4773667b15 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('graph_res','5'),
 ('step_compact','1'),
 ('db_scheme_version','6.0dev'),
-('db_scheme_build','PD150119'),
+('db_scheme_build','PD150120'),
 ('show_unknown','0'),
 ('show_lastalerts','1'),
 ('style','pandora'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 5a992c9498..46acfd8bf3 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 6.0dev-150119
+Version: 6.0dev-150120
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index f8f3e3a9b1..909f276140 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150119"
+pandora_version="6.0dev-150120"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 46a4545e05..2d69ec9e22 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "6.0dev";
-my $pandora_build = "150119";
+my $pandora_build = "150120";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 83c226ca3e..d1692c86e6 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150119
+%define release     150120
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 2c9733c7c0..d7091c2bd4 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150119
+%define release     150120
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 2cb8d42835..f39ce2cd98 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "6.0dev PS150119";
+my $version = "6.0dev PS150120";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 3acf0dfa54..6e3c4b6432 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -34,7 +34,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "6.0dev PS150119";
+my $version = "6.0dev PS150120";
 
 # save program name for logging
 my $progname = basename($0);

From 08dbba5ad6afc52e773ce44b29ae359c84b30701 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Tue, 20 Jan 2015 09:09:27 +0100
Subject: [PATCH 05/29] Change name field in custom events from Criticity to
 Severity.

---
 pandora_console/godmode/events/custom_events.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php
index 41c5bad097..2ce631dd61 100644
--- a/pandora_console/godmode/events/custom_events.php
+++ b/pandora_console/godmode/events/custom_events.php
@@ -92,7 +92,7 @@ if ($fields_selected[0]!='') {
 				$result = __('Alert');
 				break;
 			case 'criticity':
-				$result = __('Criticity');
+				$result = __('Severity');
 				break;
 			case 'user_comment':
 				$result = __('Comment');

From 43cadc3010b0914f0ca6628bea9e5135bf0f950d Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Tue, 20 Jan 2015 09:25:45 +0100
Subject: [PATCH 06/29] Fixed problems when ordering, Filters in 'Monitor
 detail' were lost.

(cherry picked from commit b215eefdf1c313dc32facc7835d2127438c1aec5)
---
 .../operation/agentes/status_monitor.php      | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php
index 03d1e855c1..30fcdee03f 100644
--- a/pandora_console/operation/agentes/status_monitor.php
+++ b/pandora_console/operation/agentes/status_monitor.php
@@ -890,21 +890,21 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
 
 $table->head[1] = __('Agent'); 
 if (! defined ('METACONSOLE')) {
-	$table->head[1] .=' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectAgentNameUp, "alt" => "up"))  . '</a>' .
-	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectAgentNameDown, "alt" => "down")) . '</a>';
+	$table->head[1] .=' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectAgentNameUp, "alt" => "up"))  . '</a>' .
+	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectAgentNameDown, "alt" => "down")) . '</a>';
 }
 
 $table->head[2] = __('Type');
 if (! defined ('METACONSOLE')) {
-	$table->head[2] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up"))  . '</a>' .
-	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
+	$table->head[2] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up"))  . '</a>' .
+	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
 }
 $table->align[2] = "left";
 
 $table->head[3] = __('Module name'); 
 if (! defined ('METACONSOLE')) {
-	$table->head[3] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleNameUp, "alt" => "up"))  . '</a>' .
-	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleNameDown, "alt" => "down")) . '</a>';
+	$table->head[3] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleNameUp, "alt" => "up"))  . '</a>' .
+	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleNameDown, "alt" => "down")) . '</a>';
 }
 
 /*
@@ -913,16 +913,16 @@ $table->head[4] = __('Tags');
 
 $table->head[5] = __('Interval'); 
 if (! defined ('METACONSOLE')) {
-	$table->head[5] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up"))  . '</a>' .
-	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . '</a>';
+	$table->head[5] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up"))  . '</a>' .
+	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . '</a>';
 }
 
 $table->align[5] = "center";
 
 $table->head[6] = __('Status');
 if (! defined ('METACONSOLE')) {
-	$table->head[6] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up"))  . '</a>' .
-	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
+	$table->head[6] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up"))  . '</a>' .
+	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
 }
 
 $table->align[6] = "center";

From ac409f1b66c109b061233a3b60a97808dc52224a Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Tue, 20 Jan 2015 09:33:23 +0100
Subject: [PATCH 07/29] Fixed problems when ordering, Filters in 'Monitor
 detail' were lost.

---
 pandora_console/operation/agentes/status_monitor.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php
index 30fcdee03f..c22a12ecb4 100644
--- a/pandora_console/operation/agentes/status_monitor.php
+++ b/pandora_console/operation/agentes/status_monitor.php
@@ -936,7 +936,7 @@ $table->align[8] = "left";
 $table->head[9] = __('Data');
 if (! defined ('METACONSOLE')) {
 	$table->head[9] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=data&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up"))  . '</a>' .
-	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
+	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
 }
 
 $table->align[9] = "left";
@@ -944,7 +944,7 @@ $table->align[9] = "left";
 $table->head[10] = __('Timestamp');
 if (! defined ('METACONSOLE')) {
 	 $table->head[10] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=timestamp&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTimestampUp, "alt" => "up"))  . '</a>' .
-	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=timestamp&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTimestampDown, "alt" => "down")) . '</a>';
+	'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=timestamp&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTimestampDown, "alt" => "down")) . '</a>';
 }
 
 $table->align[10] = "right";

From 1b34212fff5ef84c5a0611dec1ab65ec6a26e1a8 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Tue, 20 Jan 2015 10:11:47 +0100
Subject: [PATCH 08/29] changed style and adapt to style pandorafms.

---
 extras/anytermd/browser/anyterm.css | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/extras/anytermd/browser/anyterm.css b/extras/anytermd/browser/anyterm.css
index 92e1377f16..4e6df19796 100644
--- a/extras/anytermd/browser/anyterm.css
+++ b/extras/anytermd/browser/anyterm.css
@@ -101,8 +101,10 @@ noscript {
 
 .termframe {
   float: left;
-  background-color: #567953;
   padding: 0.2ex;
+  background-color: none repeat scroll 0% 0% #82B92E;
+	border-top-right-radius: 5px;
+	border-top-left-radius: 5px;
 }
 
 .termframe p {

From e2130fe48264a67e193777a732a539f759c85156 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Tue, 20 Jan 2015 12:11:01 +0100
Subject: [PATCH 09/29] Fixed problem with preview command in 'Configure alert
 action'

---
 pandora_console/include/javascript/pandora_alerts.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pandora_console/include/javascript/pandora_alerts.js b/pandora_console/include/javascript/pandora_alerts.js
index ea84156dff..e9b7c64727 100644
--- a/pandora_console/include/javascript/pandora_alerts.js
+++ b/pandora_console/include/javascript/pandora_alerts.js
@@ -12,6 +12,7 @@ function parse_alert_command (command, classs) {
 	$('.' + classs).each(function() {
 		// Only render values different from ''
 		if ($(this).val() == '') {
+			nfield++;
 			return;
 		}
 		var field = '_field' + nfield + '_';

From d19ffc0dce61ef7e756f783db47bd683bf4bd8a2 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Tue, 20 Jan 2015 17:07:54 +0100
Subject: [PATCH 10/29] fixed problems with validate alerts

---
 pandora_console/operation/agentes/alerts_status.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php
index 3754eecd0f..fc0926e051 100755
--- a/pandora_console/operation/agentes/alerts_status.php
+++ b/pandora_console/operation/agentes/alerts_status.php
@@ -131,11 +131,11 @@ else {
 }
 
 if ($alert_validate) {
-	if (check_acl ($config["id_user"], $id_group, "AW") == 0) {
-		ui_print_error_message(__('Insufficient permissions to validate alerts'));
+	if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM") ) {
+		validateAlert();
 	}
 	else {
-		validateAlert();
+		ui_print_error_message(__('Insufficient permissions to validate alerts'));
 	}
 }
 
@@ -554,7 +554,7 @@ if (!empty ($table->data)) {
 	html_print_table ($table);
 	
 	if (!defined('METACONSOLE')) {
-		if (check_acl ($config["id_user"], $id_group, "AW")) {
+		if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM") ) {
 			if (count($alerts['alerts_simple']) > 0) {
 				echo '<div class="action-buttons" style="width: '.$table->width.';">';
 				html_print_submit_button (__('Validate'), 'alert_validate', false, 'class="sub ok"', false);

From f4b66cee1a95f39d3f266caf1bc887f89a0cbfd7 Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Wed, 21 Jan 2015 00:01:07 +0100
Subject: [PATCH 11/29] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_console/pandoradb_data.sql             | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index c961229f3e..6813c2d241 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 6.0dev-150120
+Version: 6.0dev-150121
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index a4427063b0..c38d5b8707 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150120"
+pandora_version="6.0dev-150121"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 6e9a4c102b..2f1eaed3a2 100644
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '6.0dev';
-use constant AGENT_BUILD => '150120';
+use constant AGENT_BUILD => '150121';
 
 # Commands to retrieve total memory information in kB
 use constant TOTALMEMORY_CMDS => {
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 161822a9a5..ae109634fe 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150120
+%define release     150121
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 8c49f520ba..edaa75364b 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150120
+%define release     150121
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 183945aff5..9d2cbc89af 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{150120}
+{150121}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 31d0f76af5..e64e47ce04 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("6.0dev(Build 150120)")
+#define PANDORA_VERSION ("6.0dev(Build 150121)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index b65334b9a3..4a56860871 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(6.0dev(Build 150120))"
+      VALUE "ProductVersion", "(6.0dev(Build 150121))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index d13264220e..4f57afa34f 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 6.0dev-150120
+Version: 6.0dev-150121
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 9c84905f08..837a5633aa 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150120"
+pandora_version="6.0dev-150121"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 3e82b45fcd..57e07a279f 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
 /**
  * Pandora build version and version 
  */
-$build_version = 'PC150120';
+$build_version = 'PC150121';
 $pandora_version = 'v6.0dev';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 0cc55a1489..73cd343bff 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -63,7 +63,7 @@
 		<div style='height: 10px'>
 			<?php
 $version = '6.0dev';
-$build = '150120';
+$build = '150121';
 			$banner = "v$version Build $build";
 			
 			error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 1447edf1f2..84b68c1e5b 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150120
+%define release     150121
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 56d900d7bb..97dfbb535a 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150120
+%define release     150121
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 4773667b15..8bafb1430c 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('graph_res','5'),
 ('step_compact','1'),
 ('db_scheme_version','6.0dev'),
-('db_scheme_build','PD150120'),
+('db_scheme_build','PD150121'),
 ('show_unknown','0'),
 ('show_lastalerts','1'),
 ('style','pandora'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 46acfd8bf3..a2536696b1 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 6.0dev-150120
+Version: 6.0dev-150121
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 909f276140..7e3a7b48a6 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150120"
+pandora_version="6.0dev-150121"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 2d69ec9e22..c54735cbc8 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "6.0dev";
-my $pandora_build = "150120";
+my $pandora_build = "150121";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index d1692c86e6..b1cb03a0a9 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150120
+%define release     150121
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index d7091c2bd4..96ef46eb14 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150120
+%define release     150121
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index f39ce2cd98..40f70a5a7e 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "6.0dev PS150120";
+my $version = "6.0dev PS150121";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 6e3c4b6432..a51d1eb28d 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -34,7 +34,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "6.0dev PS150120";
+my $version = "6.0dev PS150121";
 
 # save program name for logging
 my $progname = basename($0);

From c76f8dd616ff1caae77f05a0b58e26e04338ef1c Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Wed, 21 Jan 2015 12:45:48 +0100
Subject: [PATCH 12/29] Uploaded lost change from yesterday. Added the text in
 the snmp console view

---
 pandora_console/operation/snmpconsole/snmp_view.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php
index c2372746ce..16a68aeb0b 100644
--- a/pandora_console/operation/snmpconsole/snmp_view.php
+++ b/pandora_console/operation/snmpconsole/snmp_view.php
@@ -580,6 +580,13 @@ if ($traps !== false) {
 				</tr>';
 		}
 		
+		if ($trap["text"] != "") {
+			$string .= '<tr>
+					<td align="left" valign="top">' . '<b>' . __('Text:') . '</td>
+					<td align="left">' . $trap['text'] . '</td>
+				</tr>';
+		}
+		
 		if ($trap["type"] != "") {
 			$trap_types = array(-1 => __('None'), 0 => __('Cold start (0)'), 1 => __('Warm start (1)'), 2 => __('Link down (2)'), 3 => __('Link up (3)'), 4 => __('Authentication failure (4)'), 5 => __('Other'));
 			

From 2d3f239789eaa9abde1ff0a4360eb0ad4fabafe2 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Wed, 21 Jan 2015 14:47:54 +0100
Subject: [PATCH 13/29] Changes imprecise names and concepts in SNMP. Ticket:
 #1688

---
 ...manage_network_components_form_network.php |   2 +-
 .../godmode/snmpconsole/snmp_alert.php        | 118 +++++++++++-------
 .../snmpconsole/snmp_trap_generator.php       |   2 +-
 .../include/help/en/help_field_match_snmp.php |   2 +-
 .../help/en/help_snmp_alert_custom.php        |   6 +-
 .../include/help/es/help_field_match_snmp.php |   2 +-
 .../operation/snmpconsole/snmp_statistics.php |   4 +-
 .../operation/snmpconsole/snmp_view.php       |  50 +++++---
 8 files changed, 114 insertions(+), 72 deletions(-)
 mode change 100644 => 100755 pandora_console/godmode/modules/manage_network_components_form_network.php
 mode change 100644 => 100755 pandora_console/godmode/snmpconsole/snmp_alert.php
 mode change 100644 => 100755 pandora_console/godmode/snmpconsole/snmp_trap_generator.php
 mode change 100644 => 100755 pandora_console/include/help/en/help_field_match_snmp.php
 mode change 100644 => 100755 pandora_console/include/help/en/help_snmp_alert_custom.php
 mode change 100644 => 100755 pandora_console/include/help/es/help_field_match_snmp.php
 mode change 100644 => 100755 pandora_console/operation/snmpconsole/snmp_statistics.php
 mode change 100644 => 100755 pandora_console/operation/snmpconsole/snmp_view.php

diff --git a/pandora_console/godmode/modules/manage_network_components_form_network.php b/pandora_console/godmode/modules/manage_network_components_form_network.php
old mode 100644
new mode 100755
index 6104fa9462..6539759b46
--- a/pandora_console/godmode/modules/manage_network_components_form_network.php
+++ b/pandora_console/godmode/modules/manage_network_components_form_network.php
@@ -44,7 +44,7 @@ $data[3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version,
 push_table_row ($data, 'snmp_port');
 
 $data = array ();
-$data[0] = __('SNMP OID');
+$data[0] = __('SNMP Enterprise String');
 $data[1] = html_print_input_text ('snmp_oid', $snmp_oid, '', 30, 400, true);
 //$table->colspan['snmp_2'][1] = 3;
 $data[2] = __('SNMP community');
diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php
old mode 100644
new mode 100755
index a112180f26..a6c8b8724b
--- a/pandora_console/godmode/snmpconsole/snmp_alert.php
+++ b/pandora_console/godmode/snmpconsole/snmp_alert.php
@@ -515,7 +515,7 @@ if ($create_alert || $update_alert) {
 	//echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>';
 	
 	// OID
-	echo '<tr id="tr-oid"><td class="datos2">'.__('OID').'</td><td class="datos2">';
+	echo '<tr id="tr-oid"><td class="datos2">'.__('Enterprise String').'</td><td class="datos2">';
 	html_print_input_text ("oid", $oid, '', 50, 255);
 	echo '</td></tr>';
 	
@@ -548,18 +548,20 @@ if ($create_alert || $update_alert) {
 	html_print_input_text ("single_value", $single_value, '', 20);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #1
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
-	echo ui_print_help_icon ("field_match_snmp", true);
-	
-	echo '</td><td class="datos">';
+	//  Variable bindings/Data #1
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data') .
+			ui_print_help_icon ("field_match_snmp", true) .
+		'</td>' .
+		'<td class="datos">';
 	echo '#';
 	html_print_input_text ("order_1", $order_1, '', 4);
 	html_print_input_text ("custom_oid_data_1", $custom_oid_data_1, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #2
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	//  Variable bindings/Data #2
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Variable bindings/Data');
 	//echo ui_print_help_icon ("snmp_alert_custom", true);
 	
 	echo '</td><td class="datos">';
@@ -568,8 +570,8 @@ if ($create_alert || $update_alert) {
 	html_print_input_text ("custom_oid_data_2", $custom_oid_data_2, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #3
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	//  Variable bindings/Data #3
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Variable bindings/Data');
 	//echo ui_print_help_icon ("snmp_alert_custom", true);
 	
 	echo '</td><td class="datos">';
@@ -578,8 +580,10 @@ if ($create_alert || $update_alert) {
 	html_print_input_text ("custom_oid_data_3", $custom_oid_data_3, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #4
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	//  Variable bindings/Data #4
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	//echo ui_print_help_icon ("snmp_alert_custom", true);
 	
 	echo '</td><td class="datos">';
@@ -588,8 +592,10 @@ if ($create_alert || $update_alert) {
 	html_print_input_text ("custom_oid_data_4", $custom_oid_data_4, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #5
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	//  Variable bindings/Data #5
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	//echo ui_print_help_icon ("snmp_alert_custom", true);
 	
 	echo '</td><td class="datos">';
@@ -598,8 +604,10 @@ if ($create_alert || $update_alert) {
 	html_print_input_text ("custom_oid_data_5", $custom_oid_data_5, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #6
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #6
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	//echo ui_print_help_icon ("snmp_alert_custom", true);
 	
 	echo '</td><td class="datos">';
@@ -608,112 +616,128 @@ if ($create_alert || $update_alert) {
 	html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #7
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #7
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_7", $order_7, '', 4);
 	html_print_input_text ("custom_oid_data_7", $custom_oid_data_7, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #8
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #8
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_8", $order_8, '', 4);
 	html_print_input_text ("custom_oid_data_8", $custom_oid_data_8, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #9
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #9
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_9", $order_9, '', 4);
 	html_print_input_text ("custom_oid_data_9", $custom_oid_data_9, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #10
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #10
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_10", $order_10, '', 4);
 	html_print_input_text ("custom_oid_data_10", $custom_oid_data_10, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #11
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #11
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' .
+			__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_11", $order_11, '', 4);
 	html_print_input_text ("custom_oid_data_11", $custom_oid_data_11, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #12
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #12
+	echo '<tr id="tr-custom_value">' .
+		'<td class="datos"  valign="top">' . __('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_12", $order_12, '', 4);
 	html_print_input_text ("custom_oid_data_12", $custom_oid_data_12, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #13
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #13
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">' .
+		__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_13", $order_13, '', 4);
 	html_print_input_text ("custom_oid_data_13", $custom_oid_data_13, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #14
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #14
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">' .
+		__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_14", $order_14, '', 4);
 	html_print_input_text ("custom_oid_data_14", $custom_oid_data_14, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #15
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #15
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">' .
+		__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_15", $order_15, '', 4);
 	html_print_input_text ("custom_oid_data_15", $custom_oid_data_15, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #16
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #16
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">' .
+		__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_16", $order_16, '', 4);
 	html_print_input_text ("custom_oid_data_16", $custom_oid_data_16, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #17
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	// Variable bindings/Data #17
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">' .
+		__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_17", $order_17, '', 4);
 	html_print_input_text ("custom_oid_data_17", $custom_oid_data_17, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #18
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	//  Variable bindings/Data #18
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_18", $order_18, '', 4);
 	html_print_input_text ("custom_oid_data_18", $custom_oid_data_18, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #19
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	//  Variable bindings/Data #19
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_19", $order_19, '', 4);
 	html_print_input_text ("custom_oid_data_19", $custom_oid_data_19, '', 60);
 	echo '</td></tr>';
 	
-	//  Custom OID/Data #20
-	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Custom OID/Data');
+	//  Variable bindings/Data #20
+	echo '<tr id="tr-custom_value"><td class="datos"  valign="top">'.__('Variable bindings/Data');
 	echo '</td><td class="datos">';
 	echo '#';
 	html_print_input_text ("order_20", $order_20, '', 4);
@@ -842,7 +866,7 @@ else {
 	$table_filter->width = "98%";
 	$table_filter->data = array();
 	$table_filter->data[0][0] = __('Free search') . ui_print_help_tip(
-		__('Search by these fields description, OID, Custom Value, SNMP Agent (IP), Single value, each Custom OIDs/Datas.'), true);
+		__('Search by these fields description, OID, Custom Value, SNMP Agent (IP), Single value, each Variable bindings/Datas.'), true);
 	$table_filter->data[0][1] =
 		html_print_input_text('free_search', $free_search, '', 30, 100, true);
 	$table_filter->data[0][2] = __('Trap type');
@@ -954,10 +978,10 @@ else {
 	$table->size[2] = "90px";
 	$table->align[2] = 'center';
 	
-	$table->head[3] = __('OID');
+	$table->head[3] = __('Enterprise String');
 	$table->align[3] = 'center';
 	
-	$table->head[4] = __('Custom Value/OID');
+	$table->head[4] = __('Custom Value/Enterprise String');
 	$table->align[4] = 'center';
 	
 	$table->head[5] = __('Description');
diff --git a/pandora_console/godmode/snmpconsole/snmp_trap_generator.php b/pandora_console/godmode/snmpconsole/snmp_trap_generator.php
old mode 100644
new mode 100755
index 4d36d17a6c..5ccb32c60a
--- a/pandora_console/godmode/snmpconsole/snmp_trap_generator.php
+++ b/pandora_console/godmode/snmpconsole/snmp_trap_generator.php
@@ -68,7 +68,7 @@ $table->data[0][1] = html_print_input_text('snmp_host_address', $snmp_host_addre
 $table->data[1][0] = __('Community');
 $table->data[1][1] = html_print_input_text('snmp_community', $snmp_community, '', 50, 255, true);
 
-$table->data[2][0] = __('OID');
+$table->data[2][0] = __('Enterprise String');
 $table->data[2][1] = html_print_input_text('snmp_oid', $snmp_oid, '', 50, 255, true);
 
 $table->data[3][0] = __('SNMP Agent');
diff --git a/pandora_console/include/help/en/help_field_match_snmp.php b/pandora_console/include/help/en/help_field_match_snmp.php
old mode 100644
new mode 100755
index ab8816cf4a..47ab269c0c
--- a/pandora_console/include/help/en/help_field_match_snmp.php
+++ b/pandora_console/include/help/en/help_field_match_snmp.php
@@ -4,7 +4,7 @@
 */
 ?>
 
-<h1>Custom OID/Data #1-20</h1>
+<h1>Variable bindings/Data #1-20</h1>
 
 <p>These are regular expressions that try to match varbinds 1 to 20. If there is a match, the alert is fired. The value of the variable is stored in the corresponding _snmp_fx_ macro (_snmp_f1_, _snmp_f2_, ...). Even though only twenty variables can be searched for matches, _snmp_fx_ macros are set for all of them (_snmp_f11_, _snmp_f12_, ...).</p>
 
diff --git a/pandora_console/include/help/en/help_snmp_alert_custom.php b/pandora_console/include/help/en/help_snmp_alert_custom.php
old mode 100644
new mode 100755
index 1fd667ecf2..8d21fc8941
--- a/pandora_console/include/help/en/help_snmp_alert_custom.php
+++ b/pandora_console/include/help/en/help_snmp_alert_custom.php
@@ -6,4 +6,8 @@
 
 <h1>Custom Value/OID</h1>
 
-<p>This search in the trap &#34;Value&#34; fields, and also in the fields &#34;Custom OID&#34; and &#34;Custom Value&#34;, that is, in the rest of the TRAP fields.</p>
+<p>
+	This search in the trap &#34;Value&#34; fields, and also in the fields
+	&#34;Variable bindings&#34; and &#34;Custom Value&#34;, that is, in
+	the rest of the TRAP fields.
+</p>
diff --git a/pandora_console/include/help/es/help_field_match_snmp.php b/pandora_console/include/help/es/help_field_match_snmp.php
old mode 100644
new mode 100755
index dea7a4e4ac..b4332e70ae
--- a/pandora_console/include/help/es/help_field_match_snmp.php
+++ b/pandora_console/include/help/es/help_field_match_snmp.php
@@ -4,7 +4,7 @@
 */
 ?>
 
-<h1>Custom OID/Data #1-20</h1>
+<h1>Variable bindings/Data #1-20</h1>
 
 <p>Son expresiones regulares que intentan casar con las variables 1 a 20. Si hay un acierto, se dispara la alerta. El valor de la variable se guarda en la macro _snmp_fx_ correspondiente (_snmp_f1_, _snmp_f2_, ...). Aunque sólo se puede especificar una expresión regular para veinte variables, las macros _snmp_fx_ macros están disponibles para todas ellas (_snmp_f11_, _snmp_f12_, ...).</p>
 
diff --git a/pandora_console/operation/snmpconsole/snmp_statistics.php b/pandora_console/operation/snmpconsole/snmp_statistics.php
old mode 100644
new mode 100755
index d5d6cc8500..26f4078206
--- a/pandora_console/operation/snmpconsole/snmp_statistics.php
+++ b/pandora_console/operation/snmpconsole/snmp_statistics.php
@@ -162,7 +162,7 @@ unset($table_source);
 // By OID
 $table_oid = new StdClass();
 $table_oid->width = '100%';
-$table_oid->head[] = __("Traps received by OID") . " - " . sprintf(__('Top %d'), 25);
+$table_oid->head[] = __("Traps received by Enterprise String") . " - " . sprintf(__('Top %d'), 25);
 $table_oid->head_colspan[] = 2;
 $table_oid->headstyle[] = "background-color: #82b92e";
 $table_oid->size = array();
@@ -175,7 +175,7 @@ $table_oid_row = array();
 $table_oid_data = new StdClass();
 $table_oid_data->width = '100%';
 $table_oid_data->head = array();
-$table_oid_data->head['oid'] = __('Trap OID');
+$table_oid_data->head['oid'] = __('Trap Enterprise String');
 $table_oid_data->head['num'] = __('Number');
 $table_oid_data->data = array();
 
diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php
old mode 100644
new mode 100755
index 16a68aeb0b..425cbe879a
--- a/pandora_console/operation/snmpconsole/snmp_view.php
+++ b/pandora_console/operation/snmpconsole/snmp_view.php
@@ -49,7 +49,7 @@ foreach ($user_groups as $id=>$name) {
 		$str_user_groups .= $id;
 	}
 	else {
-		$str_user_groups .= ','.$id;
+		$str_user_groups .= ',' . $id;
 	}
 	$i++;
 }
@@ -320,18 +320,22 @@ $table->data[2][3] = '<strong>'.__('Free search').'</strong>' . ui_print_help_ti
 $table->data[2][4] = html_print_input_text ('free_search_string', $free_search_string, '', 40, 0, true);
 
 // Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other)
-$table->data[4][1] = '<strong>'.__('Type').'</strong>' . ui_print_help_tip(__('Search by trap type'), true);
+$table->data[4][1] = '<strong>'.__('Trap type').'</strong>' . ui_print_help_tip(__('Search by trap type'), true);
 $trap_types = array(-1 => __('None'), 0 => __('Cold start (0)'), 1 => __('Warm start (1)'), 2 => __('Link down (2)'), 3 => __('Link up (3)'), 4 => __('Authentication failure (4)'), 5 => __('Other'));
 $table->data[4][2] = html_print_select ($trap_types, 'trap_type', $trap_type, 'this.form.submit();', '', '', true, false, false);
 
-$table->data[3][3] = '<strong>'.__('Group by OID/IP').'</strong>';
+$table->data[3][3] = '<strong>'.__('Group by Enterprise String/IP').'</strong>';
 $table->data[3][4] = __('Yes') . '&nbsp;'.
 	html_print_radio_button ('group_by', 1, '', $group_by, true) .
 	'&nbsp;&nbsp;';
 $table->data[3][4] .= __('No') . '&nbsp;' .
 	html_print_radio_button ('group_by', 0, '', $group_by, true);
 
-$filter = '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refr='.((int)get_parameter('refr', 0)).'&pure='.$config["pure"].'&tab='.$tab.'">';
+$filter = '<form method="POST" action="index.php?' .
+	'sec=snmpconsole&' .
+	'sec2=operation/snmpconsole/snmp_view&' .
+	'refr=' . ((int)get_parameter('refr', 0)) . '&' .
+	'pure=' . $config["pure"] . '">';
 $filter .= html_print_table($table, true);
 $filter .= '<div style="width: ' . $table->width . '; text-align: right;">';
 $filter .= html_print_submit_button(__('Update'), 'search', false, 'class="sub upd"', true);
@@ -347,7 +351,8 @@ $trapcount = (int) db_get_value_sql($sql_count);
 
 // No traps 
 if (empty ($traps)) {
-	echo '<div class="nf">'.__('There are no SNMP traps in database').'</div>';
+	echo '<div class="nf">' .
+		__('There are no SNMP traps in database') . '</div>';
 	return;
 }
 
@@ -368,7 +373,9 @@ $url_snmp = "index.php?" .
 	"group_by=" . $group_by . "&" .
 	"free_search_string=" . $free_search_string;
 
-$urlPagination = $url_snmp . "&pagination=" . $pagination . "&offset=" . $offset;
+$urlPagination = $url_snmp . "&" .
+	"pagination=" . $pagination . "&" .
+	"offset=" . $offset;
 
 ui_pagination ($trapcount, $urlPagination, $offset, $pagination);
 
@@ -391,7 +398,7 @@ $table->head[1] = __('SNMP Agent');
 $table->align[1] = "center";
 $table->size[1] = '15%';
 
-$table->head[2] = __('OID');
+$table->head[2] = __('Enterprise String');
 $table->align[2] = "center";
 $table->size[2] = '18%';
 
@@ -401,7 +408,7 @@ if ($group_by) {
 	$table->size[3] = '5%';
 }
 
-$table->head[4] = __('Value');
+$table->head[4] = __('Trap subtype');
 $table->align[4] = "center";
 $table->size[4] = '10%';
 
@@ -421,7 +428,9 @@ $table->head[8] = __('Action');
 $table->align[8] = "center";
 $table->size[8] = '10%';
 
-$table->head[9] = html_print_checkbox_extended ("allbox", 1, false, false, "javascript:CheckAll();", 'class="chk" title="'.__('All').'"', true);
+$table->head[9] = html_print_checkbox_extended ("allbox", 1, false,
+	false, "javascript:CheckAll();",
+	'class="chk" title="'.__('All').'"', true);
 $table->align[9] = "center";
 $table->size[9] = '5%';
 
@@ -430,7 +439,7 @@ $table->style[8] = "background: #F3F3F3; color: #111 !important;";
 // Skip offset records
 $idx = 0;
 if ($traps !== false) {
-
+	
 	foreach ($traps as $trap) {
 		$data = array ();
 		if (empty($trap["description"])){
@@ -532,10 +541,10 @@ if ($traps !== false) {
 				$data[8] .= '<a href="' . $url_snmp . '&delete='.$trap["id_trap"].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">' . html_print_image("images/cross.png", true, array("border" => "0", "title" => __('Delete'))) . '</a> ';
 			}
 		}
-
+		
 		$data[8] .= '<a href="javascript: toggleVisibleExtendedInfo(' . $trap["id_trap"] . ');">' . html_print_image("images/eye.png", true, array("alt" => __('Show more'), "title" => __('Show more'))) .'</a>';
-                $data[8] .= enterprise_hook ('editor_link', array ($trap));
-
+		$data[8] .= enterprise_hook ('editor_link', array ($trap));
+		
 		
 		$data[9] = html_print_checkbox_extended ("snmptrapid[]", $trap["id_trap"], false, false, '', 'class="chk"', true);
 		
@@ -544,7 +553,8 @@ if ($traps !== false) {
 		//Hiden file for description
 		$string = '<table style="border:solid 1px #D3D3D3;" width="90%" class="toggle">
 			<tr>
-				<td align="left" valign="top" width="15%" ><b>' . __('Custom data:') . '</b></td>
+				<td align="left" valign="top" width="15%">' .
+					'<b>' . __('Variable bindings:') . '</b></td>
 				<td align="left" >';
 		
 		if ($group_by) {
@@ -558,7 +568,8 @@ if ($traps !== false) {
 			"free_search_string=" . $free_search_string;
 			
 			$string .= '<a href='.$new_url.'>'.__('See more details').'</a>';
-		} else {	
+		}
+		else {
 			// Print binding vars separately
 			$binding_vars = explode ("\t", $trap['oid_custom']);
 			foreach ($binding_vars as $var) {
@@ -569,7 +580,7 @@ if ($traps !== false) {
 		$string .= '</td>
 			</tr>
 			<tr>
-				<td align="left" valign="top">' . '<b>' . __('OID:') . '</td>
+				<td align="left" valign="top">' . '<b>' . __('Enterprise String:') . '</td>
 				<td align="left"> ' . $trap['oid'] . '</td>
 			</tr>';
 		
@@ -613,7 +624,10 @@ if ($traps !== false) {
 					$desc_trap_type = __('Other');
 					break;
 			}
-			$string .= '<tr><td align="left" valign="top">' . '<b>' . __('Type:') . '</td><td align="left">' . $desc_trap_type . '</td></tr>';
+			$string .= '<tr><td align="left" valign="top">' .
+				'<b>' . __('Trap type:') . '</b>' .
+				'</td>' .
+				'<td align="left">' . $desc_trap_type . '</td></tr>';
 		}
 		
 		if ($group_by) {
@@ -650,7 +664,7 @@ if ($traps !== false) {
 					<td align="left" valign="top">' . '<b>' . __('Last trap:') . '</td>
 					<td align="left">' . $last_trap . '</td>
 				</tr>';
-
+		
 		}
 		$string .=  '</table>';
 		

From db7680eb46032d2a7139df48f15b2925eb88e621 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Wed, 21 Jan 2015 15:26:49 +0100
Subject: [PATCH 14/29] Add filter group module in general view of agents

---
 pandora_console/include/ajax/module.php       | 94 ++++++++++++-------
 .../operation/agentes/estado_monitores.php    | 25 ++++-
 2 files changed, 78 insertions(+), 41 deletions(-)

diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php
index 2ff6afe878..5dca8c9095 100755
--- a/pandora_console/include/ajax/module.php
+++ b/pandora_console/include/ajax/module.php
@@ -476,6 +476,7 @@ if ($list_modules) {
 	$status_filter_monitor = (int)get_parameter('status_filter_monitor', -1);
 	$status_text_monitor = get_parameter('status_text_monitor', '');
 	$filter_monitors = (bool)get_parameter('filter_monitors', false);
+	$status_module_group = get_parameter('status_module_group', -1);
 	$monitors_change_filter = (bool)get_parameter('monitors_change_filter', false);
 	
 	$status_filter_sql = '1 = 1';
@@ -486,6 +487,13 @@ if ($list_modules) {
 		$status_filter_sql = 'tagente_estado.estado = ' . $status_filter_monitor;
 	}
 	
+	if($status_module_group != -1){
+	$status_module_group_filter = 'id_module_group = ' . $status_module_group;
+	}
+	else{
+		$status_module_group_filter = 'id_module_group >= 0';
+	}
+	
 	$status_text_monitor_sql = '%';
 	if (!empty($status_text_monitor)) {
 		$status_text_monitor_sql .= $status_text_monitor . '%';
@@ -496,19 +504,21 @@ if ($list_modules) {
 	switch ($config["dbtype"]) {
 		case "mysql":
 			$sql = sprintf("
-				SELECT COUNT(*)
-				FROM tagente_estado,
-					(SELECT *
-					FROM tagente_modulo
-					WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
-						AND disabled = 0) tagente_modulo 
-				LEFT JOIN tmodule_group
-					ON tagente_modulo.id_module_group = tmodule_group.id_mg 
-				WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo 
-					AND %s %s 
-					AND tagente_estado.estado != %d  
-				ORDER BY tagente_modulo.id_module_group , %s  %s",
-				$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
+					SELECT COUNT(*)
+						FROM tagente_estado,
+							(SELECT *
+							FROM tagente_modulo
+							WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
+								AND disabled = 0 AND %s) tagente_modulo 
+						LEFT JOIN tmodule_group
+							ON tagente_modulo.id_module_group = tmodule_group.id_mg 
+						WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo 
+							AND %s %s 
+							AND tagente_estado.estado != %d  
+							AND tagente_modulo.%s 
+						ORDER BY tagente_modulo.id_module_group , %s  %s",
+					$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
+					$status_module_group_filter, $order['field'], $order['order']);
 			break;
 		case "postgresql":
 			$sql = sprintf("
@@ -518,22 +528,23 @@ if ($list_modules) {
 					FROM tagente_modulo
 					WHERE id_agente = %d AND nombre LIKE '%s'
 						AND delete_pending = 0
-						AND disabled = 0) tagente_modulo 
+						AND disabled = 0 AND %s) tagente_modulo 
 				LEFT JOIN tmodule_group
 					ON tagente_modulo.id_module_group = tmodule_group.id_mg 
 				WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo 
 					AND %s %s 
 					AND tagente_estado.estado != %d
+					AND tagente_modulo.%s 
 				GROUP BY tagente_modulo.id_module_group,
 					tagente_modulo.nombre
 				ORDER BY tagente_modulo.id_module_group , %s  %s",
-				$id_agente, $status_text_monitor_sql, $status_filter_sql,
-				$tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'],
+				$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql,
+				$tags_sql, AGENT_MODULE_STATUS_NO_DATA,$status_module_group_filter,$order['field'],
 				$order['order']);
 			break;
 		case "oracle":
 			$sql = sprintf ("
-				SELECT COUNT(*)" .
+					SELECT COUNT(*)" .
 				" FROM tagente_estado, tagente_modulo
 					LEFT JOIN tmodule_group
 					ON tmodule_group.id_mg = tagente_modulo.id_module_group
@@ -544,8 +555,10 @@ if ($list_modules) {
 					AND tagente_modulo.delete_pending = 0
 					AND tagente_modulo.disabled = 0
 					AND tagente_estado.estado != %d 
+					AND tagente_modulo.%s 
 				ORDER BY tagente_modulo.id_module_group , %s %s
-				", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
+				", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
+				$status_module_group_filter,$order['field'], $order['order']);
 			break;
 	}
 	
@@ -566,14 +579,17 @@ if ($list_modules) {
 					(SELECT *
 					FROM tagente_modulo
 					WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
-						AND disabled = 0) tagente_modulo 
+						AND disabled = 0 AND %s) tagente_modulo 
 				LEFT JOIN tmodule_group
 					ON tagente_modulo.id_module_group = tmodule_group.id_mg 
 				WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo 
 					AND %s %s 
 					AND tagente_estado.estado != %d  
+					AND tagente_modulo.%s 
 				ORDER BY tagente_modulo.id_module_group , %s  %s",
-				$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
+				$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
+				$status_module_group_filter, $order['field'], $order['order']);
+
 			break;
 		case "postgresql":
 			$sql = sprintf("
@@ -582,14 +598,16 @@ if ($list_modules) {
 					(SELECT *
 					FROM tagente_modulo
 					WHERE id_agente = %d AND nombre LIKE '%s' AND delete_pending = 0
-						AND disabled = 0) tagente_modulo 
+						AND disabled = 0 AND %s) tagente_modulo 
 				LEFT JOIN tmodule_group
 					ON tagente_modulo.id_module_group = tmodule_group.id_mg 
 				WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo 
 					AND %s %s 
 					AND tagente_estado.estado != %d  
+					AND tagente_modulo.%s 
 				ORDER BY tagente_modulo.id_module_group , %s  %s",
-				$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
+				$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
+				$status_module_group_filter, $order['field'], $order['order']);
 			break;
 		// If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table()
 		case "oracle":
@@ -598,7 +616,7 @@ if ($list_modules) {
 			$fields_tmodule_group = oracle_list_all_field_table('tmodule_group', 'string');
 			
 			$sql = sprintf ("
-				SELECT " . $fields_tagente_estado . ', ' . $fields_tagente_modulo . ', ' . $fields_tmodule_group .
+					SELECT " . $fields_tagente_estado . ', ' . $fields_tagente_modulo . ', ' . $fields_tmodule_group .
 				" FROM tagente_estado, tagente_modulo
 					LEFT JOIN tmodule_group
 					ON tmodule_group.id_mg = tagente_modulo.id_module_group
@@ -609,8 +627,10 @@ if ($list_modules) {
 					AND tagente_modulo.delete_pending = 0
 					AND tagente_modulo.disabled = 0
 					AND tagente_estado.estado != %d 
+					AND tagente_modulo.%s 
 				ORDER BY tagente_modulo.id_module_group , %s %s
-				", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
+				", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, AGENT_MODULE_STATUS_NO_DATA,
+				 $status_module_group_filter, $order['field'], $order['order']);
 			break;
 	}
 	
@@ -649,23 +669,24 @@ if ($list_modules) {
 	}
 	
 	$table->head[2] = __('Type') . ' ' .
-		'<a href="' . $url . '&sort_field=type&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '</a>' .
-		'<a href="' . $url . '&sort_field=type&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
+		'<a href="' . $url . '&sort_field=type&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '</a>' .
+		'<a href="' . $url . '&sort_field=type&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
 	$table->head[3] = __('Module name') . ' ' .
-		'<a href="javascript: order_module_list(\'name\', \'up\');">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
-		'<a href="javascript: order_module_list(\'name\', \'down\');">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
+		'<a href="' . $url . '&sort_field=name&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
+		'<a href="' . $url . '&sort_field=name&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
 	$table->head[4] = __('Description');
 	$table->head[5] = __('Status') . ' ' .
-		'<a href="' . $url . '&sort_field=status&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
-		'<a href="' . $url . '&sort_field=status&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
+		'<a href="' . $url . '&sort_field=status&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
+		'<a href="' . $url . '&sort_field=status&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
 	$table->head[6] = __('Warn'); 
 	$table->head[7] = __('Data') . ' ' .
-		'<a href="' . $url . '&sort_field=data&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
-		'<a href="' . $url . '&sort_field=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
+		'<a href="' . $url . '&sort_field=data&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
+		'<a href="' . $url . '&sort_field=data&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
 	$table->head[8] = __('Graph');
 	$table->head[9] = __('Last contact') . ' ' .
-		'<a href="' . $url . '&sort_field=last_contact&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .
-		'<a href="' . $url . '&sort_field=last_contact&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>';
+		'<a href="' . $url . '&sort_field=last_contact&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .
+		'<a href="' . $url . '&sort_field=last_contact&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>';
+
 	
 	$table->align = array("left", "left", "center", "left", "left", "center");
 	
@@ -1011,7 +1032,8 @@ if ($list_modules) {
 			"id_agente=" . $id_agente . "&" .
 			"refr=&filter_monitors=1&" .
 			"status_filter_monitor=" . $status_filter_monitor . "&" .
-			"status_text_monitor=" . $status_text_monitor;
+			"status_text_monitor=" . $status_text_monitor . "&".
+			"status_module_group=" . $status_module_group;
 		
 		if ($paginate_module) {
 			ui_pagination ($count_modules, false, 0, 0, false, 'offset',
@@ -1036,4 +1058,4 @@ if ($list_modules) {
 	
 	
 }
-?>
\ No newline at end of file
+?>
diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php
index 0af43e572d..46de9cd49d 100755
--- a/pandora_console/operation/agentes/estado_monitores.php
+++ b/pandora_console/operation/agentes/estado_monitores.php
@@ -193,6 +193,7 @@ ui_toggle($html_toggle,
 		parameters["sort"] = sort_rows;
 		parameters["status_filter_monitor"] = filter_status;
 		parameters["status_text_monitor"] = filter_text;
+		parameters["status_module_group"] = filter_group;
 		parameters["page"] = "include/ajax/module";
 		
 		
@@ -218,6 +219,7 @@ ui_toggle($html_toggle,
 	
 	function filter_modules() {
 		filter_status = $("#status_filter_monitor").val();
+		filter_group = $("#status_module_group").val();
 		filter_text = $("input[name='status_text_monitor']").val();
 		
 		var parameters = {};
@@ -228,6 +230,7 @@ ui_toggle($html_toggle,
 		parameters["sort"] = sort_rows;
 		parameters["status_filter_monitor"] = filter_status;
 		parameters["status_text_monitor"] = filter_text;
+		parameters["status_module_group"] = filter_group;
 		parameters["filter_monitors"] = 1;
 		parameters["monitors_change_filter"] = 1;
 		parameters["page"] = "include/ajax/module";
@@ -255,6 +258,7 @@ ui_toggle($html_toggle,
 	
 	function reset_filter_modules() {
 		$("#status_filter_monitor").val(-1);
+		$("#status_module_group").val(-1);
 		$("input[name='status_text_monitor']").val("");
 		
 		filter_modules();
@@ -270,6 +274,7 @@ ui_toggle($html_toggle,
 		parameters["sort"] = sort_rows;
 		parameters["status_filter_monitor"] = filter_status;
 		parameters["status_text_monitor"] = filter_text;
+		parameters["status_module_group"] = filter_group;
 		parameters["filter_monitors"] = 0;
 		parameters["monitors_change_filter"] = 0;
 		parameters["page"] = "include/ajax/module";
@@ -408,7 +413,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
 </script>
 <?php
 function print_form_filter_monitors($id_agent, $status_filter_monitor = -1,
-	$status_text_monitor = '') {
+	$status_text_monitor = '', $status_module_group=-1) {
 	
 	$form_text = '';
 	
@@ -431,14 +436,24 @@ function print_form_filter_monitors($id_agent, $status_filter_monitor = -1,
 	$table->data[0][2] = __('Free text for search (*):');
 	
 	$table->data[0][3] = html_print_input_text('status_text_monitor', $status_text_monitor, '', 30, 100, true);
-	
-	$table->data[0][4] = html_print_button(__('Filter'), 'filter', false, 'filter_modules();', 'class="sub search"', true);
-	$table->data[0][4] .= '&nbsp;' . html_print_button(__('Reset'), 'filter', false, 'reset_filter_modules();', 'class="sub upd"', true);
+	$table->data[0][4] = __('Module group');
+	$rows = db_get_all_rows_sql("SELECT *
+		FROM tmodule_group ORDER BY name");
+	$rows = io_safe_output($rows);
+	$rows_select = array();
+	if (!empty($rows)){
+		$rows_select[-1] = __('All');
+		foreach ($rows as $module_group)
+			$rows_select[$module_group['id_mg']] = __($module_group['name']);
+	}
+	$table->data[0][5] = html_print_select ($rows_select,'status_module_group', $status_module_group, '', '',0, true);
+	$table->data[0][6] = html_print_button(__('Filter'), 'filter', false, 'filter_modules();', 'class="sub search"', true);
+	$table->data[0][7] .= '&nbsp;' . html_print_button(__('Reset'), 'filter', false, 'reset_filter_modules();', 'class="sub upd"', true);
 	$form_text .= html_print_table($table, true);
 	
 	$filter_hidden = false;
 	
-	if ($status_filter_monitor == -1 && $status_text_monitor == '') {
+	if ($status_filter_monitor == -1 && $status_text_monitor == '' && $status_module_group == -1 ) {
 		$filter_hidden = true;
 	}
 	

From 531a7750bb53d040b09918c2fd2bb7b9548ee36f Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Wed, 21 Jan 2015 12:56:00 +0100
Subject: [PATCH 15/29] First commit with the new feature for massive
 operations intags. Ticket: #1632

---
 .../godmode/massive/massive_add_tags.php      | 249 ++++++++++++++++++
 .../godmode/massive/massive_operations.php    |  33 ++-
 pandora_console/godmode/menu.php              |   1 +
 pandora_console/include/functions_tags.php    |   4 +-
 pandora_console/include/javascript/pandora.js |   3 +-
 5 files changed, 285 insertions(+), 5 deletions(-)
 create mode 100755 pandora_console/godmode/massive/massive_add_tags.php

diff --git a/pandora_console/godmode/massive/massive_add_tags.php b/pandora_console/godmode/massive/massive_add_tags.php
new file mode 100755
index 0000000000..c6ccc45848
--- /dev/null
+++ b/pandora_console/godmode/massive/massive_add_tags.php
@@ -0,0 +1,249 @@
+<?php
+
+// Pandora FMS - http://pandorafms.com
+// ==================================================
+// Copyright (c) 2005-2009 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.
+
+
+// Load global vars
+check_login ();
+
+if (! check_acl ($config['id_user'], 0, "AW")) {
+	db_pandora_audit("ACL Violation",
+		"Trying to access massive tag addition");
+	require ("general/noaccess.php");
+	return;
+}
+
+require_once ('include/functions_agents.php');
+require_once ('include/functions_tags.php');
+
+function process_manage_add ($id_agents, $modules, $id_tags) {
+	
+	if (empty ($id_agents) || $id_agents[0] == 0) {
+		ui_print_error_message(__('No agents selected'));
+		return false;
+	}
+	
+	if (empty ($modules)) {
+		ui_print_error_message(__('No modules selected'));
+		return false;
+	}
+	
+	if (empty ($id_tags)) {
+		ui_print_error_message(__('No tags selected'));
+		return false;
+	}
+	
+	$modules_id = array();
+	
+	foreach($modules as $module) {
+		foreach($id_agents as $id_agent) {
+			 $module_id = modules_get_agentmodule_id($module, $id_agent);
+			 $modules_id[] = $module_id['id_agente_modulo'];
+		}
+	}
+	
+	if (count($modules) == 1 && $modules[0] == '0') {
+		foreach($id_agents as $id_agent) {
+			$modules_temp = agents_get_modules($id_agent);
+			foreach ($modules_temp as $id_module => $name_module) {
+				$modules_id[] = $id_module;
+			}
+		}
+	}
+	
+	
+	$conttotal = 0;
+	$contsuccess = 0;
+	foreach($modules_id as $id_module) {
+		$err_count = tags_insert_module_tag($id_module, $id_tags);
+		
+		if ($err_count == 0) {
+			$contsuccess ++;
+		}
+		
+		$conttotal ++;
+	}
+	
+	if ($contsuccess > 0) {
+		db_pandora_audit("Massive management", "Add tags", false, false,
+			"");
+	}
+	else {
+		db_pandora_audit("Massive management", "Fail try to add tags",
+			false, false, "");
+	}
+	
+	ui_print_result_message ($contsuccess > 0,
+		__('Successfully added') . "(" . $contsuccess . "/" . $conttotal . ")",
+		__('Could not be added'));
+	
+}
+
+$id_agents = get_parameter ('id_agents');
+$id_tags = get_parameter ('id_tags');
+$modules = get_parameter ('module');
+
+$add = (bool) get_parameter_post ('add');
+
+if ($add) {
+	process_manage_add ($id_agents, $modules, $id_tags);
+}
+
+$groups = users_get_groups ();
+$own_info = get_user_info($config['id_user']);
+if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
+	$return_all_group = false;
+else   
+	$return_all_group = true;
+
+$table->id = 'add_table';
+$table->width = '98%';
+$table->data = array ();
+$table->style = array ();
+$table->style[0] = 'font-weight: bold; vertical-align:top';
+$table->style[2] = 'font-weight: bold; vertical-align:top';
+$table->size = array ();
+$table->size[0] = '15%';
+$table->size[1] = '40%';
+$table->size[2] = '15%';
+$table->size[3] = '40%';
+
+$table->data = array ();
+	
+$table->data[0][0] = __('Group');
+$table->data[0][1] = html_print_select_groups(false, "AW",
+	$return_all_group, 'id_group', 0, '', 'Select', -1, true, false,
+	true, '', false, 'width:180px;');
+
+$table->data[1][0] = __('Agents');
+$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
+$table->data[1][0] .= html_print_image('images/spinner.png', true);
+$table->data[1][0] .= '</span>';
+
+$agents = agents_get_group_agents(
+	array_keys(users_get_groups ($config["id_user"], "AW", false)));
+$table->data[1][1] = html_print_select ($agents,
+	'id_agents[]', '', '', '', '', true, true, true, '', false, 'width:180px;');
+
+$table->data[1][2] = __('Modules');
+$table->data[1][2]  .= '<span id="module_loading" class="invisible">';
+$table->data[1][2] .= html_print_image('images/spinner.png', true);
+$table->data[1][2] .= '</span>';
+$table->data[1][3] = '<input type="hidden" id="modules_selection_mode" value="all" />' .
+	html_print_select (array(), 'module[]',	'', false, '', '', true, true, false, '', false, 'width:180px;');
+
+
+$table->data[2][0] = __('Tags');
+$tags = tags_get_all_tags();
+$table->data[2][1] = html_print_select ($tags,
+	'id_tags[]', '', '', '', '', true, true, true, '', false, 'width:180px;');
+
+
+echo '<form method="post"
+	id="form_tags"
+	action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_tags">';
+html_print_table ($table);
+
+echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
+html_print_input_hidden ('add', 1);
+
+html_print_submit_button (__('Add'), 'go', false, 'class="sub add"');
+echo '</div>';
+echo '</form>';
+
+// TODO: Change to iu_print_error system
+echo '<h3 class="error invisible" id="message"> </h3>';
+
+//Hack to translate text "none" in PHP to javascript
+echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
+
+ui_require_jquery_file ('form');
+ui_require_jquery_file ('pandora.controls');
+?>
+
+<script type="text/javascript">
+/* <![CDATA[ */
+$(document).ready (function () {
+	$("#checkbox-recursion").click(function () {
+		$("#id_group").trigger("change");
+	});
+	
+	$("#id_agents").change(agent_changed_by_multiple_agents);
+	
+	$("#id_group").change (function () {
+		var $select = $("#id_agents").enable ();
+		$("#agent_loading").show ();
+		$("option", $select).remove ();
+		
+		jQuery.post ("ajax.php",
+			{
+				"page" : "godmode/massive/massive_add_alerts",
+				"get_agents" : 1,
+				"id_group" : this.value,
+				"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
+				// Add a key prefix to avoid auto sorting in js object conversion
+				"keys_prefix" : "_"
+			},
+			function (data, status) {
+				options = "";
+				jQuery.each (data, function (id, value) {
+					// Remove keys_prefix from the index
+					id = id.substring(1);
+					
+					options += "<option value=\""+id+"\">"+value+"</option>";
+				});
+				$("#id_agents").append (options);
+				$("#agent_loading").hide ();
+				$select.enable ();
+			},
+			"json"
+		);
+	});
+	
+	$("#id_group").value = "0";
+	
+	$("#id_group").click (
+	function () {
+		$(this).css ("width", "auto"); 
+	});
+	
+	$("#id_group").blur (function () {
+		$(this).css ("width", "180px"); 
+	});
+	
+	$("#id_agents").click (
+	function () {
+		$(this).css ("width", "auto");
+	});
+	
+	$("#id_agents").blur (function () {
+		$(this).css ("width", "180px"); 
+	});
+	
+	$("#module").click (
+	function () {
+		$(this).css ("width", "auto"); 
+	});
+	
+	$("#module").blur (function () {
+		$(this).css ("width", "180px"); 
+	});
+	
+	$("#modules_selection_mode").change (function() {
+		$("#id_agents").trigger('change');
+	});
+	
+});
+/* ]]> */
+</script>
diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php
index 5659a59abd..8ffd93e04c 100644
--- a/pandora_console/godmode/massive/massive_operations.php
+++ b/pandora_console/godmode/massive/massive_operations.php
@@ -40,6 +40,11 @@ $options_alerts = array(
 	'enable_disable_alerts' => __('Massive alert enable/disable'),
 	'standby_alerts' => __('Massive alert setting standby'));
 
+$options_tags = array(
+	'add_tags' => __('Massive tags addition'),
+	'delete_tags' => __('Massive tags deletion')
+	);
+
 $options_agents = array(
 	'edit_agents' => __('Massive agents edition'),
 	'delete_agents' => __('Massive agents deletion'));
@@ -89,6 +94,9 @@ if ($satellite_options != ENTERPRISE_NOT_HOOK) {
 if (in_array($option, array_keys($options_alerts))) {
 	$tab = 'massive_alerts';
 }
+elseif (in_array($option, array_keys($options_tags))) {
+	$tab = 'massive_tags';
+}
 elseif (in_array($option, array_keys($options_agents))) {
 	$tab = 'massive_agents';
 }
@@ -112,6 +120,9 @@ else {
 }
 
 switch ($tab) {
+	case 'massive_tags':
+		$options = $options_tags;
+		break;
 	case 'massive_alerts':
 		$options = $options_alerts;
 		break;
@@ -140,9 +151,18 @@ if ($option == '') {
 	$option = array_shift(array_keys($options));
 }
 
-$alertstab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts">'
-	. html_print_image ('images/op_alerts.png', true, array ('title' => __('Alerts operations')))
-	. '</a>', 'active' => $tab == 'massive_alerts');
+$tagstab = array('text' =>
+	'<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_tags">' .
+		html_print_image ('images/tag.png', true,
+			array('title' => __('Tags operations'))) . '</a>',
+	'active' => $tab == 'massive_tags');
+
+
+$alertstab = array('text' =>
+	'<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts">' .
+		html_print_image ('images/op_alerts.png', true,
+			array('title' => __('Alerts operations'))) . '</a>',
+	'active' => $tab == 'massive_alerts');
 
 $userstab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_users">'
 	. html_print_image ('images/op_workspace.png', true, array ('title' => __('Users operations')))
@@ -180,6 +200,7 @@ $onheader['massive_modules'] = $modulestab;
 if (check_acl ($config['id_user'], 0, "PM")) {
 	$onheader['user_agents'] = $userstab;
 }
+$onheader['massive_tags'] = $tagstab;
 $onheader['massive_alerts'] = $alertstab;
 $onheader['policies'] = $policiestab;
 $onheader['snmp'] = $snmptab;
@@ -292,6 +313,12 @@ switch ($option) {
 	case 'copy_modules':
 		require_once ('godmode/massive/massive_copy_modules.php');
 		break;
+	case 'add_tags':
+		require_once ('godmode/massive/massive_add_tags.php');
+		break;
+	case 'delete_tags':
+		require_once ('godmode/massive/massive_delete_tags.php');
+		break;
 	default:
 		if (!enterprise_hook('massive_operations', array($option))) {
 			require_once ('godmode/massive/massive_config.php');
diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php
index b93a0e42e2..5ba3ac5a42 100644
--- a/pandora_console/godmode/menu.php
+++ b/pandora_console/godmode/menu.php
@@ -64,6 +64,7 @@ if (check_acl ($config['id_user'], 0, "AW")) {
 		$sub["godmode/massive/massive_operations&amp;tab=massive_users"]["text"] = __('Users operations');
 	}
 	$sub["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts operations');
+	$sub["godmode/massive/massive_operations&amp;tab=massive_tags"]["text"] = __('Tags operations');
 	enterprise_hook('massivepolicies_submenu');
 	enterprise_hook('massivesnmp_submenu');
 	enterprise_hook('massivesatellite_submenu');
diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php
index 809f366a1f..4605cd5cb4 100644
--- a/pandora_console/include/functions_tags.php
+++ b/pandora_console/include/functions_tags.php
@@ -425,7 +425,7 @@ function tags_insert_module_tag ($id_agent_module, $tags) {
 	
 	$values = array();
 	
-	if($tags == false) {
+	if ($tags == false) {
 		$tags = array();
 	}
 	
@@ -440,6 +440,8 @@ function tags_insert_module_tag ($id_agent_module, $tags) {
 		if ($result_tag === false)
 			$errn++;
 	}
+	
+	return $errn;
 }
 
 /**
diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js
index 298d2ecf51..c3924f5d89 100644
--- a/pandora_console/include/javascript/pandora.js
+++ b/pandora_console/include/javascript/pandora.js
@@ -177,7 +177,8 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
 	
 	$('#module').attr ('disabled', 1);
 	$('#module').empty ();
-	$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
+	$('#module').append ($('<option></option>')
+		.html ("Loading...").attr ("value", 0));
 	
 	
 	// Check if homedir was received like a JSON

From 23f14f4c0200f157a3a2de2b5643d565f1a77eea Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Wed, 21 Jan 2015 18:56:42 +0100
Subject: [PATCH 16/29] Finish the feature of massive operations with tags.
 TICKET: #1632

---
 .../godmode/massive/massive_add_tags.php      |   8 +-
 .../godmode/massive/massive_delete_tags.php   | 305 ++++++++++++++++++
 pandora_console/include/functions_tags.php    |  36 +++
 3 files changed, 345 insertions(+), 4 deletions(-)
 create mode 100755 pandora_console/godmode/massive/massive_delete_tags.php

diff --git a/pandora_console/godmode/massive/massive_add_tags.php b/pandora_console/godmode/massive/massive_add_tags.php
index c6ccc45848..25d311d4ec 100755
--- a/pandora_console/godmode/massive/massive_add_tags.php
+++ b/pandora_console/godmode/massive/massive_add_tags.php
@@ -46,15 +46,15 @@ function process_manage_add ($id_agents, $modules, $id_tags) {
 	
 	$modules_id = array();
 	
-	foreach($modules as $module) {
-		foreach($id_agents as $id_agent) {
+	foreach ($modules as $module) {
+		foreach ($id_agents as $id_agent) {
 			 $module_id = modules_get_agentmodule_id($module, $id_agent);
 			 $modules_id[] = $module_id['id_agente_modulo'];
 		}
 	}
 	
 	if (count($modules) == 1 && $modules[0] == '0') {
-		foreach($id_agents as $id_agent) {
+		foreach ($id_agents as $id_agent) {
 			$modules_temp = agents_get_modules($id_agent);
 			foreach ($modules_temp as $id_module => $name_module) {
 				$modules_id[] = $id_module;
@@ -65,7 +65,7 @@ function process_manage_add ($id_agents, $modules, $id_tags) {
 	
 	$conttotal = 0;
 	$contsuccess = 0;
-	foreach($modules_id as $id_module) {
+	foreach ($modules_id as $id_module) {
 		$err_count = tags_insert_module_tag($id_module, $id_tags);
 		
 		if ($err_count == 0) {
diff --git a/pandora_console/godmode/massive/massive_delete_tags.php b/pandora_console/godmode/massive/massive_delete_tags.php
new file mode 100755
index 0000000000..52d9ece86e
--- /dev/null
+++ b/pandora_console/godmode/massive/massive_delete_tags.php
@@ -0,0 +1,305 @@
+<?php
+
+// Pandora FMS - http://pandorafms.com
+// ==================================================
+// Copyright (c) 2005-2009 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.
+
+
+// Load global vars
+check_login ();
+
+if (! check_acl ($config['id_user'], 0, "AW")) {
+	db_pandora_audit("ACL Violation",
+		"Trying to access massive tag deletion");
+	require ("general/noaccess.php");
+	return;
+}
+
+require_once ('include/functions_agents.php');
+require_once ('include/functions_tags.php');
+
+if (is_ajax ()) {
+	$get_agents = (bool)get_parameter('get_agents', false);
+	$get_modules = (bool)get_parameter('get_modules', false);
+	
+	if ($get_agents) {
+		$id_tag = (int)get_parameter('id_tag', 0);
+		
+		$agents = tags_get_agents($id_tag);
+		
+		if (!empty($agents)) {
+			$temp = array();
+			foreach ($agents as $id_agent) {
+				$temp[$id_agent] = agents_get_name($id_agent);
+			}
+			$agents = $temp;
+		}
+		
+		echo json_encode($agents);
+		return;
+	}
+	
+	if ($get_modules) {
+		$id_tag = (int)get_parameter('id_tag', 0);
+		$id_agents = (array)get_parameter('id_agents', array());
+		
+		if (!empty($id_agents)) {
+			
+			foreach ($id_agents as $key => $id) {
+				$id_agents[$key] = (int)$id;
+			}
+			
+			$data = db_get_all_rows_sql("
+				SELECT nombre
+				FROM tagente_modulo
+				WHERE id_agente IN (" . implode(',', $id_agents) . ")
+					AND id_agente_modulo IN (
+						SELECT t1.id_agente_modulo
+						FROM ttag_module AS t1
+						WHERE id_tag = " . $id_tag . "
+							AND id_policy_module = 0)
+				GROUP BY nombre;");
+			
+			if (empty($data)) {
+				echo json_encode(array());
+			}
+			else {
+				$modules = array();
+				foreach ($data as $row) {
+					$modules[] = $row['nombre'];
+				}
+				
+				echo json_encode($modules);
+			}
+		}
+		else {
+			echo json_encode(array());
+		}
+		
+		return;
+	}
+	
+	return;
+}
+
+function process_manage_delete ($id_agents, $modules, $id_tag) {
+	
+	if (empty ($id_agents) || $id_agents[0] == 0) {
+		ui_print_error_message(__('No agents selected'));
+		return false;
+	}
+	
+	if (empty ($modules) || $modules[0] == "0") {
+		ui_print_error_message(__('No modules selected'));
+		return false;
+	}
+	
+	if (empty ($id_tag)) {
+		ui_print_error_message(__('No tag selected'));
+		return false;
+	}
+	
+	$modules_id = array();
+	foreach ($modules as $module) {
+		$data = db_get_all_rows_sql("
+			SELECT id_agente_modulo
+			FROM tagente_modulo
+			WHERE nombre = '" . $module . "'
+				AND id_agente IN (" . implode(",", $id_agents) . ")
+			");
+		
+		if (empty($data)) {
+			$data = array();
+		}
+		
+		foreach ($data as $row) {
+			$modules_id[$row['id_agente_modulo']] = $row['id_agente_modulo'];
+		}
+	}
+	
+	$conttotal = 0;
+	$contsuccess = 0;
+	foreach ($modules_id as $id_module) {
+		$success = tags_remove_tag($id_tag, $id_module);
+		
+		if ($success) {
+			$contsuccess ++;
+		}
+		
+		$conttotal ++;
+	}
+	
+	if ($contsuccess > 0) {
+		db_pandora_audit("Massive management", "Delete tags", false, false,
+			"");
+	}
+	else {
+		db_pandora_audit("Massive management", "Fail try to delete tags",
+			false, false, "");
+	}
+	
+	ui_print_result_message ($contsuccess > 0,
+		__('Successfully deleted') . "(" . $contsuccess . "/" . $conttotal . ")",
+		__('Could not be deleted'));
+	
+}
+
+$id_agents = get_parameter ('id_agents');
+$id_tag = (int)get_parameter ('id_tag');
+$modules = get_parameter ('modules');
+
+$delete = (bool) get_parameter_post ('delete');
+
+if ($delete) {
+	process_manage_delete ($id_agents, $modules, $id_tag);
+}
+
+$groups = users_get_groups ();
+$own_info = get_user_info($config['id_user']);
+if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
+	$return_all_group = false;
+else   
+	$return_all_group = true;
+
+$table->id = 'add_table';
+$table->width = '98%';
+$table->data = array ();
+$table->style = array ();
+$table->style[0] = 'font-weight: bold; vertical-align:top';
+$table->style[2] = 'font-weight: bold; vertical-align:top';
+$table->size = array ();
+$table->size[0] = '15%';
+$table->size[1] = '40%';
+$table->size[2] = '15%';
+$table->size[3] = '40%';
+
+$table->data = array ();
+
+$table->data[0][0] = __('Tags');
+$tags = tags_get_all_tags();
+$table->data[0][1] = html_print_select ($tags,
+	'id_tag', '', '', '', '', true, false, true, '', false, 'min-width:180px;');
+
+$table->data[1][0] = __('Agents');
+$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
+$table->data[1][0] .= html_print_image('images/spinner.png', true);
+$table->data[1][0] .= '</span>';
+$table->data[1][1] = html_print_select (array(),
+	'id_agents[]', '', '', '', '', true, true, true, '', false, 'min-width:180px;');
+
+$table->data[2][0] = __('Modules');
+$table->data[2][0]  .= '<span id="modules_loading" class="invisible">';
+$table->data[2][0] .= html_print_image('images/spinner.png', true);
+$table->data[2][0] .= '</span>';
+$table->data[2][1] = '<input type="hidden" id="modules_selection_mode" value="all" />' .
+	html_print_select (array(), 'modules[]',	'', false, '', '', true, true, false, '', false, 'min-width:180px;');
+
+
+
+
+
+echo '<form method="post"
+	id="form_tags"
+	action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_tags">';
+html_print_table ($table);
+
+echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
+html_print_input_hidden ('delete', 1);
+
+html_print_submit_button (__('Delete'), 'go', false, 'class="sub delete"');
+echo '</div>';
+echo '</form>';
+
+// TODO: Change to iu_print_error system
+echo '<h3 class="error invisible" id="message"> </h3>';
+
+//Hack to translate text "none" in PHP to javascript
+echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
+
+ui_require_jquery_file ('form');
+ui_require_jquery_file ('pandora.controls');
+?>
+
+<script type="text/javascript">
+/* <![CDATA[ */
+$(document).ready (function () {
+	$("#id_tag").change(function() {
+		
+		$("#agent_loading").show();
+		
+		jQuery.post ("ajax.php",
+			{
+				"page" : "godmode/massive/massive_delete_tags",
+				"get_agents" : 1,
+				"id_tag" : this.value,
+			},
+			function (data, status) {
+				$("#id_agents").empty();
+				options = "";
+				jQuery.each (data, function (id, value) {
+					options += "<option value=\""+id+"\">"+value+"</option>";
+				});
+				if (options == "") {
+					$("#id_agents").append(
+						"<option value=\"0\"><?php echo __('None');?></option>");
+				}
+				else {
+					$("#id_agents").append (options);
+				}
+				$("#agent_loading").hide ();
+				
+				$("#id_agents").trigger('change');
+			},
+			"json"
+		);
+	});
+	
+	//~ $("#id_agents").change(agent_changed_by_multiple_agents);
+	$("#id_agents").change(function() {
+		//Fill modules
+		
+		
+		$("#modules_loading").show();
+		
+		jQuery.post ("ajax.php",
+			{
+				"page" : "godmode/massive/massive_delete_tags",
+				"get_modules" : 1,
+				"id_tag": $("#id_tag").val(),
+				"id_agents[]" : $("#id_agents").val(),
+			},
+			function (data, status) {
+				$("#modules").empty();
+				
+				options = "";
+				jQuery.each (data, function (id, value) {
+					options += "<option value=\""+value+"\">"+value+"</option>";
+				});
+				if (options == "") {
+					$("#modules").append(
+						"<option value=\"0\"><?php echo __('None');?></option>");
+				}
+				else {
+					$("#modules").append (options);
+				}
+				$("#modules_loading").hide ();
+			},
+			"json"
+		);
+	});
+	
+	
+	$("#id_tag").trigger('change');
+	
+});
+/* ]]> */
+</script>
diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php
index 4605cd5cb4..9f9147e7a0 100644
--- a/pandora_console/include/functions_tags.php
+++ b/pandora_console/include/functions_tags.php
@@ -403,6 +403,14 @@ function tags_delete_tag ($id_tag) {
 	
 }
 
+function tags_remove_tag($id_tag, $id_module) {
+	$result = (bool)db_process_sql_delete('ttag_module',
+		array('id_tag' => $id_tag, 
+			'id_agente_modulo' => $id_module));
+	
+	return $result;
+}
+
 /**
  * Get tag's total count.  
  *
@@ -658,6 +666,34 @@ function tags_get_tags ($ids) {
 	return $tags;
 }
 
+function tags_get_agents($id_tag, $id_policy_module = 0) {
+	
+	$agents = db_get_all_rows_sql("
+		SELECT id_agente
+		FROM tagente
+		WHERE id_agente IN (
+			SELECT t1.id_agente
+			FROM tagente_modulo AS t1
+			WHERE t1.id_agente_modulo IN (
+				SELECT t2.id_agente_modulo
+				FROM ttag_module AS t2
+				WHERE id_tag = " . $id_tag . "
+					AND id_policy_module = " . $id_policy_module . "))");
+	
+	if (empty($agents)) {
+		return array();
+	}
+	
+	
+	$temp = array();
+	foreach ($agents as $agent) {
+		$temp[] = $agent['id_agente'];
+	}
+	$agents = $temp;
+	
+	return $agents;
+}
+
 /**
  * Give format to tags when go concatened with url.
  *

From f0c11a8280a3f43b001af253150a2a2884bd52cf Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Thu, 22 Jan 2015 14:58:45 +0100
Subject: [PATCH 17/29] Delete shortcut of remote configuration in agents

---
 .../operation/agentes/estado_agente.php       | 25 -------------------
 1 file changed, 25 deletions(-)

diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index 26a6bba414..4bc1df80a0 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -416,12 +416,6 @@ $table->head[8] = __('Last contact'). ' ' .
 
 $table->align = array ();
 
-//Only for AW flag
-if (check_acl ($config["id_user"], $group_id, "AW")) {
-	$table->head[9] = __('R');
-	$table->align[9] = "center";
-}
-
 $table->align[2] = "center";
 $table->align[3] = "center";
 $table->align[4] = "center";
@@ -500,25 +494,6 @@ foreach ($agents as $agent) {
 	// And does not print outdated agents in red. WRONG !!!!
 	// $data[7] = ui_print_timestamp ($agent_info["last_contact"], true);
 	
-	//Only for AW flag
-	if (check_acl ($config["id_user"], $group_id, "AW")) {
-		// Has remote configuration ?
-		$data[9]="";
-		
-		if (enterprise_installed()) {
-			if (config_agents_has_remote_configuration($agent["id_agente"])) {
-				$data[9] = "<a href='index.php?" .
-					"sec=estado&" .
-					"sec2=godmode/agentes/configurar_agente&" .
-					"tab=remote_configuration&" .
-					"id_agente=" . $agent["id_agente"] . "&" .
-					"disk_conf=1'>".
-				html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config')))."</a>";
-			}
-		}
-		
-	}
-	
 	array_push ($table->data, $data);
 }
 

From a240b71fb44fa22b80a34bad045249084072837e Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Thu, 22 Jan 2015 15:35:40 +0100
Subject: [PATCH 18/29] fixed error in mysql to login user without AR
 permisions

---
 pandora_console/include/functions.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index 46063ff02b..07c1cd7a32 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -2177,7 +2177,7 @@ function get_news($arguments) {
 	$modal = get_argument ('modal', $arguments, false);
 	$limit = get_argument ('limit', $arguments, 99999999);
 	
-	$id_group = array_keys(users_get_groups($id_user, 'AR', true));
+	$id_group = array_keys(users_get_groups($id_user, false, true));
 	$id_group = implode(',',$id_group);
 	$current_datetime = date('Y-m-d H:i:s', time());
 	$modal = (int) $modal;

From ac99cc49106855aecd57040b35dac2a31aca790f Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Fri, 23 Jan 2015 00:01:09 +0100
Subject: [PATCH 19/29] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_console/pandoradb_data.sql             | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 6813c2d241..71dfa7351b 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 6.0dev-150121
+Version: 6.0dev-150123
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index c38d5b8707..dd97edf6ae 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150121"
+pandora_version="6.0dev-150123"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 2f1eaed3a2..f090fd3ba2 100644
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '6.0dev';
-use constant AGENT_BUILD => '150121';
+use constant AGENT_BUILD => '150123';
 
 # Commands to retrieve total memory information in kB
 use constant TOTALMEMORY_CMDS => {
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index ae109634fe..b371c5f35c 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150121
+%define release     150123
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index edaa75364b..571604f039 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150121
+%define release     150123
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 9d2cbc89af..c4bf028ec3 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{150121}
+{150123}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index e64e47ce04..04184fbf3e 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("6.0dev(Build 150121)")
+#define PANDORA_VERSION ("6.0dev(Build 150123)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 4a56860871..3959d9e0cc 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(6.0dev(Build 150121))"
+      VALUE "ProductVersion", "(6.0dev(Build 150123))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 4f57afa34f..5f909a9dad 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 6.0dev-150121
+Version: 6.0dev-150123
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 837a5633aa..8d778b3fb4 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150121"
+pandora_version="6.0dev-150123"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 57e07a279f..175d1952bd 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
 /**
  * Pandora build version and version 
  */
-$build_version = 'PC150121';
+$build_version = 'PC150123';
 $pandora_version = 'v6.0dev';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 73cd343bff..90f747dac0 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -63,7 +63,7 @@
 		<div style='height: 10px'>
 			<?php
 $version = '6.0dev';
-$build = '150121';
+$build = '150123';
 			$banner = "v$version Build $build";
 			
 			error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 84b68c1e5b..2e14be0084 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150121
+%define release     150123
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 97dfbb535a..b5975970f4 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150121
+%define release     150123
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 8bafb1430c..2068877a92 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('graph_res','5'),
 ('step_compact','1'),
 ('db_scheme_version','6.0dev'),
-('db_scheme_build','PD150121'),
+('db_scheme_build','PD150123'),
 ('show_unknown','0'),
 ('show_lastalerts','1'),
 ('style','pandora'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index a2536696b1..4580757f63 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 6.0dev-150121
+Version: 6.0dev-150123
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 7e3a7b48a6..f2add47513 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150121"
+pandora_version="6.0dev-150123"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index c54735cbc8..c25fcb1466 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "6.0dev";
-my $pandora_build = "150121";
+my $pandora_build = "150123";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index b1cb03a0a9..b1d92f9605 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150121
+%define release     150123
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 96ef46eb14..29c45ea4ce 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150121
+%define release     150123
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 40f70a5a7e..b3e2a0556e 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "6.0dev PS150121";
+my $version = "6.0dev PS150123";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index a51d1eb28d..daf484015e 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -34,7 +34,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "6.0dev PS150121";
+my $version = "6.0dev PS150123";
 
 # save program name for logging
 my $progname = basename($0);

From 9aff58ed330637ec2c141edd394e3e0611813e9e Mon Sep 17 00:00:00 2001
From: Vanessa Gil <vanessa.gil@artica.es>
Date: Fri, 23 Jan 2015 08:59:42 +0100
Subject: [PATCH 20/29] Added Strict ACL mode to networmaps.

---
 pandora_console/include/functions_graph.php   |   8 +-
 pandora_console/include/functions_groups.php  |  18 +-
 .../include/functions_networkmap.php          | 190 +++++++++++++-----
 pandora_console/include/functions_tags.php    | 158 ++++++++++++---
 .../operation/agentes/networkmap.dinamic.php  |   6 +-
 .../operation/agentes/networkmap.groups.php   |   4 +-
 .../operation/agentes/networkmap.php          |  16 +-
 .../operation/agentes/networkmap.topology.php |   4 +-
 .../operation/agentes/networkmap_list.php     |  12 +-
 9 files changed, 318 insertions(+), 98 deletions(-)

diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 5abbf7e7d2..1506d1c262 100755
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -2369,9 +2369,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
 	}
 	
 	// Add tags condition to filter
-	$user_strict = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
-	$acltags = tags_get_user_module_and_tags ($config['id_user'], $access = 'ER', $user_strict);
-	$tags_condition = " AND (".tags_get_acl_tags_event_condition($acltags, false, $user_strict).")";
+	$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
 	
 	//This will give the distinct id_agente, give the id_grupo that goes
 	//with it and then the number of times it occured. GROUP BY statement
@@ -2465,9 +2463,7 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200) {
 	$filter = str_replace  ( "\\" , "", $filter);
 	
 	// Add tags condition to filter
-	$user_strict = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
-	$acltags = tags_get_user_module_and_tags ($config['id_user'], $access = 'ER', $user_strict);
-	$tags_condition = " AND (".tags_get_acl_tags_event_condition($acltags, false, $user_strict).")";
+	$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
 	$filter .= $tags_condition;
 	
 	$data = array ();
diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php
index b49c293957..c40cde6919 100644
--- a/pandora_console/include/functions_groups.php
+++ b/pandora_console/include/functions_groups.php
@@ -537,12 +537,22 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) {
  *
  * @return int Status of the agents.
  */
-function groups_get_status ($id_group = 0) {
+function groups_get_status ($id_group = 0, $strict_user = false) {
 	global $config;
 	
 	require_once ($config['homedir'].'/include/functions_reporting.php');
 	
-	$data = reporting_get_group_stats($id_group);
+	if ($strict_user) {
+		$acltags = tags_get_user_module_and_tags ($config['id_user'], 'AR', $strict_user);
+		$group_status = group_get_data ($config['id_user'], $strict_user, $acltags, false, 'group');
+		$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
+		$data['agent_critical'] = $groups_status['_agents_critical_'];
+		$data['agent_warning'] = $groups_status['_agents_warning_'];
+		$data['agent_unknown'] = $groups_status['_agents_unknown_'];
+		
+	} else {
+		$data = reporting_get_group_stats($id_group);
+	}
 	
 	if ($data['monitor_alerts_fired'] > 0) {
 		return AGENT_STATUS_ALERT_FIRED;
@@ -1394,7 +1404,6 @@ function groups_monitor_ok ($group_array, $strict_user = false, $id_group_strict
 	
 
 	if ($strict_user) {
-		$tags_clause = "AND tagente_modulo.id_agente_modulo NOT IN (SELECT id_agente_modulo FROM ttag_module)";
 		$count = db_get_sql ("SELECT COUNT(*) FROM tagente_modulo, tagente_estado
 							WHERE tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo
 							AND tagente_estado.estado = 0
@@ -1796,8 +1805,6 @@ function groups_get_tree(&$groups, $parent = false) {
 	
 	return $return;
 }
-
-
 function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
 	global $config;
 	
@@ -1831,7 +1838,6 @@ function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
 
 function group_get_data ($id_user = false, $user_strict = false, $acltags, $returnAllGroup = false, $mode = 'group') {
 	global $config;
-
 	if ($id_user == false) {
 		$id_user = $config['id_user'];
 	}
diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php
index c8feeb43b9..f04070b04e 100644
--- a/pandora_console/include/functions_networkmap.php
+++ b/pandora_console/include/functions_networkmap.php
@@ -113,7 +113,7 @@ function networkmap_generate_hash($pandora_name, $group = 0,
 	$graph = networkmap_generate_dot($pandora_name, $group,
 		$simple, $font_size, $layout, $nooverlap, $zoom, $ranksep,
 		$center, $regen, $pure, $id_networkmap, $show_snmp_modules,
-		$cut_names, $relative, $text_filter);
+		$cut_names, $relative, $text_filter, false, null, false, $strict_user);
 	
 	$return = array();
 	if (!empty($graph)) {
@@ -234,7 +234,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
 	$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
 	$id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
 	$relative = false, $text_filter = '', $l2_network = false, $ip_mask = null,
-	$dont_show_subgroups = false) {
+	$dont_show_subgroups = false, $strict_user = false) {
 	
 	global $config;
 	
@@ -281,12 +281,35 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
 		//Order by id_parent ascendant for to avoid the bugs
 		//because the first agents to process in the next
 		//foreach loop are without parent (id_parent = 0)
+
+		// Get agents data
+		if ($strict_user) {
+			if ($dont_show_subgroups)
+				$filter['id_group'] = $group;
+			else {
+				if (!empty($childrens)) {
+					foreach ($childrens as $children) {
+						$filter_id_groups[$children] = $children;
+					}
+				} 
+				$filter_id_groups[$group] = $group;
+				$filter['id_group'] = implode(',', $filter_id_groups);
+			}
+
+			$filter['group_by'] = 'tagente.id_agente';
+			$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_parent, tagente.id_agente, 
+						tagente.normal_count, tagente.warning_count, tagente.critical_count,
+						tagente.unknown_count, tagente.total_count, tagente.notinit_count');
+			$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
+			$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
+		} else {
+			$agents = agents_get_agents ($filter,
+				array ('id_grupo, nombre, id_os, id_parent, id_agente,
+					normal_count, warning_count, critical_count,
+					unknown_count, total_count, notinit_count'), 'AR',
+					array('field' => 'id_parent', 'order' => 'ASC'));
+		}
 		
-		$agents = agents_get_agents ($filter,
-			array ('id_grupo, nombre, id_os, id_parent, id_agente,
-				normal_count, warning_count, critical_count,
-				unknown_count, total_count, notinit_count'), 'AR',
-				array('field' => 'id_parent', 'order' => 'ASC'));
 	}
 	else if ($group == -666) {
 		$agents = false;
@@ -295,22 +318,29 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
 		$agents = networkmap_get_new_nodes_from_ip_mask($ip_mask,
 			array ('id_grupo, nombre, id_os, id_parent, id_agente,
 				normal_count, warning_count, critical_count,
-				unknown_count, total_count, notinit_count'));
+				unknown_count, total_count, notinit_count'), $strict_user);
 	}
 	else {
 		//Order by id_parent ascendant for to avoid the bugs
 		//because the first agents to process in the next
 		//foreach loop are without parent (id_parent = 0)
 		
-		$agents = agents_get_agents ($filter,
-			array ('id_grupo, nombre, id_os, id_parent, id_agente, 
-				normal_count, warning_count, critical_count,
-				unknown_count, total_count, notinit_count'), 'AR',
-				array('field' => 'id_parent', 'order' => 'ASC'));
+		if ($strict_user) {
+			$filter['group_by'] = 'tagente.id_agente';
+			$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_parent, tagente.id_agente, 
+						tagente.normal_count, tagente.warning_count, tagente.critical_count,
+						tagente.unknown_count, tagente.total_count, tagente.notinit_count');
+			$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
+			$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
+		} else {
+			$agents = agents_get_agents ($filter,
+				array ('id_grupo, nombre, id_os, id_parent, id_agente,
+					normal_count, warning_count, critical_count,
+					unknown_count, total_count, notinit_count'), 'AR',
+					array('field' => 'id_parent', 'order' => 'ASC'));
+		}
 	}
 	
-	
-	
 	if ($agents === false)
 		//return false;
 		$agents = array();
@@ -343,10 +373,14 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
 			
 			$filter = array();
 			$filter['disabled'] = 0;
-			
+
 			// Get agent modules data
-			$modules = agents_get_modules($agent['id_agente'], '*',
-				$filter, true, true);
+			if ($strict_user) {
+				$modules = tags_get_agent_modules ($agent['id_agente'], $acltags, false, $filter, false);
+			} else {
+				$modules = agents_get_modules($agent['id_agente'], '*', $filter, true, true);
+			}			
+						
 			if ($modules === false)
 				$modules = array();
 			
@@ -611,10 +645,13 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
 	$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
 	$modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0,
 	$depth = 'all', $id_networkmap = 0, $dont_show_subgroups = 0,
-	$text_filter = '') {
+	$text_filter = '', $strict_user = false) {
 	
 	global $config;
-	
+
+	if ($strict_user) {
+		$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
+	}
 	$parents = array();
 	$orphans = array();
 	
@@ -654,7 +691,11 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
 		$filter['id_grupo'] = $id_groups;
 	}
 	else {
-		$groups = db_get_all_rows_in_table ('tgrupo');
+		if ($strict_user) {
+			$groups = users_get_groups ($config['id_user'],"AR", false, true);
+		} else {
+			$groups = db_get_all_rows_in_table ('tgrupo');
+		}
 		if ($groups === false) {
 			$groups = array();
 		}
@@ -676,7 +717,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
 		// Add node
 		$nodes_groups[$group2['id_grupo']] = $group2;
 	}
-	
+
 	$node_count = 0;
 	
 	$groups_hiden = array();
@@ -702,12 +743,19 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
 	}
 	
 	if ($depth != 'group') {
+		if ($strict_user) {
+			$filter['group_by'] = 'tagente.nombre';
+			$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_agente, 
+						tagente.normal_count, tagente.warning_count, tagente.critical_count,
+						tagente.unknown_count, tagente.total_count, tagente.notinit_count');
+			$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
+		} else {
 		// Get agents data
 		$agents = agents_get_agents ($filter,
 			array ('id_grupo, nombre, id_os, id_agente, 
 				normal_count, warning_count, critical_count,
 				unknown_count, total_count, notinit_count'));
-		
+		}	
 		if ($agents === false)
 			$agents = array();
 		
@@ -741,7 +789,13 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
 			}
 			
 			// Get agent modules data
-			$modules = agents_get_modules ($agent['id_agente'], false, array('disabled' => 0), true, false);
+			if ($strict_user) {
+				$filter['disabled'] = 0;
+				$modules = tags_get_agent_modules ($agent['id_agente'], $acltags, false, $filter, false);
+			} else {
+				$modules = agents_get_modules ($agent['id_agente'], false, array('disabled' => 0), true, false);
+			}
+
 			// Parse modules
 			foreach ($modules as $key => $module) {
 				$node_count ++;
@@ -784,7 +838,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
 	
 	// Create void statistics array
 	$stats = array();
-	
+
 	// Create nodes
 	foreach ($nodes as $node_id => $node) {
 		if ($center > 0 && ! networkmap_is_descendant ($node_id, $center, $parents)) {
@@ -795,7 +849,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
 		}
 		switch ($node['type']) {
 			case 'group':
-				$graph .= networkmap_create_group_node ($node , $simple, $font_size) .
+				$graph .= networkmap_create_group_node ($node , $simple, $font_size, $metaconsole = false, null, $strict_user) .
 					"\n\t\t";
 				$stats['groups'][] = $node['id_grupo'];
 				break;
@@ -878,12 +932,12 @@ function networkmap_create_transparent_edge($head, $tail) {
 }
 
 // Returns a group node definition
-function networkmap_create_group_node ($group, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null) {
+function networkmap_create_group_node ($group, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null, $strict_user = false) {
 	global $config;
 	global $hack_networkmap_mobile;
 	
-	$status = groups_get_status ($group['id_grupo']);
-	
+	$status = groups_get_status ($group['id_grupo'], $strict_user);
+
 	// Set node status
 	switch ($status) {
 		case 0: 
@@ -963,11 +1017,21 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10, $me
 }
 
 // Returns a node definition
-function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false, $metaconsole = false, $id_server = null) {
+function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false, $metaconsole = false, $id_server = null, $strict_user = false) {
 	global $config;
 	global $hack_networkmap_mobile;
 	
-	$status = agents_get_status_from_counts($agent);
+	if ($strict_user) {
+		$strict_data['normal_count'] = groups_agent_ok ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
+		$strict_data['warning_count'] = groups_agent_warning ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
+		$strict_data['critical_count'] = groups_agent_critical ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
+		$strict_data['unknown_count'] = groups_agent_unknown ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
+		$strict_data['notinit_count'] = groups_agent_not_init ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
+		$strict_data['total_count'] = groups_agent_total ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
+		$status = agents_get_status_from_counts($strict_data);
+	} else {
+		$status = agents_get_status_from_counts($agent);
+	}
 	
 	if (defined('METACONSOLE')) {
 		$server_data = db_get_row('tmetaconsole_setup', 'id',
@@ -1062,7 +1126,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
 			$url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'];
 		}
 		
-		$node = "\n" . $agent['id_node'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
+		$node = "\n" . $agent['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
 		 <TR><TD>'.io_safe_output($name).'</TD></TR></TABLE>>,
 		 shape="doublecircle", URL="'.$url.'",
 		 tooltip="' . $url_tooltip . '"];' . "\n";
@@ -1500,7 +1564,7 @@ function networkmap_get_networkmap ($id_networkmap, $filter = false, $fields = f
  *
  * @return Networkmap with the given id. False if not available or readable.
  */
-function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = true) {
+function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = true, $strict_user = false) {
 	global $config;
 	
 	if ($id_user == '') {
@@ -1527,11 +1591,17 @@ function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = tr
 	$networkmaps = array();
 	foreach ($networkmaps_raw as $key => $networkmapitem) {
 		if ($optgrouped) {
+			if ((($networkmapitem['type'] == 'policies') || ($networkmapitem['type'] == 'radial_dynamic')) && ($strict_user)) {
+				continue;
+			}
 			$networkmaps[$networkmapitem['id_networkmap']] = 
 				array('name' => $networkmapitem['name'], 
 					'optgroup' => $networkmapitem['type']);
 		}
 		else {
+			if ((($networkmapitem['type'] == 'policies') || ($networkmapitem['type'] == 'radial_dynamic')) && ($strict_user)) {
+				continue;
+			}
 			$networkmaps[$networkmapitem['id_networkmap']] =
 				$networkmapitem['name'];
 		}
@@ -1600,7 +1670,7 @@ function networkmap_update_networkmap ($id_networkmap, $values) {
  * 
  * @return Array Networkmap diferent types.
  */
-function networkmap_get_types () {
+function networkmap_get_types ($strict_user = false) {
 	$networkmap_types = array();
 	
 	$is_enterprise = enterprise_include_once('include/functions_policies.php');
@@ -1608,9 +1678,11 @@ function networkmap_get_types () {
 	$networkmap_types['topology'] = __('Create a new topology map');
 	$networkmap_types['groups'] = __('Create a new group map');
 	$networkmap_types['dinamic'] = __('Create a new dynamic map');
-	$networkmap_types['radial_dynamic'] = __('Create a new radial dynamic map');
+	if (!$strict_user) {
+		$networkmap_types['radial_dynamic'] = __('Create a new radial dynamic map');
+	}
 	
-	if ($is_enterprise !== ENTERPRISE_NOT_HOOK) {
+	if (($is_enterprise !== ENTERPRISE_NOT_HOOK) && (!$strict_user)) {
 		$enterprise_types = enterprise_hook('policies_get_networkmap_types');
 		
 		$networkmap_types = array_merge($networkmap_types, $enterprise_types);
@@ -1624,7 +1696,7 @@ function networkmap_get_types () {
  * 
  * @return Array Networkmap diferent types.
  */
-function networkmap_get_filter_types () {
+function networkmap_get_filter_types ($strict_user = false) {
 	$networkmap_types = array();
 	
 	$is_enterprise = enterprise_include_once('include/functions_policies.php');
@@ -1632,9 +1704,11 @@ function networkmap_get_filter_types () {
 	$networkmap_types['topology'] = __('Topology');
 	$networkmap_types['groups'] = __('Group');
 	$networkmap_types['dinamic'] = __('Dynamic');
-	$networkmap_types['radial_dynamic'] = __('Radial dynamic');
+	if (!$strict_user) {
+		$networkmap_types['radial_dynamic'] = __('Radial dynamic');
+	}
 	
-	if ($is_enterprise !== ENTERPRISE_NOT_HOOK) {
+	if (($is_enterprise !== ENTERPRISE_NOT_HOOK) && (!$strict_user)) {
 		$enterprise_types = enterprise_hook('policies_get_networkmap_filter_types');
 		
 		$networkmap_types = array_merge($networkmap_types, $enterprise_types);
@@ -1659,28 +1733,48 @@ function networkmap_cidr_match($ip, $cidr_mask) {
 	return ($ip & $mask) == $subnet;
 }
 
-function networkmap_get_new_nodes_from_ip_mask($ip_mask, $fields = array()) {
+function networkmap_get_new_nodes_from_ip_mask($ip_mask, $fields = array(), $strict_user = false) {
 	$list_ip_masks = explode(",", $ip_mask);
 	
 	$list_address = db_get_all_rows_in_table('taddress');
 	if (empty($address))
 		$address = array();
+
+	if ($strict_user) {
+		$filter['group_by'] = 'tagente.id_agente';
+		$fields = array ('tagente.id_agente');
+		$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
+		$user_agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
 	
+		foreach ($all_user_agents as $agent) {
+			$user_agents[$agent['id_agente']] = $agent['id_agente'];
+		}
+	}
+
 	$agents = array();
 	foreach ($list_address as $address) {
 		foreach ($list_ip_masks as $ip_mask) {
 			if (networkmap_cidr_match($address['ip'], $ip_mask)) {
-				
+				$id_agent = db_get_value_filter('id_agent', 'taddress_agent', array('id_a' => $address['id_a']));
+						
 				if (empty($fields)) {
-					$agents[] = db_get_value_filter('id_agent',
-						'taddress_agent', array('id_a' => $address['id_a']));
+					if ($strict_user) {
+						if (array_key_exists($id_agent, $user_agents)) {
+							$agents[] = db_get_value_filter('id_agent', 'taddress_agent', array('id_a' => $address['id_a']));
+						}
+					} else {
+						$agents[] = db_get_value_filter('id_agent', 'taddress_agent', array('id_a' => $address['id_a']));
+					}
+
 				}
 				else {
-					$id_agent = db_get_value_filter('id_agent',
-						'taddress_agent', array('id_a' => $address['id_a']));
-					
-					$agents[] = db_get_row('tagente', 'id_agente',
-						$id_agent, $fields);
+					if ($strict_user) {
+						if (array_key_exists($id_agent, $user_agents)) {
+							$agents[] = db_get_row('tagente', 'id_agente', $id_agent, $fields);
+						}
+					} else {
+						$agents[] = db_get_row('tagente', 'id_agente', $id_agent, $fields);
+					}
 				}
 			}
 		}
diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php
index 9f9147e7a0..1a902cbc83 100644
--- a/pandora_console/include/functions_tags.php
+++ b/pandora_console/include/functions_tags.php
@@ -433,7 +433,7 @@ function tags_insert_module_tag ($id_agent_module, $tags) {
 	
 	$values = array();
 	
-	if ($tags == false) {
+	if($tags == false) {
 		$tags = array();
 	}
 	
@@ -590,17 +590,6 @@ function tags_get_module_tags ($id, $policy = false) {
 	return $return;
 }
 
-function tags_get_module_policy_tags($id_tag, $id_module) {
-	if (empty($id_tag))
-		return false;
-	
-	$id_module_policy = db_get_value_filter('id_policy_module',
-		'ttag_module',
-		array('id_tag' => $id_tag, 'id_agente_modulo' => $id_module));
-	
-	return $id_module_policy;
-}
-
 /**
  * Select all tags of a policy module. 
  * 
@@ -1798,14 +1787,15 @@ function tags_get_monitors_alerts ($id_tag, $groups_and_tags = array()) {
  * 
  * @return mixed Returns count of agents with this tag or false if they aren't.
  */
-function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags = array(), $filter = false, $fields = false, $meta = true, $strict_user = true) {
+function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_and_tags = array(), $filter = false, $fields = false, $meta = true, $strict_user = true, $return_all_fields = false) {
 	
 	global $config;
 
-	// Avoid mysql error
-	if (empty($id_tag))
-		return;
-		
+	if (empty($id_tag)) {
+		$tag_filter = '';
+	} else {
+		$tag_filter = " AND ttag_module.id_tag = " . $id_tag;
+	}
 	if (empty($id_user)) {
 		$id_user = $config['id_user'];
 	}
@@ -1815,17 +1805,60 @@ function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags =
 		$fields[0] = "id_agente";
 		$fields[1] = "nombre";
 	}
-	$select_fields = implode(',',$fields);
 	
+	$select_fields = implode(',',$fields);
+
 	$groups_clause = "";
 	if ($strict_user) {
 		if (!empty($groups_and_tags)) {
-			$groups_clause = " AND ".tags_get_acl_tags_module_condition($groups_and_tags, "tagente_modulo"); 	 
+			$groups_clause = " AND ".tags_get_acl_tags_module_condition($groups_and_tags, "tagente_modulo"); 		 
 		}
 	} else {
 		$groups_clause = " AND tagente.id_grupo IN (".implode(',',$groups_and_tags).")";
 	}
 	
+	if (!empty($filter['id_group'])) {
+		$groups_clause .= " AND tagente.id_grupo IN (".$filter['id_group'].")";
+	}
+
+	$status_sql = '';
+	if (isset($filter['status'])) {
+		switch ($filter['status']) {
+			case AGENT_STATUS_NORMAL:
+				$status_sql =
+					" AND (normal_count = total_count)";
+				break;
+			case AGENT_STATUS_WARNING:
+				$status_sql =
+					"AND (critical_count = 0 AND warning_count > 0)";
+				break;
+			case AGENT_STATUS_CRITICAL:
+				$status_sql =
+					"AND (critical_count > 0)";
+				break;
+			case AGENT_STATUS_UNKNOWN:
+				$status_sql =
+					"AND (critical_count = 0 AND warning_count = 0
+						AND unknown_count > 0)";
+				break;
+			case AGENT_STATUS_NOT_NORMAL:
+				$status_sql = " AND (normal_count <> total_count)";
+				break;
+			case AGENT_STATUS_NOT_INIT:
+				$status_sql = "AND (notinit_count = total_count)";
+				break;
+		}
+
+	}
+	if (!empty($filter['group_by'])) {
+		$group_by = " GROUP BY ".$filter['group_by'];
+	}
+
+	$id_agent_search = '';
+	if (!empty($filter['id_agent'])) {
+		$id_agent_search = " AND tagente.id_agente = ".$filter['id_agent'];
+	}
+
 	$search_sql = "";
 	$void_agents = "";
 	if ($filter) {
@@ -1840,23 +1873,29 @@ function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags =
 			}
 		}
 	}
-	
+
 	$user_agents_sql = "SELECT ".$select_fields ."
 		FROM tagente, tagente_modulo, ttag_module 
 		WHERE tagente.id_agente = tagente_modulo.id_agente
 		AND tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
-		AND ttag_module.id_tag = " . $id_tag .
+		". $tag_filter .
 		$groups_clause . $search_sql . $void_agents .
+		$status_sql .
+		$group_by .
 		" ORDER BY tagente.nombre ASC";
 
 	//return db_get_sql ($user_agents);	
-	$user_agents = db_get_all_rows_sql($user_agents_sql);
+	$user_agents = db_get_all_rows_sql($user_agents_sql);	
 
+	if ($user_agents == false) {
+		$user_agents = array();
+	}
+	if ($return_all_fields) {
+		return $user_agents;
+	}
 	if (!$meta){
 		$user_agents_aux = array();
-		if ($user_agents === false) {
-			$user_agents = array();
-		}
+
 		foreach ($user_agents as $ua) {
 			$user_agents_aux[$ua['id_agente']] = $ua['nombre'];
 		} 
@@ -1864,4 +1903,73 @@ function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags =
 	}
 	return $user_agents;
 }
+
+function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields = false, $filter = false, $return_all_fields = false) {
+	
+	global $config;
+	
+	// Avoid mysql error
+	if (empty($id_agent))
+		return;
+	
+	if (!is_array ($fields)) {
+		$fields = array ();
+		$fields[0] = "id_agente_modulo";
+		$fields[1] = "nombre";
+	}
+	$select_fields = implode(',',$fields);
+
+	if ($filter) {
+		$filter_sql = '';
+		if (isset($filter['disabled'])) {
+			$filter_sql .= " AND disabled = ".$filter['disabled'];
+		}
+		if (isset($filter['nombre'])) {
+			$filter_sql .= ' AND nombre LIKE "' .$filter['nombre'].'"';
+		}
+
+	}
+	
+	$tag_filter = "";
+	if (!empty($groups_and_tags)) {
+		$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
+		if (isset($groups_and_tags[$agent_group]) && ($groups_and_tags[$agent_group] != '')) {
+			//~ $tag_filter = " AND ttag_module.id_tag IN (".$groups_and_tags[$agent_group].")";
+			$tag_filter = " AND id_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (".$groups_and_tags[$agent_group]."))";
+		}
+	}
+		
+	$agent_modules_sql = "SELECT ".$select_fields ."
+		FROM tagente_modulo 
+		WHERE id_agente=". $id_agent .
+		$tag_filter .
+		$filter_sql ."
+		ORDER BY nombre";
+		
+	$agent_modules = db_get_all_rows_sql($agent_modules_sql);
+	
+	if ($agent_modules == false) {
+		$agent_modules = array();
+	}
+	
+	if ($return_all_fields) {
+		$result = array();
+		foreach ($agent_modules as $am) {
+			$am['status'] = modules_get_agentmodule_status($am['id_agente_modulo']);
+			$am['isinit'] = modules_get_agentmodule_is_init($am['id_agente_modulo']);
+			if ($am['isinit']) {
+				
+			}
+			$result[$am['id_agente_modulo']] = $am;
+		}
+		return $result;
+	}
+	
+	$result = array();
+	foreach ($agent_modules as $am) {
+		$result[$am['id_agente_modulo']] = $am['nombre'];
+	}
+		
+	return $result;	
+}
 ?>
diff --git a/pandora_console/operation/agentes/networkmap.dinamic.php b/pandora_console/operation/agentes/networkmap.dinamic.php
index 89fed73349..2f8d2849de 100755
--- a/pandora_console/operation/agentes/networkmap.dinamic.php
+++ b/pandora_console/operation/agentes/networkmap.dinamic.php
@@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
 
 require_once ('include/functions_networkmap.php');
 
+$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
+
 if ($activeTab == "radial_dynamic") {
 	include_once("include/functions_graph.php");
 	
@@ -39,7 +41,7 @@ if ($activeTab == "radial_dynamic") {
 	if (!empty($module_group))
 		$filter['module_group'] = $module_group;
 	
-	echo graph_monitor_wheel(600, 650, $filter);
+	echo graph_monitor_wheel(600, 650, $filter, $strict_user);
 	
 	echo "</div>";
 	return;
@@ -56,7 +58,7 @@ if (!isset($text_filter)) {
 $graph = networkmap_generate_hash(__('Pandora FMS'), $group, $simple,
 	$font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen,
 	$pure, $id_networkmap, $show_snmp_modules, true, true,
-	$text_filter);
+	$text_filter, $strict_user);
 
 networkmap_print_jsdata($graph);
 
diff --git a/pandora_console/operation/agentes/networkmap.groups.php b/pandora_console/operation/agentes/networkmap.groups.php
index a61447dd62..bb85d2ecb4 100644
--- a/pandora_console/operation/agentes/networkmap.groups.php
+++ b/pandora_console/operation/agentes/networkmap.groups.php
@@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
 
 require_once ('include/functions_networkmap.php');
 
+$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
+
 // Set filter
 $filter = networkmap_get_filter ($layout);
 
@@ -36,7 +38,7 @@ $filter = networkmap_get_filter ($layout);
 $graph = networkmap_generate_dot_groups (__('Pandora FMS'), $group,
 	$simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center,
 	$regen, $pure, $modwithalerts, $module_group, $hidepolicymodules,
-	$depth, $id_networkmap, $dont_show_subgroups, $text_filter);
+	$depth, $id_networkmap, $dont_show_subgroups, $text_filter, $strict_user);
 
 if ($graph === false) {
 	ui_print_error_message (__('Map could not be generated'));
diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php
index 0c05bd98b0..a55ea919c6 100644
--- a/pandora_console/operation/agentes/networkmap.php
+++ b/pandora_console/operation/agentes/networkmap.php
@@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
 
 require_once ('include/functions_networkmap.php');	
 
+$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
+
 $name = '';	
 $pure = (int) get_parameter ('pure', 0);
 $activeTab = get_parameter ('tab', 'topology');
@@ -143,7 +145,7 @@ if ($save_networkmap || $update_networkmap) {
 	}
 }
 
-$networkmaps = networkmap_get_networkmaps();
+$networkmaps = networkmap_get_networkmaps('','', true, $strict_user);
 
 $nomaps = false;
 if ($networkmaps === false) {
@@ -197,7 +199,7 @@ else {
 		'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;pure=1&amp;tab='.$activeTab.'">' . 
 			html_print_image("images/full_screen.png", true, array ('title' => __('Full screen'))) .'</a>');
 }
-if ($config['enterprise_installed']) {
+if (($config['enterprise_installed']) && (!$strict_user)) {
 	$buttons['policies'] = array('active' => $activeTab == 'policies',
 		'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=policies&amp;pure='.$pure.'">' . 
 			html_print_image("images/policies_mc.png", true, array ("title" => __('Policies view'))) .'</a>');
@@ -215,9 +217,11 @@ $buttons['dinamic'] = array('active' => $activeTab == 'dinamic',
 	'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=dinamic&amp;pure='.$pure.'">' . 
 		html_print_image("images/dynamic_network_icon.png", true, array ("title" => __('Dynamic view'))) .'</a>');
 
-$buttons['radial_dinamic'] = array('active' => $activeTab == 'radial_dynamic',
-	'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=radial_dynamic&amp;pure='.$pure.'">' . 
-		html_print_image("images/radial_dynamic_network_icon.png", true, array ("title" => __('Radial dynamic view'))) .'</a>');
+if (!$strict_user) {
+	$buttons['radial_dinamic'] = array('active' => $activeTab == 'radial_dynamic',
+		'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=radial_dynamic&amp;pure='.$pure.'">' . 
+			html_print_image("images/radial_dynamic_network_icon.png", true, array ("title" => __('Radial dynamic view'))) .'</a>');
+}
 
 $combolist = '<form name="query_sel" method="post" action="index.php?sec=network&sec2=operation/agentes/networkmap">';
 
@@ -295,7 +299,7 @@ if (!empty($name)) {
 ui_print_page_header (__('Network map') . " - " . $title,
 	"images/op_network.png", false, "network_map", false, $buttons);
 
-if (tags_has_user_acl_tags()) {
+if ((tags_has_user_acl_tags()) && (!$strict_user)) {
 	ui_print_tags_warning();
 }
 
diff --git a/pandora_console/operation/agentes/networkmap.topology.php b/pandora_console/operation/agentes/networkmap.topology.php
index fd154687a6..ad587e79f4 100644
--- a/pandora_console/operation/agentes/networkmap.topology.php
+++ b/pandora_console/operation/agentes/networkmap.topology.php
@@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
 
 require_once ('include/functions_networkmap.php');
 
+$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
+
 // Set filter
 $filter = networkmap_get_filter ($layout);
 
@@ -39,7 +41,7 @@ if (!isset($text_filter)) {
 $graph = networkmap_generate_dot(__('Pandora FMS'), $group, $simple,
 	$font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen,
 	$pure, $id_networkmap, $show_snmp_modules, true, true,
-	$text_filter, $l2_network, null, $dont_show_subgroups);
+	$text_filter, $l2_network, null, $dont_show_subgroups, $strict_user);
 
 if ($graph === false) {
 	ui_print_error_message (__('Map could not be generated'));
diff --git a/pandora_console/operation/agentes/networkmap_list.php b/pandora_console/operation/agentes/networkmap_list.php
index 5c716e38d6..a1cb7e8998 100644
--- a/pandora_console/operation/agentes/networkmap_list.php
+++ b/pandora_console/operation/agentes/networkmap_list.php
@@ -73,6 +73,8 @@ if (is_ajax()) {
 	return;
 }
 
+$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
+
 ui_print_page_header(__('Network map'), "images/op_network.png", false, "network_map", false);
 
 // Delete networkmap action
@@ -118,7 +120,7 @@ $type_search = get_parameter('type_filter', '0');
 			</td>
 			<td class='datos'>
 				<?php
-				$networkmap_filter_types = networkmap_get_filter_types();
+				$networkmap_filter_types = networkmap_get_filter_types($strict_user);
 				html_print_select($networkmap_filter_types, 'type_filter',
 					$type_search, '', __('All'), 0, false);
 				?>
@@ -200,7 +202,11 @@ else {
 		// If enterprise not loaded then skip this code
 		if ($network_map['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE')))
 			continue;
-		
+	
+		if (($network_map['type'] == 'radial_dynamic' || $network_map['type'] == 'policies') && ($strict_user)) {
+			continue;
+		}
+			
 		$data = array();
 		$data[0] = '<b><a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=view&id_networkmap=' . $network_map['id_networkmap'] . '">' . $network_map['name'] . '</a></b>';
 		$data[1] = $network_map['type'];
@@ -234,7 +240,7 @@ if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0,
 			'create' => __('Create'),
 			'delete' => __('Delete')
 		);
-	$networkmap_types = networkmap_get_types();
+	$networkmap_types = networkmap_get_types($strict_user);
 	$delete_options = array(
 			'selected' => __('Delete selected')
 		);

From 82c794a14e79da4d4fccd3d133e2391d95387ba4 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Fri, 23 Jan 2015 12:21:57 +0100
Subject: [PATCH 21/29] add links in agent name and alert name

---
 pandora_console/godmode/alerts/alert_view.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php
index bea4a56c49..9d41bef93c 100644
--- a/pandora_console/godmode/alerts/alert_view.php
+++ b/pandora_console/godmode/alerts/alert_view.php
@@ -33,6 +33,7 @@ $alert = alerts_get_alert_agent_module($id_alert);
 $template = alerts_get_alert_template ($alert['id_alert_template']);
 $actions = alerts_get_alert_agent_module_actions ($id_alert);
 $agent_name = modules_get_agentmodule_agent_name ($alert['id_agent_module']);
+$agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
 $module_name = modules_get_agentmodule_name ($alert['id_agent_module']);
 
 // Default action
@@ -57,8 +58,14 @@ $table_details->style = array();
 $table_details->style[0] = 'font-weight: bold;';
 $data = array();
 
+$data[0] = __('List alerts');
+$data[1] ='<a style=" font-size: 7pt;" href="index.php?sec=galertas&sec2=godmode/alerts/alert_list" title="'.__('List alerts').
+'"><b><span style=" font-size: 7pt;">'.__('List alerts').'</span></b></a>';
+$table_details->data[] = $data;
+
 $data[0] = __('Agent');
-$data[1] = $agent_name;
+$data[1] ='<a style=" font-size: 7pt;" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent.
+'" title="'.$agent_name.'"><b><span style=" font-size: 7pt;">'.$agent_name.'</span></b></a>';
 $table_details->data[] = $data;
 
 $data[0] = __('Module');

From 109e571e5f91992fe63de609b63998ba372673de Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Fri, 23 Jan 2015 15:05:37 +0100
Subject: [PATCH 22/29] Starting to develop the extension to check status db.

---
 pandora_console/extensions/db_status.php | 240 +++++++++++++++++++++++
 1 file changed, 240 insertions(+)
 create mode 100755 pandora_console/extensions/db_status.php

diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php
new file mode 100755
index 0000000000..447fcf13da
--- /dev/null
+++ b/pandora_console/extensions/db_status.php
@@ -0,0 +1,240 @@
+<?php
+
+// Pandora FMS - http://pandorafms.com
+// ==================================================
+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
+// Please see http://pandorafms.org for full contribution list
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+function extension_db_status_extension_tables() {
+	return array(
+		'tbackup',
+		'tfiles_repo',
+		'tfiles_repo_group',
+		'tipam_ip',
+		'tipam_network',
+		'tuser_task',
+		'tuser_task_scheduled',
+		);
+}
+
+function extension_db_status() {
+	global $config;
+	
+	
+	
+	$db_user = get_parameter('db_user', '');
+	$db_password = get_parameter('db_password', '');
+	$db_host = get_parameter('db_host', '');
+	$db_name = get_parameter('db_name', '');
+	$db_status_execute = (bool)get_parameter('db_status_execute', false);
+	
+	
+	ui_print_page_header (__("DB Status"),
+		"images/extensions.png", false, "", true, "");
+	
+	
+	if (! check_acl ($config['id_user'], 0, "PM")) {
+		db_pandora_audit("ACL Violation",
+			"Trying to access db status");
+		require ("general/noaccess.php");
+		return;
+	}
+	
+	
+	ui_print_info_message(
+		__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.'));
+	ui_print_info_message(
+		__('At the moment the checks is for MySQL/MariaDB.'));
+	
+	echo "<form method='post'>";
+	
+	echo "<fieldset>";
+	echo "<legend>" . __('DB settings') . "</legend>";
+	$table = null;
+	$table->data = array();
+	$row = array();
+	$row[] = __("DB User with privileges");
+	$row[] = html_print_input_text('db_user', $db_user, '', 50, 255, true);
+	$row[] = __("DB Password for this user");
+	$row[] = html_print_input_password('db_password', $db_password, '', 50, 255, true);
+	$table->data[] = $row;
+	$row = array();
+	$row[] = __("DB Hostname");
+	$row[] = html_print_input_text('db_host', $db_host, '', 50, 255, true);
+	$row[] = __("DB Name (temporal for testing)");
+	$row[] = html_print_input_text('db_name', $db_name, '', 50, 255, true);
+	$table->data[] = $row;
+	html_print_table($table);
+	echo "</fieldset>";
+	
+	echo "<div style='text-align: right;'>";
+	html_print_input_hidden('db_status_execute', 1);
+	html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
+	echo "</div>";
+	
+	echo "</form>";
+	
+	if ($db_status_execute) {
+		extension_db_status_execute_checks($db_user, $db_password,
+			$db_host, $db_name);
+	}
+}
+
+
+function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) {
+	global $config;
+	
+	$connection_system = $config['dbconnection'];
+	
+	// Avoid SQL injection
+	$db_name = io_safe_output($db_name);
+	$db_name = str_replace(';', ' ', $db_name);
+	$db_name = explode(" ", $db_name);
+	$db_name = $db_name[0];
+	
+	$connection_test  = mysql_connect ($db_host, $db_user, $db_password);
+	
+	if (!$connection_test) {
+		ui_print_error_message(
+			__('Unsuccessful connected to the DB'));
+	}
+	else {
+		$create_db = mysql_query ("CREATE DATABASE `$db_name`");
+		
+		if (!$create_db) {
+			ui_print_error_message(
+				__('Unsuccessful created the testing DB'));
+		}
+		else {
+			mysql_select_db($db_name, $connection_test);
+			
+			$install_tables = extension_db_status_execute_sql_file(
+				$config['homedir'] . "/pandoradb.sql",
+				$connection_test);
+			
+			if (!$install_tables) {
+				ui_print_error_message(
+					__('Unsuccessful installed tables into the testing DB'));
+			}
+			else {
+				if (enterprise_installed()) {
+					$install_tables_enterprise =
+						extension_db_status_execute_sql_file(
+							$config['homedir'] . "/enterprise/pandoradb.sql",
+							$connection_test);
+					
+					if (!$install_tables_enterprise) {
+						ui_print_error_message(
+							__('Unsuccessful installed enterprise tables into the testing DB'));
+					}
+				}
+				
+				extension_db_check_tables_differences(
+					$connection_test,
+					$connection_system,
+					$db_name,
+					$config['dbname']);
+				//extension_db_check_data_differences();
+			}
+			
+			mysql_select_db($db_name, $connection_test);
+			mysql_query ("DROP DATABASE IF EXISTS `$db_name`");
+		}
+	}
+}
+
+function extension_db_check_tables_differences($connection_test,
+	$connection_system, $db_name_test, $db_name_system) {
+	
+	global $config;
+	
+	// --------- Check the tables --------------------------------------
+	$result = mysql_query("SHOW TABLES");
+	$tables_test = array();
+	while ($row = mysql_fetch_array ($result)) {
+		$tables_test[] = $row[0];
+	}
+	mysql_free_result ($result);
+	$tables_test = array_merge($tables_test,
+		extension_db_status_extension_tables());
+	
+	
+	mysql_select_db($db_name_system, $connection_system);
+	$result = mysql_query("SHOW TABLES", $connection_system);
+	$tables_system = array();
+	while ($row = mysql_fetch_array ($result)) {
+		$tables_system[] = $row[0];
+	}
+	mysql_free_result ($result);
+	
+	$diff_tables = array_diff($tables_system, $tables_test);
+	
+	html_debug_print($tables_test);
+	html_debug_print($tables_system);
+	html_debug_print($diff_tables);
+	
+	ui_print_result_message(
+		empty($diff_tables),
+		__('Successful the DB Pandora has all tables'),
+		__('Unsuccessful the DB Pandora has not all tables. The tables lost are (%s)',
+			implode(", ", $diff_tables)));
+	
+	// --------------- Check the fields -------------------------------
+	
+	//~ mysql_select_db($db_name, $connection);
+	//~ foreach ($tables_system as $table) {
+		//~ $result = mysql_query("EXPLAIN " . $table);
+		//~ 
+		//~ $fields_system = array();
+		//~ while ($row = mysql_fetch_array ($result)) {
+			//~ $fields_system[] = $row[0];
+		//~ }
+		//~ mysql_free_result ($result);
+		//~ 
+		//~ $result = mysql_query("EXPLAIN " . $table);
+		//~ 
+		//~ $fields_system = array();
+		//~ while ($row = mysql_fetch_array ($result)) {
+			//~ $fields_system[] = $row[0];
+		//~ }
+		//~ mysql_free_result ($result);
+	//~ }
+	
+	
+}
+
+function extension_db_status_execute_sql_file($url, $connection) {
+	if (file_exists($url)) {
+		$file_content = file($url);
+		$query = "";
+		foreach ($file_content as $sql_line) {
+			if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
+				$query .= $sql_line;
+				if (preg_match("/;[\040]*\$/", $sql_line)) {
+					if (!$result = mysql_query($query, $connection)) {
+						echo mysql_error(); //Uncomment for debug
+						echo "<i><br>$query<br></i>";
+						return 0;
+					}
+					$query = "";
+				}
+			}
+		}
+		return 1;
+	}
+	else
+		return 0;
+}
+
+extensions_add_godmode_function('extension_db_status');
+extensions_add_godmode_menu_option(__('DB Status'), 'PM', 'gdbman', null, "v1r1");
+?>
\ No newline at end of file

From 9cf246d9be2f83e6482e165be6a3896a6c731296 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Fri, 23 Jan 2015 16:37:44 +0100
Subject: [PATCH 23/29] Finished the extension DB Status for to check the DBs
 in the migrations. TICKET: #1491

---
 pandora_console/extensions/db_status.php | 126 ++++++++++++++++++-----
 1 file changed, 100 insertions(+), 26 deletions(-)

diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php
index 447fcf13da..ccf6b753b5 100755
--- a/pandora_console/extensions/db_status.php
+++ b/pandora_console/extensions/db_status.php
@@ -14,6 +14,7 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 // GNU General Public License for more details.
 
+/*
 function extension_db_status_extension_tables() {
 	return array(
 		'tbackup',
@@ -25,6 +26,7 @@ function extension_db_status_extension_tables() {
 		'tuser_task_scheduled',
 		);
 }
+*/
 
 function extension_db_status() {
 	global $config;
@@ -158,14 +160,15 @@ function extension_db_check_tables_differences($connection_test,
 	global $config;
 	
 	// --------- Check the tables --------------------------------------
-	$result = mysql_query("SHOW TABLES");
+	mysql_select_db($db_name_test, $connection_test);
+	$result = mysql_query("SHOW TABLES", $connection_test);
 	$tables_test = array();
 	while ($row = mysql_fetch_array ($result)) {
 		$tables_test[] = $row[0];
 	}
 	mysql_free_result ($result);
-	$tables_test = array_merge($tables_test,
-		extension_db_status_extension_tables());
+	//~ $tables_test = array_merge($tables_test,
+		//~ extension_db_status_extension_tables());
 	
 	
 	mysql_select_db($db_name_system, $connection_system);
@@ -176,11 +179,11 @@ function extension_db_check_tables_differences($connection_test,
 	}
 	mysql_free_result ($result);
 	
-	$diff_tables = array_diff($tables_system, $tables_test);
+	$diff_tables = array_diff($tables_test, $tables_system);
 	
-	html_debug_print($tables_test);
-	html_debug_print($tables_system);
-	html_debug_print($diff_tables);
+	//~ html_debug_print($tables_test);
+	//~ html_debug_print($tables_system);
+	//~ html_debug_print($diff_tables);
 	
 	ui_print_result_message(
 		empty($diff_tables),
@@ -189,27 +192,98 @@ function extension_db_check_tables_differences($connection_test,
 			implode(", ", $diff_tables)));
 	
 	// --------------- Check the fields -------------------------------
+	$correct_fields = true;
 	
-	//~ mysql_select_db($db_name, $connection);
-	//~ foreach ($tables_system as $table) {
-		//~ $result = mysql_query("EXPLAIN " . $table);
-		//~ 
-		//~ $fields_system = array();
-		//~ while ($row = mysql_fetch_array ($result)) {
-			//~ $fields_system[] = $row[0];
-		//~ }
-		//~ mysql_free_result ($result);
-		//~ 
-		//~ $result = mysql_query("EXPLAIN " . $table);
-		//~ 
-		//~ $fields_system = array();
-		//~ while ($row = mysql_fetch_array ($result)) {
-			//~ $fields_system[] = $row[0];
-		//~ }
-		//~ mysql_free_result ($result);
-	//~ }
-	
+	foreach ($tables_system as $table) {
+		
+		mysql_select_db($db_name_test, $connection_test);
+		$result = mysql_query("EXPLAIN " . $table, $connection_test);
+		$fields_test = array();
+		if (!empty($result)) {
+			while ($row = mysql_fetch_array ($result)) {
+				$fields_test[$row[0]] = array(
+					'field ' => $row[0],
+					'type' => $row[1],
+					'null' => $row[2],
+					'key' => $row[3],
+					'default' => $row[4],
+					'extra' => $row[5]);
+			}
+			mysql_free_result ($result);
+		}
+		
+		
+		
+		mysql_select_db($db_name_system, $connection_system);
+		$result = mysql_query("EXPLAIN " . $table, $connection_system);
+		$fields_system = array();
+		if (!empty($result)) {
+			while ($row = mysql_fetch_array ($result)) {
+				$fields_system[$row[0]] = array(
+					'field ' => $row[0],
+					'type' => $row[1],
+					'null' => $row[2],
+					'key' => $row[3],
+					'default' => $row[4],
+					'extra' => $row[5]);
+			}
+			mysql_free_result ($result);
+		}
+		
+		foreach ($fields_test as $name_field => $field_test) {
+			if (!isset($fields_system[$name_field])) {
+				$correct_fields = false;
+				
+				ui_print_error_message(
+					__('Unsuccessful the table %s has not the field %s',
+					$table, $name_field));
+			}
+			else {
+				$correct_fields = false;
+				$field_system = $fields_system[$name_field];
+				
+				$diff = array_diff($field_test, $field_system);
+				
+				if (!empty($diff)) {
+					foreach ($diff as $config_field => $value) {
+						switch ($config_field) {
+							case 'type':
+								ui_print_error_message(
+									__('Unsuccessful the field %s in the table %s must be setted the type with %s.',
+									$name_field, $table, $value));
+								break;
+							case 'null':
+								ui_print_error_message(
+									__('Unsuccessful the field %s in the table %s must be setted the null values with %s.',
+									$name_field, $table, $value));
+								break;
+							case 'key':
+								ui_print_error_message(
+									__('Unsuccessful the field %s in the table %s must be setted the key as defined in the SQL file.',
+									$name_field, $table));
+								break;
+							case 'default':
+								ui_print_error_message(
+									__('Unsuccessful the field %s in the table %s must be setted the default value as %s.',
+									$name_field, $table, $value));
+								break;
+							case 'extra':
+								ui_print_error_message(
+									__('Unsuccessful the field %s in the table %s must be setted as defined in the SQL file.',
+									$name_field, $table));
+								break;
+						}
+					}
+				}
+			}
+		}
+	}
 	
+	if ($correct_fields) {
+		ui_print_success_message(
+			__('Successful all the tables have the correct fields')
+		);
+	}
 }
 
 function extension_db_status_execute_sql_file($url, $connection) {

From 7fd3da065fcfe6e366c27dcf2864d02040d727f1 Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Sat, 24 Jan 2015 00:01:09 +0100
Subject: [PATCH 24/29] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_console/pandoradb_data.sql             | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 71dfa7351b..30c6ee519e 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 6.0dev-150123
+Version: 6.0dev-150124
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index dd97edf6ae..075164310d 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150123"
+pandora_version="6.0dev-150124"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index f090fd3ba2..f0cb9a59bb 100644
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '6.0dev';
-use constant AGENT_BUILD => '150123';
+use constant AGENT_BUILD => '150124';
 
 # Commands to retrieve total memory information in kB
 use constant TOTALMEMORY_CMDS => {
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index b371c5f35c..9e4a20c7a4 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150123
+%define release     150124
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 571604f039..c832c22ce7 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150123
+%define release     150124
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index c4bf028ec3..6def9d9bfe 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{150123}
+{150124}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 04184fbf3e..7105a9c316 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("6.0dev(Build 150123)")
+#define PANDORA_VERSION ("6.0dev(Build 150124)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 3959d9e0cc..ed9baf46f8 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(6.0dev(Build 150123))"
+      VALUE "ProductVersion", "(6.0dev(Build 150124))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 5f909a9dad..b929563dcd 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 6.0dev-150123
+Version: 6.0dev-150124
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 8d778b3fb4..9dda7c37ea 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150123"
+pandora_version="6.0dev-150124"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 175d1952bd..2cffdad11f 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
 /**
  * Pandora build version and version 
  */
-$build_version = 'PC150123';
+$build_version = 'PC150124';
 $pandora_version = 'v6.0dev';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 90f747dac0..0a3381decf 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -63,7 +63,7 @@
 		<div style='height: 10px'>
 			<?php
 $version = '6.0dev';
-$build = '150123';
+$build = '150124';
 			$banner = "v$version Build $build";
 			
 			error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 2e14be0084..3a858f8e0c 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150123
+%define release     150124
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index b5975970f4..c4740c7f67 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150123
+%define release     150124
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 2068877a92..da8c288037 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('graph_res','5'),
 ('step_compact','1'),
 ('db_scheme_version','6.0dev'),
-('db_scheme_build','PD150123'),
+('db_scheme_build','PD150124'),
 ('show_unknown','0'),
 ('show_lastalerts','1'),
 ('style','pandora'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 4580757f63..35882ed2d0 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 6.0dev-150123
+Version: 6.0dev-150124
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index f2add47513..ec2764e853 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150123"
+pandora_version="6.0dev-150124"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index c25fcb1466..0890db5145 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "6.0dev";
-my $pandora_build = "150123";
+my $pandora_build = "150124";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index b1d92f9605..d39fe353d6 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150123
+%define release     150124
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 29c45ea4ce..61f38b61b0 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150123
+%define release     150124
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index b3e2a0556e..f428a7aeaf 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "6.0dev PS150123";
+my $version = "6.0dev PS150124";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index daf484015e..9b72032596 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -34,7 +34,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "6.0dev PS150123";
+my $version = "6.0dev PS150124";
 
 # save program name for logging
 my $progname = basename($0);

From 78553ae9022192ac93b836207528babc2cd0e78d Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Sun, 25 Jan 2015 00:01:08 +0100
Subject: [PATCH 25/29] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_console/pandoradb_data.sql             | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 30c6ee519e..52f6f4ee98 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 6.0dev-150124
+Version: 6.0dev-150125
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index 075164310d..36b16fbab4 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150124"
+pandora_version="6.0dev-150125"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index f0cb9a59bb..87580443cd 100644
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '6.0dev';
-use constant AGENT_BUILD => '150124';
+use constant AGENT_BUILD => '150125';
 
 # Commands to retrieve total memory information in kB
 use constant TOTALMEMORY_CMDS => {
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 9e4a20c7a4..0eca2a05bf 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150124
+%define release     150125
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index c832c22ce7..e43ebb0db3 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150124
+%define release     150125
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 6def9d9bfe..fca555c3f5 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{150124}
+{150125}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 7105a9c316..a6838100e4 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("6.0dev(Build 150124)")
+#define PANDORA_VERSION ("6.0dev(Build 150125)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index ed9baf46f8..256cadc5a4 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(6.0dev(Build 150124))"
+      VALUE "ProductVersion", "(6.0dev(Build 150125))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index b929563dcd..297a55ff1c 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 6.0dev-150124
+Version: 6.0dev-150125
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 9dda7c37ea..f60c38c05d 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150124"
+pandora_version="6.0dev-150125"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 2cffdad11f..561bcda979 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
 /**
  * Pandora build version and version 
  */
-$build_version = 'PC150124';
+$build_version = 'PC150125';
 $pandora_version = 'v6.0dev';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 0a3381decf..e11f816198 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -63,7 +63,7 @@
 		<div style='height: 10px'>
 			<?php
 $version = '6.0dev';
-$build = '150124';
+$build = '150125';
 			$banner = "v$version Build $build";
 			
 			error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index 3a858f8e0c..ac78d84864 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150124
+%define release     150125
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index c4740c7f67..ce1bb90860 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150124
+%define release     150125
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index da8c288037..0bd25e03fa 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('graph_res','5'),
 ('step_compact','1'),
 ('db_scheme_version','6.0dev'),
-('db_scheme_build','PD150124'),
+('db_scheme_build','PD150125'),
 ('show_unknown','0'),
 ('show_lastalerts','1'),
 ('style','pandora'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 35882ed2d0..09fcad52ab 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 6.0dev-150124
+Version: 6.0dev-150125
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index ec2764e853..5dad4fbc72 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150124"
+pandora_version="6.0dev-150125"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 0890db5145..82c7c29c9f 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "6.0dev";
-my $pandora_build = "150124";
+my $pandora_build = "150125";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index d39fe353d6..105cfc8e55 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150124
+%define release     150125
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 61f38b61b0..906f7b1762 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150124
+%define release     150125
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index f428a7aeaf..f89b095a25 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "6.0dev PS150124";
+my $version = "6.0dev PS150125";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 9b72032596..be47a2952b 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -34,7 +34,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "6.0dev PS150124";
+my $version = "6.0dev PS150125";
 
 # save program name for logging
 my $progname = basename($0);

From 0e70a8899a1b90fbf2df39e2a41091431971a2dd Mon Sep 17 00:00:00 2001
From: artica <artica.devel@gmail.com>
Date: Mon, 26 Jan 2015 00:01:08 +0100
Subject: [PATCH 26/29] Auto-updated build strings.

---
 pandora_agents/unix/DEBIAN/control             | 2 +-
 pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +-
 pandora_agents/unix/pandora_agent              | 2 +-
 pandora_agents/unix/pandora_agent.redhat.spec  | 2 +-
 pandora_agents/unix/pandora_agent.spec         | 2 +-
 pandora_agents/win32/installer/pandora.mpi     | 2 +-
 pandora_agents/win32/pandora.cc                | 2 +-
 pandora_agents/win32/versioninfo.rc            | 2 +-
 pandora_console/DEBIAN/control                 | 2 +-
 pandora_console/DEBIAN/make_deb_package.sh     | 2 +-
 pandora_console/include/config_process.php     | 2 +-
 pandora_console/install.php                    | 2 +-
 pandora_console/pandora_console.redhat.spec    | 2 +-
 pandora_console/pandora_console.spec           | 2 +-
 pandora_console/pandoradb_data.sql             | 2 +-
 pandora_server/DEBIAN/control                  | 2 +-
 pandora_server/DEBIAN/make_deb_package.sh      | 2 +-
 pandora_server/lib/PandoraFMS/Config.pm        | 2 +-
 pandora_server/pandora_server.redhat.spec      | 2 +-
 pandora_server/pandora_server.spec             | 2 +-
 pandora_server/util/pandora_db.pl              | 2 +-
 pandora_server/util/pandora_manage.pl          | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 52f6f4ee98..2819f4aa86 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 6.0dev-150125
+Version: 6.0dev-150126
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index 36b16fbab4..3151d0ec3e 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150125"
+pandora_version="6.0dev-150126"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 87580443cd..bfb60ad661 100644
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
 my $ThreadSem = undef;
 
 use constant AGENT_VERSION => '6.0dev';
-use constant AGENT_BUILD => '150125';
+use constant AGENT_BUILD => '150126';
 
 # Commands to retrieve total memory information in kB
 use constant TOTALMEMORY_CMDS => {
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 0eca2a05bf..0e57532bb0 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150125
+%define release     150126
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index e43ebb0db3..eca0df7f5d 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_agent_unix
 %define version     6.0dev
-%define release     150125
+%define release     150126
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index fca555c3f5..2dd97dded1 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{150125}
+{150126}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index a6838100e4..f6aacebf8b 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("6.0dev(Build 150125)")
+#define PANDORA_VERSION ("6.0dev(Build 150126)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 256cadc5a4..d807afc4ba 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(6.0dev(Build 150125))"
+      VALUE "ProductVersion", "(6.0dev(Build 150126))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 297a55ff1c..4bd5c9f315 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 6.0dev-150125
+Version: 6.0dev-150126
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index f60c38c05d..61a3677f8c 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150125"
+pandora_version="6.0dev-150126"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 561bcda979..57d7068b7f 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
 /**
  * Pandora build version and version 
  */
-$build_version = 'PC150125';
+$build_version = 'PC150126';
 $pandora_version = 'v6.0dev';
 
 // Do not overwrite default timezone set if defined.
diff --git a/pandora_console/install.php b/pandora_console/install.php
index e11f816198..424f1bcec7 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -63,7 +63,7 @@
 		<div style='height: 10px'>
 			<?php
 $version = '6.0dev';
-$build = '150125';
+$build = '150126';
 			$banner = "v$version Build $build";
 			
 			error_reporting(0);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index ac78d84864..af98dac4e0 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150125
+%define release     150126
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index ce1bb90860..17caf94cb8 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_console
 %define version     6.0dev
-%define release     150125
+%define release     150126
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 0bd25e03fa..4661751279 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('graph_res','5'),
 ('step_compact','1'),
 ('db_scheme_version','6.0dev'),
-('db_scheme_build','PD150125'),
+('db_scheme_build','PD150126'),
 ('show_unknown','0'),
 ('show_lastalerts','1'),
 ('style','pandora'),
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 09fcad52ab..781abb252d 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 6.0dev-150125
+Version: 6.0dev-150126
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 5dad4fbc72..2e82fa9310 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="6.0dev-150125"
+pandora_version="6.0dev-150126"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 82c7c29c9f..1461ddfc1f 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -43,7 +43,7 @@ our @EXPORT = qw(
 
 # version: Defines actual version of Pandora Server for this module only
 my $pandora_version = "6.0dev";
-my $pandora_build = "150125";
+my $pandora_build = "150126";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 105cfc8e55..769846bd0c 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150125
+%define release     150126
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 906f7b1762..e450ff93ca 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
 #
 %define name        pandorafms_server
 %define version     6.0dev
-%define release     150125
+%define release     150126
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index f89b095a25..ed2b3211c8 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -33,7 +33,7 @@ use PandoraFMS::Tools;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "6.0dev PS150125";
+my $version = "6.0dev PS150126";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index be47a2952b..6abc25ad22 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -34,7 +34,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "6.0dev PS150125";
+my $version = "6.0dev PS150126";
 
 # save program name for logging
 my $progname = basename($0);

From 2c985653fb4755054e67b2d02f07f9231b68deb9 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Mon, 26 Jan 2015 09:57:28 +0100
Subject: [PATCH 27/29] Fixed problem when specified partition, print return
 data not correct

(cherry picked from commit 60150ab8dd137c280f0f7a25d5ea924e273750f8)
---
 pandora_agents/unix/plugins/pandora_df_free | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pandora_agents/unix/plugins/pandora_df_free b/pandora_agents/unix/plugins/pandora_df_free
index 58d9e7a003..2ad4fed318 100755
--- a/pandora_agents/unix/plugins/pandora_df_free
+++ b/pandora_agents/unix/plugins/pandora_df_free
@@ -34,7 +34,7 @@ if ($#ARGV < 0) {
 # Parse command line parameters
 my %filesystems;
 foreach my $fs (@ARGV) {
-	$filesystems{$fs} = '-1%';
+	$filesystems{$fs} = '0%';
 }
 
 # Retrieve filesystem information
@@ -51,7 +51,7 @@ if ($#df < 0) {
 foreach my $row (@df) {
 	my @columns = split (' ', $row);
 	exit 1 if ($#columns < 4);
-	$filesystems{$columns[5]} = $columns[4] if (defined ($filesystems{$columns[0]}) || $all_filesystems == 1);
+	$filesystems{$columns[5]} = $columns[4] if (defined ($filesystems{$columns[5]}) || $all_filesystems == 1);
 }
 
 my $free;

From 2908f09b01904498239e5a891f881555cdebaa81 Mon Sep 17 00:00:00 2001
From: Vanessa Gil <vanessa.gil@artica.es>
Date: Mon, 26 Jan 2015 13:50:58 +0100
Subject: [PATCH 28/29] Added strict ACL to agent detail view.

---
 pandora_console/include/functions_groups.php  |   2 +
 .../include/functions_reporting.php           |  26 ++++-
 pandora_console/include/functions_tags.php    |  76 ++++++++++---
 .../operation/agentes/estado_agente.php       | 107 ++++++++++++------
 4 files changed, 159 insertions(+), 52 deletions(-)

diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php
index c40cde6919..7c01f64190 100644
--- a/pandora_console/include/functions_groups.php
+++ b/pandora_console/include/functions_groups.php
@@ -1893,6 +1893,8 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
 		}
 	}
 
+	$list = array();
+	
 	if ($list_groups == false) {
 		$list_groups = array();
 	}
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 8d58420a16..a70d2f8370 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -7778,7 +7778,9 @@ function reporting_get_count_events_validated ($filter, $period = 0,
  * 
  * @return string html formatted tiny stats of modules/alerts of an agent
  */
-function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $separator = ':') {
+function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $separator = ':', $strict_user = false) {
+	global $config;
+
 	$out = '';
 	
 	// Depend the type of object, the stats will refer agents, modules...
@@ -7809,6 +7811,28 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
 			break;
 	}
 	
+	if ($strict_user && $type == 'agent') {
+		
+		$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
+		$filter['disabled'] = 0;
+		$id_agent = $counts_info['id_agente'];
+		
+		$counts_info = array();
+		$counts_info['normal_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NORMAL));
+		$counts_info['warning_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_WARNING));
+		$counts_info['critical_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_CRITICAL_BAD));
+		$counts_info['notinit_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NOT_INIT));
+		$counts_info['unknown_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_UNKNOWN));
+		$counts_info['total_count'] = $counts_info['normal_count'] + $counts_info['warning_count'] + $counts_info['critical_count'] + $counts_info['unknown_count'] + $counts_info['notinit_count'];
+		
+		$all_agent_modules = tags_get_agent_modules ($id_agent, $acltags, false, $filter);
+		$mod_clause = "(".implode(',', array_keys($all_agent_modules)).")";
+		
+		$counts_info['fired_count'] = db_get_sql ("SELECT COUNT(times_fired)
+			FROM talert_template_modules
+			WHERE times_fired != 0 AND id_agent_module IN ".$mod_clause);	
+	}
+	
 	// Store the counts in a data structure to print hidden divs with titles
 	$stats = array();
 	
diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php
index 1a902cbc83..d8083344ee 100644
--- a/pandora_console/include/functions_tags.php
+++ b/pandora_console/include/functions_tags.php
@@ -1850,8 +1850,33 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_an
 		}
 
 	}
+	$disabled_sql = '';
+	if (!empty($filter['disabled'])) {
+		$disabled_sql = " AND disabled = ".$filter['disabled'];
+	}
+	
+	$order_by_condition = '';
+	if (!empty($filter['order'])) {
+		$order_by_condition = " ORDER BY ".$filter['order'];
+	} else {
+		$order_by_condition = " ORDER BY tagente.nombre ASC";
+	}
+	$limit_sql = '';
+	if (isset($filter['offset'])) {
+		$offset = $filter['offset'];
+	}
+	if (isset($filter['limit'])) {
+		$limit = $filter['limit'];
+	}
+	
+	if (isset($offset) && isset($limit)) {
+		$limit_sql = " LIMIT $offset, $limit "; 
+	}
+	
 	if (!empty($filter['group_by'])) {
 		$group_by = " GROUP BY ".$filter['group_by'];
+	} else {
+		$group_by = " GROUP BY tagente.nombre";
 	}
 
 	$id_agent_search = '';
@@ -1874,6 +1899,16 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_an
 		}
 	}
 
+	//~ $user_agents_sql = "SELECT ".$select_fields ."
+		//~ FROM tagente, tagente_modulo, ttag_module 
+		//~ WHERE tagente.id_agente = tagente_modulo.id_agente
+		//~ AND tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
+		//~ ". $tag_filter .
+		//~ $groups_clause . $search_sql . $void_agents .
+		//~ $status_sql .
+		//~ $group_by .
+		//~ " ORDER BY tagente.nombre ASC";
+		
 	$user_agents_sql = "SELECT ".$select_fields ."
 		FROM tagente, tagente_modulo, ttag_module 
 		WHERE tagente.id_agente = tagente_modulo.id_agente
@@ -1881,10 +1916,11 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_an
 		". $tag_filter .
 		$groups_clause . $search_sql . $void_agents .
 		$status_sql .
+		$disabled_sql .
 		$group_by .
-		" ORDER BY tagente.nombre ASC";
+		$order_by_condition .
+		$limit_sql;
 
-	//return db_get_sql ($user_agents);	
 	$user_agents = db_get_all_rows_sql($user_agents_sql);	
 
 	if ($user_agents == false) {
@@ -1904,7 +1940,7 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_an
 	return $user_agents;
 }
 
-function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields = false, $filter = false, $return_all_fields = false) {
+function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields = false, $filter = false, $return_all_fields = false, $get_filter_status = -1) {
 	
 	global $config;
 	
@@ -1914,18 +1950,18 @@ function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields
 	
 	if (!is_array ($fields)) {
 		$fields = array ();
-		$fields[0] = "id_agente_modulo";
-		$fields[1] = "nombre";
+		$fields[0] = "tagente_modulo.id_agente_modulo";
+		$fields[1] = "tagente_modulo.nombre";
 	}
 	$select_fields = implode(',',$fields);
 
 	if ($filter) {
 		$filter_sql = '';
 		if (isset($filter['disabled'])) {
-			$filter_sql .= " AND disabled = ".$filter['disabled'];
+			$filter_sql .= " AND tagente_modulo.disabled = ".$filter['disabled'];
 		}
 		if (isset($filter['nombre'])) {
-			$filter_sql .= ' AND nombre LIKE "' .$filter['nombre'].'"';
+			$filter_sql .= ' AND tagente_modulo.nombre LIKE "' .$filter['nombre'].'"';
 		}
 
 	}
@@ -1935,16 +1971,28 @@ function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields
 		$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
 		if (isset($groups_and_tags[$agent_group]) && ($groups_and_tags[$agent_group] != '')) {
 			//~ $tag_filter = " AND ttag_module.id_tag IN (".$groups_and_tags[$agent_group].")";
-			$tag_filter = " AND id_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (".$groups_and_tags[$agent_group]."))";
+			$tag_filter = " AND tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (".$groups_and_tags[$agent_group]."))";
 		}
 	}
 		
-	$agent_modules_sql = "SELECT ".$select_fields ."
-		FROM tagente_modulo 
-		WHERE id_agente=". $id_agent .
-		$tag_filter .
-		$filter_sql ."
-		ORDER BY nombre";
+	if ($get_filter_status != -1) {
+		$agent_modules_sql = "SELECT ".$select_fields ."
+			FROM tagente_modulo, tagente_estado
+			WHERE tagente_modulo.id_agente=". $id_agent .
+			" AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
+			 AND tagente_estado.estado = ".$get_filter_status .
+			$tag_filter .
+			$filter_sql ."
+			ORDER BY nombre";
+	} else {
+
+		$agent_modules_sql = "SELECT ".$select_fields ."
+			FROM tagente_modulo 
+			WHERE id_agente=". $id_agent .
+			$tag_filter .
+			$filter_sql ."
+			ORDER BY nombre";
+	}
 		
 	$agent_modules = db_get_all_rows_sql($agent_modules_sql);
 	
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index 4bc1df80a0..903fe97561 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -119,6 +119,8 @@ $refr = get_parameter('refr', 0);
 $recursion = get_parameter('recursion', 0);
 $status = (int) get_parameter ('status', -1);
 
+$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
+
 $onheader = array();
 
 if (check_acl ($config['id_user'], 0, "AW")) {
@@ -139,8 +141,10 @@ if (check_acl ($config['id_user'], 0, "AW")) {
 
 ui_print_page_header ( __("Agent detail"), "images/agent_mc.png", false, "agent_status", false, $onheader);
 
-if (tags_has_user_acl_tags()) {
-	ui_print_tags_warning();
+if (!$strict_user) {
+	if (tags_has_user_acl_tags()) {
+		ui_print_tags_warning();
+	}
 }
 
 // User is deleting agent
@@ -342,43 +346,72 @@ else {
 	$groups = array_keys($user_groups);
 }
 
-$total_agents = 0;
-$agents = false;
 
-$total_agents = agents_get_agents(array (
-	'disabled' => 0,
-	'id_grupo' => $groups,
-	'search' => $search_sql,
-	'status' => $status),
-	array ('COUNT(*) as total'), 'AR', false);
-$total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0;
+if ($strict_user) {
 
-
-$agents = agents_get_agents(array (
-	'order' => 'nombre ' . $order_collation . ' ASC',
-	'id_grupo' => $groups,
-	'disabled' => 0,
-	'status' => $status,
-	'search' => $search_sql,
-	'offset' => (int) get_parameter ('offset'),
-	'limit' => (int) $config['block_size']  ),
+	$filter = array (
+		'order' => 'tagente.nombre COLLATE utf8_general_ci ASC',
+		'disabled' => 0,
+		'status' => $status,
+		'search' => $search,
+		'offset' => (int) get_parameter ('offset'),
+		'limit' => (int) $config['block_size']);
+		
+	if ($group_id > 0) {
+		$groups = array($group_id);
+		if ($recursion) {
+			$groups = groups_get_id_recursive($group_id, true);
+		}
+		$filter['id_group'] = implode(',', $groups);
+	}
+		
+	$fields = array ('tagente.id_agente','tagente.id_grupo','tagente.id_os','tagente.ultimo_contacto','tagente.intervalo','tagente.comentarios description','tagente.quiet',
+			'tagente.normal_count','tagente.warning_count','tagente.critical_count','tagente.unknown_count','tagente.notinit_count','tagente.total_count','tagente.fired_count');
+			
+	$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
+			
+	$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
 	
-	array ('id_agente',
-		'id_grupo',
-		'id_os',
-		'ultimo_contacto',
-		'intervalo',
-		'comentarios description',
-		'quiet',
-		'normal_count',
-		'warning_count',
-		'critical_count',
-		'unknown_count',
-		'notinit_count',
-		'total_count',
-		'fired_count'),
-	'AR',
-	$order);
+	$total_agents = count($agents);
+
+} else {
+	$total_agents = 0;
+	$agents = false;
+
+	$total_agents = agents_get_agents(array (
+		'disabled' => 0,
+		'id_grupo' => $groups,
+		'search' => $search_sql,
+		'status' => $status),
+		array ('COUNT(*) as total'), 'AR', false);
+	$total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0;
+	
+	$agents = agents_get_agents(array (
+		'order' => 'nombre ' . $order_collation . ' ASC',
+		'id_grupo' => $groups,
+		'disabled' => 0,
+		'status' => $status,
+		'search' => $search_sql,
+		'offset' => (int) get_parameter ('offset'),
+		'limit' => (int) $config['block_size']  ),
+		
+		array ('id_agente',
+			'id_grupo',
+			'id_os',
+			'ultimo_contacto',
+			'intervalo',
+			'comentarios description',
+			'quiet',
+			'normal_count',
+			'warning_count',
+			'critical_count',
+			'unknown_count',
+			'notinit_count',
+			'total_count',
+			'fired_count'),
+		'AR',
+		$order);
+}
 
 if (empty ($agents)) {
 	$agents = array ();
@@ -472,7 +505,7 @@ foreach ($agents as $agent) {
 	
 	$data[4] = ui_print_group_icon ($agent["id_grupo"], true);
 	
-	$data[5] = reporting_tiny_stats($agent, true);
+	$data[5] = reporting_tiny_stats($agent, true, 'agent', ':', $strict_user);
 	
 	
 	$data[6] = $status_img;

From 966c866674cb3f8fdb9bd5ae80dcb93451be8fec Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Mon, 26 Jan 2015 14:54:49 +0100
Subject: [PATCH 29/29] Some changes in the db_status extension.

---
 pandora_console/extensions/db_status.php | 52 ++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php
index ccf6b753b5..248a1b3be1 100755
--- a/pandora_console/extensions/db_status.php
+++ b/pandora_console/extensions/db_status.php
@@ -191,6 +191,23 @@ function extension_db_check_tables_differences($connection_test,
 		__('Unsuccessful the DB Pandora has not all tables. The tables lost are (%s)',
 			implode(", ", $diff_tables)));
 	
+	if (!empty($diff_tables)) {
+		foreach ($diff_tables as $table) {
+			mysql_select_db($db_name_test, $connection_test);
+			$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
+			$tables_test = array();
+			while ($row = mysql_fetch_array ($result)) {
+				ui_print_info_message(
+					__('You can execute this SQL query for to fix.') . "<br />" .
+					'<pre>' .
+						$row[1] .
+					'</pre>'
+				);
+			}
+			mysql_free_result ($result);
+		}
+	}
+	
 	// --------------- Check the fields -------------------------------
 	$correct_fields = true;
 	
@@ -237,6 +254,12 @@ function extension_db_check_tables_differences($connection_test,
 				ui_print_error_message(
 					__('Unsuccessful the table %s has not the field %s',
 					$table, $name_field));
+				ui_print_info_message(
+					__('You can execute this SQL query for to fix.') . "<br />" .
+					'<pre>' .
+						"ALTER TABLE " . $table . " ADD COLUMN " . $name_field . " text;" .
+					'</pre>'
+				);
 			}
 			else {
 				$correct_fields = false;
@@ -251,26 +274,55 @@ function extension_db_check_tables_differences($connection_test,
 								ui_print_error_message(
 									__('Unsuccessful the field %s in the table %s must be setted the type with %s.',
 									$name_field, $table, $value));
+								ui_print_info_message(
+									__('You can execute this SQL query for to fix.') . "<br />" .
+									'<pre>' .
+										"ALTER TABLE " . $table . " MODIFY COLUMN " . $field . " " . $value . ";" .
+									'</pre>'
+								);
 								break;
 							case 'null':
 								ui_print_error_message(
 									__('Unsuccessful the field %s in the table %s must be setted the null values with %s.',
 									$name_field, $table, $value));
+								if ($value == "no") {
+									ui_print_info_message(
+										__('You can execute this SQL query for to fix.') . "<br />" .
+										'<pre>' .
+											"ALTER TABLE " . $table . " MODIFY COLUMN " . $field . "INT NULL;" .
+										'</pre>'
+									);
+								}
+								else {
+									ui_print_info_message(
+										__('You can execute this SQL query for to fix.') . "<br />" .
+										'<pre>' .
+											"ALTER TABLE " . $table . " MODIFY COLUMN " . $field . "INT NOT NULL;" .
+										'</pre>'
+									);
+								}
+								
 								break;
 							case 'key':
 								ui_print_error_message(
 									__('Unsuccessful the field %s in the table %s must be setted the key as defined in the SQL file.',
 									$name_field, $table));
+								ui_print_info_message(
+									__('Please check the SQL file for to know the kind of key needed.'));
 								break;
 							case 'default':
 								ui_print_error_message(
 									__('Unsuccessful the field %s in the table %s must be setted the default value as %s.',
 									$name_field, $table, $value));
+								ui_print_info_message(
+									__('Please check the SQL file for to know the kind of default value needed.'));
 								break;
 							case 'extra':
 								ui_print_error_message(
 									__('Unsuccessful the field %s in the table %s must be setted as defined in the SQL file.',
 									$name_field, $table));
+								ui_print_info_message(
+									__('Please check the SQL file for to know the kind of extra config needed.'));
 								break;
 						}
 					}