From: Sam H. <sh...@ma...> - 2004-12-21 18:05:27
|
On Dec 21, 2004, at 10:29 AM, Robert Van Dam via activitymail wrote: > * Searching on any user data field > @@ -592,6 +614,17 @@ > } elsif ($scope eq "selected") { > $result = "showing selected users"; > $self->{visibleUserIDs} = $genericParams->{selected_users}; # an > arrayref > + } elsif ($scope eq "match_regex") { > + $result = "showing matching users"; > + my $regex = $actionParams->{"action.filter.user_ids"}->[0]; > + my $field = $actionParams->{"action.filter.field"}->[0]; > + my @userRecords = $db->getUsers(@{$self->{allUserIDs}}); > + my @userIDs; > + foreach my $record (@userRecords) { > + next unless $record; > + push @userIDs, $record->user_id if $record->{$field} =~ /^$regex/i; > + } > + $self->{visibleUserIDs} = \@userIDs; > } elsif ($scope eq "match_ids") { > my @userIDs = split /\s*,\s*/, > $actionParams->{"action.filter.user_ids"}->[0]; > $self->{visibleUserIDs} = \@userIDs; You'll want to check $regex for (?{...}) and (??{...}) to prevent users from executing arbitrary perl code. See Camel, 3rd ed., p. 160. -sam |