From 2c8f67f6a9b4e93161e7cae0c38162cb8991e0ef Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 25 Mar 2009 15:39:58 +0000 Subject: A different search pagination fix (see ticket #1333) that doesn't require fixing the upstream code, thus undoing the change made in d64be5108d69ff4068d4383ab121a3ba7388ada3 --- extlib/Net/URL/Mapper/Path.php | 9 ++------- lib/router.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/extlib/Net/URL/Mapper/Path.php b/extlib/Net/URL/Mapper/Path.php index eb1c34a3f..b541002c7 100644 --- a/extlib/Net/URL/Mapper/Path.php +++ b/extlib/Net/URL/Mapper/Path.php @@ -241,12 +241,7 @@ class Net_URL_Mapper_Path } $path = '/'.trim(Net_URL::resolvePath($path), '/'); if (!empty($qstring)) { - if (!strpos($path, '?')) { - $path .= '?'; - } else { - $path .= '&'; - } - $path .= http_build_query($qstring); + $path .= '?'.http_build_query($qstring); } if (!empty($anchor)) { $path .= '#'.ltrim($anchor, '#'); @@ -432,4 +427,4 @@ class Net_URL_Mapper_Path } -?> +?> \ No newline at end of file diff --git a/lib/router.php b/lib/router.php index 83b3ffe60..d1217ca3c 100644 --- a/lib/router.php +++ b/lib/router.php @@ -437,6 +437,16 @@ class Router if($params!=null) common_log(LOG_DEBUG,"generate args:".print_r($args,true)); - return $this->m->generate($args, $params, $fragment); + $url=$this->m->generate($args, $params, $fragment); + + // Due to a bug in the Net_URL_Mapper code, the returned URL may + // contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We + // repair that here rather than modifying the upstream code... + $qpos = strpos($url,'?'); + if ($qpos !== false) { + $url = substr($url, 0, $qpos+1) . + str_replace('?', '&', substr($url, $qpos+1)); + } + return $url; } } -- cgit v1.2.3-54-g00ecf From d92926f892d72b631ba7ec3447eb73caf9ff03bd Mon Sep 17 00:00:00 2001 From: CiaranG Date: Sat, 21 Mar 2009 14:24:19 +0000 Subject: Fix to Net_URL_Mapper to make search pagination work. See Ticket #1333 --- extlib/Net/URL/Mapper/Path.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extlib/Net/URL/Mapper/Path.php b/extlib/Net/URL/Mapper/Path.php index b541002c7..eb1c34a3f 100644 --- a/extlib/Net/URL/Mapper/Path.php +++ b/extlib/Net/URL/Mapper/Path.php @@ -241,7 +241,12 @@ class Net_URL_Mapper_Path } $path = '/'.trim(Net_URL::resolvePath($path), '/'); if (!empty($qstring)) { - $path .= '?'.http_build_query($qstring); + if (!strpos($path, '?')) { + $path .= '?'; + } else { + $path .= '&'; + } + $path .= http_build_query($qstring); } if (!empty($anchor)) { $path .= '#'.ltrim($anchor, '#'); @@ -427,4 +432,4 @@ class Net_URL_Mapper_Path } -?> \ No newline at end of file +?> -- cgit v1.2.3-54-g00ecf From 55e8a6ca1b0af8e05a7ee22735585ef5ebd66fc6 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 25 Mar 2009 15:39:58 +0000 Subject: A different search pagination fix (see ticket #1333) that doesn't require fixing the upstream code, thus undoing the change made in d64be5108d69ff4068d4383ab121a3ba7388ada3 Merged. --- extlib/Net/URL/Mapper/Path.php | 9 ++------- lib/router.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/extlib/Net/URL/Mapper/Path.php b/extlib/Net/URL/Mapper/Path.php index eb1c34a3f..b541002c7 100644 --- a/extlib/Net/URL/Mapper/Path.php +++ b/extlib/Net/URL/Mapper/Path.php @@ -241,12 +241,7 @@ class Net_URL_Mapper_Path } $path = '/'.trim(Net_URL::resolvePath($path), '/'); if (!empty($qstring)) { - if (!strpos($path, '?')) { - $path .= '?'; - } else { - $path .= '&'; - } - $path .= http_build_query($qstring); + $path .= '?'.http_build_query($qstring); } if (!empty($anchor)) { $path .= '#'.ltrim($anchor, '#'); @@ -432,4 +427,4 @@ class Net_URL_Mapper_Path } -?> +?> \ No newline at end of file diff --git a/lib/router.php b/lib/router.php index e39dc217a..135e07a0f 100644 --- a/lib/router.php +++ b/lib/router.php @@ -429,6 +429,16 @@ class Router $args = $action_arg; } - return $this->m->generate($args, $params, $fragment); + $url = $this->m->generate($args, $params, $fragment); + + // Due to a bug in the Net_URL_Mapper code, the returned URL may + // contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We + // repair that here rather than modifying the upstream code... + $qpos = strpos($url,'?'); + if ($qpos !== false) { + $url = substr($url, 0, $qpos+1) . + str_replace('?', '&', substr($url, $qpos+1)); + } + return $url; } } -- cgit v1.2.3-54-g00ecf From 1116526f0855af47b353722907c57e1b4285cddc Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 25 Mar 2009 12:32:46 -0400 Subject: fixed pagination variable problem --- actions/noticesearch.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/actions/noticesearch.php b/actions/noticesearch.php index eb4a072de..9058cf53c 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -122,9 +122,10 @@ class NoticesearchAction extends SearchAction $cnt = $nl->show(); - $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, - $this->page, 'noticesearch', array('q' => $q)); + $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE, + $page, 'noticesearch', array('q' => $q)); } + function isReadOnly() { return true; -- cgit v1.2.3-54-g00ecf