Fix cross board linking support for board aliases. Note this doesn't have overboard support yet
This commit is contained in:
parent
569345cdc3
commit
c1b0012920
|
@ -2076,10 +2076,17 @@ function markup(&$body, $track_cites = false, $op = false) {
|
||||||
if ($board['uri'] != $_board) {
|
if ($board['uri'] != $_board) {
|
||||||
if (!openBoard($_board)){
|
if (!openBoard($_board)){
|
||||||
if (in_array($_board,array_keys($config['boards_alias']))){
|
if (in_array($_board,array_keys($config['boards_alias']))){
|
||||||
//$_board = $config['boards_alias'][$_board];
|
$_board = $config['boards_alias'][$_board];
|
||||||
//openBoard($_board);
|
if (openBoard($_board)){
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
continue; // Unknown board
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue; // Unknown board
|
else {
|
||||||
|
continue; // Unknown board
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2104,7 +2111,13 @@ function markup(&$body, $track_cites = false, $op = false) {
|
||||||
openBoard($tmp_board);
|
openBoard($tmp_board);
|
||||||
|
|
||||||
foreach ($cites as $matches) {
|
foreach ($cites as $matches) {
|
||||||
|
$original_board = NULL;
|
||||||
$_board = $matches[2][0];
|
$_board = $matches[2][0];
|
||||||
|
if (in_array($_board,array_keys($config['boards_alias']))){
|
||||||
|
$original_board = $_board;
|
||||||
|
$_board = $config['boards_alias'][$_board];
|
||||||
|
|
||||||
|
}
|
||||||
$cite = @$matches[3][0];
|
$cite = @$matches[3][0];
|
||||||
|
|
||||||
// preg_match_all is not multibyte-safe
|
// preg_match_all is not multibyte-safe
|
||||||
|
@ -2115,14 +2128,25 @@ function markup(&$body, $track_cites = false, $op = false) {
|
||||||
if ($cite) {
|
if ($cite) {
|
||||||
if (isset($cited_posts[$_board][$cite])) {
|
if (isset($cited_posts[$_board][$cite])) {
|
||||||
$link = $cited_posts[$_board][$cite];
|
$link = $cited_posts[$_board][$cite];
|
||||||
|
if (isset($original_board)){
|
||||||
|
$replacement = '<a ' .
|
||||||
|
($_board == $board['uri'] ?
|
||||||
|
'onclick="highlightReply(\''.$cite.'\', event);" '
|
||||||
|
: '') . 'href="' . $link . '">' .
|
||||||
|
'>>>/' . $original_board . '/' . $cite .
|
||||||
|
'</a>';
|
||||||
|
|
||||||
$replacement = '<a ' .
|
}
|
||||||
|
else {
|
||||||
|
$replacement = '<a ' .
|
||||||
($_board == $board['uri'] ?
|
($_board == $board['uri'] ?
|
||||||
'onclick="highlightReply(\''.$cite.'\', event);" '
|
'onclick="highlightReply(\''.$cite.'\', event);" '
|
||||||
: '') . 'href="' . $link . '">' .
|
: '') . 'href="' . $link . '">' .
|
||||||
'>>>/' . $_board . '/' . $cite .
|
'>>>/' . $_board . '/' . $cite .
|
||||||
'</a>';
|
'</a>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0]));
|
$body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0]));
|
||||||
$skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]);
|
$skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue