Subversion Repositories ALCASAR

Rev

Rev 2047 | Rev 2343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2047 Rev 2342
Line 1... Line 1...
1
<?php
1
<?php
2
require_once('../lib/functions.php');
2
require_once('../lib/functions.php');
3
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
3
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
4
        include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
4
	include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
5
else{
5
else{
6
	echo "<b>Could not include SQL library</b><br>\n";
6
	echo "<b>Could not include SQL library</b><br>\n";
7
	exit();
7
	exit();
8
}
8
}
9
if ($config['sql_use_operators'] == 'true'){
9
if ($config['sql_use_operators'] == 'true'){
Line 24... Line 24...
24
		$i = 0;
24
		$i = 0;
25
		$j = -1;
25
		$j = -1;
26
		$name = $attrmap["$key"] . $i;
26
		$name = $attrmap["$key"] . $i;
27
		while(isset($$name)){
27
		while(isset($$name)){
28
			$val=$$name;
28
			$val=$$name;
29
			$val = da_sql_escape_string($link, $val);
-
 
30
			$op_name = $name . '_op';
29
			$op_name = $name . '_op';
31
			$i++;
30
			$i++;
32
			$j++;
31
			$j++;
33
			$name = $attrmap["$key"] . $i;
32
			$name = $attrmap["$key"] . $i;
34
			$sql_attr=$attrmap["$key"];
33
			$sql_attr=$attrmap["$key"];
Line 77... Line 76...
77
	//	if value is null or equals the default value then don't add it
76
	//	if value is null or equals the default value then don't add it
78
			else if (isset($default_vals["$key"]) && ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])))
77
			else if (isset($default_vals["$key"]) && ($val == '' || check_defaults($val,$op_val,$default_vals["$key"])))
79
				continue;
78
				continue;
80
	//	if value differs from the sql value then update
79
	//	if value differs from the sql value then update
81
			else{
80
			else{
82
				if (isset($item_vals["$key"][$j]) && (isset($old_val) && $old_val !='') || $sql_attr=='Filter-Id'){
81
				if (isset($item_vals["$key"][$j]) && (isset($old_val) && $old_val !='') && $sql_attr=='Filter-Id'){
83
					$old_val = $item_vals["$key"][$j];
82
					$old_val = $item_vals["$key"][$j];
84
					$old_val = da_sql_escape_string($link, $old_val);
83
					$old_val = da_sql_escape_string($link, $old_val);
85
					#we keep the fourth bit of Filter-Id to warn user about administrator who read imputability logs.
84
					// we keep the fourth bit of Filter-Id to warn user about administrator who read imputability logs.
86
                                        $val[3]=$old_val[3];
85
					$val[3] = $old_val[3];
87
					$res = da_sql_query($link,$config,
86
					$res = da_sql_query($link,$config,
88
					"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
87
					"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
89
					attribute = '$sql_attr' AND value = '$old_val';");
88
					attribute = '$sql_attr' AND value = '$old_val';");
90
				// if filter-id does not exit, we create it (ALCASAR 2.9.2 DDB)
89
				// if filter-id does not exit, we create it (ALCASAR 2.9.2 DDB)
91
					if (!$res || !da_sql_affected_rows($link,$res,$config))
90
					if (!$res || !da_sql_affected_rows($link,$res,$config))