Index: .hgsubstate
===================================================================
--- .hgsubstate	(revision 3892)
+++ .hgsubstate	(revision 3938)
@@ -1,1 +1,1 @@
-99d9dc2749c64567e0403771683ad6b22597c279 inc/libs/clearbricks
+c019de4d8ec41f12428c20bd19b2166548802c28 inc/libs/clearbricks
Index: admin/index.php
===================================================================
--- admin/index.php	(revision 3918)
+++ admin/index.php	(revision 3947)
@@ -149,19 +149,20 @@
 # Dashboard drag'n'drop switch for its elements
 $core->auth->user_prefs->addWorkspace('accessibility');
-$dragndrop = '';
+$dragndrop      = '';
+$dragndrop_head = '';
+$dragndrop_msg  = [
+    'dragndrop_off' => __('Dashboard area\'s drag and drop is disabled'),
+    'dragndrop_on'  => __('Dashboard area\'s drag and drop is enabled')
+];
 if (!$core->auth->user_prefs->accessibility->nodragdrop) {
-    $dragndrop =
-    '<script type="text/javascript">' . "\n" .
-    dcPage::jsVar('dotclear.dragndrop_off', __('Dashboard area\'s drag and drop is disabled')) . "\n" .
-    dcPage::jsVar('dotclear.dragndrop_on', __('Dashboard area\'s drag and drop is enabled')) . "\n" .
-    "</script>\n" .
-    '<input type="checkbox" id="dragndrop" class="sr-only" title="' .
-        __('Dashboard area\'s drag and drop is disabled') . '" />' .
+    $dragndrop_head = dcPage::jsJson('dotclear_dragndrop', $dragndrop_msg);
+    $dragndrop      =
+    '<input type="checkbox" id="dragndrop" class="sr-only" title="' . $dragndrop_msg['dragndrop_off'] . '" />' .
     '<label for="dragndrop">' .
     '<svg aria-hidden="true" focusable="false" class="dragndrop-svg">' .
     '<use xlink:href="images/dragndrop.svg#mask"></use>' .
     '</svg>' .
-    '<span id="dragndrop-label" class="sr-only">' . __('Dashboard area\'s drag and drop is disabled') . '</span>' .
-    '</label>';
+    '<span id="dragndrop-label" class="sr-only">' . $dragndrop_msg['dragndrop_off'] . '</span>' .
+        '</label>';
 }
 
@@ -172,4 +173,5 @@
     dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
     dcPage::jsLoad('js/_index.js') .
+    $dragndrop_head .
     $admin_post_behavior .
     # --BEHAVIOR-- adminDashboardHeaders
Index: admin/js/_index.js
===================================================================
--- admin/js/_index.js	(revision 3936)
+++ admin/js/_index.js	(revision 3947)
@@ -1,3 +1,3 @@
-/*global $, dotclear, jsToolBar */
+/*global $, dotclear, jsToolBar, getData */
 'use strict';
 
