mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
misc: Minor improvements (#1897)
This commit is contained in:
parent
36d399220e
commit
14086a0ed6
3 changed files with 10 additions and 19 deletions
|
@ -2154,10 +2154,7 @@ function getBanInfo(?int $userId = null): ?array
|
|||
global $datastore;
|
||||
|
||||
// Get bans info from datastore
|
||||
if (!$bans = $datastore->get('ban_list')) {
|
||||
$datastore->update('ban_list');
|
||||
$bans = $datastore->get('ban_list');
|
||||
}
|
||||
$bans = $datastore->get('ban_list');
|
||||
|
||||
if (!isset($userId)) {
|
||||
return $bans;
|
||||
|
|
|
@ -41,10 +41,7 @@ class Censor
|
|||
}
|
||||
|
||||
// Get censored words
|
||||
if (!$censoredWords = $datastore->get('censor')) {
|
||||
$datastore->update('censor');
|
||||
$censoredWords = $datastore->get('censor');
|
||||
}
|
||||
$censoredWords = $datastore->get('censor');
|
||||
|
||||
foreach ($censoredWords as $word) {
|
||||
$this->words[] = '#(?<![\p{Nd}\p{L}_])(' . str_replace('\*', '[\p{Nd}\p{L}_]*?', preg_quote($word['word'], '#')) . ')(?![\p{Nd}\p{L}_])#iu';
|
||||
|
|
|
@ -19,7 +19,7 @@ class BBCode
|
|||
public array $tpl = [];
|
||||
|
||||
/** @var array $smilies Replacements for smilies */
|
||||
public array $smilies;
|
||||
public array $smilies = [];
|
||||
|
||||
/** @var array $tidy_cfg Tidy preprocessor configuration */
|
||||
public array $tidy_cfg = [
|
||||
|
@ -336,19 +336,16 @@ class BBCode
|
|||
{
|
||||
global $datastore;
|
||||
|
||||
if (!$this->smilies = $datastore->get('smile_replacements')) {
|
||||
$datastore->update('smile_replacements');
|
||||
$this->smilies = $datastore->get('smile_replacements');
|
||||
}
|
||||
$this->smilies = $datastore->get('smile_replacements');
|
||||
|
||||
if (defined('IN_ADMIN')) {
|
||||
foreach ($this->smilies['repl'] as &$smile) {
|
||||
$smile = preg_replace('/src="([^"]+)"/', 'src="./../$1"', $smile);
|
||||
if (!empty($this->smilies)) {
|
||||
if (defined('IN_ADMIN')) {
|
||||
foreach ($this->smilies['repl'] as &$smile) {
|
||||
$smile = preg_replace('/src="([^"]+)"/', 'src="./../$1"', $smile);
|
||||
}
|
||||
unset($smile);
|
||||
}
|
||||
unset($smile);
|
||||
}
|
||||
|
||||
if ($this->smilies) {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
if ($parsed_text = preg_replace($this->smilies['orig'], $this->smilies['repl'], $text)) {
|
||||
return $parsed_text;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue