ispman/lib/ISPMan DomainMan.pm,1.61,1.62

Joerg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30066/lib/ISPMan

Modified Files:
	DomainMan.pm 
Log Message:
some reformating/commenting
reactivated logic for "create default www vhost" and "create mail a-record"

Index: DomainMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/DomainMan.pm,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- DomainMan.pm	1 May 2004 10:06:18 -0000	1.61
+++ DomainMan.pm	1 May 2004 18:13:31 -0000	1.62
@@ -114,7 +114,7 @@
 
 sub addDomain {
    my $self=shift;
-   my $r=shift;               
+   my $r=shift;
    my $domaintype=lc($r->param("ispmanDomainType"));
    my $domain=lc($r->param("ispmanDomain"));
    $domain=~s/\s//g; # remove all spaces
@@ -123,23 +123,20 @@
    # reset $r->param("domain") for backword compatibility.
    $r->param("domain", $domain);
 
-
-
+   # set reseller/client ids
    if ($self->{'session'}) {
-      if ($self->{'session'}->param("logintype") eq "reseller") {
-         $r->param("ispmanResellerId", $self->{'session'}->param("ispmanResellerId"));
-      } elsif ($self->{'session'}->param("logintype") eq "client") {
-         $r->param("ispmanResellerId", $self->{'session'}->param("ispmanResellerId"));
-         $r->param("ispmanClientId", $self->{'session'}->param("ispmanClientId"));
-      } else {
-      }
+     if ($self->{'session'}->param("logintype") eq "reseller") {
+       $r->param("ispmanResellerId", $self->{'session'}->param("ispmanResellerId"));
+     } elsif ($self->{'session'}->param("logintype") eq "client") {
+       $r->param("ispmanResellerId", $self->{'session'}->param("ispmanResellerId"));
+       $r->param("ispmanClientId", $self->{'session'}->param("ispmanClientId"));
+     }
    }
-   
 
+   # load common domain template
    $self->addDataFromLdif("templates/domain.common.ldif.template", $r);
 
-
-
+   # which templates are needed for what domain types
    my $ou={
          'primary' => ["dnszone"],
          'slave'   => [],
@@ -147,20 +144,11 @@
          'replica' => [],
       };
 
+   # load all needed templates
    for $ou (@{$ou->{$domaintype}}){
       $self->addDataFromLdif("templates/domain.$ou.ldif.template", $r);
    }
 
-   if ($r->param("createArecordForMail") && $r->param("ispmanDomainDefaultMailDropHost")) {
-      $self->newDNSRecord($r->param("ispmanDomain"), "aRecord", "mail", $self->getHostIp($r->param("ispmanDomainDefaultMailDropHost")));
-   }
-   
-   # create default vhost for domain
-   if ($r->param("createVhost") eq "true" && $r->param("ispmanDomainDefaultWebHost")) {
-      $r->param("ispmanVhostName", "www");
-      $self->addVhost($r);
-   }
-   
    return;
 }
 
@@ -210,14 +198,12 @@
 sub addNewDomain {
    my $self=shift;
    my $r=shift;
-   
+
    my $domain=lc($r->param("ispmanDomain"));
    $domain=~s/\s//g; # remove all spaces
    # reset $r->param("ispmanDomain")
    $r->param("ispmanDomain", $domain);
-   # reset $r->param("domain") for backword compatibility.
-   $r->param("domain", $domain);
-   
+
    # do some checks for resellers/clients
    if ($self->{'session'} && $self->{'session'}->param("logintype") =~m/reseller|client/ ) {
        # check if reseller/client has reached domain limit
@@ -230,24 +216,34 @@
 	   print $self->{'message'};
 	   return;
        }
-       
+
        # check if homeDirectory lies in defaultHomeDirectoryPath
        my $defaultHomeDirectoryPath=$self->getConf("defaultHomeDirectoryPath");
        if ($r->param("homeDirectory")!~m/^$defaultHomeDirectoryPath/) {
 	   print "Add Domain aborted!\nHomeDirectory must be subdir of $defaultHomeDirectoryPath.\n";
 	   return;
        }
-       
    }
-   
-   
+
    return if $self->domainExists($r->param("ispmanDomain"));
 
-   $self->addDomain($r, $self->{'Config'});
+   $self->addDomain($r);
+
+
+   # create default a-record for mail
+   $self->log_event("createArecordForMail=" . $r->param("createArecordForMail") . "\n");
+   if ($r->param("createArecordForMail") && $r->param("ispmanDomainDefaultMailDropHost")) {
+     $self->newDNSRecord($r->param("ispmanDomain"), "aRecord", "mail", $self->getHostIp($r->param("ispmanDomainDefaultMailDropHost")));
+   }
+
+   # create default vhost for domain
+   $self->log_event("createVhost=" . $r->param("createVhost") . "\n");
+   if ($r->param("createVhost") && $r->param("ispmanDomainDefaultWebHost")) {
+     $r->param("ispmanVhostName", "www");
+     $self->addVhost($r);
+   }
 
-   #Lets put processes that should take place after entry is added to the LDAP server
    # create directories for this domain
-   
    if ($r->param("ispmanDomainType") eq "replica") {
       # Add entry for canonical map
       $self->addDomainSMTPProcess($r->param("ispmanDomain"), "AddCanonicalMapEntry", $r->param("ispmanReplicaMaster"));



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.