@@ -249,4 +249,5 @@
     // Set or reset sortable depending on #dragndrop checbkox value
     $('#dragndrop').click(function() {
+      Object.assign(dotclear, getData('dotclear_dragndrop'));
       if ($(this).is(':checked')) {
         // Activate sorting feature
Index: admin/js/prepend.js
===================================================================
--- admin/js/prepend.js	(revision 3930)
+++ admin/js/prepend.js	(revision 3945)
@@ -1,3 +1,3 @@
-/*exported getData */
+/*exported getData, isObject, mergeDeep */
 'use strict';
 
@@ -18,2 +18,27 @@
   return data;
 }
+
+function isObject(item) {
+  return (item && typeof item === 'object' && !Array.isArray(item));
+}
+
+/**
+ * Deep merge two objects.
+ * @param target
+ * @param ...sources
+ */
+function mergeDeep(target, ...sources) {
+  if (!sources.length) return target;
+  const source = sources.shift();
+  if (isObject(target) && isObject(source)) {
+    for (const key in source) {
+      if (isObject(source[key])) {
+        if (!target[key]) Object.assign(target, { [key]: {} });
+        mergeDeep(target[key], source[key]);
+      } else {
+        Object.assign(target, { [key]: source[key] });
+      }
+    }
+  }
+  return mergeDeep(target, ...sources);
+}
Index: admin/style/default-dark.css
===================================================================
--- admin/style/default-dark.css	(revision 3935)
+++ admin/style/default-dark.css	(revision 3943)
@@ -3247,5 +3247,5 @@
   background-color: #4c4d4f; }
 
-.ui-sortable-handle {
+div.ui-sortable-handle {
   border: 1px dashed currentColor !important;
   border-radius: .75em !important; }
Index: admin/style/default.css
===================================================================
--- admin/style/default.css	(revision 3935)
+++ admin/style/default.css	(revision 3943)
@@ -3247,5 +3247,5 @@
   background-color: #f3f3f3; }
 
-.ui-sortable-handle {
+div.ui-sortable-handle {
   border: 1px dashed currentColor !important;
   border-radius: .75em !important; }
Index: admin/style/scss/partials/_utils.scss
===================================================================
--- admin/style/scss/partials/_utils.scss	(revision 3935)
+++ admin/style/scss/partials/_utils.scss	(revision 3943)
@@ -8,5 +8,5 @@
 }
 
-.ui-sortable-handle {
+div.ui-sortable-handle {
   border: 1px dashed currentColor !important;
   border-radius: .75em !important;
Index: inc/admin/lib.dc.page.php
===================================================================
--- inc/admin/lib.dc.page.php	(revision 3934)
+++ inc/admin/lib.dc.page.php	(revision 3946)
@@ -75,4 +75,5 @@
             $blog_box = '<p><label for="switchblog" class="classic">' . __('Blogs:') . '</label> ' .
             $core->formNonce() . form::combo('switchblog', $blogs, $core->blog->id) .
+            form::hidden(['redir'], $_SERVER['REQUEST_URI']) .
             '<input type="submit" value="' . __('ok') . '" class="hidden-if-js" /></p>';
         }
Index: inc/admin/prepend.php
===================================================================
--- inc/admin/prepend.php	(revision 3923)
+++ inc/admin/prepend.php	(revision 3946)
@@ -135,8 +135,13 @@
         }
 
-        # Removing switchblog from URL
-        $redir = $_SERVER['REQUEST_URI'];
-        $redir = preg_replace('/switchblog=(.*?)(&|$)/', '', $redir);
-        $redir = preg_replace('/\?$/', '', $redir);
+        if (!empty($_REQUEST['redir'])) {
+            # Keep context as far as possible
+            $redir = $_REQUEST['redir'];
+        } else {
+            # Removing switchblog from URL
+            $redir = $_SERVER['REQUEST_URI'];
+            $redir = preg_replace('/switchblog=(.*?)(&|$)/', '', $redir);
+            $redir = preg_replace('/\?$/', '', $redir);
+        }
         http::redirect($redir);
         exit;
Index: inc/config.php.in
===================================================================
--- inc/config.php.in	(revision 3789)
+++ inc/config.php.in	(revision 3939)
@@ -73,4 +73,7 @@
 //define('HTTP_PROXY_PORT','8080');
 
+// Reverse Proxy
+//define('DC_REVERSE_PROXY',false);
+
 // Show hidden media dirs
 //define('DC_SHOW_HIDDEN_DIRS', false);
Index: inc/prepend.php
===================================================================
--- inc/prepend.php	(revision 3920)
+++ inc/prepend.php	(revision 3939)
@@ -177,5 +177,7 @@
     http::$https_scheme_on_443 = true;
 }
-
+if (defined('DC_REVERSE_PROXY') && DC_REVERSE_PROXY) {
+    http::$reverse_proxy = true;
+}
 if (!defined('DC_DBPERSIST')) {
     define('DC_DBPERSIST', false);
Index: plugins/dcLegacyEditor/inc/dc.legacy.editor.behaviors.php
===================================================================
--- plugins/dcLegacyEditor/inc/dc.legacy.editor.behaviors.php	(revision 3915)
+++ plugins/dcLegacyEditor/inc/dc.legacy.editor.behaviors.php	(revision 3945)
@@ -26,12 +26,14 @@
         if (empty($editor) || $editor != 'dcLegacyEditor') {return;}
 
+        $js = [
+            'legacy_editor_context' => $context,
+            'legacy_editor_syntax' => $syntax,
+            'legacy_editor_tags_context' => [$context => $tags]
+        ];
+
         return
         self::jsToolBar() .
-        dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/_post_editor.js')) .
-        '<script type="text/javascript">' . "\n" .
-        dcPage::jsVar('dotclear.legacy_editor_context', $context) .
-        dcPage::jsVar('dotclear.legacy_editor_syntax', $syntax) .
-        'dotclear.legacy_editor_tags_context = ' . sprintf('{%s:["%s"]};' . "\n", $context, implode('","', $tags)) . "\n" .
-            "</script>\n";
+        dcPage::jsJson('legacy_editor_ctx', $js) .
+        dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/_post_editor.js'));
     }
 
@@ -59,5 +61,83 @@
     protected static function jsToolBar()
     {
+        $rtl = l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? 'direction: rtl;' : '';
+        $css = <<<EOT
+body {
+    color: #000;
+    background: #f9f9f9;
+    margin: 0;
+    padding: 2px;
+    border: none;
+    $rtl
+}
+code {
+    color: #666;
+    font-weight: bold;
+}
+body > p:first-child {
+    margin-top: 0;
+}
+EOT;
+        $js = [
+            'dialog_url'            => 'popup.php',
+            'iframe_css'            => $css,
+            'base_url'              => $GLOBALS['core']->blog->host,
+            'switcher_visual_title' => __('visual'),
+            'switcher_source_title' => __('source'),
+            'legend_msg'            => __('You can use the following shortcuts to format your text.'),
+            'elements'              => [
+                    'blocks' => ['options' => [
+                        'none' => __('-- none --'),
+                        'nonebis' => __('-- block format --'),
+                        'p' => __('Paragraph'),
+                        'h1' => __('Level 1 header'),
+                        'h2' => __('Level 2 header'),
+                        'h3' => __('Level 3 header'),
+                        'h4' => __('Level 4 header'),
+                        'h5' => __('Level 5 header'),
+                        'h6' => __('Level 6 header'),
+                    ]],
+
+                    'strong' => ['title' => __('Strong emphasis')],
+                    'em' => ['title' => __('Emphasis')],
+                    'ins' => ['title' => __('Inserted')],
+                    'del' => ['title' => __('Deleted')],
+                    'quote' => ['title' => __('Inline quote')],
+                    'code' => ['title' => __('Code')],
+                    'mark' => ['title' => __('Mark')],
+                    'br' => ['title' => __('Line break')],
+                    'blockquote' => ['title' => __('Blockquote')],
+                    'pre' => ['title' => __('Preformated text')],
+                    'ul' => ['title' => __('Unordered list')],
+                    'ol' => ['title' => __('Ordered list')],
+
+                    'link' => [
+                        'title' => __('Link'),
+                        'accesskey' => __('l'),
+                        'href_prompt' => __('URL?'),
+                        'hreflang_prompt' => __('Language?')
+                    ],
+
+                    'img' => [
+                        'title' => __('External image'),
+                        'src_prompt' => __('URL?')
+                    ],
+
+                    'img_select' => [
+                        'title' => __('Media chooser'),
+                        'accesskey' => __('m')
+                    ],
+
+                    'post_link' => ['title' => __('Link to an entry')],
+                    'removeFormat' => ['title' => __('Remove text formating')]
+            ],
+            'toolbar_bottom' => (boolean) isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('toolbar_bottom')
+        ];
+        if (!$GLOBALS['core']->auth->check('media,media_admin', $GLOBALS['core']->blog->id)) {
+            $js['elements']['img_select']['disabled'] = true;
+        }
+
         $res =
+        dcPage::jsJson('legacy_editor', $js) .
         dcPage::cssLoad(dcPage::getPF('dcLegacyEditor/css/jsToolBar/jsToolBar.css')) .
         dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.js'));
@@ -69,73 +149,5 @@
         $res .=
         dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.dotclear.js')) .
-        '<script type="text/javascript">' . "\n" .
-        "jsToolBar.prototype.dialog_url = 'popup.php'; " . "\n" .
-        "jsToolBar.prototype.iframe_css = '" .
-        'body {' .
-        '   color: #000;' .
-        '   background: #f9f9f9;' .
-        '   margin: 0;' .
-        '   padding: 2px;' .
-        '   border: none;' .
-        (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? ' direction: rtl;' : '') .
-        '}' .
-        'code {' .
-        '   color: #666;' .
-        '   font-weight: bold;' .
-        '}' .
-        'body > p:first-child {' .
-        '   margin-top: 0;' .
-        '}' .
-        "'; " . "\n" .
-        "jsToolBar.prototype.base_url = '" . html::escapeJS($GLOBALS['core']->blog->host) . "'; " . "\n" .
-        "jsToolBar.prototype.switcher_visual_title = '" . html::escapeJS(__('visual')) . "'; " . "\n" .
-        "jsToolBar.prototype.switcher_source_title = '" . html::escapeJS(__('source')) . "'; " . "\n" .
-        "jsToolBar.prototype.legend_msg = '" .
-        html::escapeJS(__('You can use the following shortcuts to format your text.')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.none = '" . html::escapeJS(__('-- none --')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.nonebis = '" . html::escapeJS(__('-- block format --')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.p = '" . html::escapeJS(__('Paragraph')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.h1 = '" . html::escapeJS(__('Level 1 header')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.h2 = '" . html::escapeJS(__('Level 2 header')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.h3 = '" . html::escapeJS(__('Level 3 header')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.h4 = '" . html::escapeJS(__('Level 4 header')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.h5 = '" . html::escapeJS(__('Level 5 header')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blocks.options.h6 = '" . html::escapeJS(__('Level 6 header')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.strong.title = '" . html::escapeJS(__('Strong emphasis')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.em.title = '" . html::escapeJS(__('Emphasis')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.ins.title = '" . html::escapeJS(__('Inserted')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.del.title = '" . html::escapeJS(__('Deleted')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.quote.title = '" . html::escapeJS(__('Inline quote')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.code.title = '" . html::escapeJS(__('Code')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.mark.title = '" . html::escapeJS(__('Mark')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.br.title = '" . html::escapeJS(__('Line break')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.blockquote.title = '" . html::escapeJS(__('Blockquote')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.pre.title = '" . html::escapeJS(__('Preformated text')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.ul.title = '" . html::escapeJS(__('Unordered list')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.ol.title = '" . html::escapeJS(__('Ordered list')) . "'; " . "\n" .
-
-        "jsToolBar.prototype.elements.link.title = '" . html::escapeJS(__('Link')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.link.accesskey = '" . html::escapeJS(__('l')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.link.href_prompt = '" . html::escapeJS(__('URL?')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.link.hreflang_prompt = '" . html::escapeJS(__('Language?')) . "'; " . "\n" .
-
-        "jsToolBar.prototype.elements.img.title = '" . html::escapeJS(__('External image')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.img.src_prompt = '" . html::escapeJS(__('URL?')) . "'; " . "\n" .
-
-        "jsToolBar.prototype.elements.img_select.title = '" . html::escapeJS(__('Media chooser')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.img_select.accesskey = '" . html::escapeJS(__('m')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.post_link.title = '" . html::escapeJS(__('Link to an entry')) . "'; " . "\n" .
-        "jsToolBar.prototype.elements.removeFormat = jsToolBar.prototype.elements.removeFormat || {}; " . "\n" .
-        "jsToolBar.prototype.elements.removeFormat.title = '" . html::escapeJS(__('Remove text formating')) . "'; " . "\n";
-
-        if (!$GLOBALS['core']->auth->check('media,media_admin', $GLOBALS['core']->blog->id)) {
-            $res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n";
-        }
-
-        $res .= "jsToolBar.prototype.toolbar_bottom = " .
-            (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('toolbar_bottom') ? 'true' : 'false') . ";\n";
-
-        $res .=
-            "</script>\n";
+        dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.config.js'));
 
         return $res;
Index: plugins/dcLegacyEditor/js/_post_editor.js
===================================================================
--- plugins/dcLegacyEditor/js/_post_editor.js	(revision 3880)
+++ plugins/dcLegacyEditor/js/_post_editor.js	(revision 3945)
@@ -1,4 +1,7 @@
-/*global $, dotclear, jsToolBar */
+/*global $, dotclear, jsToolBar, getData */
 'use strict';
+
+// Get context
+Object.assign(dotclear, getData('legacy_editor_ctx'));
 
 $(function() {
@@ -6,4 +9,5 @@
     return;
   }
+
   if (dotclear.legacy_editor_context === undefined ||
     dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context] === undefined) {
Index: plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.config.js
===================================================================
--- plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.config.js	(revision 3945)
+++ plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.config.js	(revision 3945)
@@ -0,0 +1,5 @@
+/*global jsToolBar, getData, mergeDeep */
+'use strict';
+
+jsToolBar.prototype.elements.removeFormat = jsToolBar.prototype.elements.removeFormat || {};
+mergeDeep(jsToolBar.prototype, getData('legacy_editor'));
Index: plugins/importExport/inc/class.dc.ieModule.php
===================================================================
--- plugins/importExport/inc/class.dc.ieModule.php	(revision 3874)
+++ plugins/importExport/inc/class.dc.ieModule.php	(revision 3944)
@@ -10,5 +10,7 @@
  */
 
-if (!defined('DC_RC_PATH')) {return;}
+if (!defined('DC_RC_PATH')) {
+    return;
+}
 
 abstract class dcIeModule
@@ -74,6 +76,6 @@
         '<h3>' . __('Congratulation!') . '</h3>' .
         '<p class="success">' . __('Your blog has been successfully imported. Welcome on Dotclear 2!') . '</p>' .
-        '<ul><li><strong><a href="' . $this->core->decode('admin.post') . '">' . __('Why don\'t you blog this now?') . '</a></strong></li>' .
-        '<li>' . __('or') . ' <a href="' . $this->core->decode('admin.home') . '">' . __('visit your dashboard') . '</a></li></ul>';
+        '<ul><li><strong><a href="' . $this->core->adminurl->decode('admin.post') . '">' . __('Why don\'t you blog this now?') . '</a></strong></li>' .
+        '<li>' . __('or') . ' <a href="' . $this->core->adminurl->decode('admin.home') . '">' . __('visit your dashboard') . '</a></li></ul>';
     }
 }
Index: plugins/widgets/_widgets_functions.php
===================================================================
--- plugins/widgets/_widgets_functions.php	(revision 3874)
+++ plugins/widgets/_widgets_functions.php	(revision 3948)
@@ -36,10 +36,8 @@
             ($w->title ? $w->renderTitle('<label for="q">' . html::escapeHTML($w->title) . '</label>') : '') .
             '<form action="' . $core->blog->url . '" method="get" role="search">' .
-            '<fieldset>' .
             '<p><input type="text" size="10" maxlength="255" id="q" name="q" value="' . $value . '" ' .
             ($w->placeholder ? 'placeholder="' . html::escapeHTML($w->placeholder) . '"' : '') .
             ' aria-label="' . __('Search') . '"/> ' .
-            '<input type="submit" class="submit" value="ok" /></p>' .
-            '</fieldset>' .
+            '<input type="submit" class="submit" value="ok" title="' . __('Search') . '" /></p>' .
             '</form>');
     }
