PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Bug Tracker (http://www.phpdig.net/forum/forumdisplay.php?f=27)
-   -   relative links without URI but only "?bla=1" (http://www.phpdig.net/forum/showthread.php?t=1361)

blueyed 09-24-2004 05:37 AM

relative links without URI but only "?bla=1"
 
It seems that PhpDig (1.8.3) follows links like

<a href="?a=1&amp;b=2">link</a>

on http://localhost/path

to http://localhost?a=1&amp;b=2

instead of

http://localhost/path?a=1&amp;b=2

blueyed 10-12-2004 05:05 AM

FIXED.. :)

in admin/robot_functions in line 780 add this:


Code:

            elseif (substr($regs[8],0,1) == "?") {
                  $links[$index] = phpdigRewriteUrl($path.$file.$regs[8]);
            }

This way links like
HTML Code:

<a href="?param=1">Link</a>
on a page like http://domain.com/subdir/file are followed as http://domain.com/subdir/file?param=1 and not http://domain.com/subdir/?param=1

I hope this makes it into the next release.

Thank you.

blueyed 12-03-2004 02:05 AM

bugfix: handle href="?getparam=x" correctly
 
please see http://www.phpdig.net/forum/showthread.php?t=1361

blueyed 12-06-2004 02:23 AM

Fix for the fix.. replace the code I've suggested with this one.

The previous code would build links like "someuri.html?page=5?page=6".. :/

Code:

elseif( $regs[8]{0} == '?' )
{ // path/file is a query string - cut it from base file
  $links[$index] = phpdigRewriteUrl( $path.preg_replace( '#\?.*#', '', $file ).$regs[8] );
}

It's below
Code:

elseif (substr($regs[8],0,1) == "/") {
  $links[$index] = phpdigRewriteUrl($regs[8]);
}

and above
Code:

else {
  $links[$index] = phpdigRewriteUrl($path.$regs[8]);
}



All times are GMT -8. The time now is 06:38 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.