From f2b3e1014ba8f8b494a7eab41ad05803f342c72c Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Thu, 9 Aug 2018 21:05:43 +0200 Subject: [PATCH] fixes #3171 moved query param p to the options/query parameter of url() Implemented a fiy for accidentally double ampersand in the query part of the url --- e107_handlers/application.php | 6 ++++-- .../forum/shortcodes/batch/view_shortcodes.php | 12 +++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/e107_handlers/application.php b/e107_handlers/application.php index 0db4aab21..a4679ecf1 100644 --- a/e107_handlers/application.php +++ b/e107_handlers/application.php @@ -160,11 +160,13 @@ class e_url if($newLocation != $this->_request) { $redirect = e107::getParser()->replaceConstants($newLocation); - list($file,$query) = explode("?",$redirect,2); + list($file,$query) = explode("?", $redirect,2); $get = array(); if(!empty($query)) { + // issue #3171 fix double ampersand in case of wrong query definition + $query = str_replace('&&', '&', $query); parse_str($query,$get); } @@ -179,7 +181,7 @@ class e_url if(file_exists($file)) { define('e_CURRENT_PLUGIN', $plug); - define('e_QUERY', $query); // do not add to e107_class.php + define('e_QUERY', str_replace('&&', '&', $query)); // do not add to e107_class.php define('e_URL_LEGACY', $redirect); $this->_include= $file; diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index d14ba025b..d96bde48d 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -1029,20 +1029,14 @@ { $thread->page = 1; } -// $url = rawurlencode(e107::getUrl()->create('forum/thread/view', array('name' => $thread->threadInfo['thread_name'], 'id' => $thread->threadId, 'page' => '[FROM]'))); -// $url = e_REQUEST_SELF."?p=[FROM]"; // SEF URL Friendly. - $url = e107::url('forum', 'topic', $this->var) . "&p=[FROM]"; + // issue #3171 old method produced an invalid url: /forum/subforum/35/forum-topic/&p=2 + // moved additional parameter p= to the options/query array + $url = e107::url('forum', 'topic', $this->var, array('query' => array('p' => '--FROM--'))); // . "&p=[FROM]"; $parms = "total={$thread->pages}&type=page¤t={$thread->page}&url=" . urlencode($url) . "&caption=off&tmpl=default&navcount=4&glyphs=1"; - //XXX FIXME - pull-down template not practical here. Can we force another? - -// $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); return e107::getParser()->parseTemplate("{NEXTPREV={$parms}}"); - /* - $parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off"; - $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");*/ } }