"; $newurl = $cur_link["host"]; if(strncmp($url_info["path"], "./", 2) == 0) $url_info["path"] = substr($url_info["path"], 2); if($url_info["path"] != "") { if($url_info["path"][0] == "/") $newurl .= $url_info["path"]; else { if(($ps = strrpos($cur_link["path"], "/")) > 0) $curpath = substr($cur_link["path"], 0, $ps); $newurl .= "/".$curpath."/".$url_info["path"]; } } // echo "tempnewurl: $newurl
"; } else { $newurl = $url_info["host"]; if($url_info["path"][0] == "/") $newurl .= $url_info["path"]; else $newurl .= "/".$url_info["path"]; } if($url_info["query"] != "") $newurl .= "?".rebuildQuery($url_info["query"]); while(strpos($newurl, "//") !== false) $newurl = str_replace("//", "/", $newurl); $newurl = "http://".$newurl; $newurl = str_replace("&", "&", $newurl); return $newurl; } // $url is an external link ? [both $url and $versus need http://] function isLinkExternal($url, $versus){ $url_info = parse_url($url); $dom_info = parse_url($versus); if($url_info["scheme"] != "http" && $url_info["scheme"] != "") return true; if ($url_info["host"] != $dom_info["host"] && $url_info["host"] != "" && $url_info["host"] != "www.".$dom_info["host"] && "www.".$url_info["host"] != $dom_info["host"]) return true; if($url_info["port"] != $dom_info["port"]) return true; if($url_info["path"][1] == "~") return true; $type = substr(strrchr($url_info['path'],"."),1); if($type == "jpg" || $type == "JPG" || $type == "jpeg" || $type == "png" || $type == "gif" || $type == "rar" || $type == "db")return true; return false; } ?>