1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

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
This commit is contained in:
Achim Ennenbach
2018-08-09 21:05:43 +02:00
parent 604cda1f83
commit f2b3e1014b
2 changed files with 7 additions and 11 deletions

View File

@@ -160,11 +160,13 @@ class e_url
if($newLocation != $this->_request) if($newLocation != $this->_request)
{ {
$redirect = e107::getParser()->replaceConstants($newLocation); $redirect = e107::getParser()->replaceConstants($newLocation);
list($file,$query) = explode("?",$redirect,2); list($file,$query) = explode("?", $redirect,2);
$get = array(); $get = array();
if(!empty($query)) if(!empty($query))
{ {
// issue #3171 fix double ampersand in case of wrong query definition
$query = str_replace('&&', '&', $query);
parse_str($query,$get); parse_str($query,$get);
} }
@@ -179,7 +181,7 @@ class e_url
if(file_exists($file)) if(file_exists($file))
{ {
define('e_CURRENT_PLUGIN', $plug); 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); define('e_URL_LEGACY', $redirect);
$this->_include= $file; $this->_include= $file;

View File

@@ -1029,20 +1029,14 @@
{ {
$thread->page = 1; $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. // issue #3171 old method produced an invalid url: /forum/subforum/35/forum-topic/&p=2
$url = e107::url('forum', 'topic', $this->var) . "&p=[FROM]"; // 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&current={$thread->page}&url=" . urlencode($url) . "&caption=off&tmpl=default&navcount=4&glyphs=1"; $parms = "total={$thread->pages}&type=page&current={$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}}"); 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}}");*/
} }
} }