cleaned up requires

v1.18.x
Baris Soner Usakli 11 years ago
parent bfe081f672
commit 140f90f7f3

@ -1,6 +1,6 @@
var RDB = require('./../redis.js'),
utils = require('./../../public/src/utils.js'),
categories = require('./../categories.js');
var RDB = require('./../redis'),
utils = require('./../../public/src/utils'),
categories = require('./../categories');
(function(CategoriesAdmin) {

@ -1,15 +1,15 @@
var RDB = require('../redis'),
utils = require('../../public/src/utils'),
user = require('../user'),
Groups = require('../groups');
groups = require('../groups');
(function(UserAdmin) {
UserAdmin.makeAdmin = function(uid, theirid, socket) {
user.isAdministrator(uid, function(err, isAdmin) {
if (isAdmin) {
Groups.getGidFromName('Administrators', function(err, gid) {
Groups.join(gid, theirid, function(err) {
groups.getGidFromName('Administrators', function(err, gid) {
groups.join(gid, theirid, function(err) {
if (!err) {
socket.emit('event:alert', {
title: 'User Modified',
@ -34,8 +34,8 @@ var RDB = require('../redis'),
UserAdmin.removeAdmin = function(uid, theirid, socket) {
user.isAdministrator(uid, function(err, isAdmin) {
if (isAdmin) {
Groups.getGidFromName('Administrators', function(err, gid) {
Groups.leave(gid, theirid, function(err) {
groups.getGidFromName('Administrators', function(err, gid) {
groups.leave(gid, theirid, function(err) {
if (!err) {
socket.emit('event:alert', {

@ -1,15 +1,18 @@
var user = require('./../user.js'),
Groups = require('../groups'),
topics = require('./../topics.js'),
RDB = require('./../redis.js'),
pkg = require('./../../package.json'),
categories = require('./../categories.js'),
Meta = require('../meta'),
plugins = require('../plugins'),
winston = require('winston'),
nconf = require('nconf'),
var nconf = require('nconf'),
fs = require('fs'),
path = require('path');
path = require('path'),
winston = require('winston'),
RDB = require('./../redis'),
user = require('./../user'),
groups = require('../groups'),
topics = require('./../topics'),
pkg = require('./../../package.json'),
categories = require('./../categories'),
meta = require('../meta'),
plugins = require('../plugins');
(function (Admin) {
Admin.isAdmin = function (req, res, next) {
@ -291,7 +294,7 @@ var user = require('./../user.js'),
});
// app.get('/export', function (req, res) {
// Meta.db.getFile(function (err, dbFile) {
// meta.db.getFile(function (err, dbFile) {
// if (!err) {
// res.download(dbFile, 'redis.rdb', function (err) {
// console.log(err);
@ -356,7 +359,7 @@ var user = require('./../user.js'),
});
app.get('/groups', function (req, res) {
Groups.list({
groups.list({
expand: true
}, function (err, groups) {
res.json(200, {

@ -1,17 +1,16 @@
var user = require('../user'),
var path = require('path'),
nconf = require('nconf'),
async = require('async'),
user = require('../user'),
auth = require('./authentication'),
topics = require('../topics'),
posts = require('../posts'),
categories = require('../categories'),
CategoryTools = require('../categoryTools')
Groups = require('../groups'),
categoryTools = require('../categoryTools')
utils = require('../../public/src/utils'),
pkg = require('../../package.json'),
meta = require('../meta'),
path = require('path'),
nconf = require('nconf'),
async = require('async');
meta = require('../meta');
(function (Api) {
@ -130,7 +129,7 @@ var user = require('../user'),
var uid = (req.user) ? req.user.uid : 0;
// Category Whitelisting
CategoryTools.privileges(req.params.id, uid, function(err, privileges) {
categoryTools.privileges(req.params.id, uid, function(err, privileges) {
if (!err && privileges.read) {
categories.getCategoryById(req.params.id, uid, function (err, data) {
if (!err && data && data.disabled === "0")
@ -176,7 +175,9 @@ var user = require('../user'),
notifications: notifications
});
});
} else res.send(403);
} else {
res.send(403);
}
});
app.get('/confirm/:id', function (req, res) {
@ -236,12 +237,14 @@ var user = require('../user'),
function searchPosts(callback) {
search(postSearch, function (err, pids) {
if (err)
if (err) {
return callback(err, null);
}
posts.getPostSummaryByPids(pids, function (err, posts) {
if (err)
if (err){
return callback(err, null);
}
callback(null, posts);
});
})
@ -249,8 +252,9 @@ var user = require('../user'),
function searchTopics(callback) {
search(topicSearch, function (err, tids) {
if (err)
if (err) {
return callback(err, null);
}
topics.getTopicsByTids(tids, 0, function (topics) {
callback(null, topics);
@ -259,8 +263,9 @@ var user = require('../user'),
}
async.parallel([searchPosts, searchTopics], function (err, results) {
if (err)
if (err) {
return next();
}
return res.json({
show_no_topics: results[1].length ? 'hide' : '',

@ -10,7 +10,7 @@
user = require('../user'),
plugins = require('../plugins'),
winston = require('winston'),
login_module = require('./../login.js');
login_module = require('./../login');
passport.use(new passportLocal(function(user, password, next) {
login_module.loginViaLocal(user, password, function(err, login) {

@ -4,7 +4,7 @@ var nconf = require('nconf'),
path = require('path'),
fs = require('fs'),
validator = require('validator'),
Plugins = require('../plugins'),
plugins = require('../plugins'),
PluginRoutes = function(app) {
app.get('/plugins/fireHook', function(req, res) {
@ -20,7 +20,7 @@ var nconf = require('nconf'),
app.put('/plugins/fireHook', function(req, res) {
// PUT = action
Plugins.fireHook('action:' + req.body.hook, req.body.args);
plugins.fireHook('action:' + req.body.hook, req.body.args);
res.send(200);
});

Loading…
Cancel
Save