diff --git a/install/data/navigation.json b/install/data/navigation.json
index 0ec72805de..8c7965dc7e 100644
--- a/install/data/navigation.json
+++ b/install/data/navigation.json
@@ -1,71 +1,71 @@
[
{
"route": "/categories",
- "title": "\\[\\[global:header.categories\\]\\]",
+ "title": "[[global:header.categories]]",
"enabled": true,
"iconClass": "fa-list",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.categories\\]\\]"
+ "text": "[[global:header.categories]]"
},
{
"id": "unread-count",
"route": "/unread",
- "title": "\\[\\[global:header.unread\\]\\]",
+ "title": "[[global:header.unread]]",
"enabled": true,
"iconClass": "fa-inbox",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.unread\\]\\]",
+ "text": "[[global:header.unread]]",
"properties": {
"loggedIn": true
}
},
{
"route": "/recent",
- "title": "\\[\\[global:header.recent\\]\\]",
+ "title": "[[global:header.recent]]",
"enabled": true,
"iconClass": "fa-clock-o",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.recent\\]\\]"
+ "text": "[[global:header.recent]]"
},
{
"route": "/tags",
- "title": "\\[\\[global:header.tags\\]\\]",
+ "title": "[[global:header.tags]]",
"enabled": true,
"iconClass": "fa-tags",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.tags\\]\\]"
+ "text": "[[global:header.tags]]"
},
{
"route": "/popular",
- "title": "\\[\\[global:header.popular\\]\\]",
+ "title": "[[global:header.popular]]",
"enabled": true,
"iconClass": "fa-fire",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.popular\\]\\]"
+ "text": "[[global:header.popular]]"
},
{
"route": "/users",
- "title": "\\[\\[global:header.users\\]\\]",
+ "title": "[[global:header.users]]",
"enabled": true,
"iconClass": "fa-user",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.users\\]\\]"
+ "text": "[[global:header.users]]"
},
{
"route": "/groups",
- "title": "\\[\\[global:header.groups\\]\\]",
+ "title": "[[global:header.groups]]",
"enabled": true,
"iconClass": "fa-group",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.groups\\]\\]"
+ "text": "[[global:header.groups]]"
},
{
"route": "/admin",
- "title": "\\[\\[global:header.admin\\]\\]",
+ "title": "[[global:header.admin]]",
"enabled": true,
"iconClass": "fa-cogs",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.admin\\]\\]",
+ "text": "[[global:header.admin]]",
"properties": {
"targetBlank": false,
"adminOnly": true
@@ -73,11 +73,11 @@
},
{
"route": "/search",
- "title": "\\[\\[global:header.search\\]\\]",
+ "title": "[[global:header.search]]",
"enabled": true,
"iconClass": "fa-search",
"textClass": "visible-xs-inline",
- "text": "\\[\\[global:header.search\\]\\]",
+ "text": "[[global:header.search]]",
"properties": {
"searchInstalled": true
}
diff --git a/public/language/el/modules.json b/public/language/el/modules.json
index 3c85a388de..e2d45cd043 100644
--- a/public/language/el/modules.json
+++ b/public/language/el/modules.json
@@ -1,31 +1,31 @@
{
- "chat.chatting_with": "Συνομιλία με τον/την ",
- "chat.placeholder": "Γράψε το μήνυμά σου εδώ, πάτα enter για αποστολή",
- "chat.send": "Αποστολή",
- "chat.no_active": "Δεν έχεις ενεργές συνομιλίες.",
- "chat.user_typing": "Ο/Η %1 πληκτρολογεί...",
- "chat.user_has_messaged_you": "Ο/Η %1 σου έστειλε μήνυμα.",
+ "chat.chatting_with": "Chat with ",
+ "chat.placeholder": "Type chat message here, press enter to send",
+ "chat.send": "Send",
+ "chat.no_active": "You have no active chats.",
+ "chat.user_typing": "%1 is typing ...",
+ "chat.user_has_messaged_you": "%1 has messaged you.",
"chat.see_all": "See all chats",
"chat.mark_all_read": "Mark all chats read",
- "chat.no-messages": "Παρακαλώ επέλεξε έναν παραλήπτη για να δείς το ιστορικό της συνομιλίας",
+ "chat.no-messages": "Please select a recipient to view chat message history",
"chat.no-users-in-room": "No users in this room",
- "chat.recent-chats": "Πρόσφατες Συνομιλίες",
- "chat.contacts": "Επαφές",
- "chat.message-history": "Ιστορικό Συνομιλίας",
- "chat.pop-out": "Αποκόλληση συνομιλίας",
+ "chat.recent-chats": "Recent Chats",
+ "chat.contacts": "Contacts",
+ "chat.message-history": "Message History",
+ "chat.pop-out": "Pop out chat",
"chat.minimize": "Minimize",
- "chat.maximize": "Μεγιστοποίηση",
- "chat.seven_days": "7 Ημέρες",
- "chat.thirty_days": "30 Ημέρες",
- "chat.three_months": "3 Μήνες",
+ "chat.maximize": "Maximize",
+ "chat.seven_days": "7 Days",
+ "chat.thirty_days": "30 Days",
+ "chat.three_months": "3 Months",
"chat.delete_message_confirm": "Are you sure you wish to delete this message?",
"chat.add-users-to-room": "Add users to room",
"composer.compose": "Compose",
"composer.show_preview": "Show Preview",
"composer.hide_preview": "Hide Preview",
- "composer.user_said_in": "Ο/Η %1 είπε στο %2:",
- "composer.user_said": "Ο/Η %1 είπε:",
- "composer.discard": "Είσαι σίγουρος/η πως θέλεις να πετάξεις αυτή την δημοσίευση;",
+ "composer.user_said_in": "%1 said in %2:",
+ "composer.user_said": "%1 said:",
+ "composer.discard": "Are you sure you wish to discard this post?",
"composer.submit_and_lock": "Submit and Lock",
"composer.toggle_dropdown": "Toggle Dropdown",
"composer.uploading": "Uploading %1",
diff --git a/public/language/el/notifications.json b/public/language/el/notifications.json
index 08e3166f97..692813475f 100644
--- a/public/language/el/notifications.json
+++ b/public/language/el/notifications.json
@@ -1,15 +1,15 @@
{
- "title": "Ειδοποιήσεις",
- "no_notifs": "Δεν έχεις νέες ειδοποιήσεις;",
+ "title": "Notifications",
+ "no_notifs": "You have no new notifications",
"see_all": "See all notifications",
"mark_all_read": "Mark all notifications read",
- "back_to_home": "Πίσω στο %1",
- "outgoing_link": "Εξερχόμενος Σύνδεσμος",
+ "back_to_home": "Back to %1",
+ "outgoing_link": "Outgoing Link",
"outgoing_link_message": "You are now leaving %1",
- "continue_to": "Συνέχεια στο %1",
- "return_to": "Επιστροφή στο %1",
- "new_notification": "Νέα Ειδοποίηση",
- "you_have_unread_notifications": "Έχεις μη αναγνωσμένες ειδοποιήσεις.",
+ "continue_to": "Continue to %1",
+ "return_to": "Return to %1",
+ "new_notification": "New Notification",
+ "you_have_unread_notifications": "You have unread notifications.",
"all": "All",
"topics": "Topics",
"replies": "Replies",
@@ -19,30 +19,30 @@
"new-flags": "New Flags",
"my-flags": "Flags assigned to me",
"bans": "Bans",
- "new_message_from": "Νέο μήνυμα από τον/την %1",
- "upvoted_your_post_in": "Ο/Η %1 υπερψήφισε την δημοσίευσή σου στο %2.",
+ "new_message_from": "New message from %1",
+ "upvoted_your_post_in": "%1 has upvoted your post in %2.",
"upvoted_your_post_in_dual": "%1 and %2 have upvoted your post in %3.",
"upvoted_your_post_in_multiple": "%1 and %2 others have upvoted your post in %3.",
"moved_your_post": "%1 has moved your post to %2",
"moved_your_topic": "%1 has moved %2",
- "user_flagged_post_in": "Ο/Η %1 επεσήμανε μια δημοσίευσή σου στο %2",
+ "user_flagged_post_in": "%1 flagged a post in %2",
"user_flagged_post_in_dual": "%1 and %2 flagged a post in %3",
"user_flagged_post_in_multiple": "%1 and %2 others flagged a post in %3",
"user_flagged_user": "%1 flagged a user profile (%2)",
"user_flagged_user_dual": "%1 and %2 flagged a user profile (%3)",
"user_flagged_user_multiple": "%1 and %2 others flagged a user profile (%3)",
- "user_posted_to": "Ο/Η %1 έγραψε μια απάντηση στο: %2",
+ "user_posted_to": "%1 has posted a reply to: %2",
"user_posted_to_dual": "%1 and %2 have posted replies to: %3",
"user_posted_to_multiple": "%1 and %2 others have posted replies to: %3",
"user_posted_topic": "%1 has posted a new topic: %2",
- "user_started_following_you": "Ο/Η %1 σε ακολουθεί.",
+ "user_started_following_you": "%1 started following you.",
"user_started_following_you_dual": "%1 and %2 started following you.",
"user_started_following_you_multiple": "%1 and %2 others started following you.",
"new_register": "%1 sent a registration request.",
"new_register_multiple": "There are %1 registration requests awaiting review.",
"flag_assigned_to_you": "Flag %1 has been assigned to you",
- "email-confirmed": "Το Εmail Επιβεβαιώθηκε",
- "email-confirmed-message": "Ευχαριστούμε που επιβεβαίωσες το email σου. Ο λογαριασμός σου είναι πλέον πλήρως ενεργοποιημένος.",
- "email-confirm-error-message": "Υπήρξε κάποιο πρόβλημα με την επιβεβαίωση της διεύθυνσής email σου. Ίσως ο κώδικας να είναι άκυρος ή να έχει λήξει.",
+ "email-confirmed": "Email Confirmed",
+ "email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
+ "email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired.",
"email-confirm-sent": "Στάλθηκε email επιβεβαίωσης."
}
\ No newline at end of file
diff --git a/public/language/el/reset_password.json b/public/language/el/reset_password.json
index 7af6489001..4df4164ac3 100644
--- a/public/language/el/reset_password.json
+++ b/public/language/el/reset_password.json
@@ -9,8 +9,8 @@
"repeat_password": "Επιβεβαίωση Κωδικού",
"enter_email": "Παρακαλώ γράψε την διεύθυνση email σου και θα σου στείλουμε ένα email με οδηγίες για το πως να επαναφέρεις τον λογαριασμό σου.",
"enter_email_address": "Εισαγωγή Διεύθυνσης Email",
- "password_reset_sent": "Η Επαναφορά Κωδικού Εστάλη",
- "invalid_email": "Άκυρο Email / Το email δεν υπάρχει!",
+ "password_reset_sent": "Password Reset Sent",
+ "invalid_email": "Invalid Email / Email does not exist!",
"password_too_short": "The password entered is too short, please pick a different password.",
"passwords_do_not_match": "The two passwords you've entered do not match.",
"password_expired": "Your password has expired, please choose a new password"
diff --git a/public/language/uk/email.json b/public/language/uk/email.json
index 48574768db..88deabc041 100644
--- a/public/language/uk/email.json
+++ b/public/language/uk/email.json
@@ -1,13 +1,13 @@
{
- "password-reset-requested": "Отриман запит на відновлення паролю - %1!",
+ "password-reset-requested": "Отриманий запит на відновлення паролю - %1!",
"welcome-to": "Ласкаво просимо до %1",
"invite": "Запрошення від %1",
"greeting_no_name": "Привіт",
"greeting_with_name": "Привіт %1",
"welcome.text1": "Дякуємо за реєстрацію з %1!",
- "welcome.text2": "Щоб повністю активувати ваш аккаунт, нам потрібно верефікувати володіння е-мейлом, який ви вказали при реєстрації ",
+ "welcome.text2": "Щоб повністю активувати ваш аккаунт, нам потрібно перевірити, що вам належить електронна адреса, яку ви вказали при реєстрації ",
"welcome.text3": "Адміністратор схвалив ваш запит на реєстрацію. Ви можете залогінитись, використовуючи свій пароль та назву аккаунту",
- "welcome.cta": "Натисніть тут, щоб підтвердити вашу скриньку",
+ "welcome.cta": "Натисніть тут, щоб підтвердити вашу електронну адресу",
"invitation.text1": "%1 запросив вас приєднатися до %2",
"invitation.ctr": "Натисніть тут, щоб створити аккаунт",
"reset.text1": "Ми отримали запит на відновлення вашого паролю, можливо тому, что ви його забули. Якщо це не потрібно - проігноруйте цей лист",
diff --git a/public/src/admin/admin.js b/public/src/admin/admin.js
index 7ec41a553b..0b6867b81c 100644
--- a/public/src/admin/admin.js
+++ b/public/src/admin/admin.js
@@ -231,4 +231,10 @@
});
});
}
+
+ // tell ace to use the right paths when requiring modules
+ require(['ace/ace'], function (ace) {
+ ace.config.set('packaged', true);
+ ace.config.set('basePath', config.relative_path + '/assets/src/modules/ace/');
+ });
}());
diff --git a/public/src/admin/appearance/customise.js b/public/src/admin/appearance/customise.js
index a8fc5282cd..268d8480af 100644
--- a/public/src/admin/appearance/customise.js
+++ b/public/src/admin/appearance/customise.js
@@ -1,6 +1,5 @@
'use strict';
-
define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Settings, ace) {
var Customise = {};
diff --git a/public/src/admin/settings/email.js b/public/src/admin/settings/email.js
index ca454ab1ba..d25fa05c30 100644
--- a/public/src/admin/settings/email.js
+++ b/public/src/admin/settings/email.js
@@ -1,7 +1,7 @@
'use strict';
-define('admin/settings/email', ['admin/settings', 'ace/ace'], function (ace) {
+define('admin/settings/email', ['ace/ace', 'admin/settings'], function (ace) {
var module = {};
var emailEditor;
diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js
index a082a31935..11c7bee005 100644
--- a/public/src/modules/translator.js
+++ b/public/src/modules/translator.js
@@ -50,6 +50,7 @@
/**
* Construct a new Translator object
* @param {string} language - Language code for this translator instance
+ * @exports translator.Translator
*/
function Translator(language) {
var self = this;
@@ -283,7 +284,7 @@
}
var argsToTranslate = args.map(function (arg) {
- return string(arg).collapseWhitespace().decodeHTMLEntities().escapeHTML().s;
+ return string(arg).collapseWhitespace().decodeHTMLEntities().escapeHTML().s.replace(/&/g, '&');
}).map(function (arg) {
return self.translate(arg);
});
@@ -443,6 +444,9 @@
return Translator;
}());
+ /**
+ * @exports translator
+ */
var adaptor = {
/**
* The Translator class
diff --git a/src/categories/recentreplies.js b/src/categories/recentreplies.js
index 1908db45e6..595cba3f9e 100644
--- a/src/categories/recentreplies.js
+++ b/src/categories/recentreplies.js
@@ -3,7 +3,6 @@
var async = require('async');
var winston = require('winston');
-var validator = require('validator');
var _ = require('underscore');
var db = require('../database');
@@ -11,7 +10,6 @@ var posts = require('../posts');
var topics = require('../topics');
var privileges = require('../privileges');
var batch = require('../batch');
-var translator = require('../translator');
module.exports = function (Categories) {
Categories.getRecentReplies = function (cid, uid, count, callback) {
@@ -136,7 +134,7 @@ module.exports = function (Categories) {
teaser.user.uid = undefined;
teaser.topic = {
slug: topicData[index].slug,
- title: translator.escape(validator.escape(String(topicData[index].title))),
+ title: topicData[index].title,
};
}
});
diff --git a/src/controllers/category.js b/src/controllers/category.js
index 602f158eeb..114fd8ba63 100644
--- a/src/controllers/category.js
+++ b/src/controllers/category.js
@@ -161,9 +161,6 @@ categoryController.get = function (req, res, callback) {
return callback(err);
}
- categoryData.topics.forEach(function (topic) {
- topic.title = translator.escape(topic.title);
- });
categoryData.description = translator.escape(categoryData.description);
categoryData.privileges = userPrivileges;
categoryData.showSelect = categoryData.privileges.editable;
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index 8f767ad36c..4fe1bf96d5 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -14,7 +14,6 @@ var plugins = require('../plugins');
var helpers = require('./helpers');
var pagination = require('../pagination');
var utils = require('../utils');
-var translator = require('../translator');
var topicsController = {};
@@ -130,14 +129,13 @@ topicsController.get = function (req, res, callback) {
plugins.fireHook('filter:controllers.topic.get', { topicData: topicData, uid: req.uid }, next);
},
function (data, next) {
- data.topicData.title = translator.escape(data.topicData.title);
var breadcrumbs = [
{
text: data.topicData.category.name,
url: nconf.get('relative_path') + '/category/' + data.topicData.category.slug,
},
{
- text: translator.escape(data.topicData.title),
+ text: data.topicData.title,
},
];
diff --git a/src/database/mongo.js b/src/database/mongo.js
index 91b41306f1..ae2ff77856 100644
--- a/src/database/mongo.js
+++ b/src/database/mongo.js
@@ -116,9 +116,9 @@
var meta = require('../meta');
var sessionStore;
- var ttlDays = 1000 * 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0);
- var ttlSeconds = 1000 * (parseInt(meta.config.loginSeconds, 10) || 0);
- var ttl = ttlSeconds || ttlDays || 1209600000; // Default to 14 days
+ var ttlDays = 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0);
+ var ttlSeconds = (parseInt(meta.config.loginSeconds, 10) || 0);
+ var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days in seconds
if (nconf.get('redis')) {
sessionStore = require('connect-redis')(session);
diff --git a/src/languages.js b/src/languages.js
index 0769656519..c4c3d5ae0e 100644
--- a/src/languages.js
+++ b/src/languages.js
@@ -31,6 +31,9 @@ Languages.list = function (callback) {
var languages = [];
fs.readdir(languagesPath, function (err, files) {
+ if (err && err.code === 'ENOENT') {
+ return callback(null, []);
+ }
if (err) {
return callback(err);
}
diff --git a/src/posts/summary.js b/src/posts/summary.js
index 0eaadaca94..065007dca8 100644
--- a/src/posts/summary.js
+++ b/src/posts/summary.js
@@ -5,12 +5,11 @@ var async = require('async');
var validator = require('validator');
var S = require('string');
-var db = require('../database');
+var topics = require('../topics');
var user = require('../user');
var plugins = require('../plugins');
var categories = require('../categories');
var utils = require('../utils');
-var translator = require('../translator');
module.exports = function (Posts) {
Posts.getPostSummaryByPids = function (pids, uid, options, callback) {
@@ -39,8 +38,8 @@ module.exports = function (Posts) {
if (uids.indexOf(posts[i].uid) === -1) {
uids.push(posts[i].uid);
}
- if (topicKeys.indexOf('topic:' + posts[i].tid) === -1) {
- topicKeys.push('topic:' + posts[i].tid);
+ if (topicKeys.indexOf(posts[i].tid) === -1) {
+ topicKeys.push(posts[i].tid);
}
});
async.parallel({
@@ -111,15 +110,15 @@ module.exports = function (Posts) {
}, callback);
}
- function getTopicAndCategories(topicKeys, callback) {
- db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount', 'mainPid'], function (err, topics) {
+ function getTopicAndCategories(tids, callback) {
+ topics.getTopicsFields(tids, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount', 'mainPid'], function (err, topics) {
if (err) {
return callback(err);
}
var cids = topics.map(function (topic) {
if (topic) {
- topic.title = translator.escape(validator.escape(String(topic.title)));
+ topic.title = String(topic.title);
topic.deleted = parseInt(topic.deleted, 10) === 1;
}
return topic && topic.cid;
diff --git a/src/socket.io/admin/rooms.js b/src/socket.io/admin/rooms.js
index 544bdc04da..70b908d4dc 100644
--- a/src/socket.io/admin/rooms.js
+++ b/src/socket.io/admin/rooms.js
@@ -5,7 +5,7 @@ var async = require('async');
var os = require('os');
var nconf = require('nconf');
var winston = require('winston');
-var validator = require('validator');
+
var topics = require('../../topics');
var pubsub = require('../../pubsub');
@@ -109,7 +109,7 @@ SocketRooms.getAll = function (socket, data, callback) {
topTenTopics.forEach(function (topic, index) {
totals.topics[topic.tid] = {
value: topic.count || 0,
- title: validator.escape(String(titles[index].title)),
+ title: String(titles[index].title),
};
});
next(null, totals);
diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.js
index ee393a42b9..c1ad05b119 100644
--- a/src/socket.io/posts/tools.js
+++ b/src/socket.io/posts/tools.js
@@ -1,7 +1,6 @@
'use strict';
var async = require('async');
-var validator = require('validator');
var posts = require('../../posts');
var topics = require('../../topics');
@@ -169,7 +168,7 @@ module.exports = function (SocketPosts) {
uid: socket.uid,
pid: data.pid,
ip: socket.ip,
- title: validator.escape(String(title)),
+ title: String(title),
}, next);
},
], callback);
diff --git a/src/socket.io/topics/tools.js b/src/socket.io/topics/tools.js
index 74cdb68e7e..7302a5ad04 100644
--- a/src/socket.io/topics/tools.js
+++ b/src/socket.io/topics/tools.js
@@ -1,7 +1,6 @@
'use strict';
var async = require('async');
-var validator = require('validator');
var topics = require('../../topics');
var events = require('../../events');
@@ -114,7 +113,7 @@ module.exports = function (SocketTopics) {
uid: socket.uid,
ip: socket.ip,
tid: tid,
- title: validator.escape(String(title)),
+ title: String(title),
}, next);
},
], callback);
diff --git a/src/topics/create.js b/src/topics/create.js
index 01a0a87460..2ec75d3781 100644
--- a/src/topics/create.js
+++ b/src/topics/create.js
@@ -324,7 +324,7 @@ module.exports = function (Topics) {
postData.display_move_tools = true;
postData.selfPost = false;
postData.timestampISO = utils.toISOString(postData.timestamp);
- postData.topic.title = validator.escape(String(postData.topic.title));
+ postData.topic.title = String(postData.topic.title);
next(null, postData);
},
diff --git a/src/topics/data.js b/src/topics/data.js
index 8df112dcbf..d0a6208632 100644
--- a/src/topics/data.js
+++ b/src/topics/data.js
@@ -5,14 +5,43 @@ var validator = require('validator');
var db = require('../database');
var categories = require('../categories');
var utils = require('../utils');
+var translator = require('../translator');
+
+function escapeTitle(topicData) {
+ if (!topicData) {
+ return;
+ }
+ if (topicData.title) {
+ topicData.title = translator.escape(validator.escape(topicData.title.toString()));
+ }
+ if (topicData.titleRaw) {
+ topicData.titleRaw = translator.escape(topicData.titleRaw);
+ }
+}
module.exports = function (Topics) {
Topics.getTopicField = function (tid, field, callback) {
- db.getObjectField('topic:' + tid, field, callback);
+ db.getObjectField('topic:' + tid, field, function (err, value) {
+ if (err) {
+ return callback(err);
+ }
+
+ if (field === 'title') {
+ value = translator.escape(validator.escape(String(value)));
+ }
+ callback(null, value);
+ });
};
Topics.getTopicFields = function (tid, fields, callback) {
- db.getObjectFields('topic:' + tid, fields, callback);
+ db.getObjectFields('topic:' + tid, fields, function (err, topic) {
+ if (err) {
+ return callback(err);
+ }
+
+ escapeTitle(topic);
+ callback(null, topic);
+ });
};
Topics.getTopicsFields = function (tids, fields, callback) {
@@ -22,7 +51,14 @@ module.exports = function (Topics) {
var keys = tids.map(function (tid) {
return 'topic:' + tid;
});
- db.getObjectsFields(keys, fields, callback);
+ db.getObjectsFields(keys, fields, function (err, topics) {
+ if (err) {
+ return callback(err);
+ }
+
+ topics.forEach(escapeTitle);
+ callback(null, topics);
+ });
};
Topics.getTopicData = function (tid, callback) {
@@ -57,8 +93,10 @@ module.exports = function (Topics) {
if (!topic) {
return;
}
+
topic.titleRaw = topic.title;
- topic.title = validator.escape(String(topic.title));
+ topic.title = String(topic.title);
+ escapeTitle(topic);
topic.timestampISO = utils.toISOString(topic.timestamp);
topic.lastposttimeISO = utils.toISOString(topic.lastposttime);
}