mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 04:13:49 +01:00
Update functions.php
current regex consumes the space after a post quote, instead of merely checking that it's there. As a result textually consecutive post quotes, which the source calls cites, cannot be separated by a single space. This fixes that
This commit is contained in:
parent
72f38933c2
commit
75236d6ae5
@ -2069,7 +2069,7 @@ function markup(&$body, $track_cites = false, $op = false) {
|
||||
if ($num_links > $config['max_links'])
|
||||
error($config['error']['toomanylinks']);
|
||||
}
|
||||
|
||||
|
||||
if ($config['markup_repair_tidy'])
|
||||
$body = str_replace(' ', ' ', $body);
|
||||
|
||||
@ -2086,14 +2086,14 @@ function markup(&$body, $track_cites = false, $op = false) {
|
||||
$tracked_cites = array();
|
||||
|
||||
// Cites
|
||||
if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
|
||||
if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)((?=[\s,.)?!])|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
|
||||
if (count($cites[0]) > $config['max_cites']) {
|
||||
error($config['error']['toomanycites']);
|
||||
}
|
||||
|
||||
$skip_chars = 0;
|
||||
$body_tmp = $body;
|
||||
|
||||
|
||||
$search_cites = array();
|
||||
foreach ($cites as $matches) {
|
||||
$search_cites[] = '`id` = ' . $matches[2][0];
|
||||
@ -2102,12 +2102,12 @@ function markup(&$body, $track_cites = false, $op = false) {
|
||||
|
||||
$query = query(sprintf('SELECT `thread`, `id` FROM ``posts_%s`` WHERE ' .
|
||||
implode(' OR ', $search_cites), $board['uri'])) or error(db_error());
|
||||
|
||||
|
||||
$cited_posts = array();
|
||||
while ($cited = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$cited_posts[$cited['id']] = $cited['thread'] ? $cited['thread'] : false;
|
||||
}
|
||||
|
||||
|
||||
foreach ($cites as $matches) {
|
||||
$cite = $matches[2][0];
|
||||
|
||||
@ -2133,21 +2133,21 @@ function markup(&$body, $track_cites = false, $op = false) {
|
||||
}
|
||||
|
||||
// Cross-board linking
|
||||
if (preg_match_all('/(^|\s)>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?([\s,.)?]|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
|
||||
if (preg_match_all('/(^|\s)>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?((?=[\s,.)?!])|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
|
||||
if (count($cites[0]) > $config['max_cites']) {
|
||||
error($config['error']['toomanycross']);
|
||||
}
|
||||
|
||||
$skip_chars = 0;
|
||||
$body_tmp = $body;
|
||||
|
||||
|
||||
if (isset($cited_posts)) {
|
||||
// Carry found posts from local board >>X links
|
||||
foreach ($cited_posts as $cite => $thread) {
|
||||
$cited_posts[$cite] = $config['root'] . $board['dir'] . $config['dir']['res'] .
|
||||
($thread ? $thread : $cite) . '.html#' . $cite;
|
||||
}
|
||||
|
||||
|
||||
$cited_posts = array(
|
||||
$board['uri'] => $cited_posts
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user