Fix cat_id select, and ldap filter

This commit is contained in:
Miles Lott 2001-03-29 16:07:34 +00:00
parent c4ebab9d28
commit a031515dbe
2 changed files with 8 additions and 21 deletions

View File

@ -174,40 +174,27 @@
$match = 0; $match = 0;
if($DEBUG) { echo "<br>"; } if($DEBUG) { echo "<br>"; }
for($i=0;$i<count($ldap_fields);$i++) { for($i=0;$i<count($ldap_fields);$i++) {
$matched = ""; $yes = True;
$allmatched = False;
reset($filterfields);
reset($filterfields);
while (list($col,$filt) = each($filterfields)) while (list($col,$filt) = each($filterfields))
{ {
if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$filt.'"'; } if($DEBUG) { echo '&nbsp;&nbsp;Testing "'.$col.'" for "'.$filt.'"'; }
if ($ldap_fields[$i][$col][0] == $filt) if ($ldap_fields[$i][$col][0] == $filt)
{ {
if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."&nbsp;&nbsp;"; } if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."&nbsp;&nbsp;"; }
$matched[$col] = True; $yes &= True;
$match++; $match++;
} }
else else
{ {
$matched[$col] = False;
if($DEBUG) { echo ', but number '.$ldap_fields[$i]["uidnumber"][0].' did not match.'."&nbsp;&nbsp;"; } if($DEBUG) { echo ', but number '.$ldap_fields[$i]["uidnumber"][0].' did not match.'."&nbsp;&nbsp;"; }
$yes &= False;
$match--; $match--;
} }
while (list($colmatch) = each($matched))
{
if ($matched[$col])
{
$allmatched = True;
}
else
{
$allmatched = False;
}
}
} }
if ($allmatched) if ($yes)
{ {
if($DEBUG) { echo $ldap_fields[$i]["uidnumber"][0].' matched all!'."<br>"; } if($DEBUG) { echo $ldap_fields[$i]["uidnumber"][0].' matched all!'."<br>"; }
$new_ldap[] = $ldap_fields[$i]; $new_ldap[] = $ldap_fields[$i];

View File

@ -109,19 +109,19 @@
if (!$filter) { $filter = "none"; } if (!$filter) { $filter = "none"; }
if ($filter == "none") { if ($filter == "none") {
if ($cat_id == "all") { if (!$cat_id) {
$qfilter = 'tid=n'; $qfilter = 'tid=n';
} else { } else {
$qfilter = 'tid=n,cat_id='.$cat_id; $qfilter = 'tid=n,cat_id='.$cat_id;
} }
} elseif($filter == "private") { } elseif($filter == "private") {
if ($cat_id == "all") { if (!$cat_id) {
$qfilter = 'tid=n,access=private,owner='.$phpgw_info["user"]["account_id"]; $qfilter = 'tid=n,access=private,owner='.$phpgw_info["user"]["account_id"];
} else { } else {
$qfilter = 'tid=n,access=private,owner='.$phpgw_info["user"]["account_id"].',cat_id='.$cat_id; $qfilter = 'tid=n,access=private,owner='.$phpgw_info["user"]["account_id"].',cat_id='.$cat_id;
} }
} else { } else {
if ($cat_id == "all") { if (!$cat_id) {
$qfilter = 'tid=n,owner='.$filter; $qfilter = 'tid=n,owner='.$filter;
} else { } else {
$qfilter = 'tid=n,owner='.$filter.'cat_id='.$cat_id; $qfilter = 'tid=n,owner='.$filter.'cat_id='.$cat_id;