Changeset 97


Ignore:
Timestamp:
12/02/04 15:48:33 (19 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Backported pool/static type checks from /trunk r72

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/main.cgi

    r91 r97  
    371371    # Fix up types from pools (which are single-char)
    372372    # Fixing the database would be...  painful.  :(
    373     if ($data[2] =~ /^[sdcmw]$/) {
     373    if ($data[2] =~ /^[cdsmw]$/) {
    374374      $data[2] .= 'i';
    375375    }
     
    377377        $data[1], $full_alloc_types{$data[2]}, $data[3], $data[4]);
    378378    # Allow listing of pool if desired/required.
    379     if ($data[2] =~ /^[sdcmw]p$/) {
     379    if ($data[2] =~ /^[cdsmw]p$/) {
    380380      $row[0] .= ' &nbsp; <a href="/ip/cgi-bin/main.cgi?action=listpool'.
    381381        "&pool=$data[0]\">List IPs</a>";
     
    666666        $data[3], $full_alloc_types{$data[2]}, $data[1], $data[4]);
    667667    # If the allocation is a pool, allow listing of the IPs in the pool.
    668     if ($data[2] =~ /^[sdcmw]p$/) {
     668    if ($data[2] =~ /^[cdsmw]p$/) {
    669669      $row[0] .= ' &nbsp; <a href="/ip/cgi-bin/main.cgi?action=listpool'.
    670670        "&pool=$data[0]\">List IPs</a>";
     
    839839#  + Different flavours of netblock
    840840
    841   if ($webvar{alloctype} =~ /^[scdmw]i$/) {
     841  if ($webvar{alloctype} =~ /^[cdsmw]i$/) {
    842842    my ($base,undef) = split //, $webvar{alloctype};    # split into individual chars
    843843    my $sql;
     
    898898          " a set of smaller netblocks or a single smaller netblock.";
    899899      } else {
    900         if ($webvar{alloctype} =~ /^[scdmw]p$/) {
     900        if ($webvar{alloctype} =~ /^[cdsmw]p$/) {
    901901          if (($webvar{city} !~ /^(Sudbury|North Bay)$/) && ($webvar{alloctype} eq 'dp')) {
    902902            printAndExit("You must chose Sudbury or North Bay for DSL pools."); }
     
    940940      $cidr = $subblocks[0];
    941941    }
    942   } # if ($webvar{alloctype} =~ /^[cdsm]i$/) {
     942  } # if ($webvar{alloctype} =~ /^[cdsmw]i$/)
    943943
    944944  open HTML, "../confirm.html"
     
    995995# Same ordering as confirmation page
    996996
    997   if ($webvar{alloctype} =~ /^[cdsm]i$/) {
     997  if ($webvar{alloctype} =~ /^[cdsmw]i$/) {
    998998    my ($base,$tmp) = split //, $webvar{alloctype};     # split into individual chars
    999999
     
    11461146      # special extra handling for pools.
    11471147      # Note that this must be done for ANY pool allocation!
    1148       if ( my ($pooltype) = ($webvar{alloctype} =~ /^([cdsm])p$/) ) {
     1148      if ( my ($pooltype) = ($webvar{alloctype} =~ /^([cdsmw])p$/) ) {
    11491149        # have to insert all pool IPs into poolips table as "unallocated".
    11501150        $sth = $ip_dbh->prepare("insert into poolips values ('$webvar{fullcidr}',".
     
    12011201    }
    12021202#    print "<!-- [ In validateInput().  Insert customer ID cross-check here. ] -->\n";
    1203   } elsif ($webvar{alloctype} =~ /^([sdcmw]p|si|dn|dy|dc|ee|rr|ii)$/){
     1203  } elsif ($webvar{alloctype} =~ /^([cdsmw]p|si|dn|dy|dc|ee|rr|ii)$/){
    12041204    # All non-customer allocations MUST be entered with "our" customer ID.
    12051205    # I have Defined this as 6750400 for consistency.
     
    12501250
    12511251  # Postfix "i" on pool IP types
    1252   if ($data[2] =~ /^[cdsm]$/) {
     1252  if ($data[2] =~ /^[cdsmw]$/) {
    12531253    $data[2] .= "i";
    12541254  }
     
    13121312    # Relatively simple SQL transaction here.
    13131313    my $sql;
    1314     if (my $pooltype = ($webvar{alloctype} =~ /^([cdms])i$/) ) {
     1314    if (my $pooltype = ($webvar{alloctype} =~ /^([cdsmw])i$/) ) {
    13151315      $sql = "update poolips set custid='$webvar{custid}',notes='$webvar{notes}',".
    13161316        "circuitid='$webvar{circid}',description='$webvar{desc}' ".
     
    13991399    $desc = "N/A";
    14001400    $notes = "N/A";
    1401   } elsif ($webvar{alloctype} =~ /^[sdcmw]i$/) { # done with alloctype=rr
     1401  } elsif ($webvar{alloctype} =~ /^[cdsmw]i$/) { # done with alloctype=rr
    14021402
    14031403    # Unassigning a static IP
     
    14121412    $alloctype .="i";
    14131413
    1414   } else { # done with alloctype=[sdcmw]i
     1414  } else { # done with alloctype=[cdsmw]i
    14151415
    14161416    my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes from ".
     
    14371437
    14381438  # Set the warning text.
    1439   if ($alloctype =~ /^[sdcmw]p$/) {
     1439  if ($alloctype =~ /^[cdsmw]p$/) {
    14401440    $html =~ s|<!--warn-->|<tr bgcolor="black"><td colspan="2"><div class="red">Warning: clicking confirm will remove this record entirely.<br>Any IPs allocated from this pool will also be removed!</div></td></tr>|;
    14411441  } else {
     
    14591459  local $ip_dbh->{RaiseError} = 1;
    14601460
    1461   if ($webvar{alloctype} =~ /^[sdcmw]i$/) {
     1461  if ($webvar{alloctype} =~ /^[cdsmw]i$/) {
    14621462
    14631463    eval {
     
    14821482    syslog "notice", "$authuser deallocated static IP $webvar{block}";
    14831483
    1484   } elsif ($webvar{alloctype} eq 'mm') { # end alloctype = [sdcmw]i
     1484  } elsif ($webvar{alloctype} eq 'mm') { # end alloctype = [cdsmw]i
    14851485
    14861486    eval {
     
    15271527        $sth->execute;
    15281528        # Special case - delete pool IPs
    1529         if ($webvar{alloctype} =~ /^[sdcmw]p$/) {
     1529        if ($webvar{alloctype} =~ /^[cdsmw]p$/) {
    15301530          # We have to delete the IPs from the pool listing.
    15311531          $sth = $ip_dbh->prepare("delete from poolips where pool='$webvar{block}'");
Note: See TracChangeset for help on using the changeset viewer.