From 520b349c1742ce930a0124d6c4acc2f2ce5635cc Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 19 Feb 2014 13:30:31 -0500 Subject: [PATCH 1/9] closes #1044 --- public/src/forum/accountedit.js | 9 +++-- public/templates/topic.tpl | 2 +- src/events.js | 18 ++++++++-- src/user.js | 58 +++++++++++++++++++++++++-------- 4 files changed, 65 insertions(+), 22 deletions(-) diff --git a/public/src/forum/accountedit.js b/public/src/forum/accountedit.js index 0deeda57c7..13bab6cf9d 100644 --- a/public/src/forum/accountedit.js +++ b/public/src/forum/accountedit.js @@ -190,10 +190,11 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) { $('#changePasswordBtn').on('click', function() { - if (passwordvalid && passwordsmatch && currentPassword.val()) { + if (passwordvalid && passwordsmatch && (currentPassword.val() || app.isAdmin)) { socket.emit('user.changePassword', { 'currentPassword': currentPassword.val(), - 'newPassword': password.val() + 'newPassword': password.val(), + 'uid': templates.get('theirid') }, function(err) { currentPassword.val(''); @@ -203,12 +204,10 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) { passwordvalid = false; if (err) { - app.alertError(err.message); - return; + return app.alertError(err.message); } app.alertSuccess('Your password is updated!'); - }); } return false; diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 76e937b93c..c6eeaeb2df 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -296,4 +296,4 @@ - \ No newline at end of file + diff --git a/src/events.js b/src/events.js index e7ac7356e2..825db1c832 100644 --- a/src/events.js +++ b/src/events.js @@ -13,6 +13,17 @@ var fs = require('fs'), logWithUser(uid, 'changed password'); } + events.logAdminChangeUserPassword = function(adminUid, theirUid) { + user.getMultipleUserFields([adminUid, theirUid], ['username'], function(err, userData) { + if(err) { + return winston.error('Error logging event. ' + err.message); + } + + var msg = userData[0].username + '(uid ' + adminUid + ') changed password of ' + userData[1].username + '(uid ' + theirUid + ')'; + events.log(msg); + }); + } + events.logPasswordReset = function(uid) { logWithUser(uid, 'reset password'); } @@ -53,11 +64,10 @@ var fs = require('fs'), user.getUserField(uid, 'username', function(err, username) { if(err) { - winston.error('Error logging event. ' + err.message); - return; + return winston.error('Error logging event. ' + err.message); } - var msg = '[' + new Date().toUTCString() + '] - ' + username + '(uid ' + uid + ') ' + string; + var msg = username + '(uid ' + uid + ') ' + string; events.log(msg); }); } @@ -65,6 +75,8 @@ var fs = require('fs'), events.log = function(msg) { var logFile = path.join(nconf.get('base_dir'), logFileName); + msg = '[' + new Date().toUTCString() + '] - ' + msg; + fs.appendFile(logFile, msg + '\n', function(err) { if(err) { winston.error('Error logging event. ' + err.message); diff --git a/src/user.js b/src/user.js index 13d3669f2c..a3edb449d1 100644 --- a/src/user.js +++ b/src/user.js @@ -424,27 +424,59 @@ var bcrypt = require('bcryptjs'), }; User.changePassword = function(uid, data, callback) { + if(!data || !data.uid) { + return callback(new Error('invalid-uid')); + } + + function hashAndSetPassword(callback) { + User.hashPassword(data.newPassword, function(err, hash) { + if(err) { + return callback(err); + } + + User.setUserField(data.uid, 'password', hash, function(err) { + if(err) { + return callback(err); + } + + if(parseInt(uid, 10) === parseInt(data.uid, 10)) { + events.logPasswordChange(data.uid); + } else { + events.logAdminChangeUserPassword(uid, data.uid); + } + + callback(); + }); + }); + } + if (!utils.isPasswordValid(data.newPassword)) { return callback(new Error('Invalid password!')); } - User.getUserField(uid, 'password', function(err, currentPassword) { - bcrypt.compare(data.currentPassword, currentPassword, function(err, res) { - if (err) { - return callback(err); + if(parseInt(uid, 10) !== parseInt(data.uid, 10)) { + User.isAdministrator(uid, function(err, isAdmin) { + if(err || !isAdmin) { + return callback(err || new Error('not-allowed')); } - if (res) { - User.hashPassword(data.newPassword, function(err, hash) { - User.setUserField(uid, 'password', hash); - events.logPasswordChange(uid); - callback(null); - }); - } else { - callback(new Error('Your current password is not correct!')); + hashAndSetPassword(callback); + }); + } else { + User.getUserField(uid, 'password', function(err, currentPassword) { + if(err) { + return callback(err); } + + bcrypt.compare(data.currentPassword, currentPassword, function(err, res) { + if (err || !res) { + return callback(err || new Error('Your current password is not correct!')); + } + + hashAndSetPassword(callback); + }); }); - }); + } }; User.setUserField = function(uid, field, value, callback) { From 7e2823bf3055e7344d6e0dabb6b7ec066c72de16 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 19 Feb 2014 13:57:09 -0500 Subject: [PATCH 2/9] show recent event data first' --- src/routes/admin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/admin.js b/src/routes/admin.js index c0afc39b4b..61e15a0f02 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -375,7 +375,10 @@ var nconf = require('nconf'), if(err) { return next(err); } - res.json(200, {eventdata: data.toString()}); + if(data) { + data = data.toString().split('\n').reverse().join('\n'); + } + res.json(200, {eventdata: data}); }); }); From 031e8128c77259561e8cd5cc95413ac354129672 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Feb 2014 14:33:34 -0500 Subject: [PATCH 3/9] fixed #912, added new page string for popular topics --- public/language/en_GB/pages.json | 1 + src/webserver.js | 37 ++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/public/language/en_GB/pages.json b/public/language/en_GB/pages.json index d01f5f8a9b..9fc75d3d2b 100644 --- a/public/language/en_GB/pages.json +++ b/public/language/en_GB/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/src/webserver.js b/src/webserver.js index d87c58b66d..fd6536e5e4 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -132,16 +132,6 @@ module.exports.server = server; href: nconf.get('relative_path') + '/favicon.ico' }); - // Browser Title - var metaTitle = templateValues.metaTags.filter(function(tag) { - return tag.property === 'og:title'; - }); - if (metaTitle.length > 0 && metaTitle[0].content) { - templateValues.browserTitle = metaTitle[0].content; - } else { - templateValues.browserTitle = meta.config.browserTitle || 'NodeBB'; - } - if(options.req.user && options.req.user.uid) { uid = options.req.user.uid; } @@ -153,15 +143,34 @@ module.exports.server = server; templateValues.customCSS = meta.config.customCSS; } - user.isAdministrator(uid, function(err, isAdmin) { - templateValues.isAdmin = isAdmin; + async.parallel([ + function(next) { + translator.get('pages:' + path.basename(options.req.url), function(translated) { + var metaTitle = templateValues.metaTags.filter(function(tag) { + return tag.name === 'title'; + }); + if (translated) { + templateValues.browserTitle = translated; + } else if (metaTitle.length > 0 && metaTitle[0].content) { + templateValues.browserTitle = metaTitle[0].content; + } else { + templateValues.browserTitle = meta.config.browserTitle || 'NodeBB'; + } + next(); + }); + }, + function(next) { + user.isAdministrator(uid, function(err, isAdmin) { + templateValues.isAdmin = isAdmin || false; + next(); + }); + } + ], function() { translator.translate(templates.header.parse(templateValues), function(template) { callback(null, template); }); }); - - }); }; From 7c7f66c08bf8b2fb9307d4a0db46a804e95c13ea Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Feb 2014 14:34:50 -0500 Subject: [PATCH 4/9] bringing language files up to date --- public/language/ar/pages.json | 1 + public/language/cs/pages.json | 1 + public/language/de/global.json | 8 ++--- public/language/de/notifications.json | 4 +-- public/language/de/pages.json | 1 + public/language/de/recent.json | 2 +- public/language/de/topic.json | 46 +++++++++++++-------------- public/language/de/user.json | 18 +++++------ public/language/es/pages.json | 1 + public/language/fi/pages.json | 1 + public/language/fr/pages.json | 1 + public/language/he/pages.json | 1 + public/language/hu/pages.json | 1 + public/language/it/pages.json | 1 + public/language/nb/pages.json | 1 + public/language/pl/global.json | 8 ++--- public/language/pl/pages.json | 1 + public/language/pl/topic.json | 10 +++--- public/language/pl/user.json | 2 +- public/language/pt_BR/pages.json | 1 + public/language/ru/notifications.json | 4 +-- public/language/ru/pages.json | 1 + public/language/ru/topic.json | 4 +-- public/language/sk/pages.json | 1 + public/language/sv/pages.json | 1 + public/language/tr/pages.json | 1 + public/language/zh_CN/global.json | 2 +- public/language/zh_CN/login.json | 2 +- public/language/zh_CN/pages.json | 1 + public/language/zh_CN/user.json | 30 ++++++++--------- public/language/zh_TW/pages.json | 1 + 31 files changed, 88 insertions(+), 70 deletions(-) diff --git a/public/language/ar/pages.json b/public/language/ar/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/ar/pages.json +++ b/public/language/ar/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/cs/pages.json b/public/language/cs/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/cs/pages.json +++ b/public/language/cs/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/de/global.json b/public/language/de/global.json index e301e623b4..7a6910df88 100644 --- a/public/language/de/global.json +++ b/public/language/de/global.json @@ -10,14 +10,14 @@ "500.message": "Ooops! Looks like something went wrong!", "register": "Registrierung", "login": "Login", - "welcome_back": "Welcome Back ", - "you_have_successfully_logged_in": "You have successfully logged in", + "welcome_back": "Willkommen zurück", + "you_have_successfully_logged_in": "Du hast dich erfolgreich eingeloggt", "logout": "Logout", "logout.title": "Du bist ausgeloggt.", "logout.message": "Du hast dich soeben erfolgreich aus dem Forum ausgeloggt.", "save_changes": "Speichere Änderungen", "close": "Schließen", - "pagination": "Pagination", + "pagination": "Seitennummerierung", "header.admin": "Admin", "header.recent": "Aktuell", "header.unread": "Ungelesen", @@ -52,5 +52,5 @@ "dnd": "Nicht stören", "invisible": "Unsichtbar", "offline": "Offline", - "privacy": "Privacy" + "privacy": "Privatsphäre" } \ No newline at end of file diff --git a/public/language/de/notifications.json b/public/language/de/notifications.json index 806e837806..b38e73a7bc 100644 --- a/public/language/de/notifications.json +++ b/public/language/de/notifications.json @@ -1,7 +1,7 @@ { "title": "Benachrichtigungen", - "no_notifs": "You have no new notifications", - "see_all": "See all Notifications", + "no_notifs": "Du hast keine neuen Benachrichtigungen", + "see_all": "Alle Benachrichtigungen ansehen", "back_to_home": "Zurück zur Startseite", "outgoing_link": "Externer Link", "outgoing_link_message": "Du verlässt nun", diff --git a/public/language/de/pages.json b/public/language/de/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/de/pages.json +++ b/public/language/de/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/de/recent.json b/public/language/de/recent.json index 33ec31df44..b787bae5cc 100644 --- a/public/language/de/recent.json +++ b/public/language/de/recent.json @@ -3,5 +3,5 @@ "day": "Tag", "week": "Woche", "month": "Monat", - "no_recent_topics": "There are no recent topics." + "no_recent_topics": "Es gibt keine aktuellen Themen." } \ No newline at end of file diff --git a/public/language/de/topic.json b/public/language/de/topic.json index fc52499c9c..2c073da3db 100644 --- a/public/language/de/topic.json +++ b/public/language/de/topic.json @@ -2,7 +2,7 @@ "topic": "Thema", "topics": "Themen", "no_topics_found": "Keine passende Themen gefunden.", - "no_posts_found": "No posts found!", + "no_posts_found": "Keine Beiträge gefunden!", "profile": "Profil", "posted_by": "Geposted von", "chat": "Chat", @@ -19,19 +19,19 @@ "tools": "Tools", "flag": "Markieren", "flag_title": "Diesen Beitrag zur Moderation markieren", - "deleted_message": "This thread has been deleted. Only users with thread management privileges can see it.", - "watch": "Watch", - "share_this_post": "Share this Post", + "deleted_message": "Dieser Thread wurde gelöscht. Nur Nutzer mit Thread-Management Rechten können ihn sehen.", + "watch": "Beobachten", + "share_this_post": "Diesen Beitrag teilen", "thread_tools.title": "Thread Tools", "thread_tools.markAsUnreadForAll": "Als ungelesen markieren", - "thread_tools.pin": "Pin Topic", - "thread_tools.unpin": "Unpin Topic", - "thread_tools.lock": "Lock Topic", - "thread_tools.unlock": "Unlock Topic", - "thread_tools.move": "Move Topic", - "thread_tools.fork": "Fork Topic", - "thread_tools.delete": "Delete Topic", - "thread_tools.restore": "Restore Topic", + "thread_tools.pin": "Thema anpinnen", + "thread_tools.unpin": "Thema nicht mehr anpinnen", + "thread_tools.lock": "Thema schließen", + "thread_tools.unlock": "Thema öffnen", + "thread_tools.move": "Thema verschieben", + "thread_tools.fork": "Thema aufspalten", + "thread_tools.delete": "Thema löschen", + "thread_tools.restore": "Thema wiederherstellen", "load_categories": "Kategorien laden", "disabled_categories_note": "Deaktivierte Kategorien sind ausgegraut.", "confirm_move": "verschieben", @@ -41,10 +41,10 @@ "favourites.not_logged_in.title": "Nicht eingeloggt!", "favourites.not_logged_in.message": "Bitte logge dich ein, um diesen Beitrag favorisieren zu können.", "favourites.has_no_favourites": "Du hast noch keine Favoriten.", - "vote.not_logged_in.title": "Not Logged In", - "vote.not_logged_in.message": "Please log in in order to vote", - "vote.cant_vote_self.title": "Invalid Vote", - "vote.cant_vote_self.message": "You cannot vote for your own post", + "vote.not_logged_in.title": "Nicht eingeloggt", + "vote.not_logged_in.message": "Zum Bewerten bitte einloggen", + "vote.cant_vote_self.title": "Ungültige Bewertung", + "vote.cant_vote_self.message": "Du kannst deinen eigenen Beitrag nicht bewerten", "loading_more_posts": "Lade Mehr Posts", "move_topic": "Thema verschieben", "move_post": "Beitrag verschieben", @@ -55,11 +55,11 @@ "fork_success": "Thema erfolgreich aufgespalten!", "reputation": "Reputation", "posts": "Beiträge", - "composer.title_placeholder": "Enter your topic title here...", - "composer.write": "Write", - "composer.preview": "Preview", - "composer.discard": "Discard", - "composer.submit": "Submit", - "composer.replying_to": "Replying to", - "composer.new_topic": "New Topic" + "composer.title_placeholder": "Hier den Titel des Themas eingeben...", + "composer.write": "Schreiben", + "composer.preview": "Vorschau", + "composer.discard": "Verwerfen", + "composer.submit": "Absenden", + "composer.replying_to": "Als Antwort auf", + "composer.new_topic": "Neues Thema" } \ No newline at end of file diff --git a/public/language/de/user.json b/public/language/de/user.json index 4acbcc6c91..ae5f8f2993 100644 --- a/public/language/de/user.json +++ b/public/language/de/user.json @@ -9,7 +9,7 @@ "age": "Alter", "joined": "Beigetreten", "lastonline": "Zuletzt online", - "profile": "Profile", + "profile": "Profil", "profile_views": "Profilaufrufe", "reputation": "Reputation", "posts": "Posts", @@ -20,28 +20,28 @@ "gravatar": "Gravatar", "birthday": "Geburtstag", "chat": "Chat", - "follow": "Follow", - "unfollow": "Unfollow", + "follow": "Folgen", + "unfollow": "Nicht mehr folgen", "change_picture": "Ändere Profilbild", "edit": "Ändern", "uploaded_picture": "Hochgeladene Bilder", "upload_new_picture": "Neues Bild hochladen", - "current_password": "Current Password", + "current_password": "Aktuelles Passwort", "change_password": "Ändere Passwort", "confirm_password": "Passwort wiederholen", "password": "Passwort", "upload_picture": "Bild hochladen", "upload_a_picture": "Ein Bild hochladen", - "image_spec": "You may only upload PNG, JPG, or GIF files", + "image_spec": "Du darfst nur Dateien vom Typ PNG, JPG oder GIF hochladen", "max": "max.", "settings": "Einstellungen", "show_email": "Zeige meine E-Mail Adresse an.", "has_no_follower": "Dieser User hat noch keine Follower.", "follows_no_one": "Dieser User folgt noch niemanden.", - "has_no_posts": "This user didn't post anything yet.", + "has_no_posts": "Dieser Nutzer hat noch nichts gepostet.", "email_hidden": "E-Mail Adresse versteckt", "hidden": "versteckt", - "paginate_description": "Paginate topics and posts instead of using infinite scroll.", - "topics_per_page": "Topics per Page", - "posts_per_page": "Posts per Page" + "paginate_description": "Themen und Beiträge auf Seiten aufteilen statt unendliches Scrollen verweden", + "topics_per_page": "Themen pro Seite", + "posts_per_page": "Beiträge pro Seite" } \ No newline at end of file diff --git a/public/language/es/pages.json b/public/language/es/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/es/pages.json +++ b/public/language/es/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/fi/pages.json b/public/language/fi/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/fi/pages.json +++ b/public/language/fi/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/fr/pages.json b/public/language/fr/pages.json index baf9d9473e..3c61eb6cf8 100644 --- a/public/language/fr/pages.json +++ b/public/language/fr/pages.json @@ -1,6 +1,7 @@ { "home": "Accueil", "unread": "Sujets non lus", + "popular": "Popular Topics", "recent": "Sujets Récents", "users": "Utilisateurs enregistrés", "notifications": "Notifications", diff --git a/public/language/he/pages.json b/public/language/he/pages.json index a7cf97124d..0ff571585f 100644 --- a/public/language/he/pages.json +++ b/public/language/he/pages.json @@ -1,6 +1,7 @@ { "home": "דף הבית", "unread": "נושאים שלא נקראו", + "popular": "Popular Topics", "recent": "נושאים אחרונים", "users": "משתמשים רשומים", "notifications": "התראות", diff --git a/public/language/hu/pages.json b/public/language/hu/pages.json index 2cd8f7a0ce..00a3c97c1a 100644 --- a/public/language/hu/pages.json +++ b/public/language/hu/pages.json @@ -1,6 +1,7 @@ { "home": "Kezdőlap", "unread": "Olvasatlan Topikok", + "popular": "Popular Topics", "recent": "Friss Topikok", "users": "Regisztrált Felhasználók", "notifications": "Értesítések", diff --git a/public/language/it/pages.json b/public/language/it/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/it/pages.json +++ b/public/language/it/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/nb/pages.json b/public/language/nb/pages.json index cf9620b18a..60940216d0 100644 --- a/public/language/nb/pages.json +++ b/public/language/nb/pages.json @@ -1,6 +1,7 @@ { "home": "Hjem", "unread": "Uleste emner", + "popular": "Popular Topics", "recent": "Seneste emner", "users": "Registrerte brukere", "notifications": "Varsler", diff --git a/public/language/pl/global.json b/public/language/pl/global.json index 0a908625df..b8f5162365 100644 --- a/public/language/pl/global.json +++ b/public/language/pl/global.json @@ -10,14 +10,14 @@ "500.message": "Coś poszło nie tak.", "register": "Zarejestruj się", "login": "Zaloguj się", - "welcome_back": "Welcome Back ", - "you_have_successfully_logged_in": "You have successfully logged in", + "welcome_back": "Witaj z powrotem!", + "you_have_successfully_logged_in": "Zostałeś pomyślnie zalogowany.", "logout": "Wyloguj się", "logout.title": "Wylogowałeś się.", "logout.message": "Pomyślnie wylogowałeś się z forum.", "save_changes": "Zapisz zmiany", "close": "Zamknij", - "pagination": "Pagination", + "pagination": "Numerowanie stron", "header.admin": "Administracja", "header.recent": "Ostatnie", "header.unread": "Nieprzeczytane", @@ -52,5 +52,5 @@ "dnd": "Nie przeszkadzać", "invisible": "Niewidoczny", "offline": "Niedostępny", - "privacy": "Privacy" + "privacy": "Prywatność" } \ No newline at end of file diff --git a/public/language/pl/pages.json b/public/language/pl/pages.json index a966a141cb..ee44ea945b 100644 --- a/public/language/pl/pages.json +++ b/public/language/pl/pages.json @@ -1,6 +1,7 @@ { "home": "Strona główna", "unread": "Nieprzeczytane wątki", + "popular": "Popular Topics", "recent": "Ostatnie wątki", "users": "Zarejestrowani użytkownicy", "notifications": "Powiadomienia", diff --git a/public/language/pl/topic.json b/public/language/pl/topic.json index 9cd30f9296..020d68d6c2 100644 --- a/public/language/pl/topic.json +++ b/public/language/pl/topic.json @@ -19,15 +19,15 @@ "tools": "Narzędzia", "flag": "Zgłoś", "flag_title": "Zgłoś post do moderacji", - "deleted_message": "This thread has been deleted. Only users with thread management privileges can see it.", - "watch": "Watch", - "share_this_post": "Share this Post", + "deleted_message": "Ten wątek został usunięty. Tylko użytkownicy z uprawnieniami do zarządzania wątkami mogą go widzieć.", + "watch": "Obserwuj", + "share_this_post": "Udostępnij", "thread_tools.title": "Narzędzia wątków", "thread_tools.markAsUnreadForAll": "Oznacz jako nieprzeczytany", "thread_tools.pin": "Przypnij wątek", - "thread_tools.unpin": "Unpin Topic", + "thread_tools.unpin": "Odepnij wątek", "thread_tools.lock": "Zamknij wątek", - "thread_tools.unlock": "Unlock Topic", + "thread_tools.unlock": "Otwórz wątek", "thread_tools.move": "Przenieś wątek", "thread_tools.fork": "Skopiuj wątek", "thread_tools.delete": "Usuń wątek", diff --git a/public/language/pl/user.json b/public/language/pl/user.json index e438b566ae..36d9b509ec 100644 --- a/public/language/pl/user.json +++ b/public/language/pl/user.json @@ -26,7 +26,7 @@ "edit": "Edytuj", "uploaded_picture": "Przesłane zdjęcie", "upload_new_picture": "Prześlij nowe zdjęcie", - "current_password": "Current Password", + "current_password": "Obecne hasło", "change_password": "Zmień hasło", "confirm_password": "Potwierdź hasło", "password": "Hasło", diff --git a/public/language/pt_BR/pages.json b/public/language/pt_BR/pages.json index 0519cf223e..8f6d6f08e8 100644 --- a/public/language/pt_BR/pages.json +++ b/public/language/pt_BR/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Tópicos Não Lidos", + "popular": "Popular Topics", "recent": "Tópicos Recentes", "users": "Usuários Registrados", "notifications": "Notificações", diff --git a/public/language/ru/notifications.json b/public/language/ru/notifications.json index 87245bd6f3..8749bb8a50 100644 --- a/public/language/ru/notifications.json +++ b/public/language/ru/notifications.json @@ -1,7 +1,7 @@ { "title": "Уведомления", - "no_notifs": "You have no new notifications", - "see_all": "See all Notifications", + "no_notifs": "Для Вас нет новых уведомлений", + "see_all": "Просмотреть все уведомления", "back_to_home": "Вернуться на NodeBB", "outgoing_link": "Внешняя ссылка", "outgoing_link_message": "Вы покидаете", diff --git a/public/language/ru/pages.json b/public/language/ru/pages.json index b4a44b79e7..0d5f5b9ca9 100644 --- a/public/language/ru/pages.json +++ b/public/language/ru/pages.json @@ -1,6 +1,7 @@ { "home": "Главная", "unread": "Непрочитанные темы", + "popular": "Popular Topics", "recent": "Последние темы", "users": "Зарегистрированные пользователи", "notifications": "Уведомления", diff --git a/public/language/ru/topic.json b/public/language/ru/topic.json index 785cacbf07..2ab3aadc57 100644 --- a/public/language/ru/topic.json +++ b/public/language/ru/topic.json @@ -26,8 +26,8 @@ "thread_tools.markAsUnreadForAll": "Отметить как непрочитанные", "thread_tools.pin": "Pin Topic", "thread_tools.unpin": "Unpin Topic", - "thread_tools.lock": "Lock Topic", - "thread_tools.unlock": "Unlock Topic", + "thread_tools.lock": "Закрыть Тему", + "thread_tools.unlock": "Открыть Тему", "thread_tools.move": "Move Topic", "thread_tools.fork": "Fork Topic", "thread_tools.delete": "Delete Topic", diff --git a/public/language/sk/pages.json b/public/language/sk/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/sk/pages.json +++ b/public/language/sk/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/sv/pages.json b/public/language/sv/pages.json index 585c08b83b..dd938e334f 100644 --- a/public/language/sv/pages.json +++ b/public/language/sv/pages.json @@ -1,6 +1,7 @@ { "home": "Hem", "unread": "Olästa ämnen", + "popular": "Popular Topics", "recent": "Senaste ämnena", "users": "Registrerade användare", "notifications": "Notiser", diff --git a/public/language/tr/pages.json b/public/language/tr/pages.json index 4f3ecda974..55f625162f 100644 --- a/public/language/tr/pages.json +++ b/public/language/tr/pages.json @@ -1,6 +1,7 @@ { "home": "Ana Sayfa", "unread": "Okunmayan Başlıklar", + "popular": "Popular Topics", "recent": "Güncel Konular", "users": "Kayıtlı Kullanıcılar", "notifications": "Bildirimler", diff --git a/public/language/zh_CN/global.json b/public/language/zh_CN/global.json index abc3e33663..ca76a1ea64 100644 --- a/public/language/zh_CN/global.json +++ b/public/language/zh_CN/global.json @@ -10,7 +10,7 @@ "500.message": "不好!看来是哪里出错了!", "register": "注册", "login": "登录", - "welcome_back": "Welcome Back ", + "welcome_back": "欢迎回来", "you_have_successfully_logged_in": "You have successfully logged in", "logout": "退出", "logout.title": "你已经退出。", diff --git a/public/language/zh_CN/login.json b/public/language/zh_CN/login.json index 5c426ecbb3..25fe9a81f2 100644 --- a/public/language/zh_CN/login.json +++ b/public/language/zh_CN/login.json @@ -6,5 +6,5 @@ "forgot_password": "忘记密码?", "alternative_logins": "其他登录方式", "failed_login_attempt": "登录失败,请再尝试。", - "login_successful": "你已成功登录!" + "login_successful": "您已经成功登录!" } \ No newline at end of file diff --git a/public/language/zh_CN/pages.json b/public/language/zh_CN/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/zh_CN/pages.json +++ b/public/language/zh_CN/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", diff --git a/public/language/zh_CN/user.json b/public/language/zh_CN/user.json index a9ed9e4495..698abc17c6 100644 --- a/public/language/zh_CN/user.json +++ b/public/language/zh_CN/user.json @@ -1,47 +1,47 @@ { "banned": "封禁", - "offline": "下线", + "offline": "离线", "username": "用户名", - "email": "Email", + "email": "邮件", "fullname": "姓名", "website": "网站", "location": "地址", "age": "年龄", "joined": "加入时间", "lastonline": "最后在线", - "profile": "Profile", + "profile": "资料", "profile_views": "资料被查看", "reputation": "声望", "posts": "发帖数", - "favourites": "Favourites", + "favourites": "收藏的帖子", "followers": "被关注", "following": "关注", "signature": "签名", "gravatar": "Gravatar头像", "birthday": "生日", - "chat": "Chat", - "follow": "Follow", - "unfollow": "Unfollow", + "chat": "聊天", + "follow": "关注", + "unfollow": "取消关注", "change_picture": "改变头像", "edit": "编辑", "uploaded_picture": "已有头像", "upload_new_picture": "上传新头像", - "current_password": "Current Password", + "current_password": "当前密码", "change_password": "更改密码", "confirm_password": "确认密码", "password": "密码", "upload_picture": "上传头像", "upload_a_picture": "上传一张照片", - "image_spec": "You may only upload PNG, JPG, or GIF files", - "max": "max.", - "settings": "Settings", + "image_spec": "您只能上传PNG,JPG或者是GIF图片文件", + "max": "最大.", + "settings": "设置", "show_email": "显示我的邮箱", "has_no_follower": "该用户还没有被任何人关注。", "follows_no_one": "该用户还没有关注过任何人。", - "has_no_posts": "This user didn't post anything yet.", + "has_no_posts": "此用户还未发表过任何帖子.", "email_hidden": "邮箱被隐藏", "hidden": "隐藏", - "paginate_description": "Paginate topics and posts instead of using infinite scroll.", - "topics_per_page": "Topics per Page", - "posts_per_page": "Posts per Page" + "paginate_description": "使用分页方式显示话题和帖子,代替滚动显示", + "topics_per_page": "每页话题数量设置", + "posts_per_page": "每页帖子数量设置" } \ No newline at end of file diff --git a/public/language/zh_TW/pages.json b/public/language/zh_TW/pages.json index fa44fbfe46..d60e0a0a9b 100644 --- a/public/language/zh_TW/pages.json +++ b/public/language/zh_TW/pages.json @@ -1,6 +1,7 @@ { "home": "Home", "unread": "Unread Topics", + "popular": "Popular Topics", "recent": "Recent Topics", "users": "Registered Users", "notifications": "Notifications", From 0d7e47ded745f1249960a1077b93a75d7da53ca8 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Feb 2014 14:47:00 -0500 Subject: [PATCH 5/9] closed #1057 --- public/src/modules/composer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index d5ba7e8e73..79299e82e0 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -218,7 +218,12 @@ define(['taskbar'], function(taskbar) { case 'fa fa-link': if (selectionStart === selectionEnd) { // Nothing selected + var cursorPos = postContentEl[0].selectionStart; insertIntoInput(postContentEl, "[link text](link url)"); + + // Highlight "link url" + postContentEl[0].selectionStart = cursorPos + 12; + postContentEl[0].selectionEnd = cursorPos + 20; } else { // Text selected postContentEl.val(postContentEl.val().slice(0, selectionStart) + '[' + postContentEl.val().slice(selectionStart, selectionEnd) + '](link url)' + postContentEl.val().slice(selectionEnd)); From 3107e43b648dab020bae36450c9e0dc73d6c65d5 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Feb 2014 15:24:39 -0500 Subject: [PATCH 6/9] cleaned up admin panel index a bit --- public/src/forum/admin/index.js | 18 +++++++++- public/templates/admin/index.tpl | 56 ++++++++++++++++++++------------ 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/public/src/forum/admin/index.js b/public/src/forum/admin/index.js index c99dd43cb9..914676115d 100644 --- a/public/src/forum/admin/index.js +++ b/public/src/forum/admin/index.js @@ -14,7 +14,23 @@ define(function() { }, function() { window.location.href = RELATIVE_PATH + '/'; }); - }) + }); + + $.get('https://api.github.com/repos/designcreateplay/NodeBB/tags', function(releases) { + var version = $('#version').html(), + latestVersion = releases[0].name.slice(1), + checkEl = $('.version-check'); + checkEl.html($('.version-check').html().replace('', 'v' + latestVersion)); + + // Alter box colour accordingly + if (latestVersion === version) { + checkEl.removeClass('alert-info').addClass('alert-success'); + checkEl.append('

