Codice:
replaceBBCodeImage: function(url) {
if(this.settings['bbCodeImages']) {
if (!arguments.callee.regExpUrl) {
arguments.callee.regExpUrl = new RegExp(
this.regExpMediaUrl,
''
);
}
if(!url || !url.match(arguments.callee.regExpUrl))
return url;
url = url.replace(/\s/gm, this.encodeText(' '));
var maxWidth = this.dom['chatList'].offsetWidth-50;
var maxHeight = this.dom['chatList'].offsetHeight-50;
return '<a href="'
+url
+'" onclick="window.open(this.href); return false;">'
+'<img class="bbCodeImage" style="max-width:'
+maxWidth
+'px; max-height:'
+maxHeight
+'px;" src="'
+url
+'" alt="" onload="ajaxChat.updateChatlistView();"/></a>';
}
return url;
},
Dovrei controllare se nella variabile url è contenuta una determinata stringa 'stringa_di_prova' e in caso affermativo ritornare url
Io di javascript non ne capsco molto (diciamo non ne capisco nulla) ed è ora che mi metta a studiarlo, ma la mancanza di ciò è un grave bug di sicurezza nel codice. Potrei avere la pappa pronta?
Grazie!