forked from extern/egroupware
replace eval with JSON.parse and egw.applyFunc
This commit is contained in:
parent
c18e1107dd
commit
3fdf4057d6
@ -410,7 +410,18 @@ var AdminApp = /** @class */ (function (_super) {
|
||||
this.load(link);
|
||||
}
|
||||
else if (link.substr(0, 11) == 'javascript:') {
|
||||
eval(link.substr(11));
|
||||
var href_regexp = /^javascript:([^\(]+)\((.*)?\);?$/;
|
||||
var matches = link.match(href_regexp);
|
||||
var args = [];
|
||||
if (matches.length > 1 && matches[2] !== undefined) {
|
||||
try {
|
||||
args = JSON.parse('[' + matches[2] + ']');
|
||||
}
|
||||
catch (e) { // deal with '-encloded strings (JSON allows only ")
|
||||
args = JSON.parse('[' + matches[2].replace(/'/g, '"') + ']');
|
||||
}
|
||||
}
|
||||
egw.applyFunc(matches[1], args);
|
||||
}
|
||||
};
|
||||
/**
|
||||
|
@ -454,7 +454,19 @@ class AdminApp extends EgwApp
|
||||
}
|
||||
else if (link.substr(0,11) == 'javascript:')
|
||||
{
|
||||
eval(link.substr(11));
|
||||
const href_regexp = /^javascript:([^\(]+)\((.*)?\);?$/;
|
||||
const matches = link.match(href_regexp);
|
||||
let args = [];
|
||||
if (matches.length > 1 && matches[2] !== undefined)
|
||||
{
|
||||
try {
|
||||
args = JSON.parse('['+matches[2]+']');
|
||||
}
|
||||
catch(e) { // deal with '-encloded strings (JSON allows only ")
|
||||
args = JSON.parse('['+matches[2].replace(/'/g, '"')+']');
|
||||
}
|
||||
}
|
||||
egw.applyFunc(matches[1], args);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user