diff --git a/src/posts/user.js b/src/posts/user.js index 2799e4298d..fcfcd8643b 100644 --- a/src/posts/user.js +++ b/src/posts/user.js @@ -8,7 +8,7 @@ var async = require('async'), meta = require('../meta'), websockets = require('../socket.io'), postTools = require('../postTools'), - plugins = require('../plugins') + plugins = require('../plugins'); module.exports = function(Posts) { @@ -61,6 +61,7 @@ module.exports = function(Posts) { } userData.custom_profile_info = results.customProfileInfo.profile; + userData.signature = sanitizeSignature(userData.signature); plugins.fireHook('filter:posts.modifyUserInfo', userData, next); }); @@ -105,3 +106,18 @@ module.exports = function(Posts) { }); }; }; + +function sanitizeSignature(signature) { + var string = require('string')(signature), + tagsToStrip = []; + + if (parseInt(meta.config['signatures:disableLinks'], 10) === 1) { + tagsToStrip.push('a'); + } + + if (parseInt(meta.config['signatures:disableImages'], 10) === 1) { + tagsToStrip.push('img'); + } + + return tagsToStrip.length ? string.stripTags.apply(string, tagsToStrip).s : signature; +} \ No newline at end of file diff --git a/src/views/admin/settings/post.tpl b/src/views/admin/settings/post.tpl index af1b927fbe..2af1117c10 100644 --- a/src/views/admin/settings/post.tpl +++ b/src/views/admin/settings/post.tpl @@ -41,11 +41,33 @@ + + + + +