Changeset 370 for trunk/cgi-bin


Ignore:
Timestamp:
11/27/07 12:18:27 (17 years ago)
Author:
Kris Deugau
Message:

/trunk

Merge bugfixes and enhancements from /branches/stable r351 through r359

Location:
trunk/cgi-bin
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r350 r370  
    2525        %allocated %free %routed %bigfree %IPDBacl
    2626        &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &deleteBlock
    27         &mailNotify
     27        &getBlockData &mailNotify
    2828        );
    2929
     
    3333                @masterblocks %allocated %free %routed %bigfree %IPDBacl
    3434                &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock
    35                 &deleteBlock &mailNotify
     35                &deleteBlock &getBlockData &mailNotify
    3636                )]
    3737        );
     
    492492      $msg = "Unable to deallocate $disp_alloctypes{$type} $cidr";
    493493      $sth = $dbh->prepare("update poolips set custid='6750400',available='y',".
    494         "city=(select city from allocations where cidr >>= '$cidr'),".
     494        "city=(select city from allocations where cidr >>= '$cidr'".
     495        " order by masklen(cidr) desc limit 1),".
    495496        "description='',notes='',circuitid='' where ip='$cidr'");
    496497      $sth->execute;
     
    643644
    644645
     646## IPDB::getBlockData()
     647# Return custid, type, city, and description for a block
     648sub getBlockData {
     649  my $dbh = shift;
     650  my $block = shift;
     651
     652  my $sth = $dbh->prepare("select cidr,custid,type,city,description from searchme".
     653        " where cidr='$block'");
     654  $sth->execute();
     655  return $sth->fetchrow_array();
     656} # end getBlockData()
     657
     658
    645659## IPDB::mailNotify()
    646660# Sends notification mail to recipients regarding an IPDB operation
  • trunk/cgi-bin/admin.cgi

    r348 r370  
    570570        " value='$types[0]'>$types[1]</option>\n";
    571571    }
    572     print "<option". (($data[2] eq 'in') ? ' selected' : '') .
    573         " value='in'>Internal netblock</option>\n</select></td>\n";
    574572
    575573    print qq(<td><input name=city value="$data[3]"></td>\n).
  • trunk/cgi-bin/ipdb.psql

    r347 r370  
    147147we      Dynamic WiFi block      Dynamic WiFi block      104     WL-RES  ISP-WIFI
    148148ve      Dynamic VoIP block      Dynamic VoIP block      105     DYN-VOIP        ISP
    149 li      Static IP - LAN/POP     Static LAN/POP IP       190     6750400 ISP
    150 ld      Static Pool - LAN/POP   LAN pool        191     6750400 ISP
     149li      Static IP - LAN/POP     Static LAN/POP IP       190     NOC-VPN ISP
     150li      Static IP - Management  Static management IP    191     NOC-VPN ISP
     151ld      Static Pool - LAN/POP   LAN pool        195     NOC-VPN ISP
     152ld      Static Pool - Management        Management pool 196     NOC-VPN ISP
     153in      Internal netblock       Internal netblock       199     6750400 ISP
    151154wc      Reserve for CORE/WAN blocks     CORE/WAN blocks 200     6750400 ISP
    152155pc      Reserve for dynamic-route DSL netblocks Dynamic-route netblocks 201     6750400 ISP-STATIC-DSL
     
    158161fr      Fibre   Fibre   223             ISP
    159162rm      Routing Routed netblock 500     6750400 ISP
    160 in      Internal netblock       Internal netblock       990     6750400 ISP
    161163mm      Master block    Master block    999     6750400 ISP
    162164\.
  • trunk/cgi-bin/main.cgi

    r320 r370  
    12831283  }
    12841284
     1285  # need to retrieve block data before deleting so we can notify on that
     1286  my ($cidr,$custid,$type,$city,$description) = getBlockData($ip_dbh, $webvar{block});
     1287
    12851288  my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{alloctype});
    12861289
    12871290  if ($code eq 'OK') {
    12881291    print "<div class=heading align=center>Success!  $webvar{block} deallocated.</div>\n";
    1289     syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}";
     1292    syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}".
     1293        " $custid, $city, desc='$description'";
    12901294    # Notify tech@ when a block/IP is deallocated
    12911295#    mailNotify('tech@example.com',"REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
    1292 #       "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n");
     1296#       "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n".
     1297#       "CustID: $custid\nCity: $city\nDescription: $description\n");
    12931298  } else {
    12941299    if ($webvar{alloctype} =~ /^.i$/) {
  • trunk/cgi-bin/newcity.cgi

    r214 r370  
    4040
    4141if ($webvar{pop} eq 'on') {
    42   $sth = $dbh->prepare("insert into cities values ('$webvar{city}','y')");
     42  $sth = $dbh->prepare("insert into cities (city,routing) values ('$webvar{city}','y')");
    4343} else {
    44   $sth = $dbh->prepare("insert into cities values ('$webvar{city}','n')");
     44  $sth = $dbh->prepare("insert into cities (city,routing) values ('$webvar{city}','n')");
    4545}
    4646$sth->execute;
  • trunk/cgi-bin/search.cgi

    r351 r370  
    4040my %webvar = parse_post();
    4141cleanInput(\%webvar);
     42
     43if (defined($webvar{rpp})) {
     44  ($RESULTS_PER_PAGE) = ($webvar{rpp} =~ /(\d+)/);
     45}
    4246
    4347if (!defined($webvar{stype})) {
     
    185189  } else {
    186190    # Add the limit/offset clauses
    187     $sql .= " order by cidr limit $RESULTS_PER_PAGE offset $offset";
     191    $sql .= " order by cidr";
     192    $sql .= " limit $RESULTS_PER_PAGE offset $offset" if $RESULTS_PER_PAGE != 0;
    188193    # And tell the user.
    189194    print "<div class=heading>Searching...............</div>\n";
     
    420425
    421426  # print the page thing..
    422   if ($rowCount > $RESULTS_PER_PAGE) {
     427  if ($RESULTS_PER_PAGE > 0 && $rowCount > $RESULTS_PER_PAGE) {
    423428    my $pages = ceil($rowCount/$RESULTS_PER_PAGE);
    424429    print qq(<div class="center"> Page: );
Note: See TracChangeset for help on using the changeset viewer.