diff --git a/public/templates/category.tpl b/public/templates/category.tpl index 827147e7c6..e711f90433 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -21,8 +21,8 @@
- -

{topics.recent_author}: {topics.recent_post}

+ +

{topics.teaser_username}: {topics.teaser_text}

diff --git a/src/posts.js b/src/posts.js index 8c5eaccc71..35931d5a90 100644 --- a/src/posts.js +++ b/src/posts.js @@ -37,7 +37,6 @@ marked.setOptions({ var uid = post_data.uid[i], pid = post_data.pid[i]; - console.log(current_user, uid); if (post_data.deleted[i] === null || (post_data.deleted[i] === '1' && manage_content) || current_user === uid) { var post_obj = { 'pid' : pid, @@ -307,9 +306,6 @@ marked.setOptions({ user.getUserFields(uid, ['username'], function(data){ - RDB.set('tid:' + tid + ':recent:post', content); - RDB.set('tid:' + tid + ':recent:author', data.username); - //add active users to this category RDB.get('tid:' + tid + ':cid', function(err, cid) { RDB.handle(err); diff --git a/src/topics.js b/src/topics.js index 6929760f0a..e7f8619f70 100644 --- a/src/topics.js +++ b/src/topics.js @@ -3,7 +3,13 @@ var RDB = require('./redis.js'), utils = require('./utils.js'), user = require('./user.js'), configs = require('../config.js'), - categories = require('./categories.js'); + categories = require('./categories.js'), + marked = require('marked') + async = require('async'); + +marked.setOptions({ + breaks: true +}); (function(Topics) { @@ -30,8 +36,6 @@ var RDB = require('./redis.js'), locked = [], deleted = [], pinned = [], - recent_post = [], - recent_author = []; for (var i=0, ii=tids.length; i/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase () + var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, + commentsAndPhpTags = /|<\?(?:php)?[\s\S]*?\?>/gi; + return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { + return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''; + }); + } } module.exports = utils; \ No newline at end of file diff --git a/src/webserver.js b/src/webserver.js index 44ed5f0838..ad451882b2 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -227,13 +227,12 @@ var express = require('express'), app.get('/api/:method/:id*', api_method); app.get('/test', function(req, res) { - categories.getModerators(2, function(mods) { - res.send(JSON.stringify(mods)); + topics.get_teasers([1, 2, 3], function(teasers) { + res.send(JSON.stringify(teasers)); }); }); - //START TODO: MOVE TO GRAPH.JS app.get('/graph/users/:username/picture', function(req, res) {