@@ -126,6 +126,10 @@ public function seo_regression($event)
126126 array ('pattern ' => array ('before ' => 'forum ' , 'after ' => '' ), 'replacement ' => 'viewforum.php?f= ' , 'paginate ' => array ('before ' => 'page ' , 'after ' => '\.html ' )),
127127 array ('pattern ' => array ('before ' => '-f ' , 'after ' => '' ), 'replacement ' => 'viewforum.php?f= ' , 'paginate ' => array ('before ' => 'page ' , 'after ' => '\.html ' )),
128128 ),
129+ 'team ' => array (
130+ array ('pattern ' => 'team\.html ' , 'replacement ' => 'memberlist.php?mode=team ' ),
131+ array ('pattern ' => 'equipe\.html ' , 'replacement ' => 'memberlist.php?mode=team ' ),
132+ ),
129133 );
130134
131135 // Do not remove the following array
@@ -145,13 +149,23 @@ public function seo_regression($event)
145149 $ uri = $ this ->request ->server ('REQUEST_URI ' );
146150 $ original_url_parts = $ this ->path_helper ->get_url_parts ($ uri );
147151
148- $ base_uri = $ original_url_parts ['base ' ];
152+ if (strpos ($ original_url_parts ['base ' ], $ this ->config ['script_path ' ]) === 0 )
153+ {
154+ $ base_uri = substr ($ original_url_parts ['base ' ], strlen ($ this ->config ['script_path ' ]));
155+ if (substr ($ base_uri , 0 , 1 ) !== '/ ' )
156+ {
157+ $ base_uri = '/ ' . $ base_uri ;
158+ }
159+ }
160+ else
161+ {
162+ // We are outside of the forum, don't rewrite
163+ return ;
164+ }
149165
150166 // Check the following parameters before rebuilding the URI
151167 $ allow_uri_rebuild_params [] = !strpos ($ base_uri , '. ' . $ this ->php_ext );
152168 $ allow_uri_rebuild_params [] = $ base_uri !== '/ ' ;
153- $ allow_uri_rebuild_params [] = $ base_uri !== $ this ->config ['script_path ' ];
154- $ allow_uri_rebuild_params [] = $ base_uri !== $ this ->config ['script_path ' ] . '/ ' ;
155169
156170 if ($ this ->allow_uri_rebuild ($ allow_uri_rebuild_params ))
157171 {
@@ -195,6 +209,11 @@ private function allow_uri_rebuild($args)
195209 private function build_url ($ uri , $ base_uri , $ seo_params , $ no_ids = false )
196210 {
197211 $ build_url = '' ;
212+
213+ if ($ this ->check_static_rewrite ($ base_uri , $ seo_params , $ build_url ))
214+ {
215+ return $ build_url ;
216+ }
198217
199218 $ uri_clean = $ this ->strip_forum_name ($ base_uri );
200219
@@ -248,6 +267,39 @@ private function build_url($uri, $base_uri, $seo_params, $no_ids = false)
248267
249268 return $ build_url ;
250269 }
270+
271+ /**
272+ * Check for static rewrites
273+ *
274+ * @param string $uri
275+ * @param string $base_uri
276+ * @param array $seo_params
277+ * @param string &$build_url
278+ *
279+ * @return bool
280+ * @access private
281+ */
282+ private function check_static_rewrite ($ base_uri , $ seo_params , &$ build_url )
283+ {
284+ foreach ($ seo_params as $ seo_param )
285+ {
286+ if (!is_string ($ seo_param [0 ]['pattern ' ]))
287+ {
288+ continue ;
289+ }
290+
291+ foreach ($ seo_param as $ seo_config )
292+ {
293+ if (preg_match ('#^/( ' . $ seo_config ['pattern ' ] . ')$# ' , $ base_uri ))
294+ {
295+ $ build_url = $ seo_config ['replacement ' ];
296+ return true ;
297+ }
298+ }
299+ }
300+
301+ return false ;
302+ }
251303
252304 /**
253305 * Strip the forum name from the given URI
0 commit comments