实体字符编码

pull/267/head
midoks 3 years ago
parent ab338dc8a7
commit 84f2c20f2a
  1. 6
      plugins/op_waf/js/op_waf.js
  2. 28
      route/static/app/public.js

@ -1612,8 +1612,6 @@ function wafSite(){
});
}
function wafLogRequest(page){
var args = {};
args['page'] = page;
@ -1640,9 +1638,9 @@ function wafLogRequest(page){
list += '<td><span class="overflow_hide" style="width:112px;">' + getLocalTime(data[i]['time'])+'</span></td>';
list += '<td><span class="overflow_hide" style="width:50px;">' + data[i]['domain'] +'</span></td>';
list += '<td><span class="overflow_hide" style="width:60px;">' + data[i]['ip'] +'</span></td>';
list += '<td><span class="overflow_hide" style="width:50px;">' + data[i]['uri'] +'</span></td>';
list += '<td><span class="overflow_hide" style="width:50px;">' + data[i]['uri'] +'</span></td>';// data[i]['uri']
list += '<td><span class="overflow_hide" style="width:50px;">' + data[i]['rule_name'] +'</span></td>';
list += '<td><span class="overflow_hide" style="width:200px;">' + data[i]['reason'] +'</span></td>';
list += '<td><span class="overflow_hide" style="width:200px;">' + entitiesEncode(data[i]['reason']) +'</span></td>';//data[i]['reason']
list += '<td><a data-id="'+i+'" href="javascript:;" class="btlink details" title="详情">详情</a></td>';
list += '</tr>';
}

@ -1620,6 +1620,34 @@ function toArrayObject(str){
return data;
}
/**
* 实体字符编码
* @param {*} text 待编码的文本
* @returns
*/
function entitiesEncode(text) {
text = text.replace(/&/g, "&amp;");
text = text.replace(/</g, "&lt;");
text = text.replace(/>/g, "&gt;");
text = text.replace(/ /g, "&nbsp;");
text = text.replace(/"/g, "&quot;");
return text;
}
/**
* 实体字符解码
* @param {*} text 待解码的文本
* @returns
*/
function entitiesDecode(text) {
text = text.replace(/&amp;/g, "&");
text = text.replace(/&lt;/g, "<");
text = text.replace(/&gt;/g, ">");
text = text.replace(/&nbsp;/g, " ");
text = text.replace(/&quot;/g, "'");
return text;
}
function pluginService(_name, version){
var data = {name:_name, func:'status'}
if ( typeof(version) != 'undefined' ){

Loading…
Cancel
Save