diff --git a/core/trunk/core/class/class_functions.php b/core/trunk/core/class/class_functions.php
index a4b7ae45da9cccf32577f9c0459efd9f7661a1bc..efddddac12e0b458a044e903836ab756493fbb63 100644
--- a/core/trunk/core/class/class_functions.php
+++ b/core/trunk/core/class/class_functions.php
@@ -939,7 +939,7 @@ class functions
 			$string = str_replace("'", "''", $string);
 			$string = str_replace("\\", "", $string);
 		}
-		else if($_SESSION['config']['databasetype'] == "MYSQL" || $_SESSION['config']['databasetype'] == "POSTGRESQL" && (ini_get('magic_quotes_gpc') <> true || phpversion() >= 6))
+		else if(($_SESSION['config']['databasetype'] == "MYSQL" || $_SESSION['config']['databasetype'] == "POSTGRESQL")  && !get_magic_quotes_runtime()) //&& (ini_get('magic_quotes_gpc') <> true && phpversion() >= 6)
 		{
 			$string = addslashes($string);
 		}
diff --git a/core/trunk/core/class/class_request.php b/core/trunk/core/class/class_request.php
index 3fd69f789c88043363454db796412b4935c50f2f..8492beec47b7eb33950f05e63238cb7ca1ce96a7 100644
--- a/core/trunk/core/class/class_request.php
+++ b/core/trunk/core/class/class_request.php
@@ -110,20 +110,23 @@ class request extends dbquery
 			$join .= $second_join_table." on ".$second_join_table.".".$join_key." = ".$first_join_table.".".$join_key;
 		}
 
-		$where2 = "";
-		for($i=0; $i < count($_SESSION['user']['security']); $i++)
+		if($add_security)
 		{
-			if(isset($_SESSION['user']['security'][$i]['table']) && isset($_SESSION['user']['security'][$i]['coll_id']))
+			for($i=0; $i < count($_SESSION['user']['security']); $i++)
 			{
-				if(preg_match('/'.$_SESSION['user']['security'][$i]['table'].'/',$table_string) )
+				if(isset($_SESSION['user']['security'][$i]['table']) && isset($_SESSION['user']['security'][$i]['coll_id']))
 				{
-					if(empty($where))
+					if(preg_match('/'.$_SESSION['user']['security'][$i]['table'].'/',$table_string) || preg_match('/'.$_SESSION['user']['security'][$i]['view'].'/',$table_string) )
 					{
-						$where2 = " where ( ".$_SESSION['user']['security'][$i]['where']." ) ";
-					}
-					else
-					{
-						$where2 = " and ( ".$_SESSION['user']['security'][$i]['where']." ) ";
+						if(empty($where_string))
+						{
+							$where_string = " where ( ".$_SESSION['user']['security'][$i]['where']." ) ";
+						}
+						else
+						{
+							$where_string = ''.$where_string." and ( ".$_SESSION['user']['security'][$i]['where']." ) ";
+						}
+						break;
 					}
 				}
 			}
diff --git a/core/trunk/core/init.php b/core/trunk/core/init.php
index 7cdee9fe67026589ae2f03bf10014d6e37eaf122..fafc096c4b51d13a348568cfbfcc9c463a64cb63 100644
--- a/core/trunk/core/init.php
+++ b/core/trunk/core/init.php
@@ -11,6 +11,7 @@ else
 	ini_set('date.timezone', 'Europe/Paris');
 	date_default_timezone_set('Europe/Paris');
 }
+
 if(isset($_SESSION['config']['corepath']) && !empty($_SESSION['config']['corepath']))
 {
 	chdir($_SESSION['config']['corepath']);