v1.18.x
barisusakli 8 years ago
commit e3205bcfad

@ -1,71 +1,71 @@
[ [
{ {
"route": "/categories", "route": "/categories",
"title": "\\[\\[global:header.categories\\]\\]", "title": "[[global:header.categories]]",
"enabled": true, "enabled": true,
"iconClass": "fa-list", "iconClass": "fa-list",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.categories\\]\\]" "text": "[[global:header.categories]]"
}, },
{ {
"id": "unread-count", "id": "unread-count",
"route": "/unread", "route": "/unread",
"title": "\\[\\[global:header.unread\\]\\]", "title": "[[global:header.unread]]",
"enabled": true, "enabled": true,
"iconClass": "fa-inbox", "iconClass": "fa-inbox",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.unread\\]\\]", "text": "[[global:header.unread]]",
"properties": { "properties": {
"loggedIn": true "loggedIn": true
} }
}, },
{ {
"route": "/recent", "route": "/recent",
"title": "\\[\\[global:header.recent\\]\\]", "title": "[[global:header.recent]]",
"enabled": true, "enabled": true,
"iconClass": "fa-clock-o", "iconClass": "fa-clock-o",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.recent\\]\\]" "text": "[[global:header.recent]]"
}, },
{ {
"route": "/tags", "route": "/tags",
"title": "\\[\\[global:header.tags\\]\\]", "title": "[[global:header.tags]]",
"enabled": true, "enabled": true,
"iconClass": "fa-tags", "iconClass": "fa-tags",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.tags\\]\\]" "text": "[[global:header.tags]]"
}, },
{ {
"route": "/popular", "route": "/popular",
"title": "\\[\\[global:header.popular\\]\\]", "title": "[[global:header.popular]]",
"enabled": true, "enabled": true,
"iconClass": "fa-fire", "iconClass": "fa-fire",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.popular\\]\\]" "text": "[[global:header.popular]]"
}, },
{ {
"route": "/users", "route": "/users",
"title": "\\[\\[global:header.users\\]\\]", "title": "[[global:header.users]]",
"enabled": true, "enabled": true,
"iconClass": "fa-user", "iconClass": "fa-user",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.users\\]\\]" "text": "[[global:header.users]]"
}, },
{ {
"route": "/groups", "route": "/groups",
"title": "\\[\\[global:header.groups\\]\\]", "title": "[[global:header.groups]]",
"enabled": true, "enabled": true,
"iconClass": "fa-group", "iconClass": "fa-group",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.groups\\]\\]" "text": "[[global:header.groups]]"
}, },
{ {
"route": "/admin", "route": "/admin",
"title": "\\[\\[global:header.admin\\]\\]", "title": "[[global:header.admin]]",
"enabled": true, "enabled": true,
"iconClass": "fa-cogs", "iconClass": "fa-cogs",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.admin\\]\\]", "text": "[[global:header.admin]]",
"properties": { "properties": {
"targetBlank": false, "targetBlank": false,
"adminOnly": true "adminOnly": true
@ -73,11 +73,11 @@
}, },
{ {
"route": "/search", "route": "/search",
"title": "\\[\\[global:header.search\\]\\]", "title": "[[global:header.search]]",
"enabled": true, "enabled": true,
"iconClass": "fa-search", "iconClass": "fa-search",
"textClass": "visible-xs-inline", "textClass": "visible-xs-inline",
"text": "\\[\\[global:header.search\\]\\]", "text": "[[global:header.search]]",
"properties": { "properties": {
"searchInstalled": true "searchInstalled": true
} }

@ -1,31 +1,31 @@
{ {
"chat.chatting_with": "Συνομιλία με τον/την <span id=\"chat-with-name\"></span>", "chat.chatting_with": "Chat with <span id=\"chat-with-name\"></span>",
"chat.placeholder": "Γράψε το μήνυμά σου εδώ, πάτα enter για αποστολή", "chat.placeholder": "Type chat message here, press enter to send",
"chat.send": "Αποστολή", "chat.send": "Send",
"chat.no_active": "Δεν έχεις ενεργές συνομιλίες.", "chat.no_active": "You have no active chats.",
"chat.user_typing": "Ο/Η %1 πληκτρολογεί...", "chat.user_typing": "%1 is typing ...",
"chat.user_has_messaged_you": "Ο/Η %1 σου έστειλε μήνυμα.", "chat.user_has_messaged_you": "%1 has messaged you.",
"chat.see_all": "See all chats", "chat.see_all": "See all chats",
"chat.mark_all_read": "Mark all chats read", "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.no-users-in-room": "No users in this room",
"chat.recent-chats": "Πρόσφατες Συνομιλίες", "chat.recent-chats": "Recent Chats",
"chat.contacts": "Επαφές", "chat.contacts": "Contacts",
"chat.message-history": "Ιστορικό Συνομιλίας", "chat.message-history": "Message History",
"chat.pop-out": "Αποκόλληση συνομιλίας", "chat.pop-out": "Pop out chat",
"chat.minimize": "Minimize", "chat.minimize": "Minimize",
"chat.maximize": "Μεγιστοποίηση", "chat.maximize": "Maximize",
"chat.seven_days": "7 Ημέρες", "chat.seven_days": "7 Days",
"chat.thirty_days": "30 Ημέρες", "chat.thirty_days": "30 Days",
"chat.three_months": "3 Μήνες", "chat.three_months": "3 Months",
"chat.delete_message_confirm": "Are you sure you wish to delete this message?", "chat.delete_message_confirm": "Are you sure you wish to delete this message?",
"chat.add-users-to-room": "Add users to room", "chat.add-users-to-room": "Add users to room",
"composer.compose": "Compose", "composer.compose": "Compose",
"composer.show_preview": "Show Preview", "composer.show_preview": "Show Preview",
"composer.hide_preview": "Hide Preview", "composer.hide_preview": "Hide Preview",
"composer.user_said_in": "Ο/Η %1 είπε στο %2:", "composer.user_said_in": "%1 said in %2:",
"composer.user_said": "Ο/Η %1 είπε:", "composer.user_said": "%1 said:",
"composer.discard": "Είσαι σίγουρος/η πως θέλεις να πετάξεις αυτή την δημοσίευση;", "composer.discard": "Are you sure you wish to discard this post?",
"composer.submit_and_lock": "Submit and Lock", "composer.submit_and_lock": "Submit and Lock",
"composer.toggle_dropdown": "Toggle Dropdown", "composer.toggle_dropdown": "Toggle Dropdown",
"composer.uploading": "Uploading %1", "composer.uploading": "Uploading %1",

@ -1,15 +1,15 @@
{ {
"title": "Ειδοποιήσεις", "title": "Notifications",
"no_notifs": "Δεν έχεις νέες ειδοποιήσεις;", "no_notifs": "You have no new notifications",
"see_all": "See all notifications", "see_all": "See all notifications",
"mark_all_read": "Mark all notifications read", "mark_all_read": "Mark all notifications read",
"back_to_home": "Πίσω στο %1", "back_to_home": "Back to %1",
"outgoing_link": "Εξερχόμενος Σύνδεσμος", "outgoing_link": "Outgoing Link",
"outgoing_link_message": "You are now leaving %1", "outgoing_link_message": "You are now leaving %1",
"continue_to": "Συνέχεια στο %1", "continue_to": "Continue to %1",
"return_to": "Επιστροφή στο %1", "return_to": "Return to %1",
"new_notification": "Νέα Ειδοποίηση", "new_notification": "New Notification",
"you_have_unread_notifications": "Έχεις μη αναγνωσμένες ειδοποιήσεις.", "you_have_unread_notifications": "You have unread notifications.",
"all": "All", "all": "All",
"topics": "Topics", "topics": "Topics",
"replies": "Replies", "replies": "Replies",
@ -19,30 +19,30 @@
"new-flags": "New Flags", "new-flags": "New Flags",
"my-flags": "Flags assigned to me", "my-flags": "Flags assigned to me",
"bans": "Bans", "bans": "Bans",
"new_message_from": "Νέο μήνυμα από τον/την <strong>%1</strong>", "new_message_from": "New message from <strong>%1</strong>",
"upvoted_your_post_in": "Ο/Η <strong>%1</strong> υπερψήφισε την δημοσίευσή σου στο <strong>%2</strong>.", "upvoted_your_post_in": "<strong>%1</strong> has upvoted your post in <strong>%2</strong>.",
"upvoted_your_post_in_dual": "<strong>%1</strong> and <strong>%2</strong> have upvoted your post in <strong>%3</strong>.", "upvoted_your_post_in_dual": "<strong>%1</strong> and <strong>%2</strong> have upvoted your post in <strong>%3</strong>.",
"upvoted_your_post_in_multiple": "<strong>%1</strong> and %2 others have upvoted your post in <strong>%3</strong>.", "upvoted_your_post_in_multiple": "<strong>%1</strong> and %2 others have upvoted your post in <strong>%3</strong>.",
"moved_your_post": "<strong>%1</strong> has moved your post to <strong>%2</strong>", "moved_your_post": "<strong>%1</strong> has moved your post to <strong>%2</strong>",
"moved_your_topic": "<strong>%1</strong> has moved <strong>%2</strong>", "moved_your_topic": "<strong>%1</strong> has moved <strong>%2</strong>",
"user_flagged_post_in": "Ο/Η <strong>%1</strong> επεσήμανε μια δημοσίευσή σου στο <strong>%2</strong>", "user_flagged_post_in": "<strong>%1</strong> flagged a post in <strong>%2</strong>",
"user_flagged_post_in_dual": "<strong>%1</strong> and <strong>%2</strong> flagged a post in <strong>%3</strong>", "user_flagged_post_in_dual": "<strong>%1</strong> and <strong>%2</strong> flagged a post in <strong>%3</strong>",
"user_flagged_post_in_multiple": "<strong>%1</strong> and %2 others flagged a post in <strong>%3</strong>", "user_flagged_post_in_multiple": "<strong>%1</strong> and %2 others flagged a post in <strong>%3</strong>",
"user_flagged_user": "<strong>%1</strong> flagged a user profile (%2)", "user_flagged_user": "<strong>%1</strong> flagged a user profile (%2)",
"user_flagged_user_dual": "<strong>%1</strong> and <strong>%2</strong> flagged a user profile (%3)", "user_flagged_user_dual": "<strong>%1</strong> and <strong>%2</strong> flagged a user profile (%3)",
"user_flagged_user_multiple": "<strong>%1</strong> and %2 others flagged a user profile (%3)", "user_flagged_user_multiple": "<strong>%1</strong> and %2 others flagged a user profile (%3)",
"user_posted_to": "Ο/Η <strong>%1</strong> έγραψε μια απάντηση στο: <strong>%2</strong>", "user_posted_to": "<strong>%1</strong> has posted a reply to: <strong>%2</strong>",
"user_posted_to_dual": "<strong>%1</strong> and <strong>%2</strong> have posted replies to: <strong>%3</strong>", "user_posted_to_dual": "<strong>%1</strong> and <strong>%2</strong> have posted replies to: <strong>%3</strong>",
"user_posted_to_multiple": "<strong>%1</strong> and %2 others have posted replies to: <strong>%3</strong>", "user_posted_to_multiple": "<strong>%1</strong> and %2 others have posted replies to: <strong>%3</strong>",
"user_posted_topic": "<strong>%1</strong> has posted a new topic: <strong>%2</strong>", "user_posted_topic": "<strong>%1</strong> has posted a new topic: <strong>%2</strong>",
"user_started_following_you": "Ο/Η <strong>%1</strong> σε ακολουθεί.", "user_started_following_you": "<strong>%1</strong> started following you.",
"user_started_following_you_dual": "<strong>%1</strong> and <strong>%2</strong> started following you.", "user_started_following_you_dual": "<strong>%1</strong> and <strong>%2</strong> started following you.",
"user_started_following_you_multiple": "<strong>%1</strong> and %2 others started following you.", "user_started_following_you_multiple": "<strong>%1</strong> and %2 others started following you.",
"new_register": "<strong>%1</strong> sent a registration request.", "new_register": "<strong>%1</strong> sent a registration request.",
"new_register_multiple": "There are <strong>%1</strong> registration requests awaiting review.", "new_register_multiple": "There are <strong>%1</strong> registration requests awaiting review.",
"flag_assigned_to_you": "<strong>Flag %1</strong> has been assigned to you", "flag_assigned_to_you": "<strong>Flag %1</strong> has been assigned to you",
"email-confirmed": "Το Εmail Επιβεβαιώθηκε", "email-confirmed": "Email Confirmed",
"email-confirmed-message": "Ευχαριστούμε που επιβεβαίωσες το email σου. Ο λογαριασμός σου είναι πλέον πλήρως ενεργοποιημένος.", "email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
"email-confirm-error-message": "Υπήρξε κάποιο πρόβλημα με την επιβεβαίωση της διεύθυνσής email σου. Ίσως ο κώδικας να είναι άκυρος ή να έχει λήξει.", "email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired.",
"email-confirm-sent": "Στάλθηκε email επιβεβαίωσης." "email-confirm-sent": "Στάλθηκε email επιβεβαίωσης."
} }

@ -9,8 +9,8 @@
"repeat_password": "Επιβεβαίωση Κωδικού", "repeat_password": "Επιβεβαίωση Κωδικού",
"enter_email": "Παρακαλώ γράψε την <strong>διεύθυνση email σου</strong> και θα σου στείλουμε ένα email με οδηγίες για το πως να επαναφέρεις τον λογαριασμό σου.", "enter_email": "Παρακαλώ γράψε την <strong>διεύθυνση email σου</strong> και θα σου στείλουμε ένα email με οδηγίες για το πως να επαναφέρεις τον λογαριασμό σου.",
"enter_email_address": "Εισαγωγή Διεύθυνσης Email", "enter_email_address": "Εισαγωγή Διεύθυνσης Email",
"password_reset_sent": "Η Επαναφορά Κωδικού Εστάλη", "password_reset_sent": "Password Reset Sent",
"invalid_email": "Άκυρο Email / Το email δεν υπάρχει!", "invalid_email": "Invalid Email / Email does not exist!",
"password_too_short": "The password entered is too short, please pick a different password.", "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.", "passwords_do_not_match": "The two passwords you've entered do not match.",
"password_expired": "Your password has expired, please choose a new password" "password_expired": "Your password has expired, please choose a new password"

@ -1,13 +1,13 @@
{ {
"password-reset-requested": "Отриман запит на відновлення паролю - %1!", "password-reset-requested": "Отриманий запит на відновлення паролю - %1!",
"welcome-to": "Ласкаво просимо до %1", "welcome-to": "Ласкаво просимо до %1",
"invite": "Запрошення від %1", "invite": "Запрошення від %1",
"greeting_no_name": "Привіт", "greeting_no_name": "Привіт",
"greeting_with_name": "Привіт %1", "greeting_with_name": "Привіт %1",
"welcome.text1": "Дякуємо за реєстрацію з %1!", "welcome.text1": "Дякуємо за реєстрацію з %1!",
"welcome.text2": "Щоб повністю активувати ваш аккаунт, нам потрібно верефікувати володіння е-мейлом, який ви вказали при реєстрації ", "welcome.text2": "Щоб повністю активувати ваш аккаунт, нам потрібно перевірити, що вам належить електронна адреса, яку ви вказали при реєстрації ",
"welcome.text3": "Адміністратор схвалив ваш запит на реєстрацію. Ви можете залогінитись, використовуючи свій пароль та назву аккаунту", "welcome.text3": "Адміністратор схвалив ваш запит на реєстрацію. Ви можете залогінитись, використовуючи свій пароль та назву аккаунту",
"welcome.cta": "Натисніть тут, щоб підтвердити вашу скриньку", "welcome.cta": "Натисніть тут, щоб підтвердити вашу електронну адресу",
"invitation.text1": "%1 запросив вас приєднатися до %2", "invitation.text1": "%1 запросив вас приєднатися до %2",
"invitation.ctr": "Натисніть тут, щоб створити аккаунт", "invitation.ctr": "Натисніть тут, щоб створити аккаунт",
"reset.text1": "Ми отримали запит на відновлення вашого паролю, можливо тому, что ви його забули. Якщо це не потрібно - проігноруйте цей лист", "reset.text1": "Ми отримали запит на відновлення вашого паролю, можливо тому, что ви його забули. Якщо це не потрібно - проігноруйте цей лист",

@ -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/');
});
}()); }());

