v1.18.x
barisusakli 10 years ago
parent ceb4de653d
commit 417a573f67

@ -90,6 +90,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) {
userData.status = require('../socket.io').isUserOnline(userData.uid) ? (userData.status || 'online') : 'offline';
userData.banned = parseInt(userData.banned, 10) === 1;
userData.website = validator.escape(userData.website);
userData.websiteLink = !userData.website.startsWith('http') ? 'http://' + userData.website : userData.website;
userData.websiteName = userData.website.replace(validator.escape('http://'), '').replace(validator.escape('https://'), '');
userData.followingCount = parseInt(userData.followingCount, 10) || 0;
userData.followerCount = parseInt(userData.followerCount, 10) || 0;

@ -129,25 +129,6 @@ module.exports = function(User) {
return updateFullname(uid, data.fullname, next);
} else if (field === 'signature') {
data[field] = S(data[field]).stripTags().s;
} else if (field === 'website') {
var urlObj;
if (data[field].length > 0) {
urlObj = url.parse(data[field], false, true);
if (!urlObj.protocol) {
urlObj.protocol = 'http';
urlObj.slashes = true;
}
if (!urlObj.hostname && urlObj.pathname) {
urlObj.hostname = urlObj.pathname;
urlObj.pathname = null;
}
if (urlObj.pathname === '/') {
urlObj.pathname = null;
}
}
if (urlObj) {
data[field] = url.format(urlObj);
}
}
User.setUserField(uid, field, data[field], next);

Loading…
Cancel
Save