mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 19:21:04 +01:00
merge
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
{
|
||||
"chat.chatting_with": "Συνομιλία με τον/την <span id=\"chat-with-name\"></span>",
|
||||
"chat.placeholder": "Γράψε το μήνυμά σου εδώ, πάτα enter για αποστολή",
|
||||
"chat.send": "Αποστολή",
|
||||
"chat.no_active": "Δεν έχεις ενεργές συνομιλίες.",
|
||||
"chat.user_typing": "Ο/Η %1 πληκτρολογεί...",
|
||||
"chat.user_has_messaged_you": "Ο/Η %1 σου έστειλε μήνυμα.",
|
||||
"chat.chatting_with": "Chat with <span id=\"chat-with-name\"></span>",
|
||||
"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",
|
||||
|
||||
@@ -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": "Νέο μήνυμα από τον/την <strong>%1</strong>",
|
||||
"upvoted_your_post_in": "Ο/Η <strong>%1</strong> υπερψήφισε την δημοσίευσή σου στο <strong>%2</strong>.",
|
||||
"new_message_from": "New message from <strong>%1</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_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_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_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_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_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_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_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_multiple": "<strong>%1</strong> and %2 others started following you.",
|
||||
"new_register": "<strong>%1</strong> sent a registration request.",
|
||||
"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",
|
||||
"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 επιβεβαίωσης."
|
||||
}
|
||||
@@ -9,8 +9,8 @@
|
||||
"repeat_password": "Επιβεβαίωση Κωδικού",
|
||||
"enter_email": "Παρακαλώ γράψε την <strong>διεύθυνση email σου</strong> και θα σου στείλουμε ένα 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"
|
||||
|
||||
@@ -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": "Ми отримали запит на відновлення вашого паролю, можливо тому, что ви його забули. Якщо це не потрібно - проігноруйте цей лист",
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Settings, ace) {
|
||||
var Customise = {};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user