]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 328434: Move GroupIsActive into post_bug.cgi
authormkanat%kerio.com <>
Thu, 2 Mar 2006 05:26:18 +0000 (05:26 +0000)
committermkanat%kerio.com <>
Thu, 2 Mar 2006 05:26:18 +0000 (05:26 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=wicked, a=justdave

globals.pl
post_bug.cgi

index 4f7b6e03a2bc24e2830db41181054a7411d9a798..2c7861c6b93aa742e5e18a18ebd01e36c7760b28 100644 (file)
@@ -526,20 +526,6 @@ sub GroupIdToName {
     return $name;
 }
 
-
-# Determines whether or not a group is active by checking 
-# the "isactive" column for the group in the "groups" table.
-# Note: This function selects groups by id rather than by name.
-sub GroupIsActive {
-    my ($groupid) = (@_);
-    $groupid ||= 0;
-    PushGlobalSQLState();
-    SendSQL("SELECT isactive FROM groups WHERE id=$groupid");
-    my $isactive = FetchOneColumn();
-    PopGlobalSQLState();
-    return $isactive;
-}
-
 # Determines if the given bug_status string represents an "Opened" bug.  This
 # routine ought to be parameterizable somehow, as people tend to introduce
 # new states into Bugzilla.
index 296979b79636ed7058c04e742c2bc19d6e69d458..50ef6ecefd90d04caa22eb4afb727d1adafb66fb 100755 (executable)
@@ -55,6 +55,26 @@ my $dbh = Bugzilla->dbh;
 my $template = Bugzilla->template;
 my $vars = {};
 
+######################################################################
+# Subroutines
+######################################################################
+
+# Determines whether or not a group is active by checking
+# the "isactive" column for the group in the "groups" table.
+# Note: This function selects groups by id rather than by name.
+sub GroupIsActive {
+    my ($group_id) = @_;
+    $group_id ||= 0;
+    detaint_natural($group_id);
+    my ($is_active) = Bugzilla->dbh->selectrow_array(
+        "SELECT isactive FROM groups WHERE id = ?", undef, $group_id);
+    return $is_active;
+}
+
+######################################################################
+# Main Script
+######################################################################
+
 # do a match on the fields if applicable
 
 &Bugzilla::User::match_field ($cgi, {