Changeset 593 for branches/stable/cgi-bin/IPDB.pm
- Timestamp:
- 05/14/13 18:10:22 (11 years ago)
- Location:
- branches/stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable
- Property svn:mergeinfo changed
/branches/htmlform (added) merged: 446-451,456-461,463-484,487-505,511-514,516 /trunk merged: 517
- Property svn:mergeinfo changed
-
branches/stable/cgi-bin/IPDB.pm
r592 r593 24 24 @EXPORT_OK = qw( 25 25 %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist @masterblocks 26 %allocated %free %routed %bigfree %IPDBacl 26 %allocated %free %routed %bigfree %IPDBacl %aclmsg 27 27 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &addMaster 28 28 &deleteBlock &getBlockData &mailNotify … … 32 32 %EXPORT_TAGS = ( ALL => [qw( 33 33 %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist 34 @masterblocks %allocated %free %routed %bigfree %IPDBacl 34 @masterblocks %allocated %free %routed %bigfree %IPDBacl %aclmsg 35 35 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock 36 36 &addMaster &deleteBlock &getBlockData &mailNotify … … 52 52 our %bigfree; 53 53 our %IPDBacl; 54 55 # mapping table for functional-area => error message 56 our %aclmsg = ( 57 addmaster => 'add a master block', 58 addblock => 'add an allocation', 59 updateblock => 'update a block', 60 delblock => 'delete an allocation', 61 ); 54 62 55 63 our $org_name = 'Example Corp'; … … 126 134 } 127 135 136 ##fixme: initialize HTML::Template env var for template path 137 # something like $self->path().'/templates' ? 138 # $ENV{HTML_TEMPLATE_ROOT} = 'foo/bar'; 139 128 140 return (1,"OK"); 129 141 } # end initIPDBGlobals … … 174 186 sub finish { 175 187 my $dbh = $_[0]; 176 $dbh->disconnect ;188 $dbh->disconnect if $dbh; 177 189 } # end finish 178 190 … … 360 372 } 361 373 362 $sth = $dbh->prepare("update poolips set custid='$custid',". 363 "city='$city',available='n',description='$desc',notes='$notes',". 364 "circuitid='$circid',privdata='$privdata'". 365 " where ip='$cidr'"); 366 $sth->execute; 374 $sth = $dbh->prepare("update poolips set custid=?,city=?,". 375 "available='n',description=?,notes=?,circuitid=?,privdata=?". 376 " where ip=?"); 377 $sth->execute($custid, $city, $desc, $notes, $circid, $privdata, "$cidr"); 367 378 # node hack 368 379 if ($nodeid && $nodeid ne '') { … … 413 424 $sth = $dbh->prepare("insert into allocations". 414 425 " (cidr,custid,type,city,description,notes,maskbits,circuitid,privdata)". 415 " values ('$cidr','$custid','$type','$city',?,?,". 416 $cidr->masklen.",?,?)"); 417 $sth->execute($desc,$notes,$circid,$privdata); 426 " values (?,?,?,?,?,?,?,?,?)"); 427 $sth->execute("$cidr", $custid, $type, $city, $desc, $notes, $cidr->masklen, $circid, $privdata); 418 428 419 429 # And initialize the pool, if necessary … … 527 537 $sth = $dbh->prepare("insert into allocations (cidr,custid,type,city,". 528 538 "description,notes,maskbits,circuitid,privdata)". 529 " values ('$cidr','$custid','$type','$city',?,?,". 530 $cidr->masklen.",?,?)"); 531 $sth->execute($desc,$notes,$circid,$privdata); 539 " values (?,?,?,?,?,?,?,?,?)"); 540 $sth->execute("$cidr", $custid, $type, $city, $desc, $notes, $cidr->masklen, $circid, $privdata); 532 541 533 542 # And initialize the pool, if necessary … … 653 662 eval { 654 663 $msg = "Unable to deallocate $disp_alloctypes{$type} $cidr"; 655 $sth = $dbh->prepare("update poolips set custid= '$defcustid',available='y',".656 "city=(select city from allocations where cidr >>= '$cidr'".664 $sth = $dbh->prepare("update poolips set custid=?,available='y',". 665 "city=(select city from allocations where cidr >>= ?". 657 666 " order by masklen(cidr) desc limit 1),". 658 "description='',notes='',circuitid='' where ip= '$cidr'");659 $sth->execute ;667 "description='',notes='',circuitid='' where ip=?"); 668 $sth->execute($defcustid, "$cidr", "$cidr"); 660 669 $dbh->commit; 661 670 };
Note:
See TracChangeset
for help on using the changeset viewer.