"use strict"; var async = require('async'), winston = require('winston'), validator = require('validator'), _ = require('underscore'), db = require('./database'), posts = require('./posts'), utils = require('../public/src/utils'), plugins = require('./plugins'), user = require('./user'), categories = require('./categories'), privileges = require('./privileges'); (function(Topics) { require('./topics/create')(Topics); require('./topics/delete')(Topics); require('./topics/unread')(Topics); require('./topics/recent')(Topics); require('./topics/popular')(Topics); require('./topics/fork')(Topics); require('./topics/posts')(Topics); require('./topics/follow')(Topics); require('./topics/tags')(Topics); Topics.getTopicData = function(tid, callback) { db.getObject('topic:' + tid, function(err, topic) { if (err || !topic) { return callback(err); } topic.title = validator.escape(topic.title); topic.relativeTime = utils.toISOString(topic.timestamp); callback(null, topic); }); }; Topics.getTopicsData = function(tids, callback) { var keys = []; for (var i=0; i