Selaa lähdekoodia

Change o_censoring

Visman 3 vuotta sitten
vanhempi
commit
ab3e4dd1f6

+ 2 - 2
app/Models/Censorship/Censorship.php

@@ -27,7 +27,7 @@ class Censorship extends Model
      */
     public function init(): Censorship
     {
-        if ('1' == $this->c->config->o_censoring) {
+        if (1 == $this->c->config->b_censoring) {
             $list = $this->c->Cache->get('censorship');
 
             if (! isset($list['searchList'], $list['replaceList'])) {
@@ -50,7 +50,7 @@ class Censorship extends Model
      */
     public function censor(string $str): string
     {
-        if ('1' == $this->c->config->o_censoring) {
+        if (1 == $this->c->config->b_censoring) {
             return (string) \preg_replace($this->searchList, $this->replaceList,  $str);
         } else {
             return $str;

+ 4 - 4
app/Models/Pages/Admin/Censoring.php

@@ -28,7 +28,7 @@ class Censoring extends Admin
             $v = $this->c->Validator->reset()
                 ->addRules([
                     'token'               => 'token:AdminCensoring',
-                    'o_censoring'         => 'required|integer|in:0,1',
+                    'b_censoring'         => 'required|integer|in:0,1',
                     'form.*.search_for'   => 'string:trim|max:60',
                     'form.*.replace_with' => 'string:trim|max:60',
                 ])->addAliases([
@@ -37,7 +37,7 @@ class Censoring extends Admin
                 ]);
 
             if ($v->validation($_POST)) {
-                $this->c->config->o_censoring = $v->o_censoring;
+                $this->c->config->b_censoring = $v->b_censoring;
                 $this->c->config->save();
 
                 $this->c->censorship->save($v->form);
@@ -70,9 +70,9 @@ class Censoring extends Admin
             'sets'   => [
                 'onoff' => [
                     'fields' => [
-                        'o_censoring' => [
+                        'b_censoring' => [
                             'type'    => 'radio',
-                            'value'   => $this->c->config->o_censoring,
+                            'value'   => $this->c->config->b_censoring,
                             'values'  => [1 => __('Yes'), 0 => __('No')],
                             'caption' => 'Censor words label',
                             'help'    => 'Censor words help',

+ 1 - 1
app/Models/Pages/Admin/Install.php

@@ -1221,7 +1221,7 @@ class Install extends Admin
             'i_disp_users'            => 50,
             'b_quickpost'             => 1,
             'b_users_online'          => 1,
-            'o_censoring'             => 0,
+            'b_censoring'             => 0,
             'o_show_dot'              => 0,
             'o_topic_views'           => 1,
             'o_quickjump'             => 1,

+ 2 - 0
app/Models/Pages/Admin/Update.php

@@ -508,6 +508,7 @@ class Update extends Admin
         $this->c->config->b_make_links      = '1' == $this->c->config->o_make_links ? 1 : 0;
         $this->c->config->b_quickpost       = '1' == $this->c->config->o_quickpost ? 1 : 0;
         $this->c->config->b_users_online    = '1' == $this->c->config->o_users_online ? 1 : 0;
+        $this->c->config->b_censoring       = '1' == $this->c->config->o_censoring ? 1 : 0;
 
         unset($this->c->config->o_timeout_visit);
         unset($this->c->config->o_timeout_online);
@@ -519,6 +520,7 @@ class Update extends Admin
         unset($this->c->config->o_make_links);
         unset($this->c->config->o_quickpost);
         unset($this->c->config->o_users_online);
+        unset($this->c->config->o_censoring);
 
         $this->c->config->save();