version 1.71.2.1, 2017/06/13 15:49:36
|
version 1.71.2.2, 2019/03/02 16:25:56
|
Line 440 function stringeval() {
|
Line 440 function stringeval() {
|
draw(); |
draw(); |
} |
} |
|
|
|
function ipstringeval() { |
|
var patternIp = /^([\[\]a-zA-Z\.\d\*\-]+)$/; |
|
var acctypes = new Array; |
|
acctypes = ['allow','deny']; |
|
svalue = ''; |
|
for (var i=0; i<acctypes.length; i++) { |
|
var items = choices.document.getElementsByName('setip'+acctypes[i]); |
|
if (items.length > 0) { |
|
for (var j=0; j<items.length; j++) { |
|
if (items[j].type == "text") { |
|
var possip = items[j].value; |
|
possip = possip.replace(/^\s+|\s+$/g,''); |
|
if (patternIp.test(possip)) { |
|
if (acctypes[i] == 'deny') { |
|
possip = '!'+possip; |
|
} |
|
if (svalue == '') { |
|
svalue = possip; |
|
} else { |
|
svalue += ','+possip; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
function addIpRule(iptype) { |
|
var frame = window.frames["choices"]; |
|
if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) { |
|
var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype); |
|
var count = innerDiv.childNodes.length |
|
var ipDiv = frame.document.createElement('div'); |
|
ipDiv.innerHTML = '<input type="text" size="10" name="setip'+iptype+'" onblur="parent.ipstringeval();" />'+ |
|
'<a href="#" onclick="parent.removeIpRule(\''+iptype+'\',\''+count+'\')">Remove</a>'; |
|
frame.document.getElementById('LC_string_ipacc_inner_'+iptype).appendChild(ipDiv); |
|
} |
|
return false; |
|
} |
|
|
|
function removeIpRule(iptype,num) { |
|
var frame = window.frames["choices"]; |
|
if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) { |
|
var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype); |
|
for (var i=0; i<innerDiv.childNodes.length; i++) { |
|
if (i==num) { |
|
innerDiv.removeChild(innerDiv.childNodes[i]); |
|
ipstringeval(); |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
|
function radiostringeval(newval) { |
function radiostringeval(newval) { |
svalue=newval; |
svalue=newval; |
draw(); |
draw(); |
Line 490 function draw() {
|
Line 545 function draw() {
|
choicewrite(' action="javascript:floateval();"'); |
choicewrite(' action="javascript:floateval();"'); |
} |
} |
if (ptype=='string') { |
if (ptype=='string') { |
choicewrite(' action="javascript:stringeval();"'); |
if (pscat == 'ip') { |
|
choicewrite(' action="javascript:ipstringeval();"'); |
|
} else { |
|
choicewrite(' action="javascript:stringeval();"'); |
|
} |
} |
} |
if (ptype != 'int' && ptype != 'float' && ptype != 'string') { |
if (ptype != 'int' && ptype != 'float' && ptype != 'string') { |
choicewrite(' action=""'); |
choicewrite(' action=""'); |
Line 841 function draw() {
|
Line 900 function draw() {
|
choicewrite(' /> No</label><br />'); |
choicewrite(' /> No</label><br />'); |
} |
} |
if (pscat=='ip') { |
if (pscat=='ip') { |
tablestart('IP Number/Name'); |
var currallow = new Array; |
choicewrite('<tr><td>Value:</td><td colspan="2">'); |
var currdeny = new Array; |
choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+ |
if ((svalue != '') && (svalue != null)) { |
'" onchange="parent.stringeval()" />'); |
var patternComma = /,/; |
|
var patternAllow = /^([\[\]a-zA-Z\.\d\*\-]+)$/; |
|
var patternDeny = /^\!([\[\]a-zA-Z\.\d\*\-]+)$/; |
|
var current = new Array; |
|
if (patternComma.test(svalue)) { |
|
current = svalue.split(','); |
|
} else { |
|
current = [svalue]; |
|
} |
|
for (var i=0; i<current.length; i++) { |
|
if (patternDeny.test(current[i])) { |
|
var denied = current[i].replace(/^!/,''); |
|
currdeny.push(denied); |
|
} else { |
|
if (patternAllow.test(current[i])) { |
|
currallow.push(current[i]); |
|
} |
|
} |
|
} |
|
} |
|
if (currdeny.length == 0) { |
|
currdeny = (''); |
|
} |
|
if (currallow.length == 0) { |
|
currallow = (''); |
|
} |
|
var curripaccess = [currallow,currdeny]; |
|
tablestart('IP Number/Name'); |
|
choicewrite('<tr><th>Allow from</th><th>Deny from</th></tr><tr>'); |
|
var acctypes = ['allow','deny']; |
|
for (var i=0; i<acctypes.length; i++) { |
|
choicewrite('<td valign="top">'+ |
|
'<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'+acctypes[i]+'">'+ |
|
'<div class="LC_string_ipacc_inner" id="LC_string_ipacc_inner_'+acctypes[i]+'">'); |
|
for (var j=0; j<curripaccess[i].length; j++) { |
|
choicewrite('<div><input type="text" size="10" name="setip'+acctypes[i]+'" value="'+curripaccess[i][j]+'" onblur="parent.ipstringeval();" />'); |
|
choicewrite('<a href="#" onclick="parent.removeIpRule(\''+acctypes[i]+'\',\''+j+'\')">Remove</a>'); |
|
choicewrite('</div>'); |
|
} |
|
choicewrite('</div><button onclick="parent.addIpRule(\''+acctypes[i]+'\');">Add item</button>'); |
|
} |
|
choicewrite('</div></td></tr></table>'); |
} |
} |
if (pscat=='fileext') { |
if (pscat=='fileext') { |
tablestart('Allowed File Extensions'); |
tablestart('Allowed File Extensions'); |