Changeset 72 for trunk


Ignore:
Timestamp:
11/15/04 16:53:24 (20 years ago)
Author:
Kris Deugau
Message:

/trunk

Fixed checks for static-ip allocation types. Really. For sure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r70 r72  
    356356    # Fix up types from pools (which are single-char)
    357357    # Fixing the database would be...  painful.  :(
    358     if ($data[2] =~ /^[sdcmw]$/) {
     358    if ($data[2] =~ /^[cdsmw]$/) {
    359359      $data[2] .= 'i';
    360360    }
     
    362362        $data[1], $full_alloc_types{$data[2]}, $data[3], $data[4]);
    363363    # Allow listing of pool if desired/required.
    364     if ($data[2] =~ /^[sdcmw]p$/) {
     364    if ($data[2] =~ /^[cdsmw]p$/) {
    365365      $row[0] .= ' &nbsp; <a href="/ip/cgi-bin/main.cgi?action=listpool'.
    366366        "&pool=$data[0]\">List IPs</a>";
     
    651651        $data[3], $full_alloc_types{$data[2]}, $data[1], $data[4]);
    652652    # If the allocation is a pool, allow listing of the IPs in the pool.
    653     if ($data[2] =~ /^[sdcmw]p$/) {
     653    if ($data[2] =~ /^[cdsmw]p$/) {
    654654      $row[0] .= ' &nbsp; <a href="/ip/cgi-bin/main.cgi?action=listpool'.
    655655        "&pool=$data[0]\">List IPs</a>";
     
    814814#  + Different flavours of netblock
    815815
    816   if ($webvar{alloctype} =~ /^[scdmw]i$/) {
     816  if ($webvar{alloctype} =~ /^[cdsmw]i$/) {
    817817    my ($base,undef) = split //, $webvar{alloctype};    # split into individual chars
    818818    my $sql;
     
    870870          " a set of smaller netblocks or a single smaller netblock.";
    871871      } else {
    872         if ($webvar{alloctype} =~ /^[scdmw]p$/) {
     872        if ($webvar{alloctype} =~ /^[cdsmw]p$/) {
    873873          if (($webvar{city} !~ /^(Sudbury|North Bay)$/) && ($webvar{alloctype} eq 'dp')) {
    874874            printAndExit("You must chose Sudbury or North Bay for DSL pools."); }
     
    912912      $cidr = $subblocks[0];
    913913    }
    914   } # if ($webvar{alloctype} =~ /^[cdsm]i$/) {
     914  } # if ($webvar{alloctype} =~ /^[cdsmw]i$/)
    915915
    916916  open HTML, "../confirm.html"
     
    964964# Same ordering as confirmation page
    965965
    966   if ($webvar{alloctype} =~ /^[scdmw]i$/) {
     966  if ($webvar{alloctype} =~ /^[cdsmw]i$/) {
    967967    my ($base,$tmp) = split //, $webvar{alloctype};     # split into individual chars
    968968
     
    11141114      # special extra handling for pools.
    11151115      # Note that this must be done for ANY pool allocation!
    1116       if ( my ($pooltype) = ($webvar{alloctype} =~ /^([cdsm])p$/) ) {
     1116      if ( my ($pooltype) = ($webvar{alloctype} =~ /^([cdsmw])p$/) ) {
    11171117        # have to insert all pool IPs into poolips table as "unallocated".
    11181118        $sth = $ip_dbh->prepare("insert into poolips values ('$webvar{fullcidr}',".
     
    11581158    }
    11591159    print "<!-- [ In validateInput().  Insert customer ID cross-check here. ] -->\n";
    1160   } elsif ($webvar{alloctype} =~ /^([sdcmw]p|si|dn|dy|dc|ee|rr|ii)$/){
     1160  } elsif ($webvar{alloctype} =~ /^([cdsmw]p|si|dn|dy|dc|ee|rr|ii)$/){
    11611161    # All non-customer allocations MUST be entered with "our" customer ID.
    11621162    # I have Defined this as 6750400 for consistency.
     
    12041204
    12051205  # Postfix "i" on pool IP types
    1206   if ($data[2] =~ /^[cdsm]$/) {
     1206  if ($data[2] =~ /^[cdsmw]$/) {
    12071207    $data[2] .= "i";
    12081208  }
     
    12641264    # Relatively simple SQL transaction here.
    12651265    my $sql;
    1266     if (my $pooltype = ($webvar{alloctype} =~ /^([cdms])i$/) ) {
     1266    if (my $pooltype = ($webvar{alloctype} =~ /^([cdsmw])i$/) ) {
    12671267      $sql = "update poolips set custid='$webvar{custid}',".
    12681268        "notes='$webvar{notes}',description='$webvar{desc}' ".
     
    13441344    $desc = "N/A";
    13451345    $notes = "N/A";
    1346   } elsif ($webvar{alloctype} =~ /^[sdcmw]i$/) { # done with alloctype=rr
     1346  } elsif ($webvar{alloctype} =~ /^[cdsmw]i$/) { # done with alloctype=rr
    13471347
    13481348    # Unassigning a static IP
     
    13571357    $alloctype .="i";
    13581358
    1359   } else { # done with alloctype=[sdcmw]i
     1359  } else { # done with alloctype=[cdsmw]i
    13601360
    13611361    my $sth = $ip_dbh->prepare("select cidr,custid,type,city,description,notes from ".
     
    13811381
    13821382  # Set the warning text.
    1383   if ($alloctype =~ /^[sdcmw]p$/) {
     1383  if ($alloctype =~ /^[cdsmw]p$/) {
    13841384    $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>|;
    13851385  } else {
     
    14031403  local $ip_dbh->{RaiseError} = 1;
    14041404
    1405   if ($webvar{alloctype} =~ /^[sdcmw]i$/) {
     1405  if ($webvar{alloctype} =~ /^[cdsmw]i$/) {
    14061406
    14071407    eval {
     
    14261426    syslog "notice", "$authuser deallocated static IP $webvar{block}";
    14271427
    1428   } elsif ($webvar{alloctype} eq 'mm') { # end alloctype = [sdcmw]i
     1428  } elsif ($webvar{alloctype} eq 'mm') { # end alloctype = [cdsmw]i
    14291429
    14301430    eval {
     
    14711471        $sth->execute;
    14721472        # Special case - delete pool IPs
    1473         if ($webvar{alloctype} =~ /^[sdcmw]p$/) {
     1473        if ($webvar{alloctype} =~ /^[cdsmw]p$/) {
    14741474          # We have to delete the IPs from the pool listing.
    14751475          $sth = $ip_dbh->prepare("delete from poolips where pool='$webvar{block}'");
Note: See TracChangeset for help on using the changeset viewer.