update: fix knowledge access data foreach

This commit is contained in:
tokumeikoi 2022-03-10 16:16:14 +08:00
parent 2eb428fc3c
commit d5504354bc
2 changed files with 6 additions and 4 deletions

View File

@ -64,9 +64,11 @@ class KnowledgeController extends Controller
private function formatAccessData(&$body) private function formatAccessData(&$body)
{ {
function getBetween($input, $start, $end){$substr = substr($input, strlen($start)+strpos($input, $start),(strlen($input) - strpos($input, $end))*(-1));return $substr;} function getBetween($input, $start, $end){$substr = substr($input, strlen($start)+strpos($input, $start),(strlen($input) - strpos($input, $end))*(-1));return $substr;}
$accessData = getBetween($body, '<!--access start-->', '<!--access end-->'); while (strpos($body, '<!--access start-->') !== false) {
if ($accessData) { $accessData = '<!--access start-->' . getBetween($body, '<!--access start-->', '<!--access end-->') . '<!--access end-->';
$body = str_replace($accessData, '<div class="v2board-no-access">'. __('You must have a valid subscription to view content in this area') .'</div>', $body); 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);
}
} }
} }
} }

File diff suppressed because one or more lines are too long