You are up-to-date

'); + } else if (latestVersion > version) { + checkEl.removeClass('alert-info').addClass('alert-danger'); + checkEl.append('

A new version (v' + latestVersion + ') has been released. Consider upgrading your NodeBB.

'); + } + }); }; Admin.updateRoomUsage = function(err, data) { diff --git a/public/templates/admin/index.tpl b/public/templates/admin/index.tpl index aa4838ef35..0ff8383dc3 100644 --- a/public/templates/admin/index.tpl +++ b/public/templates/admin/index.tpl @@ -1,20 +1,36 @@ - -
-

Welcome to NodeBB

-
-

- NodeBB Community Forum - Get Plugins and Themes - Follow @NodeBB - NodeBB Wiki -

-

You are running NodeBB v{version}. Always make sure that your NodeBB is up to date for the latest security patches and bug fixes.

-
- - -
-

Active Users socket connections

-

- -

-
+
+ +
+
+
Active Users socket connections
+
+
+
+
+
+
+
+
Updates
+
+
+

You are running NodeBB v{version}.

+
+

+ Always make sure that your NodeBB is up to date for the latest security patches and bug fixes. +

+
+
+
+
\ No newline at end of file From 495fded6dd185955aed32c145e7763404767bca5 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 19 Feb 2014 15:33:59 -0500 Subject: [PATCH 7/9] closes #1038 --- public/src/forum/admin/categories.js | 44 ++++++++++++--------------- public/templates/admin/categories.tpl | 8 ++++- src/categories.js | 5 ++- src/routes/admin.js | 4 +-- src/routes/api.js | 4 +-- src/webserver.js | 2 +- 6 files changed, 35 insertions(+), 32 deletions(-) diff --git a/public/src/forum/admin/categories.js b/public/src/forum/admin/categories.js index e9840d8968..7b4f761c52 100644 --- a/public/src/forum/admin/categories.js +++ b/public/src/forum/admin/categories.js @@ -83,7 +83,7 @@ define(['uploader'], function(uploader) { var category = { name: $('#inputName').val(), description: $('#inputDescription').val(), - icon: $('#new-category-modal i').val(), + icon: $('#new-category-modal i').attr('value'), bgColor: '#0059b2', color: '#fff', order: $('.admin-categories #entry-container').children().length + 1 @@ -105,10 +105,26 @@ define(['uploader'], function(uploader) { var html = templates.prepare(templates['admin/categories'].blocks['categories']).parse({ categories: [data] }); + html = $(html); + html.find('[data-name="bgColor"], [data-name="color"]').each(enableColorPicker); $('#entry-container').append(html); $('#new-category-modal').modal('hide'); + }); + } + + function enableColorPicker(idx, inputEl) { + var jinputEl = $(inputEl), + previewEl = jinputEl.parents('[data-cid]').find('.preview-box'); + jinputEl.ColorPicker({ + color: jinputEl.val() || '#000', + onChange: function(hsb, hex) { + jinputEl.val('#' + hex); + if (inputEl.getAttribute('data-name') === 'bgColor') previewEl.css('background', '#' + hex); + else if (inputEl.getAttribute('data-name') === 'color') previewEl.css('color', '#' + hex); + modified(inputEl); + } }); } @@ -141,21 +157,12 @@ define(['uploader'], function(uploader) { modified(ev.target); }); - $('.dropdown li[data-disabled]').each(function(index, element) { - var disabled = $(element).attr('data-disabled'); - if (disabled == "0" || disabled == "") { - $(element).html(' Disable'); - } else { - $(element).html(' Enable'); - } - }); - $('.dropdown').on('click', '[data-disabled]', function(ev) { var btn = $(this); var categoryRow = btn.parents('li'); var cid = categoryRow.attr('data-cid'); - var disabled = this.getAttribute('data-disabled') === '0' ? '1' : '0'; + var disabled = this.getAttribute('data-disabled') === 'false' ? '1' : '0'; categoryRow.remove(); modified_categories[cid] = modified_categories[cid] || {}; modified_categories[cid]['disabled'] = disabled; @@ -165,20 +172,7 @@ define(['uploader'], function(uploader) { }); // Colour Picker - $('[data-name="bgColor"], [data-name="color"]').each(function(idx, inputEl) { - var jinputEl = $(this), - previewEl = jinputEl.parents('[data-cid]').find('.preview-box'); - - jinputEl.ColorPicker({ - color: this.value || '#000', - onChange: function(hsb, hex) { - jinputEl.val('#' + hex); - if (inputEl.getAttribute('data-name') === 'bgColor') previewEl.css('background', '#' + hex); - else if (inputEl.getAttribute('data-name') === 'color') previewEl.css('color', '#' + hex); - modified(inputEl); - } - }); - }); + $('[data-name="bgColor"], [data-name="color"]').each(enableColorPicker); $('.admin-categories').on('click', '.save', save); diff --git a/public/templates/admin/categories.tpl b/public/templates/admin/categories.tpl index c89bbf2806..b25f2f8218 100644 --- a/public/templates/admin/categories.tpl +++ b/public/templates/admin/categories.tpl @@ -100,7 +100,13 @@ diff --git a/src/categories.js b/src/categories.js index 09caa7d1f1..640122598d 100644 --- a/src/categories.js +++ b/src/categories.js @@ -30,6 +30,7 @@ var db = require('./database'), description: data.description, icon: data.icon, bgColor: data.bgColor, + background: data.bgColor, color: data.color, slug: slug, topic_count: 0, @@ -96,7 +97,7 @@ var db = require('./database'), 'category_name': results.category.name, 'category_description': results.category.description, 'link': results.category.link, - 'disabled': results.category.disabled || '0', + 'disabled': results.category.disabled, 'topic_row_size': 'col-md-9', 'category_id': category_id, 'active_users': results.active_users, @@ -167,6 +168,7 @@ var db = require('./database'), if(err) { return callback(err); } + if(cids && cids.length === 0) { return callback(null, {categories : []}); } @@ -301,6 +303,7 @@ var db = require('./database'), if (exists) { db.getObject('category:' + cid, function(err, data) { data.background = data.image ? 'url(' + data.image + ')' : data.bgColor; + data.disabled = data.disabled ? parseInt(data.disabled, 10) !== 0 : false; callback(err, data); }); } else { diff --git a/src/routes/admin.js b/src/routes/admin.js index 61e15a0f02..57c27519f2 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -316,7 +316,7 @@ var nconf = require('nconf'), app.get('/categories/active', function (req, res) { categories.getAllCategories(0, function (err, data) { data.categories = data.categories.filter(function (category) { - return (!category.disabled || parseInt(category.disabled, 10) === 0); + return !category.disabled; }); res.json(data); }); @@ -325,7 +325,7 @@ var nconf = require('nconf'), app.get('/categories/disabled', function (req, res) { categories.getAllCategories(0, function (err, data) { data.categories = data.categories.filter(function (category) { - return parseInt(category.disabled, 10) === 1; + return category.disabled; }); res.json(data); }); diff --git a/src/routes/api.js b/src/routes/api.js index 301c2ea671..3a62e1b417 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -87,7 +87,7 @@ var path = require('path'), categories.getAllCategories(uid, function (err, data) { data.categories = data.categories.filter(function (category) { - return (!category.disabled || parseInt(category.disabled, 10) === 0); + return !category.disabled; }); function canSee(category, next) { @@ -279,7 +279,7 @@ var path = require('path'), data.currentPage = page; data.privileges = privileges; - if (data && parseInt(data.disabled, 10) === 0) { + if (data && !data.disabled) { res.json(data); } else { next(); diff --git a/src/webserver.js b/src/webserver.js index d87c58b66d..5362e6e6e4 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -504,7 +504,7 @@ module.exports.server = server; categories.getAllCategories(0, function (err, returnData) { returnData.categories = returnData.categories.filter(function (category) { - return parseInt(category.disabled, 10) !== 1; + return !category.disabled; }); async.filter(returnData.categories, canSee, function(visibleCategories) { From ea222c4f8af32eeff4270f300f9487081334ba4e Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 19 Feb 2014 16:44:36 -0500 Subject: [PATCH 8/9] crash fix for notifications, removed exec_body_script, closes #1058 --- public/src/ajaxify.js | 54 +------------------------------------------ src/notifications.js | 2 +- 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index b5b8a258f1..58e6eceb76 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -97,7 +97,7 @@ var ajaxify = {}; templates.flush(); templates.load_template(function () { - exec_body_scripts(content); + require(['forum/' + tpl_url], function(script) { if (script && script.init) { script.init(); @@ -172,56 +172,4 @@ var ajaxify = {}; }); }); - function exec_body_scripts(body_el) { - // modified from http://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml - - function nodeName(elem, name) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - } - - function evalScript(elem) { - var data = (elem.text || elem.textContent || elem.innerHTML || ""), - head = document.getElementsByTagName("head")[0] || - document.documentElement, - script = document.createElement("script"); - - script.type = "text/javascript"; - try { - script.appendChild(document.createTextNode(data)); - } catch (e) { - script.text = data; - } - - if (elem.src) { - script.src = elem.src; - } - - head.insertBefore(script, head.firstChild); - //TODO: remove from head before inserting?, doing this breaks scripts in safari so commented out for now - //head.removeChild(script); - } - - var scripts = [], - script, - children_nodes = $(body_el).find('script'), - child, - i; - - for (i = 0; children_nodes[i]; i++) { - child = children_nodes[i]; - if (nodeName(child, "script") && - (!child.type || child.type.toLowerCase() === "text/javascript")) { - scripts.push(child); - } - } - - for (i = 0; scripts[i]; i++) { - script = scripts[i]; - if (script.parentNode) { - script.parentNode.removeChild(script); - } - evalScript(scripts[i]); - } - } - }(jQuery)); diff --git a/src/notifications.js b/src/notifications.js index 06d20223dd..66eed78704 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -127,7 +127,7 @@ var async = require('async'), if (nids && nids.length > 0) { async.each(nids, function(nid, next) { Notifications.get(nid, uid, function(nid_info) { - if (nid_info.uniqueId === uniqueId) { + if (nid_info && nid_info.uniqueId === uniqueId) { db.sortedSetRemove('uid:' + uid + ':notifications:unread', nid); } From f50d77bca0124c7d27c799de0ee7a3ac662f5e2d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Feb 2014 17:23:25 -0500 Subject: [PATCH 9/9] resolved #1060 --- package.json | 2 +- src/postTools.js | 2 +- src/posts.js | 2 +- src/routes/plugins.js | 2 +- src/topics.js | 2 +- src/user.js | 3 +-- src/webserver.js | 3 +-- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index f9588447f1..424f97d689 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "rss": "~0.2.0", "prompt": "~0.2.11", "uglify-js": "~2.4.0", - "validator": "~1.5.1", + "validator": "~3.2.1", "nodebb-plugin-mentions": "~0.4", "nodebb-plugin-markdown": "~0.3", "nodebb-theme-vanilla": "~0.0.13", diff --git a/src/postTools.js b/src/postTools.js index 37c888fa54..d79515a480 100644 --- a/src/postTools.js +++ b/src/postTools.js @@ -108,7 +108,7 @@ var winston = require('winston'), ], function(err, results) { websockets.in('topic_' + results[0].tid).emit('event:post_edited', { pid: pid, - title: validator.sanitize(title).escape(), + title: validator.escape(title), isMainPost: results[0].isMainPost, content: results[1] }); diff --git a/src/posts.js b/src/posts.js index 95f0da116b..88a2d2037c 100644 --- a/src/posts.js +++ b/src/posts.js @@ -291,7 +291,7 @@ var db = require('./database'), postData.categoryName = categoryData.name; postData.categoryIcon = categoryData.icon; postData.categorySlug = categoryData.slug; - postData.title = validator.sanitize(topicData.title).escape(); + postData.title = validator.escape(topicData.title); postData.topicSlug = topicData.slug; next(null, postData); }) diff --git a/src/routes/plugins.js b/src/routes/plugins.js index 2af868700c..96638a86dd 100644 --- a/src/routes/plugins.js +++ b/src/routes/plugins.js @@ -13,7 +13,7 @@ var nconf = require('nconf'), if (typeof returnData === 'object') { res.json(200, returnData); } else { - res.send(200, validator.sanitize(returnData).escape()); + res.send(200, validator.escape(returnData)); } }); }); diff --git a/src/topics.js b/src/topics.js index f282b5ad4b..f285db24b9 100644 --- a/src/topics.js +++ b/src/topics.js @@ -279,7 +279,7 @@ var async = require('async'), } if(data) { - data.title = validator.sanitize(data.title).escape(); + data.title = validator.escape(data.title); data.relativeTime = utils.toISOString(data.timestamp); } diff --git a/src/user.js b/src/user.js index a3edb449d1..56d60f3c83 100644 --- a/src/user.js +++ b/src/user.js @@ -4,7 +4,6 @@ var bcrypt = require('bcryptjs'), winston = require('winston'), gravatar = require('gravatar'), check = require('validator').check, - sanitize = require('validator').sanitize, S = require('string'), utils = require('./../public/src/utils'), @@ -335,7 +334,7 @@ var bcrypt = require('bcryptjs'), } data[field] = data[field].trim(); - data[field] = sanitize(data[field]).escape(); + data[field] = validator.escape(data[field]); if (field === 'email') { User.getUserFields(uid, ['email', 'picture', 'uploadedpicture'], function(err, userData) { diff --git a/src/webserver.js b/src/webserver.js index 16f8cbf0d7..687280bf14 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -574,7 +574,6 @@ module.exports.server = server; function (topicData, next) { var lastMod = topicData.timestamp, - sanitize = validator.sanitize, description = (function() { var content = ''; if(topicData.posts.length) { @@ -585,7 +584,7 @@ module.exports.server = server; content = content.substr(0, 255) + '...'; } - return sanitize(content).escape(); + return validator.escape(content); })(), timestamp;