fixed dplicate tag detection

git-svn-id: http://yolanda.mister-muffin.de/svn@273 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2008-04-06 21:10:55 +00:00
parent fa1b8fb203
commit b8381595b2
2 changed files with 10 additions and 14 deletions

View file

@ -22,20 +22,7 @@ while(($subject) = $sth->fetchrow_array())
$val =~ s/^\s*(.*?)\s*$/$1/;
if(length($val) >= 4)
{
#check if some clever guy has written a tag multiple times
$found = 0;
foreach my $tmpval (@subject)
{
if($val eq $tmpval)
{
$found = 1;
}
}
#only add tag if it is not been entered twice or more
if(!$found)
{
%hash->{$val}++;
}
%hash->{$val}++;
}
}
}

View file

@ -25,6 +25,15 @@ if($userinfo->{'username'})
{
if($query->param('DC.Title')&&$query->param('DC.Subject')&&$query->param('DC.Description'))
{
#remove duplicates from tags
@subject = split(' ', $query->param('DC.Subject'));
@unique{ @subject } = ();
foreach $tag (keys %unique)
{
$subject.=$tag." ";
}
$page->{'uploadform'}->{'DC.Subject'} = $ubject;
$page->{'innerresults'} = [''];
my @args = ();