var user = require('./../user.js'), topics = require('./../topics.js'), RDB = require('./../redis.js'), pkg = require('./../../package.json'), categories = require('./../categories.js'), plugins = require('../plugins'), winston = require('winston'); (function(Admin) { Admin.isAdmin = function(req, res, next) { user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function(isAdmin) { if (!isAdmin) res.redirect('/403'); else next(); }); } Admin.build_header = function(res) { return templates['admin/header'].parse({ csrf:res.locals.csrf_token, relative_path: nconf.get('relative_path') }); } Admin.create_routes = function(app) { (function() { var routes = [ 'categories/active', 'categories/disabled', 'users', 'topics', 'settings', 'themes', 'twitter', 'facebook', 'gplus', 'redis', 'motd', 'users/latest', 'users/sort-posts', 'users/sort-reputation', 'users/search', 'plugins' ]; for (var i=0, ii=routes.length; i