View Single Post
Old 03-27-2004, 02:06 AM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. There is a 1.8.0 fix in this post that should be applied.

However, even with the fix, I'm not sure parse_url will handle a URL in the query string. See below.
PHP Code:
<?php
$url
="http://www.heritageglass.com?amp;zoneid=0&source=&dest=http://www.heritageglass.com";
print_r(parse_url($url)); // without fix and with url
echo "\n<br>\n";
$url="http://www.heritageglass.com?zoneid=0&source=&dest=http://www.heritageglass.com";
print_r(parse_url($url)); // with fix and with url
echo "\n<br>\n";
$url="http://www.heritageglass.com?zoneid=0&source=&dest=";
print_r(parse_url($url)); // with fix and without url
?>
The output is as follows:

Array
(
[scheme] => http
[host] => www.heritageglass.com?amp;zoneid=0&source=&dest=http
[path] => //www.heritageglass.com
)

Array
(
[scheme] => http
[host] => www.heritageglass.com?zoneid=0&source=&dest=http
[path] => //www.heritageglass.com
)

Array
(
[scheme] => http
[host] => www.heritageglass.com
[query] => zoneid=0&source=&dest=
)


Untested, but in robot_functions.php you might try the following code:
PHP Code:
$newurl parse_url($newpath);

// add this chunk of code here
if ((isset($newurl["host"])) && (eregi("[?]",$newurl["host"]))) {
  if (!isset(
$newurl["path"])) { $newurl["path"] = ""; }
  if (!isset(
$newurl["query"])) { $newurl["query"] = ""; }
  
$newurl["query"] = substr(strstr($newurl["host"],"?"),1).$newurl["path"].$newurl["query"];
  unset(
$newurl["path"]);
  
$newurl["host"] = substr($newurl["host"],0,strpos($newurl["host"],"?"));
}

//search if relocation is absolute or relative 
Remember to remove any "word" wrapping in the above code.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote