Changeset 476 for branches/htmlform/cgi-bin/main.cgi
- Timestamp:
- 08/25/10 15:16:21 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/htmlform/cgi-bin/main.cgi
r474 r476 1102 1102 mailNotify($ip_dbh, 's:swi', "SWIPed: $disp_alloctypes{$webvar{alloctype}} $webvar{block}", 1103 1103 "$webvar{block} had SWIP status changed to \"Yes\" by $authuser") if $webvar{swip} eq 'on'; 1104 open (HTML, "../updated.html") 1105 or croak "Could not open updated.html :$!"; 1106 my $html = join('', <HTML>); 1104 1105 ## node hack 1106 if ($webvar{node} && $webvar{node} ne '-') { 1107 $sth = $ip_dbh->prepare("SELECT node_name FROM nodes WHERE node_id=?"); 1108 $sth->execute($webvar{node}); 1109 my ($nodename) = $sth->fetchrow_array(); 1110 $page->param(nodename => $nodename); 1111 } 1112 ## end node hack 1107 1113 1108 1114 # Link back to browse-routed or list-pool page on "Update complete" page. 1109 my $backlink = "/ip/cgi-bin/main.cgi?action=";1110 1115 my $cblock; # to contain the CIDR of the container block we're retrieving. 1111 1116 my $sql; 1112 1117 if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) { 1118 $page->param(backpool => 1); 1113 1119 $sql = "select pool from poolips where ip='$webvar{block}'"; 1114 $backlink .= "listpool&pool=";1115 1120 } else { 1116 1121 $sql = "select cidr from routed where cidr >>= '$webvar{block}'"; 1117 $backlink .= "showrouted&block=";1118 1122 } 1119 1123 # I define there to be no errors on this operation... so we don't need to check for them. … … 1123 1127 $sth->fetch(); 1124 1128 $sth->finish; 1125 $backlink .= $cblock; 1126 1127 my $swiptmp = ($webvar{swip} eq 'on' ? 'Yes' : 'No'); 1128 $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g; 1129 $webvar{city} = $q->escapeHTML($webvar{city}); 1130 $html =~ s/\$\$CITY\$\$/$webvar{city}/g; 1131 $html =~ s/\$\$ALLOCTYPE\$\$/$webvar{alloctype}/g; 1132 $html =~ s/\$\$TYPEFULL\$\$/$disp_alloctypes{$webvar{alloctype}}/g; 1133 $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g; 1134 $html =~ s/\$\$SWIP\$\$/$swiptmp/g; 1135 $webvar{circid} = $q->escapeHTML($webvar{circid}); 1136 $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g; 1137 $webvar{desc} = $q->escapeHTML($webvar{desc}); 1138 $html =~ s/\$\$DESC\$\$/$webvar{desc}/g; 1139 $webvar{notes} = $q->escapeHTML($webvar{notes}); 1140 $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g; 1141 $html =~ s/\$\$BACKLINK\$\$/$backlink/g; 1142 $html =~ s/\$\$BACKBLOCK\$\$/$cblock/g; 1143 1144 if ($IPDBacl{$authuser} =~ /s/) { 1145 $privdata = qq(<tr class="color2"><td valign="top">Restricted data:</td>). 1146 qq(<td class="regular">).$q->escapeHTML($webvar{privdata}).qq(</td></tr>\n); 1147 } 1148 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 1149 1150 print $html; 1129 $page->param(backblock => $cblock); 1130 1131 $page->param(cidr => $webvar{block}); 1132 $page->param(city => $webvar{city}); 1133 $page->param(disptype => $disp_alloctypes{$webvar{alloctype}}); 1134 $page->param(custid => $webvar{custid}); 1135 $page->param(swip => $webvar{swip} eq 'on' ? 'Yes' : 'No'); 1136 $page->param(circid => $q->escapeHTML($webvar{circid})); 1137 $page->param(desc => $q->escapeHTML($webvar{desc})); 1138 $page->param(notes => $q->escapeHTML($webvar{notes})); 1139 $webvar{privdata} = ($webvar{privdata} ? $q->escapeHTML($webvar{privdata}) : " "); 1140 $page->param(privdata => $webvar{privdata}) 1141 if $IPDBacl{$authuser} =~ /s/; 1151 1142 1152 1143 } # update() … … 1241 1232 sub finalDelete { 1242 1233 if ($IPDBacl{$authuser} !~ /d/) { 1243 printError("You shouldn't have been able to get here. Access denied.");1234 $page->param(aclerr => 1); 1244 1235 return; 1245 1236 } … … 1250 1241 my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{alloctype}); 1251 1242 1243 $page->param(block => $webvar{block}); 1252 1244 if ($code eq 'OK') { 1253 print "<div class=heading align=center>Success! $webvar{block} deallocated.</div>\n";1254 1245 syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}". 1255 1246 " $custid, $city, desc='$description'"; … … 1258 1249 "CustID: $custid\nCity: $city\nDescription: $description\n"); 1259 1250 } else { 1251 $page->param(failmsg => $msg); 1260 1252 if ($webvar{alloctype} =~ /^.i$/) { 1261 1253 syslog "err", "$authuser could not deallocate static IP '$webvar{block}': '$msg'"; 1262 printError("Could not deallocate static IP $webvar{block}: $msg");1263 1254 } else { 1264 1255 syslog "err", "$authuser could not deallocate netblock '$webvar{block}': '$msg'"; 1265 printError("Could not deallocate netblock $webvar{block}: $msg");1256 $page->param(netblock => 1); 1266 1257 } 1267 1258 }
Note:
See TracChangeset
for help on using the changeset viewer.