Index: /trunk/DNSDB.pm
===================================================================
--- /trunk/DNSDB.pm	(revision 475)
+++ /trunk/DNSDB.pm	(revision 476)
@@ -1746,5 +1746,6 @@
 # Takes a database handle, entity type, entity ID, and new group ID
 sub changeGroup {
-  my $dbh = shift;
+  my $self = shift;
+  my $dbh = $self->{dbh};
   my $type = shift;
   my $id = shift;
@@ -2328,5 +2329,6 @@
 sub addGroup {
   $errstr = '';
-  my $dbh = shift;
+  my $self = shift;
+  my $dbh = $self->{dbh};
   my $groupname = shift;
   my $pargroup = shift;
@@ -2428,5 +2430,6 @@
 # Returns a status code and message
 sub delGroup {
-  my $dbh = shift;
+  my $self = shift;
+  my $dbh = $self->{dbh};
   my $groupid = shift;
 
@@ -2494,5 +2497,6 @@
 sub getChildren {
   $errstr = '';
-  my $dbh = shift;
+  my $self = shift;
+  my $dbh = $self->{dbh};
   my $rootgroup = shift;
   my $groupdest = shift;
@@ -2515,5 +2519,5 @@
     while (my ($group) = $sth->fetchrow_array) {
       push @$groupdest, $group;
-      getChildren($dbh,$group,$groupdest) if $immed eq 'all';
+      $self->getChildren($group, $groupdest) if $immed eq 'all';
     }
   }
@@ -2546,5 +2550,6 @@
 # Returns an integer count of the resulting group list.
 sub getGroupCount {
-  my $dbh = shift;
+  my $self = shift;
+  my $dbh = $self->{dbh};
 
   my %args = @_;
@@ -2571,5 +2576,6 @@
 # Returns an arrayref containing hashrefs suitable for feeding straight to HTML::Template
 sub getGroupList {
-  my $dbh = shift;
+  my $self = shift;
+  my $dbh = $self->{dbh};
 
   my %args = @_;
Index: /trunk/dns-rpc.cgi
===================================================================
--- /trunk/dns-rpc.cgi	(revision 475)
+++ /trunk/dns-rpc.cgi	(revision 476)
@@ -200,5 +200,5 @@
 	};
 ## optional $inhert arg?
-  my ($code,$msg) = DNSDB::addGroup($dbh, $args{groupname}, $args{parent_id}, $perms);
+  my ($code,$msg) = $dnsdb->addGroup($args{groupname}, $args{parent_id}, $perms);
   die $msg if $code eq 'FAIL';
   return $msg;
@@ -214,9 +214,9 @@
   # Let's be nice;  delete based on groupid OR group name.  Saves an RPC call round-trip, maybe.
   if ($args{group} =~ /^\d+$/) {
-    ($code,$msg) = DNSDB::delGroup($dbh, $args{group});
+    ($code,$msg) = $dnsdb->delGroup($args{group});
   } else {
     my $grpid = DNSDB::groupID($dbh, $args{group});
     die "Can't find group\n" if !$grpid;
-    ($code,$msg) = DNSDB::delGroup($dbh, $grpid);
+    ($code,$msg) = $dnsdb->delGroup($grpid);
   }
   die $msg if $code eq 'FAIL';
Index: /trunk/dns.cgi
===================================================================
--- /trunk/dns.cgi	(revision 475)
+++ /trunk/dns.cgi	(revision 476)
@@ -874,5 +874,5 @@
     # https://secure.deepnet.cx/trac/dnsadmin/ticket/8 for the UI enhancement
     # that will make this variable.
-    my ($code,$msg) = addGroup($dbh, $webvar{newgroup}, $webvar{pargroup}, \%newperms, 1);
+    my ($code,$msg) = $dnsdb->addGroup($webvar{newgroup}, $webvar{pargroup}, \%newperms, 1);
     if ($code eq 'OK') {
       if ($alterperms) {
@@ -917,5 +917,5 @@
 
   } elsif ($webvar{del} eq 'ok') {
-    my ($code,$msg) = delGroup($dbh, $webvar{id});
+    my ($code,$msg) = $dnsdb->delGroup($webvar{id});
     if ($code eq 'OK') {
 ##fixme: need to clean up log when deleting a major container
@@ -1060,5 +1060,5 @@
     # Do the $webvar{bulkaction}
     my ($code, $msg);
-    ($code, $msg) = changeGroup($dbh, 'domain', $webvar{$_}, $webvar{destgroup})
+    ($code, $msg) = $dnsdb->changeGroup('domain', $webvar{$_}, $webvar{destgroup})
 	if $webvar{bulkaction} eq 'move';
     if ($webvar{bulkaction} eq 'deactivate' || $webvar{bulkaction} eq 'activate') {
@@ -1766,5 +1766,5 @@
 
   my $grptree = HTML::Template->new(filename => 'templates/grptree.tmpl');
-  getChildren($dbh,$root,\@childlist,'immediate');
+  $dnsdb->getChildren($root, \@childlist, 'immediate');
   return if $#childlist == -1;
   my @grouplist;
@@ -2032,5 +2032,5 @@
 
   my @childgroups;
-  getChildren($dbh, $curgroup, \@childgroups, 'all') if $searchsubs;
+  $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs;
   my $childlist = join(',',@childgroups);
 
@@ -2090,9 +2090,9 @@
 
   my @childgroups;
-  getChildren($dbh, $curgroup, \@childgroups, 'all') if $searchsubs;
+  $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs;
   my $childlist = join(',',@childgroups);
 
-  my ($count) = getGroupCount($dbh, (childlist => $childlist, curgroup => $curgroup,
-        filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ) );
+  my ($count) = $dnsdb->getGroupCount(childlist => $childlist, curgroup => $curgroup,
+        filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) );
 
 # fill page count and first-previous-next-last-all bits
@@ -2125,7 +2125,7 @@
   $sortby = 'g2.group_name' if $sortby eq 'parent';
 
-  my $glist = getGroupList($dbh, (childlist => $childlist, curgroup => $curgroup,
+  my $glist = $dnsdb->getGroupList(childlist => $childlist, curgroup => $curgroup,
 	filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef),
-	offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder) );
+	offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder);
 
   $page->param(grouptable => $glist);
@@ -2145,5 +2145,5 @@
 
     my @childlist;
-    getChildren($dbh,$root,\@childlist,'immediate');
+    $dnsdb->getChildren($root, \@childlist, 'immediate');
     return if $#childlist == -1;
     foreach (@childlist) {
@@ -2188,5 +2188,5 @@
 
   my @childgroups;
-  getChildren($dbh, $curgroup, \@childgroups, 'all') if $searchsubs;
+  $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs;
   my $childlist = join(',',@childgroups);
 
@@ -2235,5 +2235,5 @@
 
   my @childgroups;
-  getChildren($dbh, $curgroup, \@childgroups, 'all') if $searchsubs;
+  $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs;
   my $childlist = join(',',@childgroups);
 
