From e0a88beb706616756e3972bfd2719768b17d186c Mon Sep 17 00:00:00 2001 From: josch Date: Wed, 9 Apr 2008 13:23:12 +0000 Subject: [PATCH] check for min tag length on upload git-svn-id: http://yolanda.mister-muffin.de/svn@287 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/tools/tagcloud.pl | 2 +- trunk/upload.pl | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/trunk/tools/tagcloud.pl b/trunk/tools/tagcloud.pl index 9fdafdb..367b719 100755 --- a/trunk/tools/tagcloud.pl +++ b/trunk/tools/tagcloud.pl @@ -20,7 +20,7 @@ while(($subject) = $sth->fetchrow_array()) { #strip whitespaces $val =~ s/^\s*(.*?)\s*$/$1/; - if(length($val) >= 4) + if(length($val) >= 3) { %hash->{$val}++; } diff --git a/trunk/upload.pl b/trunk/upload.pl index cd7e813..0fa25e5 100644 --- a/trunk/upload.pl +++ b/trunk/upload.pl @@ -23,17 +23,21 @@ if($userinfo->{'username'}) if($query->param('2')) { - 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) { - #remove duplicates from tags - @subject = split(' ', $query->param('DC.Subject')); - @unique{ @subject } = (); - foreach $tag (keys %unique) + if(length($tag) >= 3) { $subject.=$tag." "; } - $page->{'uploadform'}->{'DC.Subject'} = $subject; - + } + $subject =~ s/\s*$//; + $page->{'uploadform'}->{'DC.Subject'} = $subject; + + if($query->param('DC.Title')&&$query->param('DC.Subject')&&$query->param('DC.Description')) + { $page->{'innerresults'} = ['']; my @args = ();