From 4307a2c07f6559a71c3cf67f0cde60704ee373ea Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 17 Apr 2009 16:05:25 +0000 Subject: [PATCH] Changed jumpto() JS function to be more fail-safe. (But #27635 - patch by peterkclee) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9466 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/overall_header.html | 11 +++++++++-- phpBB/adm/style/simple_header.html | 11 +++++++++-- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/forum_fn.js | 11 +++++++++-- .../styles/subsilver2/template/overall_header.html | 13 ++++++++++--- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index 0720519ce2..ccf38e49b8 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -28,9 +28,16 @@ function jumpto() { var page = prompt(jump_page, on_page); - if (page !== null && !isNaN(page) && page > 0) + if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) { - document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + if (base_url.indexOf('?') == -1) + { + document.location.href = base_url + '?start=' + ((page - 1) * per_page); + } + else + { + document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + } } } diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html index 3e36c47988..2339b70a93 100644 --- a/phpBB/adm/style/simple_header.html +++ b/phpBB/adm/style/simple_header.html @@ -39,9 +39,16 @@ function jumpto() { var page = prompt(jump_page, on_page); - if (page !== null && !isNaN(page) && page > 0) + if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) { - document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + if (base_url.indexOf('?') == -1) + { + document.location.href = base_url + '?start=' + ((page - 1) * per_page); + } + else + { + document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + } } } diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 875281d5d2..62c64a9c2a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -150,6 +150,7 @@
  • [Change] Add unique key to ACL options table to prevent duplicate permission options. (Bug #41835)
  • [Change] Redirect to relevant MCP page of multi-page topic if accessing quickmod tools (Split option for example)
  • [Change] Performance improvements for native fulltext search (patch by Paul)
  • +
  • [Change] Changed jumpto() JS function to be more fail-safe. (But #27635 - patch by peterkclee)
  • [Feature] Added new options for visual confirmation.
  • [Feature] Allow download of conflicting file for later reference in automatic updater
  • [Feature] Allow translation of custom BBCode help messages. (Patch by bantu)
  • diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 6694dfb61b..06c4d1e785 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -23,9 +23,16 @@ function jumpto() { var page = prompt(jump_page, on_page); - if (page !== null && !isNaN(page) && page > 0) + if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) { - document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + if (base_url.indexOf('?') == -1) + { + document.location.href = base_url + '?start=' + ((page - 1) * per_page); + } + else + { + document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + } } } diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 6db4f85690..a2ed06132d 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -39,12 +39,19 @@ function popup(url, width, height, name) function jumpto() { var page = prompt('{LA_JUMP_PAGE}:', '{ON_PAGE}'); - var perpage = '{PER_PAGE}'; + var per_page = '{PER_PAGE}'; var base_url = '{A_BASE_URL}'; - if (page !== null && !isNaN(page) && page > 0) + if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) { - document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * perpage); + if (base_url.indexOf('?') == -1) + { + document.location.href = base_url + '?start=' + ((page - 1) * per_page); + } + else + { + document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + } } }