fix: 修复知识库 access start 在webman中重新定义的问题

This commit is contained in:
xboard 2023-11-22 21:33:19 +08:00
parent 4c1c024afa
commit 638dbef30a

View File

@ -62,12 +62,8 @@ class KnowledgeController extends Controller
private function formatAccessData(&$body)
{
function getBetween($input, $start, $end){$substr = substr($input, strlen($start)+strpos($input, $start),(strlen($input) - strpos($input, $end))*(-1));return $start . $substr . $end;}
while (strpos($body, '<!--access start-->') !== false) {
$accessData = getBetween($body, '<!--access start-->', '<!--access end-->');
if ($accessData) {
$body = str_replace($accessData, '<div class="v2board-no-access">'. __('You must have a valid subscription to view content in this area') .'</div>', $body);
}
}
$pattern = '/<!--access start-->(.*?)<!--access end-->/s';
$replacement = '<div class="v2board-no-access">' . __('You must have a valid subscription to view content in this area') . '</div>';
$body = preg_replace($pattern, $replacement, $body);
}
}