From b8381595b279b64596e9141caf5b473364b144a4 Mon Sep 17 00:00:00 2001 From: josch Date: Sun, 6 Apr 2008 21:10:55 +0000 Subject: [PATCH] fixed dplicate tag detection git-svn-id: http://yolanda.mister-muffin.de/svn@273 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/tools/tagcloud.pl | 15 +-------------- trunk/upload.pl | 9 +++++++++ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/trunk/tools/tagcloud.pl b/trunk/tools/tagcloud.pl index bb56aca..9fdafdb 100755 --- a/trunk/tools/tagcloud.pl +++ b/trunk/tools/tagcloud.pl @@ -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}++; } } } diff --git a/trunk/upload.pl b/trunk/upload.pl index 043ee5a..85cf0be 100644 --- a/trunk/upload.pl +++ b/trunk/upload.pl @@ -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 = ();