Revision e573ee95
Added by Colin Fleming over 12 years ago
usr/local/www/firewall_shaper_layer7.php | ||
---|---|---|
63 | 63 |
|
64 | 64 |
$default_layer7shaper_msg = "<tr><td colspan=\"4\">"; |
65 | 65 |
$default_layer7shaper_msg .= "<span class=\"vexpl\"><span class=\"red\"><strong>" . gettext("Note") . ":<br/>"; |
66 |
$default_layer7shaper_msg .= "</strong></span>" . gettext("You can add new layer7 protocol patterns by simply uploading the file") . " <a href=\"diag_patterns.php\">" . gettext("here") . ".</a><br/>"; |
|
66 |
$default_layer7shaper_msg .= "</strong></span>" . gettext("You can add new layer7 protocol patterns by simply uploading the file") . " <a href=\"diag_patterns.php\">" . gettext("here") . ".</a></span><br/>";
|
|
67 | 67 |
$default_layer7shaper_msg .= "</td></tr>"; |
68 | 68 |
|
69 | 69 |
|
... | ... | |
114 | 114 |
default: |
115 | 115 |
echo log_error("Get default"); |
116 | 116 |
$show_proto_form = false; |
117 |
$output_form .= "<p class=\"pgtitle\">" . $dn_default_shaper_msg . $default_layer7shaper_msg . "</p>";
|
|
117 |
$output_form .= $dn_default_shaper_msg . $default_layer7shaper_msg;
|
|
118 | 118 |
break; |
119 | 119 |
} |
120 | 120 |
} |
... | ... | |
191 | 191 |
$output_form .= $container->build_form(); |
192 | 192 |
} else { |
193 | 193 |
$show_proto_form = false; |
194 |
$output_form .= "<p class=\"pgtitle\">" . $dn_default_shaper_msg . $default_layer7shaper_msg . "</p>";
|
|
194 |
$output_form .= $dn_default_shaper_msg . $default_layer7shaper_msg;
|
|
195 | 195 |
} |
196 | 196 |
} else if ($_POST['delete']) { |
197 | 197 |
$container->delete_l7c(); |
... | ... | |
208 | 208 |
} |
209 | 209 |
else { |
210 | 210 |
$show_proto_form = false; |
211 |
$output_form .= "<p class=\"pgtitle\">" . $dn_default_shaper_msg . $default_layer7shaper_msg . "</p>";
|
|
211 |
$output_form .= $dn_default_shaper_msg . $default_layer7shaper_msg;
|
|
212 | 212 |
} |
213 | 213 |
|
214 | 214 |
// Builds the left tree |
... | ... | |
220 | 220 |
} |
221 | 221 |
$tree .= "</ul>"; |
222 | 222 |
|
223 |
$output = "<div id=\"shaperarea\" style=\"position:relative\">";
|
|
223 |
$output = "<table summary=\"output form\">";
|
|
224 | 224 |
$output .= $output_form; |
225 | 225 |
$closehead = false; |
226 | 226 |
include("head.inc"); |
... | ... | |
269 | 269 |
|
270 | 270 |
/* Fill the variables with available protocols, structures and behaviours */ |
271 | 271 |
function fillProtocol() { |
272 |
var protocol = '<select name="protocol[]" id="protocol" style="font-size:8pt">';
|
|
272 |
var protocol = '<select name="protocol[]" style="font-size:8pt">'; |
|
273 | 273 |
var name; |
274 | 274 |
|
275 | 275 |
<?php foreach ($avail_protos as $key => $proto) { ?> |
276 | 276 |
name = "<?= $proto; ?>"; |
277 |
protocol += "<option value=" + name + ">" + name + "</option>"; |
|
277 |
protocol += "<option value=" + name + ">" + name + "<\/option>";
|
|
278 | 278 |
<?php } ?> |
279 |
protocol += "</select>"; |
|
279 |
protocol += "<\/select>";
|
|
280 | 280 |
|
281 | 281 |
return protocol; |
282 | 282 |
} |
283 | 283 |
|
284 | 284 |
function fillStructure() { |
285 |
var structure = '<select name="structure[]" id="structure" style="font-size:8pt" onchange="changeBehaviourValues(this.parentNode.parentNode);">';
|
|
285 |
var structure = '<select name="structure[]" style="font-size:8pt" onchange="changeBehaviourValues(this.parentNode.parentNode);">'; |
|
286 | 286 |
var name; |
287 | 287 |
<?php foreach ($avail_structures as $key => $struct) { ?> |
288 | 288 |
name = "<?= $struct; ?>"; |
289 | 289 |
if(name == "queue") { |
290 |
if(js_behaviours_altq != "") { structure += "<option value=" + name + ">" + name + "</option>";} |
|
290 |
if(js_behaviours_altq != "") { structure += "<option value=" + name + ">" + name + "<\/option>";}
|
|
291 | 291 |
} |
292 | 292 |
else { |
293 | 293 |
if(name == "limiter") { |
294 |
if(js_behaviours_limiter != "") { structure += "<option value=" + name + ">" + name + "</option>";} |
|
294 |
if(js_behaviours_limiter != "") { structure += "<option value=" + name + ">" + name + "<\/option>";}
|
|
295 | 295 |
} |
296 |
else structure += "<option value=" + name + ">" + name + "</option>"; //action |
|
296 |
else structure += "<option value=" + name + ">" + name + "<\/option>"; //action
|
|
297 | 297 |
} |
298 | 298 |
<?php } ?> |
299 |
structure += "</select>"; |
|
299 |
structure += "<\/select>";
|
|
300 | 300 |
|
301 | 301 |
return structure; |
302 | 302 |
} |
303 | 303 |
|
304 | 304 |
//Used by default to fill the values when inserting a new row. |
305 | 305 |
function fillBehaviour() { |
306 |
var behaviour = '<select name="behaviour[]" id="behaviour" style="width:80px; font-size:8pt">';
|
|
306 |
var behaviour = '<select name="behaviour[]" style="width:80px; font-size:8pt">'; |
|
307 | 307 |
var name; |
308 | 308 |
<?php foreach ($avail_behaviours_action as $key => $behav) { ?> |
309 | 309 |
name = "<?= $behav; ?>"; |
310 |
behaviour += "<option value=" + name + ">" + name + "</option>"; |
|
310 |
behaviour += "<option value=" + name + ">" + name + "<\/option>";
|
|
311 | 311 |
<?php } ?> |
312 |
behaviour += "</select>"; |
|
312 |
behaviour += "<\/select>";
|
|
313 | 313 |
|
314 | 314 |
return behaviour; |
315 | 315 |
} |
... | ... | |
337 | 337 |
var new_behav; |
338 | 338 |
var name; |
339 | 339 |
for(i=0; i<a_behav.length; i++) { |
340 |
new_behav += "<option value=" + a_behav[i] + ">" + a_behav[i] + "</option>"; |
|
340 |
new_behav += "<option value=" + a_behav[i] + ">" + a_behav[i] + "<\/option>";
|
|
341 | 341 |
} |
342 | 342 |
|
343 | 343 |
document.getElementsByName("behaviour[]")[selectedRow].innerHTML = new_behav; |
... | ... | |
356 | 356 |
var tFielsNum = rows_count - initial_count[table_id]; |
357 | 357 |
if (rows_limit!=0 && tFielsNum >= rows_limit) return false; |
358 | 358 |
|
359 |
var remove = '<a onclick="removeRow(\''+table_id+'\',this.parentNode.parentNode)" href="#"><img border="0" src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="x" /></a>'; |
|
359 |
var remove = '<a onclick="removeRow(\''+table_id+'\',this.parentNode.parentNode)" href="#"><img border="0" src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="x" /><\/a>';
|
|
360 | 360 |
|
361 | 361 |
try { |
362 | 362 |
var newRow = tbl.insertRow(rows_count); |
... | ... | |
433 | 433 |
</a><br/> |
434 | 434 |
</td> |
435 | 435 |
<td width="75%" valign="top" align="center"> |
436 |
<table summary="output form">
|
|
436 |
<div id="shaperarea" style="position:relative">
|
|
437 | 437 |
<?php |
438 | 438 |
echo $output; |
439 | 439 |
?> |
440 | 440 |
|
441 | 441 |
<!-- Layer 7 rules form --> |
442 | 442 |
<?php if($show_proto_form): ?> |
443 |
<td width="22%" valign="top" class="vncellreq"> |
|
443 |
<tr><td width="22%" valign="top" class="vncellreq">
|
|
444 | 444 |
<div id="addressnetworkport"> |
445 | 445 |
<?=gettext("Rule(s)"); ?> |
446 | 446 |
</div> |
... | ... | |
488 | 488 |
?> |
489 | 489 |
<tr> |
490 | 490 |
<td> |
491 |
<select name="protocol[]" class="formselect" id="protocol" style="font-size:8pt">
|
|
491 |
<select name="protocol[]" class="formselect" style="font-size:8pt"> |
|
492 | 492 |
<?php foreach($avail_protos as $proto): ?> |
493 | 493 |
<option value="<?=$proto;?>" <?php if ($proto == $l7rule->GetRProtocol()) echo "selected=\"selected\""; ?>><?=$proto;?></option> |
494 | 494 |
<?php endforeach; ?> |
495 | 495 |
</select> |
496 | 496 |
</td> |
497 | 497 |
<td> |
498 |
<select name="structure[]" class="formselect" id="structure" style="font-size:8pt" onchange="changeBehaviourValues(this.parentNode.parentNode);">
|
|
498 |
<select name="structure[]" class="formselect" style="font-size:8pt" onchange="changeBehaviourValues(this.parentNode.parentNode);"> |
|
499 | 499 |
<?php foreach($avail_structures as $struct) { |
500 | 500 |
if($struct == "queue") { |
501 | 501 |
if(!empty($avail_behaviours_altq)) { ?> |
... | ... | |
518 | 518 |
</select> |
519 | 519 |
</td> |
520 | 520 |
<td> |
521 |
<select name="behaviour[]" class="formselect" id="behaviour" style="width:80px; font-size:8pt">
|
|
521 |
<select name="behaviour[]" class="formselect" style="width:80px; font-size:8pt"> |
|
522 | 522 |
<?php if($l7rule->GetRStructure() == "action"): ?> |
523 | 523 |
<?php foreach($avail_behaviours_action as $behaviour): ?> |
524 | 524 |
<option value="<?=$behaviour ?>" <?php if ($behaviour == $l7rule->GetRBehaviour()) echo "selected=\"selected\""; ?>><?=$behaviour;?></option> |
... | ... | |
562 | 562 |
</td> |
563 | 563 |
|
564 | 564 |
<td width="78%"> |
565 |
<input id="submit" |
|
566 |
name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> |
|
565 |
<input id="submit" name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> |
|
567 | 566 |
|
568 | 567 |
<a href="firewall_shaper_layer7.php"> |
569 |
<input id="cancelbutton" |
|
570 |
name="cancelbutton" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" /></a> |
|
568 |
<input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" /> |
|
571 | 569 |
|
572 | 570 |
<?php if($container): ?> |
573 |
<input id="delete" type="submit" class="formbtn" name="delete" value="<?=gettext("Delete"); ?>" /></a>
|
|
571 |
<input id="delete" type="submit" class="formbtn" name="delete" value="<?=gettext("Delete"); ?>" /> |
|
574 | 572 |
<?php endif ?> |
573 |
</a> |
|
575 | 574 |
</td> |
576 | 575 |
</tr> |
577 | 576 |
<?php endif; ?> |
578 | 577 |
<!-- End of layer7 rules form --> |
579 | 578 |
</table> |
579 |
</div><!-- end of div:shape area --> |
|
580 | 580 |
|
581 | 581 |
</td></tr> |
582 | 582 |
</table> |
Also available in: Unified diff
Tidy up "firewall_shaper_layer7.php" XHTML
Add missing closing SPAN tag
Remove P tag and class from shaper message
Swap TABLE and DIV tags
Add CDATA sections to SCRIPT tags and escape closing SECTION and OPTION
tags
Add missing TR tag
Add missing end DIV tag