Changeset 422
- Timestamp:
- 07/06/10 15:50:22 (14 years ago)
- Location:
- trunk/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r420 r422 827 827 my ($action,$subj,$message) = @_; 828 828 829 ##fixme: need to redesign the breakdown/processing for $action for proper handling of all cases 830 829 831 # split action into parts for fiddlement. nb: there are almost certainly better ways to do this. 830 my @actionbits = ($action =~ /^(.)(.)(.)$/);832 my @actionbits = split //, $action; 831 833 832 834 # want to notify anyone who has specifically requested notify on *this* type ($action as passed), … … 859 861 $mailer->mail("ipdb\@$domain"); 860 862 $mailer->to($recip); 861 $mailer->data("From: \" IP Database\" <ipdb\@$domain>\n",863 $mailer->data("From: \"$org_name IP Database\" <ipdb\@$domain>\n", 862 864 "To: $recip\n", 863 865 "Date: ".strftime("%a, %d %b %Y %H:%M:%S %z",localtime)."\n", -
trunk/cgi-bin/admin.cgi
r418 r422 111 111 Bump "last updated" timestamp on this master: <select name=whichmaster>$masterlist</select> 112 112 <input type=submit value="Update timestamp"> (Sets timestamp to "now")</form> 113 <a href="admin.cgi?action=listcust">Edit customer data for rWHOIS</a> 113 <a href="admin.cgi?action=listcust">Edit customer data for rWHOIS</a> - data used for 114 blocks with the SWIP box checkmarked. Links to edit/add data are on this page. 114 115 115 116 <hr><a href="admin.cgi?action=showpools">List IP Pools</a> for manual tweaking and updates 117 116 118 <hr><a href="admin.cgi?action=showusers">Manage users</a> (add/remove users; change 117 internal access controls - note that this does NOT include IP-based limits) 119 internal access controls - note that this does NOT include IP-based limits)<br> 120 <a href="admin.cgi?action=emailnotice">Manage email notice options</a> (pick which events 121 and allocation types cause notifications; configure recipient lists for notices) 122 118 123 <hr>Consistency check tools<br> 119 124 <a href="consistency-check.pl">General</a>: Check general netblock consistency.<br> 120 125 <a href="freespace.pl">Free space</a>: List total and aggregate free space. Does not 121 126 include private networks (192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8) 122 <hr>(r)WHOIS<br>123 <a href="list-cust.php">List customer data for WHOIS</a> - data used for blocks with the SWIP box checkmarked.124 Links to edit/add data are on this page.125 127 ); 126 128 } else { … … 254 256 syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ". 255 257 "'$webvar{alloctype}'"; 256 mailNotify($ip_dbh, " $disp_alloctypes{$webvar{alloctype}} allocation",258 mailNotify($ip_dbh, "a$webvar{alloctype}", 257 259 "$disp_alloctypes{$webvar{alloctype}} $webvar{cidr} allocated to customer". 258 260 " $webvar{custid}\n". … … 312 314 <input type=hidden name=newcust value=1> 313 315 <td>CustID:</td><td><input name=custid></td> 314 <!-- <td>Name:</td><td><input name=name></td></tr>315 <tr><td>Street:</td><td><input name=street></td></tr> -->316 <!-- <td>Street2:</td><td><input name=street2></td> -->317 <!-- <tr><td>City:</td><td><input name=city></td>318 <td>Province: (2-letter code)</td><td><input name=province value=ON length=2 size=2></td></tr>319 <tr><td>Country: (2-letter code)</td><td><input name=country value=CA length=2 size=2></td>320 <td>Postal/ZIP Code:</td><td><input name=pocode></td></tr>321 <tr><td>Phone:</td><td><input name=phone></td> -->322 <!-- <td>Default rDNS:</td><td><input name=def_rdns></td></tr>323 <td>Description:</td><td><input name=description></td> -->324 <!-- </tr>325 <tr>326 <td>ARIN Handles:</td><td>327 Tech: <input name=tech_handle value="VH25-ORG-ARIN"><br>328 Abuse: <input name=abuse_handle><br>329 Admin: <input name=admin_handle><br>330 Note: Only tech is required at the moment.331 </td>332 <td>"Special":</td><td><textarea name=special rows=4 cols=40></textarea></td>333 </tr> -->334 316 <td align=center><input type=submit value="Go to edit page for this custid"></td></tr> 335 317 </form></table> … … 344 326 } 345 327 print "</table>\n"; 346 } elsif ($webvar{action} eq 'newcust') {347 if ($webvar{custid} eq '') {348 print 'No CustID entered. PTHBT! (Hit "Back" and fix the problem.)';349 } else {350 $sth = $ip_dbh->prepare("insert into customers ".351 "(custid, name, street, city, province, country, pocode, ".352 "phone, tech_handle, abuse_handle, admin_handle) values ".353 "('$webvar{custid}', '$webvar{name}', '$webvar{street}', ".354 "'$webvar{city}', '$webvar{province}', '$webvar{country}', ".355 "'$webvar{pocode}', '$webvar{phone}', '$webvar{techhandle}', ".356 "'$webvar{abusehandle}', '$webvar{adminhandle}')");357 $sth->execute;358 if ($sth->err) {359 print "INSERT failed: ".$sth->errstr."\n";360 } else {361 print "Success! Added customer contact data:\n".362 qq(<table border=1><tr>363 <td>CustID:</td>$webvar{custid}</td><td>Name:</td>$webvar{name}</td></tr>364 <tr><td>Street:</td><td>$webvar{street}</td></tr>365 <tr><td>City:</td><td>$webvar{city}</td><td>Province:</td><td>$webvar{province}</td></tr>366 <tr><td>Country:</td><td>$webvar{country}</td>367 <td>Postal/ZIP Code:</td><td>$webvar{pocode}</td></tr>368 <tr><td>Phone:</td><td>$webvar{phone}</td>369 <!-- <td>Default rDNS:</td><td><input name=def_rdns></td></tr>370 <tr><td>Description:</td><td><input name=description></td> -->371 <td>ARIN Handles:</td><td>372 Tech: $webvar{tech_handle}<br>373 Abuse: $webvar{abuse_handle}<br>374 Admin: $webvar{admin_handle}<br>375 </td></tr></table>376 );377 } # $sth err check378 } # bad custid379 328 } elsif ($webvar{action} eq 'edcust') { 380 329 if ($webvar{newcust}) { … … 415 364 <div style="margin-left:5px"> 416 365 <h3>Explanation for "Special" field:</h3> 417 This is the field I've mangled into providing a custom WHOIS netname identifier for blocks tagged "SWIP".366 This is a temporary place to define the WHOIS "net name" for a block. 418 367 It may be removed later, more likely migrated elsewhere. 419 368 <p>It's formatted like this, one line for each custom net name: 420 369 <pre>NetName[CIDR block]: NET-NAME</pre> 421 370 Example: 422 <pre>NetName 209.91.133.0/24: CYBERSUDBURY-1</pre>371 <pre>NetName192.168.236.0/24: MEGAWIDGET-1</pre> 423 372 Note: 424 373 <ul style="margin-top: 0px;"> … … 572 521 print qq(<hr><a href="admin.cgi?action=showusers">Back</a> to user listing\n); 573 522 523 } elsif ($webvar{action} eq 'emailnotice') { 524 print "<h4>Email notice management:</h4>\nClick the email addresses to edit that list."; 525 $sth = $ip_dbh->prepare("SELECT action,reciplist FROM notify"); 526 $sth->execute; 527 528 print "<table border=1>\n"; 529 while (my ($notice_code,$reciplist) = $sth->fetchrow_array() ) { 530 ##fixme: hairy mess, only a few things call mailNotify() anyway, so many possible notices won't work. 531 my $action_out = dispNoticeCode($notice_code); 532 print "<tr><td>$action_out</td>". 533 qq(<td><a href="admin.cgi?action=ednotice&code=$notice_code">$reciplist</a></td>). 534 qq(<td><a href="admin.cgi?action=delnotice&code=$notice_code">Delete</a></tr>\n); 535 } 536 print "</table>\n"; 537 } elsif ($webvar{action} eq 'ednotice') { 538 print "<h4>Editing recipient list for '".dispNoticeCode($webvar{code})."':</h4>\n"; 539 ##work 540 $sth = $ip_dbh->prepare("SELECT reciplist FROM notify WHERE action=?"); 541 $sth->execute($webvar{code}); 542 my ($reciplist) = $sth->fetchrow_array; 543 $reciplist =~ s/,/\n/g; 544 print qq(<form action=admin.cgi method=POST><input type=hidden name=code value="$webvar{code}">\n). 545 qq(<input type=hidden name=action value="updnotice"><table border=1><tr><td>). 546 qq(<textarea cols="40" rows="5" name=reciplist>$reciplist</textarea></td><td><input type=submit value="Update">\n). 547 "</td></tr></table></form>\n"; 548 } elsif ($webvar{action} eq 'updnotice') { 549 print "<h4>Updating recipient list for '".dispNoticeCode($webvar{code})."':</h4>\n"; 550 $sth = $ip_dbh->prepare("UPDATE notify SET reciplist=? WHERE action=?"); 551 $webvar{reciplist} =~ s/[\r\n]+/,/g; 552 $sth->execute($webvar{reciplist}, $webvar{code}); 553 if ($sth->err) { 554 print "Failed: DB error: ".$sth->errstr."\n"; 555 } else { 556 print "OK!<br>\n" 557 } 558 print qq(<a href="admin.cgi?action=emailnotice">Back to email notice list</a>\n); 574 559 } elsif ($webvar{action} ne '<NULL>') { 575 560 print "webvar{action} check failed: Don't know how to $webvar{action}"; … … 724 709 print "</form></table>\n"; 725 710 } 711 712 713 # interpret the notify codes 714 sub dispNoticeCode { 715 my $code = shift; 716 my $action_out = ''; 717 # my $code = $notice_code; 718 if ($code =~ /^f:(.+)$/) { 719 $code =~ s/^f://; 720 $action_out = "Failure on "; 721 } 722 if (my $target = $code =~ /^n(.+)/) { 723 $action_out .= "New "; 724 if ($1 eq 'ci') { $action_out .= "city"; } 725 elsif ($1 eq 'no') { $action_out .= "node"; } 726 else { $action_out .= '<unknown>'; } 727 } else { 728 my ($action,$target) = ($code =~ /^(.)(.+)$/); 729 if ($action eq 'a') { $action_out .= 'Add '; } 730 elsif ($action eq 'u') { $action_out .= 'Update '; } 731 elsif ($action eq 'd') { $action_out .= 'Delete '; } 732 ##fixme: what if we get something funky? 733 if ($target eq 'a') { $action_out .= "all"; } 734 else { $action_out .= $disp_alloctypes{$target}; } 735 } 736 return $action_out; 737 }
Note:
See TracChangeset
for help on using the changeset viewer.