1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Bugtracker #4141 - missing link - thanks marj

This commit is contained in:
e107steved 2007-10-13 20:48:34 +00:00
parent a944a91dc8
commit 7aa64c3f01

View File

@ -1,27 +1,45 @@
global $pref;
$parm = trim($parm);
$external = (($pref['links_new_window'] || strpos($parm, 'external') === 0) && substr($parm,0,1) != "#") ? " rel='external'" : "";
/*
[link=$parm $extras]$code_text[/link]
Correct Usage:
[link=http://mysite.com external]My text[/link]
[link=http://mysite.com rel=external]My text[/link]
[link=external]http://mysite.com[/link]
[link]http://mysite.com[/link]
[link=mailto:myemail@email.com]My name[/link]
Historic usage:
[link=external=http://mysite.com]My text[/link]
*/
if(strpos($parm,"{e_")!==FALSE){
$external = "";
}
$parm = trim($parm);
if(substr($parm,0,6) == "mailto")
{
list($pre,$email) = explode(":",$parm);
list($p1,$p2) = explode("@",$email);
return "<a class='bbcode' rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
}
/* Fix for people using link=external= */
if(strpos($parm,"external=") !== FALSE)
{
list($extras,$parm) = explode("=",$parm);
$parm = $parm." ".$extras;
}
if(substr($parm,0,6) == "mailto")
{
list($pre,$email) = explode(":",$parm);
list($p1,$p2) = explode("@",$email);
return "<a class='bbcode' rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
}
list($link,$extras) = explode(" ",$parm);
if(!$parm) $link = $code_text;
if($link == "external" && $extras == "")
{
$link = $code_text;
$extras = "rel=external";
}
$insert = (($pref['links_new_window'] || $extras == "external" || strpos($extras,"rel=external")!==FALSE) && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#") ? "rel='external' " : "";
if (strtolower(substr($link,0,11)) == 'javascript:') return '';
return "<a class='bbcode' href='".$tp -> toAttribute($link)."' ".$insert.">".$code_text."</a>";
if ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
{
$parm = preg_replace('#^external.#is', '', $parm);
if (strtolower(substr($parm,0,11)) == 'javascript:') return '';
return "<a class='bbcode' href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
}
else
{
if (strtolower(substr($code_text,0,11)) == 'javascript:') return '';
return "<a class='bbcode' href='".$tp -> toAttribute($code_text)."'".$external.">".$code_text."</a>";
}