@ -1,6 +1,5 @@
'use strict'; 'use strict';
define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Settings, ace) { define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Settings, ace) {
var Customise = {}; var Customise = {};

@ -1,7 +1,7 @@
'use strict'; '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 module = {};
var emailEditor; var emailEditor;

@ -50,6 +50,7 @@
/** /**
* Construct a new Translator object * Construct a new Translator object
* @param {string} language - Language code for this translator instance * @param {string} language - Language code for this translator instance
* @exports translator.Translator
*/ */
function Translator(language) { function Translator(language) {
var self = this; var self = this;
@ -283,7 +284,7 @@
} }
var argsToTranslate = args.map(function (arg) { var argsToTranslate = args.map(function (arg) {
return string(arg).collapseWhitespace().decodeHTMLEntities().escapeHTML().s; return string(arg).collapseWhitespace().decodeHTMLEntities().escapeHTML().s.replace(/&amp;/g, '&');
}).map(function (arg) { }).map(function (arg) {
return self.translate(arg); return self.translate(arg);
}); });
@ -443,6 +444,9 @@
return Translator; return Translator;
}()); }());
/**
* @exports translator
*/
var adaptor = { var adaptor = {
/** /**
* The Translator class * The Translator class

@ -3,7 +3,6 @@
var async = require('async'); var async = require('async');
var winston = require('winston'); var winston = require('winston');
var validator = require('validator');
var _ = require('underscore'); var _ = require('underscore');
var db = require('../database'); var db = require('../database');
@ -11,7 +10,6 @@ var posts = require('../posts');
var topics = require('../topics'); var topics = require('../topics');
var privileges = require('../privileges'); var privileges = require('../privileges');
var batch = require('../batch'); var batch = require('../batch');
var translator = require('../translator');
module.exports = function (Categories) { module.exports = function (Categories) {
Categories.getRecentReplies = function (cid, uid, count, callback) { Categories.getRecentReplies = function (cid, uid, count, callback) {
@ -136,7 +134,7 @@ module.exports = function (Categories) {
teaser.user.uid = undefined; teaser.user.uid = undefined;
teaser.topic = { teaser.topic = {
slug: topicData[index].slug, slug: topicData[index].slug,
title: translator.escape(validator.escape(String(topicData[index].title))), title: topicData[index].title,
}; };
} }
}); });

@ -161,9 +161,6 @@ categoryController.get = function (req, res, callback) {
return callback(err); return callback(err);
} }
categoryData.topics.forEach(function (topic) {
topic.title = translator.escape(topic.title);
});
categoryData.description = translator.escape(categoryData.description); categoryData.description = translator.escape(categoryData.description);
categoryData.privileges = userPrivileges; categoryData.privileges = userPrivileges;
categoryData.showSelect = categoryData.privileges.editable; categoryData.showSelect = categoryData.privileges.editable;

@ -14,7 +14,6 @@ var plugins = require('../plugins');
var helpers = require('./helpers'); var helpers = require('./helpers');
var pagination = require('../pagination'); var pagination = require('../pagination');
var utils = require('../utils'); var utils = require('../utils');
var translator = require('../translator');
var topicsController = {}; var topicsController = {};
@ -130,14 +129,13 @@ topicsController.get = function (req, res, callback) {
plugins.fireHook('filter:controllers.topic.get', { topicData: topicData, uid: req.uid }, next); plugins.fireHook('filter:controllers.topic.get', { topicData: topicData, uid: req.uid }, next);
}, },
function (data, next) { function (data, next) {
data.topicData.title = translator.escape(data.topicData.title);
var breadcrumbs = [ var breadcrumbs = [
{ {
text: data.topicData.category.name, text: data.topicData.category.name,
url: nconf.get('relative_path') + '/category/' + data.topicData.category.slug, url: nconf.get('relative_path') + '/category/' + data.topicData.category.slug,
}, },
{ {
text: translator.escape(data.topicData.title), text: data.topicData.title,
}, },
]; ];

@ -116,9 +116,9 @@
var meta = require('../meta'); var meta = require('../meta');
var sessionStore; var sessionStore;
var ttlDays = 1000 * 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0); var ttlDays = 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 0);
var ttlSeconds = 1000 * (parseInt(meta.config.loginSeconds, 10) || 0); var ttlSeconds = (parseInt(meta.config.loginSeconds, 10) || 0);
var ttl = ttlSeconds || ttlDays || 1209600000; // Default to 14 days var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days in seconds
if (nconf.get('redis')) { if (nconf.get('redis')) {
sessionStore = require('connect-redis')(session); sessionStore = require('connect-redis')(session);

@ -31,6 +31,9 @@ Languages.list = function (callback) {
var languages = []; var languages = [];
fs.readdir(languagesPath, function (err, files) { fs.readdir(languagesPath, function (err, files) {
if (err && err.code === 'ENOENT') {
return callback(null, []);
}
if (err) { if (err) {
return callback(err); return callback(err);
} }

@ -5,12 +5,11 @@ var async = require('async');
var validator = require('validator'); var validator = require('validator');
var S = require('string'); var S = require('string');
var db = require('../database'); var topics = require('../topics');
var user = require('../user'); var user = require('../user');
var plugins = require('../plugins'); var plugins = require('../plugins');
var categories = require('../categories'); var categories = require('../categories');
var utils = require('../utils'); var utils = require('../utils');
var translator = require('../translator');
module.exports = function (Posts) { module.exports = function (Posts) {
Posts.getPostSummaryByPids = function (pids, uid, options, callback) { Posts.getPostSummaryByPids = function (pids, uid, options, callback) {
@ -39,8 +38,8 @@ module.exports = function (Posts) {
if (uids.indexOf(posts[i].uid) === -1) { if (uids.indexOf(posts[i].uid) === -1) {
uids.push(posts[i].uid); uids.push(posts[i].uid);
} }
if (topicKeys.indexOf('topic:' + posts[i].tid) === -1) { if (topicKeys.indexOf(posts[i].tid) === -1) {
topicKeys.push('topic:' + posts[i].tid); topicKeys.push(posts[i].tid);
} }
}); });
async.parallel({ async.parallel({
@ -111,15 +110,15 @@ module.exports = function (Posts) {
}, callback); }, callback);
} }
function getTopicAndCategories(topicKeys, callback) { function getTopicAndCategories(tids, callback) {
db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount', 'mainPid'], function (err, topics) { topics.getTopicsFields(tids, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount', 'mainPid'], function (err, topics) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
var cids = topics.map(function (topic) { var cids = topics.map(function (topic) {
if (topic) { if (topic) {
topic.title = translator.escape(validator.escape(String(topic.title))); topic.title = String(topic.title);
topic.deleted = parseInt(topic.deleted, 10) === 1; topic.deleted = parseInt(topic.deleted, 10) === 1;
} }
return topic && topic.cid; return topic && topic.cid;

@ -5,7 +5,7 @@ var async = require('async');
var os = require('os'); var os = require('os');
var nconf = require('nconf'); var nconf = require('nconf');
var winston = require('winston'); var winston = require('winston');
var validator = require('validator');
var topics = require('../../topics'); var topics = require('../../topics');
var pubsub = require('../../pubsub'); var pubsub = require('../../pubsub');
@ -109,7 +109,7 @@ SocketRooms.getAll = function (socket, data, callback) {
topTenTopics.forEach(function (topic, index) { topTenTopics.forEach(function (topic, index) {
totals.topics[topic.tid] = { totals.topics[topic.tid] = {
value: topic.count || 0, value: topic.count || 0,
title: validator.escape(String(titles[index].title)), title: String(titles[index].title),
}; };
}); });
next(null, totals); next(null, totals);

@ -1,7 +1,6 @@
'use strict'; 'use strict';
var async = require('async'); var async = require('async');
var validator = require('validator');
var posts = require('../../posts'); var posts = require('../../posts');
var topics = require('../../topics'); var topics = require('../../topics');
@ -169,7 +168,7 @@ module.exports = function (SocketPosts) {
uid: socket.uid, uid: socket.uid,
pid: data.pid, pid: data.pid,
ip: socket.ip, ip: socket.ip,
title: validator.escape(String(title)), title: String(title),
}, next); }, next);
}, },
], callback); ], callback);

@ -1,7 +1,6 @@
'use strict'; 'use strict';
var async = require('async'); var async = require('async');
var validator = require('validator');
var topics = require('../../topics'); var topics = require('../../topics');
var events = require('../../events'); var events = require('../../events');
@ -114,7 +113,7 @@ module.exports = function (SocketTopics) {
uid: socket.uid, uid: socket.uid,
ip: socket.ip, ip: socket.ip,
tid: tid, tid: tid,
title: validator.escape(String(title)), title: String(title),
}, next); }, next);
}, },
], callback); ], callback);

@ -324,7 +324,7 @@ module.exports = function (Topics) {
postData.display_move_tools = true; postData.display_move_tools = true;
postData.selfPost = false; postData.selfPost = false;
postData.timestampISO = utils.toISOString(postData.timestamp); 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); next(null, postData);
}, },

@ -5,14 +5,43 @@ var validator = require('validator');
var db = require('../database'); var db = require('../database');
var categories = require('../categories'); var categories = require('../categories');
var utils = require('../utils'); 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) { module.exports = function (Topics) {
Topics.getTopicField = function (tid, field, callback) { 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) { 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) { Topics.getTopicsFields = function (tids, fields, callback) {
@ -22,7 +51,14 @@ module.exports = function (Topics) {
var keys = tids.map(function (tid) { var keys = tids.map(function (tid) {
return 'topic:' + 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) { Topics.getTopicData = function (tid, callback) {
@ -57,8 +93,10 @@ module.exports = function (Topics) {
if (!topic) { if (!topic) {
return; return;
} }
topic.titleRaw = topic.title; 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.timestampISO = utils.toISOString(topic.timestamp);
topic.lastposttimeISO = utils.toISOString(topic.lastposttime); topic.lastposttimeISO = utils.toISOString(topic.lastposttime);
} }

Loading…
Cancel
Save