[Bb-trac] Re: [bbPress] #1003: regex parsing error on page_number_links when pretty permalinks off

bbPress bb-trac at lists.bbpress.org
Fri Dec 5 23:36:12 GMT 2008


#1003: regex parsing error on page_number_links when pretty permalinks off
----------------------+-----------------------------------------------------
 Reporter:  _ck_      |        Owner:                    
     Type:  defect    |       Status:  new               
 Priority:  normal    |    Milestone:  1.0-beta & XML-RPC
Component:  Back-end  |      Version:  1.0-beta (trunk)  
 Severity:  normal    |   Resolution:                    
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by _ck_):

 The approach I'd suggest is to reduce the complexity of how it's presented
 to `function bb_paginate_links`

 Strip the URI entirely of `/page/x/` `?page=x` and `&page=x`

 Also, the URI is not just `$_SERVER['REQUEST_URI']`
 `$_SERVER['QUERY_STRING']` has to be looked at too

 untested:
 {{{
 if (empty($_SERVER['QUERY_STRING'])) {
     $uri=$_SERVER['REQUEST_URI'];
 } else {
     $uri=$_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING']
 }
 $uri=preg_replace('!([&?\/])page[=\/][0-9]+!','$1',$uri);

 }}}

 Then I guess analyze the resulting uri to see if needs to add `?page=x` or
 `&page=x`

-- 
Ticket URL: <http://trac.bbpress.org/ticket/1003#comment:3>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list