Changeset 592 for branches/stable/cgi-bin
- Timestamp:
- 05/14/13 17:45:17 (12 years ago)
- Location:
- branches/stable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable
- Property svn:mergeinfo changed
/trunk merged: 452-455,462,485-486,515
- Property svn:mergeinfo changed
-
branches/stable/cgi-bin/IPDB.pm
r550 r592 321 321 my $alloc_from = new NetAddr::IP $_[2]; 322 322 my $sth; 323 324 $desc = '' if !$desc; 325 $notes = '' if !$notes; 326 $circid = '' if !$circid; 327 $privdata = '' if !$privdata; 323 328 324 329 # Snag the "type" of the freeblock (alloc_from) "just in case" … … 591 596 # have to insert all pool IPs into poolips table as "unallocated". 592 597 $sth = $dbh->prepare("insert into poolips (pool,ip,custid,city,type)". 593 " values ('$pool', ?, '$defcustid', '$city', '$type')");598 " values ('$pool', ?, '$defcustid', ?, '$type')"); 594 599 my @poolip_list = $pool->hostenum; 595 600 if ($class eq 'all') { # (DSL-ish block - *all* IPs available 596 601 if ($pool->addr !~ /\.0$/) { # .0 causes weirdness. 597 $sth->execute($pool->addr );602 $sth->execute($pool->addr, $city); 598 603 } 599 604 for (my $i=0; $i<=$#poolip_list; $i++) { 600 $sth->execute($poolip_list[$i]->addr );605 $sth->execute($poolip_list[$i]->addr, $city); 601 606 } 602 607 $pool--; 603 608 if ($pool->addr !~ /\.255$/) { # .255 can cause weirdness. 604 $sth->execute($pool->addr );609 $sth->execute($pool->addr, $city); 605 610 } 606 611 } else { # (real netblock) 607 612 for (my $i=1; $i<=$#poolip_list; $i++) { 608 $sth->execute($poolip_list[$i]->addr );613 $sth->execute($poolip_list[$i]->addr, $city); 609 614 } 610 615 } 611 616 }; 612 617 if ($@) { 613 $msg = "'".$sth->errstr."'";618 $msg = $@." '".$sth->errstr."'"; 614 619 eval { $dbh->rollback; }; 615 620 return ('FAIL',$msg); … … 847 852 my ($action,$subj,$message) = @_; 848 853 849 return if $ domain eq 'example.com'; # no point being obnoxious if we're still stuck with defaults.854 return if $smtphost eq 'smtp.example.com'; # do nothing if still using default SMTP host. 850 855 851 856 ##fixme: need to redesign the breakdown/processing for $action for proper handling of all cases -
branches/stable/cgi-bin/admin.cgi
r507 r592 17 17 use DBI; 18 18 use CommonWeb qw(:ALL); 19 use CustIDCK;20 19 #use POSIX qw(ceil); 21 20 use NetAddr::IP; … … 26 25 ##uselib## 27 26 27 use CustIDCK; 28 28 use MyIPDB; 29 29 … … 254 254 syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ". 255 255 "'$webvar{alloctype}'"; 256 mailNotify($ip_dbh, "a$webvar{alloctype}", 257 "$disp_alloctypes{$webvar{alloctype}} $webvar{cidr} allocated to customer". 258 " $webvar{custid}\n". 256 mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation", 257 "$disp_alloctypes{$webvar{alloctype}} $webvar{cidr} allocated to customer $webvar{custid}\n". 259 258 "Description: $webvar{desc}\n\nAllocated by: $authuser\n"); 260 259 } -
branches/stable/cgi-bin/ipdb.psql
r507 r592 47 47 "pool" cidr DEFAULT '255.255.255.255/32' NOT NULL, 48 48 "ip" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY, 49 "oldcustid" character varying(16) DEFAULT '' NOT NULL,50 49 "city" character varying(30) DEFAULT '' NOT NULL, 51 50 "type" character(2) DEFAULT '' NOT NULL, … … 63 62 CREATE TABLE "allocations" ( 64 63 "cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY, 65 "oldcustid" character varying(16) DEFAULT '',66 64 "type" character(2) DEFAULT '', 67 65 "city" character varying(30) DEFAULT '', … … 77 75 ); 78 76 79 CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes, allocations. oldcustid, allocations.circuitid FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes, poolips.oldcustid, poolips.circuitid FROM poolips;77 CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes, allocations.circuitid FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes, poolips.circuitid FROM poolips; 80 78 81 79 CREATE TABLE "alloctypes" ( -
branches/stable/cgi-bin/main.cgi
r550 r592 14 14 use DBI; 15 15 use CommonWeb qw(:ALL); 16 use CustIDCK;17 16 use POSIX qw(ceil); 18 17 use NetAddr::IP; … … 23 22 ##uselib## 24 23 24 use CustIDCK; 25 25 use MyIPDB; 26 26 … … 1045 1045 # because I'm lazy, we'll try to make the SELECT's bring out identical)ish) data 1046 1046 if ($webvar{block} =~ /\/32$/ && !$webvar{reallyblock}) { 1047 $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp,privdata ,oldcustidfrom poolips where ip='$webvar{block}'";1047 $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp,privdata from poolips where ip='$webvar{block}'"; 1048 1048 } else { 1049 $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata, oldcustid,swip from allocations where cidr='$webvar{block}'"1049 $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip from allocations where cidr='$webvar{block}'" 1050 1050 } 1051 1051 … … 1122 1122 } 1123 1123 ## end node hack 1124 $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g;1125 1124 $html =~ s/\$\$CITY\$\$/<input type=text name=city value="$data[3]">/g; 1126 1125 $html =~ s/\$\$CIRCID\$\$/<input type="text" name="circid" value="$data[4]" maxlength=64 size=64 class="regular">/g; … … 1140 1139 ## end node hack 1141 1140 $html =~ s/\$\$CUSTID\$\$/$data[1]/g; 1142 $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g;1143 1141 $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}/g; 1144 1142 $html =~ s/\$\$CITY\$\$/$data[3]/g; -
branches/stable/cgi-bin/search.cgi
r507 r592 128 128 my $sql = "(select $cols from searchme where". 129 129 " $webvar{custexclude} (custid ilike '%$webvar{custid}%'". 130 " OR $webvar{custexclude} oldcustid ilike '%$webvar{custid}%'))".131 130 " $sqlconcat (select $cols from searchme where $webvar{descexclude} description ilike '%$webvar{desc}%')". 132 131 " $sqlconcat (select $cols from searchme where $webvar{notesexclude} notes ilike '%$webvar{notes}%')"; … … 336 335 # Query for a customer ID. Note that we can't restrict to "numeric-only" 337 336 # as we have non-numeric custIDs in the legacy data. :/ 338 $sql = "select $cols from searchme where custid ilike '%$query%' or oldcustid ilike '%$query%' ordescription like '%$query%'";337 $sql = "select $cols from searchme where custid ilike '%$query%' or description like '%$query%'"; 339 338 my $count = countRows($sql); 340 339 $sql .= " order by cidr limit $RESULTS_PER_PAGE offset $offset";
Note:
See TracChangeset
for help on using the changeset viewer.