]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Updater.php
Merge pull request #796 from virtualtam/changelog
[github/shaarli/Shaarli.git] / application / Updater.php
index 3f5d325b8ec5d29be258144f744b03598f3e19cf..27cb2f0a43e29b2e4879d91cac672b4a16e3159f 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+use Shaarli\Config\ConfigJson;
+use Shaarli\Config\ConfigPhp;
 
 /**
  * Class Updater.
@@ -336,6 +338,29 @@ class Updater
         }
         $this->conf->set('resource.theme', 'vintage');
         $this->conf->write($this->isLoggedIn);
+
+        return true;
+    }
+
+    /**
+     * * `markdown_escape` is a new setting, set to true as default.
+     *
+     * If the markdown plugin was already enabled, escaping is disabled to avoid
+     * breaking existing entries.
+     */
+    public function updateMethodEscapeMarkdown()
+    {
+        if ($this->conf->exists('security.markdown_escape')) {
+            return true;
+        }
+
+        if (in_array('markdown', $this->conf->get('general.enabled_plugins'))) {
+            $this->conf->set('security.markdown_escape', false);
+        } else {
+            $this->conf->set('security.markdown_escape', true);
+        }
+        $this->conf->write($this->isLoggedIn);
+
         return true;
     }
 }