Seite 1 von 1
[Suche Mod] Link im gleichen Fenster öffnen
Verfasst: 06.06.2003 18:39
von m-a-b
hi!
suche nen mod bzw. hack, der folgendes bewirkt.
(denke da muss man nur die bbcode.php editieren).
meine seite lautet:
www.aev-forum.de
wenn jemand nen link mit
www..../viewtopic.php?xxx postet,
dann öffnet sich die seite, wenn man drauf klickt im gleichen fenster.
wenn der link nicht
www.aev-forum.de ist also z.b.
www.web.de, und man klickt drauf, öffnet sich die seite in nem neuen Fenster!
is auf
www.phpbb2.de auch der Fall!
hab schon ewig danach gesucht, aber nix gefunden.
kann mir einer helfen???
mfg
markus

Verfasst: 08.06.2003 10:56
von m-a-b
hab's auf phpbb2 gefunden.
in der bbcode.php folgendes finden.
mit diesem code ersetzen
Code: Alles auswählen
function make_clickable($text)
{
// pad it with a space so we can match things at the start of the 1st line.
$ret = " " . $text;
// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
// xxxx can only be alpha characters.
// yyyy is anything up to the first space, newline, or comma.
$ret = preg_replace("#([\n ])([a-z]+?)://(".$_SERVER[HTTP_HOST]."[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\">\\2://\\3</a>", $ret);
$ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
// yyyy contains either alphanum, "-", or "."
// zzzz is optional.. will contain everything up to the first space, newline, or comma.
// This is slightly restrictive - it's not going to match stuff like "forums.foo.com"
// This is to keep it from getting annoying and matching stuff that's not meant to be a link.
$ret = preg_replace("#([\n ])www\.(".$_SERVER[HTTP_HOST]."[a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\">www.\\2.\\3\\4</a>", $ret);
$ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret);
// matches an email@domain type address at the start of a line, or after a space.
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
$ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
// Remove our padding..
$ret = substr($ret, 1);
return($ret);
}
dann sollte es funktionieren!
mfg
Markus
