Changeset 284 for trunk/cgi-bin/main.cgi
- Timestamp:
- 09/21/05 16:30:31 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/main.cgi
r261 r284 626 626 } 627 627 $html =~ s|\$\$ALLCITIES\$\$|$cities|g; 628 629 my $i = 0; 630 $i++ if $webvar{fbtype} eq 'y'; 631 # Check to see if user is allowed to do anything with sensitive data 632 my $privdata = ''; 633 if ($IPDBacl{$authuser} =~ /s/) { 634 $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>). 635 qq(<td class=regular><textarea rows="3" cols="64" name="privdata" class="regular">). 636 qq(</textarea></td></tr>\n); 637 $i++; 638 } 639 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 640 641 $i = $i % 2; 642 $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/; 628 643 629 644 print $html; … … 789 804 $html =~ s|\$\$ACTION\$\$|insert|g; 790 805 806 my $i=1; 807 # Check to see if user is allowed to do anything with sensitive data 808 my $privdata = ''; 809 if ($IPDBacl{$authuser} =~ /s/) { 810 $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>). 811 qq(<td class=regular>$webvar{privdata}). 812 qq(<input type=hidden name=privdata value="$webvar{privdata}"></td></tr>\n); 813 $i++; 814 } 815 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 816 817 $i = $i % 2; 818 $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/; 819 791 820 print $html; 792 821 … … 803 832 return if !validateInput(); 804 833 834 if (!defined($webvar{privdata})) { 835 $webvar{privdata} = ''; 836 } 805 837 # $code is "success" vs "failure", $msg contains OK for a 806 838 # successful netblock allocation, the IP allocated for static … … 808 840 my ($code,$msg) = allocateBlock($ip_dbh, $webvar{fullcidr}, $webvar{alloc_from}, 809 841 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes}, 810 $webvar{circid} );842 $webvar{circid}, $webvar{privdata}); 811 843 812 844 if ($code eq 'OK') { … … 904 936 # because I'm lazy, we'll try to make the SELECT's bring out identical)ish) data 905 937 if ($webvar{block} =~ /\/32$/) { 906 $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp from poolips where ip='$webvar{block}'";938 $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp,privdata from poolips where ip='$webvar{block}'"; 907 939 } else { 908 $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp from allocations where cidr='$webvar{block}'"940 $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata from allocations where cidr='$webvar{block}'" 909 941 } 910 942 … … 971 1003 my $i=1; 972 1004 1005 # Check to see if we can display sensitive data 1006 my $privdata = ''; 1007 if ($IPDBacl{$authuser} =~ /s/) { 1008 $privdata = qq(<tr class="color).($i%2).qq("><td class=heading>Restricted data:</td>). 1009 qq(<td class=regular><textarea rows="3" cols="64" name="privdata" class="regular">). 1010 qq($data[8]</textarea></td></tr>\n); 1011 $i++; 1012 } 1013 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 1014 973 1015 # More ACL trickery - we can live with forms that don't submit, 974 1016 # but we can't leave the extra table rows there, and we *really* … … 976 1018 my $updok = ''; 977 1019 if ($IPDBacl{$authuser} =~ /c/) { 978 $updok = qq(<tr class="color $i"><td colspan=2><div class="center">).1020 $updok = qq(<tr class="color).($i%2).qq("><td colspan=2><div class="center">). 979 1021 qq(<input type="submit" value=" Update this block " class="regular">). 980 1022 "</div></td></tr></form>\n"; … … 986 1028 if ($IPDBacl{$authuser} =~ /d/) { 987 1029 $delok = qq(<form method="POST" action="main.cgi"> 988 <tr class="color $i"><td colspan=2 class="regular"><div class=center>1030 <tr class="color).($i%2).qq("><td colspan=2 class="regular"><div class=center> 989 1031 <input type="hidden" name="action" value="delete"> 990 1032 <input type="hidden" name="block" value="$webvar{block}"> … … 1003 1045 # action=update 1004 1046 sub update { 1047 if ($IPDBacl{$authuser} !~ /c/) { 1048 printError("You shouldn't have been able to get here. Access denied."); 1049 return; 1050 } 1051 1052 # Check to see if we can update restricted data 1053 my $privdata = ''; 1054 if ($IPDBacl{$authuser} =~ /s/) { 1055 $privdata = ",privdata='$webvar{privdata}'"; 1056 } 1005 1057 1006 1058 # Make sure incoming data is in correct format - custID among other things. … … 1013 1065 if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) { 1014 1066 $sql = "update poolips set custid='$webvar{custid}',notes='$webvar{notes}',". 1015 "circuitid='$webvar{circid}',description='$webvar{desc}',city='$webvar{city}' 1016 " where ip='$webvar{block}'";1067 "circuitid='$webvar{circid}',description='$webvar{desc}',city='$webvar{city}'". 1068 "$privdata where ip='$webvar{block}'"; 1017 1069 } else { 1018 1070 $sql = "update allocations set custid='$webvar{custid}',". 1019 1071 "description='$webvar{desc}',notes='$webvar{notes}',city='$webvar{city}',". 1020 "type='$webvar{alloctype}',circuitid='$webvar{circid}' where cidr='$webvar{block}'"; 1072 "type='$webvar{alloctype}',circuitid='$webvar{circid}'$privdata ". 1073 "where cidr='$webvar{block}'"; 1021 1074 } 1022 1075 # Log the details of the change. … … 1054 1107 $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g; 1055 1108 1109 if ($IPDBacl{$authuser} =~ /s/) { 1110 $privdata = qq(<tr class="color2"><td valign="top">Restricted data:</td>). 1111 qq(<td class="regular">).desanitize($webvar{privdata}).qq(</td></tr>\n); 1112 } 1113 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 1114 1056 1115 print $html; 1057 1116 … … 1078 1137 } 1079 1138 1080 my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype );1139 my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype, $privdata); 1081 1140 1082 1141 if ($webvar{alloctype} eq 'rm') { … … 1107 1166 1108 1167 # Unassigning a static IP 1109 my $sth = $ip_dbh->prepare("select ip,custid,city,type,notes,circuitid from poolips".1110 " where ip='$webvar{block}'");1168 my $sth = $ip_dbh->prepare("select ip,custid,city,type,notes,circuitid,privdata". 1169 " from poolips where ip='$webvar{block}'"); 1111 1170 $sth->execute(); 1112 1171 # croak $sth->errstr() if($sth->errstr()); 1113 1172 1114 $sth->bind_columns(\$cidr, \$custid, \$city, \$alloctype, \$notes, \$circid); 1173 $sth->bind_columns(\$cidr, \$custid, \$city, \$alloctype, \$notes, \$circid, 1174 \$privdata); 1115 1175 $sth->fetch() || croak $sth->errstr; 1116 1176 1117 1177 } else { # done with alloctype=~ /^.i$/ 1118 1178 1119 my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes from".1120 " allocations where cidr='$webvar{block}'");1179 my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes,privdata". 1180 " from allocations where cidr='$webvar{block}'"); 1121 1181 $sth->execute(); 1122 1182 # croak $sth->errstr() if($sth->errstr()); 1123 1183 1124 $sth->bind_columns(\$cidr, \$custid, \$alloctype, \$city, \$circid, \$desc, \$notes); 1184 $sth->bind_columns(\$cidr, \$custid, \$alloctype, \$city, \$circid, \$desc, 1185 \$notes, \$privdata); 1125 1186 $sth->fetch() || carp $sth->errstr; 1126 1187 } # end cases for different alloctypes … … 1145 1206 $html =~ s|<!--warn-->|<tr bgcolor="black"><td colspan="2"><div class="red">Warning: clicking confirm will remove this record entirely.</div></td></tr>|; 1146 1207 } 1208 1209 my $i = 1; 1210 # Check to see if user is allowed to do anything with sensitive data 1211 if ($IPDBacl{$authuser} =~ /s/) { 1212 $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>). 1213 qq(<td class=regular>$privdata</td></tr>\n); 1214 $i++; 1215 } 1216 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 1217 1218 $i = ++$i % 2; 1219 $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/; 1147 1220 1148 1221 print $html;
Note:
See TracChangeset
for help on using the changeset viewer.