From 75f178636b93076335b4a956581ca02fe6864f91 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 25 Jan 2014 19:50:50 -0500 Subject: [PATCH] more fixes --- public/src/forum/pagination.js | 2 +- public/src/forum/topic.js | 3 +++ public/src/templates.js | 1 + src/routes/api.js | 2 +- src/routes/user.js | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/src/forum/pagination.js b/public/src/forum/pagination.js index 7c21a3090d..ca0d0513c7 100644 --- a/public/src/forum/pagination.js +++ b/public/src/forum/pagination.js @@ -42,7 +42,7 @@ define(function() { pagination.loadPage = function(page, callback) { page = parseInt(page, 10); - if(page < 1 || page > pagination.pageCount) { + if(!utils.isNumber(page) || page < 1 || page > pagination.pageCount) { return; } diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 3976687684..cc5524655b 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -1018,6 +1018,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { if(config.usePagination) { socket.emit('posts.getPidPage', pid, function(err, page) { + if(err) { + return; + } if(parseInt(page, 10) !== pagination.currentPage) { pagination.loadPage(page); } else { diff --git a/public/src/templates.js b/public/src/templates.js index 3e32653c1c..993cf20f30 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -196,6 +196,7 @@ template_data = data; parse_template(); }).fail(function (data, textStatus) { + jQuery('#content, #footer').stop(true, true).removeClass('ajaxifying'); if (data && data.status == 404) { return ajaxify.go('404'); } else if (data && data.status === 403) { diff --git a/src/routes/api.js b/src/routes/api.js index f700334764..286392e141 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -171,7 +171,7 @@ var path = require('path'), page = req.query.page; } - if(parseInt(page, 10) < 1) { + if(!utils.isNumber(page) || parseInt(page, 10) < 1) { return res.send(404); } diff --git a/src/routes/user.js b/src/routes/user.js index b8d385e3fd..7ae12c386b 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -8,6 +8,7 @@ var fs = require('fs'), posts = require('./../posts'), postTools = require('../postTools'), utils = require('./../../public/src/utils'), + templates = require('./../../public/src/templates'), meta = require('./../meta'), db = require('./../database');