|
|
|
@ -33,22 +33,27 @@ var Controllers = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Controllers.home = function(req, res, next) {
|
|
|
|
|
var route = meta.config.homePageRoute || meta.config.homePageCustom || 'categories',
|
|
|
|
|
hook = 'action:homepage.get:' + route;
|
|
|
|
|
var route = meta.config.homePageRoute || meta.config.homePageCustom || 'categories';
|
|
|
|
|
|
|
|
|
|
if (plugins.hasListeners(hook)) {
|
|
|
|
|
plugins.fireHook(hook, {req: req, res: res, next: next});
|
|
|
|
|
} else {
|
|
|
|
|
if (route === 'categories' || route === '/') {
|
|
|
|
|
Controllers.categories.list(req, res, next);
|
|
|
|
|
} else if (route === 'recent') {
|
|
|
|
|
Controllers.recent.get(req, res, next);
|
|
|
|
|
} else if (route === 'popular') {
|
|
|
|
|
Controllers.popular.get(req, res, next);
|
|
|
|
|
user.getSettings(req.uid, function(err, settings) {
|
|
|
|
|
if (!err) route = settings.homePageRoute || route;
|
|
|
|
|
|
|
|
|
|
var hook = 'action:homepage.get:' + route;
|
|
|
|
|
|
|
|
|
|
if (plugins.hasListeners(hook)) {
|
|
|
|
|
plugins.fireHook(hook, {req: req, res: res, next: next});
|
|
|
|
|
} else {
|
|
|
|
|
res.redirect(route);
|
|
|
|
|
if (route === 'categories' || route === '/') {
|
|
|
|
|
Controllers.categories.list(req, res, next);
|
|
|
|
|
} else if (route === 'recent') {
|
|
|
|
|
Controllers.recent.get(req, res, next);
|
|
|
|
|
} else if (route === 'popular') {
|
|
|
|
|
Controllers.popular.get(req, res, next);
|
|
|
|
|
} else {
|
|
|
|
|
res.redirect(route);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Controllers.reset = function(req, res, next) {
|
|
|
|
|