Typ Deines phpBB Forums: Premodded phpBB
MODs: Ja
Dein Wissensstand: Einsteiger
Link zu Deinem Forum: http://komsomolsk.spec-f.de
PHP Version: 4.3.10
MySQL Version: 4.1.10
Was hast Du gemacht, bevor das Problem aufgetreten ist?
includes/bbcode.php
Code: Alles auswählen
function make_clickable($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $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, comma, double quote or <
if (stristr($ret,"spec-f.de"))
{
$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_self\">\\2</a>", $ret);
}
else
{
$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"http://komsomolsk.spec-f.de/rlink/rlink.php?url=http://navig8.to/?\\2\" target=\"_blank\">\\2</a>", $ret);
}
// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
// zzzz is optional.. will contain everything up to the first space, newline,
// comma, double quote or <.
if(!stristr($ret,"spec-f.de") )
{
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://komsomolsk.spec-f.de/rlink/rlink.php?url=http://navig8.to/?http://\\2\" target=\"_blank\">\\2</a>", $ret);
}
else
{
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_self\">\\2</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);
}Was hast Du bereits versucht um das Problem zu lösen?
Ich habe versucht, eine for Schleife einzufügen, und daran Sch... ich zu scheitern:
Code: Alles auswählen
function make_clickable($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $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, comma, double quote or <
for ($i=0; !$ret; $i++)
{
if (stristr($ret,"spec-f.de"))
{
$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_self\">\\2</a>", $ret);
}
else
{
$ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"http://komsomolsk.spec-f.de/rlink/rlink.php?url=http://navig8.to/?\\2\" target=\"_blank\">\\2</a>", $ret);
}
// matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
// zzzz is optional.. will contain everything up to the first space, newline,
// comma, double quote or <.
if(!stristr($ret,"spec-f.de") )
{
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://komsomolsk.spec-f.de/rlink/rlink.php?url=http://navig8.to/?http://\\2\" target=\"_blank\">\\2</a>", $ret);
}
else
{
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_self\">\\2</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);
}Fehlerbeschreibung und Nachricht
Guten Morgen,
die Idee hinter dieser Code Erweiterung ist, dass Links die innerhalb meines Forum zeigen,
nicht in einem extra Fenster geöffnet werden und auch nicht von rlink.php geöffnet werden.
Das funktioniert einwandfrei, aber nur, wenn pro Post nur externe oder nur interne Links
angegeben werden.
Zum Beispiel:
Ein Post hat folgende Links:
http://www.oxpus.de
und oder
www.phpbb.com
Die werden dann so korrekt aufgerufen:
[]http://komsomolsk.spec-f.de/rlink/rlink ... .phpbb.com
bzw.
[]http://komsomolsk.spec-f.de/rlink/rlink ... w.oxpus.de
Ein Post mit Links, die innerhalb meines Forum zeigen funktioniert auch korrekt:
http://komsomolsk.spec-f.de
und oder
www.spec-f.de
Es werden beim Anklicken die Links http://komsomolsk.spec-f.de bzw. www.spec-f.de ohne rlink.php weiter geleitet und im selben Browser Fenster geöffnet.
Funktioniert wie schon erwähnt tadellos. Das Problem ist, dass nur pro Post, egal wieviele URLs
in diesem Post angegeben wurden, bbcode.php nur 1x ausgeführt wird.
Zum Beispiel hat ein Post folgende URLs:
http://www.oxpus.de
und
http://spec-f.de/mp
Bei einem Klick auf diese Links http://www.oxpus.de und oder http://spec-f.de/mp werde diese jeweils im eigenen Browser geöffnet.
Beim Anklicken des Link von oxpus müsste aber so weitergeleitet werden:
http://komsomolsk.spec-f.de/rlink/rlink ... w.oxpus.de
Und wie da jetzt die richtige Schleife reinsetzen?
Ein weiteres Problem sehe ich noch in so der [url] und [url=xxxx Abfrage, aber dazu
komme ich später, wenn dieses Problem vielleicht beseitigt werden kann.
Gruß Stöbi
Hmmm, ich vermisse hier eine Vorschau. Ich kann nur Absenden.