]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 283924: Move ValidateComment out of CGI.pl
authormkanat%kerio.com <>
Mon, 7 Mar 2005 21:55:33 +0000 (21:55 +0000)
committermkanat%kerio.com <>
Mon, 7 Mar 2005 21:55:33 +0000 (21:55 +0000)
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=LpSolit, a=justdave

Bugzilla/Bug.pm
CGI.pl
attachment.cgi

index b2261e1ee18b9dd4f68782705b9ac573d087e0f9..b9229d98e7f5af8f023a5a491c9806ed51836d05 100755 (executable)
@@ -44,6 +44,13 @@ use Bugzilla::User;
 use Bugzilla::Util;
 use Bugzilla::Error;
 
+use base qw(Exporter);
+@Bugzilla::Bug::EXPORT = qw(
+    ValidateComment
+);
+
+use constant MAX_COMMENT_LENGTH => 65535;
+
 sub fields {
     # Keep this ordering in sync with bugzilla.dtd
     my @fields = qw(bug_id alias creation_ts short_desc delta_ts
@@ -585,6 +592,14 @@ sub CountOpenDependencies {
     return @dependencies;
 }
 
+sub ValidateComment ($) {
+    my ($comment) = @_;
+
+    if (defined($comment) && length($comment) > MAX_COMMENT_LENGTH) {
+        ThrowUserError("comment_too_long");
+    }
+}
+
 sub AUTOLOAD {
   use vars qw($AUTOLOAD);
   my $attr = $AUTOLOAD;
diff --git a/CGI.pl b/CGI.pl
index d650ea08ed807c14aeb1b259274a058da7052deb..652d6c03b478cc07be9f940edb43851386a83e21 100644 (file)
--- a/CGI.pl
+++ b/CGI.pl
@@ -188,16 +188,6 @@ sub ValidateBugID {
     }
 }
 
-sub ValidateComment {
-    # Make sure a comment is not too large (greater than 64K).
-    
-    my ($comment) = @_;
-    
-    if (defined($comment) && length($comment) > 65535) {
-        ThrowUserError("comment_too_long");
-    }
-}
-
 sub PasswordForLogin {
     my ($login) = (@_);
     SendSQL("select cryptpassword from profiles where login_name = " .
index 92d127e1a1977dea36a9463fa31f1d11fdd8b91f..64e30f64a7f8b0b7b727be2ec5744ea57e957818 100755 (executable)
@@ -48,6 +48,7 @@ use Bugzilla::Flag;
 use Bugzilla::FlagType; 
 use Bugzilla::User;
 use Bugzilla::Util;
+use Bugzilla::Bug;
 
 # Check whether or not the user is logged in and, if so, set the $::userid 
 Bugzilla->login();