Index: inc/admin/lib.dc.page.php
===================================================================
--- inc/admin/lib.dc.page.php	(revision 3685)
+++ inc/admin/lib.dc.page.php	(revision 3709)
@@ -10,1129 +10,1131 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_RC_PATH')) { return; }
-
-define('DC_AUTH_PAGE','auth.php');
+if (!defined('DC_RC_PATH')) {return;}
+
+define('DC_AUTH_PAGE', 'auth.php');
 
 class dcPage
 {
-	private static $loaded_js = array();
-	private static $loaded_css = array();
-	private static $xframe_loaded = false;
-	private static $N_TYPES = array(
-		"success" => "success",
-		"warning" => "warning-msg",
-		"error" => "error",
-		"message" => "message",
-		"static" => "static-msg");
-
-	# Auth check
-	public static function check($permissions)
-	{
-		global $core;
-
-		if ($core->blog && $core->auth->check($permissions,$core->blog->id)) {
-			return;
-		}
-
-		if (session_id()) {
-			$core->session->destroy();
-		}
-		http::redirect(DC_AUTH_PAGE);
-	}
-
-	# Check super admin
-	public static function checkSuper()
-	{
-		global $core;
-
-		if (!$core->auth->isSuperAdmin())
-		{
-			if (session_id()) {
-				$core->session->destroy();
-			}
-			http::redirect(DC_AUTH_PAGE);
-		}
-	}
-
-	# Top of admin page
-	public static function open($title='',$head='',$breadcrumb='',$options=array())
-	{
-		global $core;
-
-		# List of user's blogs
-		if ($core->auth->getBlogCount() == 1 || $core->auth->getBlogCount() > 20)
-		{
-			$blog_box =
-			'<p>'.__('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'.
-			html::escapeHTML($core->blog->name).'</strong>';
-
-			if ($core->auth->getBlogCount() > 20) {
-				$blog_box .= ' - <a href="'.$core->adminurl->get("admin.blogs").'">'.__('Change blog').'</a>';
-			}
-			$blog_box .= '</p>';
-		}
-		else
-		{
-			$rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20));
-			$blogs = array();
-			while ($rs_blogs->fetch()) {
-				$blogs[html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id;
-			}
-			$blog_box =
-			'<p><label for="switchblog" class="classic">'.
-			__('Blogs:').'</label> '.
-			$core->formNonce().
-			form::combo('switchblog',$blogs,$core->blog->id).
-			'<input type="submit" value="'.__('ok').'" class="hidden-if-js" /></p>';
-		}
-
-		$safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode'];
-
-		# Display
-		$headers = new ArrayObject(array());
-
-		# Content-Type
-		$headers['content-type'] = 'Content-Type: text/html; charset=UTF-8';
-
-		# Referrer Policy for admin pages
-		$headers['referrer'] = 'Referrer-Policy: strict-origin';
-
-		# Prevents Clickjacking as far as possible
-		if (isset($options['x-frame-allow'])) {
-			self::setXFrameOptions($headers,$options['x-frame-allow']);
-		} else {
-			self::setXFrameOptions($headers);
-		}
-
-		# Content-Security-Policy (only if safe mode if not active, it may help)
-		if (!$safe_mode && $core->blog->settings->system->csp_admin_on) {
-			// Get directives from settings if exist, else set defaults
-			$csp = new ArrayObject(array());
-
-			// SQlite Clearbricks driver does not allow using single quote at beginning or end of a field value
-			// so we have to use neutral values (localhost and 127.0.0.1) for some CSP directives
-			$csp_prefix = $core->con->driver() == 'sqlite' ? 'localhost ' : '';	// Hack for SQlite Clearbricks driver
-			$csp_suffix = $core->con->driver() == 'sqlite' ? ' 127.0.0.1' : '';	// Hack for SQlite Clearbricks driver
-
-			$csp['default-src'] = $core->blog->settings->system->csp_admin_default ?:
-				$csp_prefix."'self'".$csp_suffix;
-			$csp['script-src'] = $core->blog->settings->system->csp_admin_script ?:
-				$csp_prefix."'self' 'unsafe-inline' 'unsafe-eval'".$csp_suffix;
-			$csp['style-src'] = $core->blog->settings->system->csp_admin_style ?:
-				$csp_prefix."'self' 'unsafe-inline'".$csp_suffix;
-			$csp['img-src'] = $core->blog->settings->system->csp_admin_img ?:
-				$csp_prefix."'self' data: http://media.dotaddict.org blob:";
-
-			# Cope with blog post preview (via public URL in iframe)
-			if (!is_null($core->blog->host)) {
-				$csp['default-src'] .= ' '.parse_url($core->blog->host,PHP_URL_HOST);
-				$csp['script-src'] .= ' '.parse_url($core->blog->host,PHP_URL_HOST);
-				$csp['style-src'] .= ' '.parse_url($core->blog->host,PHP_URL_HOST);
-			}
-			# Cope with media display in media manager (via public URL)
-			if (!is_null($core->media)) {
-				$csp['img-src'] .= ' '.parse_url($core->media->root_url,PHP_URL_HOST);
-			}
-			# Allow everything in iframe (used by editors to preview public content)
-			$csp['child-src'] = "*";
-
-			# --BEHAVIOR-- adminPageHTTPHeaderCSP
-			$core->callBehavior('adminPageHTTPHeaderCSP',$csp);
-
-			// Construct CSP header
-			$directives = array();
-			foreach ($csp as $key => $value) {
-				if ($value) {
-					$directives[] = $key.' '.$value;
-				}
-			}
-			if (count($directives)) {
-				if (version_compare(phpversion(),'5.4','>=')) {
-					// csp_report.php needs PHP ≥ 5.4
-					$directives[] = "report-uri ".DC_ADMIN_URL."csp_report.php";
-				}
-				$report_only = ($core->blog->settings->system->csp_admin_report_only) ? '-Report-Only' : '';
-				$headers['csp'] = "Content-Security-Policy".$report_only.": ".implode(" ; ",$directives);
-			}
-		}
-
-		# --BEHAVIOR-- adminPageHTTPHeaders
-		$core->callBehavior('adminPageHTTPHeaders',$headers);
-		foreach ($headers as $key => $value) {
-			header($value);
-		}
-
-		echo
-		'<!DOCTYPE html>'.
-		'<html lang="'.$core->auth->getInfo('user_lang').'">'."\n".
-		"<head>\n".
-		'  <meta charset="UTF-8" />'."\n".
-		'  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n".
-		'  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n".
-		'  <meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n".
-		'  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n".
-
-
-		self::cssLoad('style/default.css');
-		if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
-			echo self::cssLoad('style/default-rtl.css');
-		}
-
-		$core->auth->user_prefs->addWorkspace('interface');
-		if (!$core->auth->user_prefs->interface->hide_std_favicon) {
-			echo
-			'<link rel="icon" type="image/png" href="images/favicon96-login.png" />'."\n".
-			'<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />'."\n";
-		}
-
-		if ($core->auth->user_prefs->interface->htmlfontsize) {
-			echo
-			'<script type="text/javascript">'."\n".
-			self::jsVar('dotclear_htmlFontSize',$core->auth->user_prefs->interface->htmlfontsize)."\n".
-			"</script>\n";
-		}
-
-		echo
-		self::jsCommon().
-		self::jsToggles().
-		$head;
-
-		if ($core->auth->user_prefs->interface->hidemoreinfo) {
-			echo
-			'<script type="text/javascript">'."\n".
-			'dotclear.hideMoreInfo = true;'."\n".
-			"</script>\n";
-		}
-		if ($core->auth->user_prefs->interface->showajaxloader) {
-			echo
-			'<script type="text/javascript">'."\n".
-			'dotclear.showAjaxLoader = true;'."\n".
-			"</script>\n";
-		}
-
-		# --BEHAVIOR-- adminPageHTMLHead
-		$core->callBehavior('adminPageHTMLHead');
-
-		echo
-		"</head>\n".
-		'<body id="dotclear-admin'.
-		($safe_mode ? ' safe-mode' : '').'" class="no-js'.
-		($core->auth->user_prefs->interface->dynfontsize ? ' responsive-font' : '').'">'."\n".
-
-		'<ul id="prelude">'.
-		'<li><a href="#content">'.__('Go to the content').'</a></li>'.
-		'<li><a href="#main-menu">'.__('Go to the menu').'</a></li>'.
-		'<li><a href="#qx">'.__('Go to search').'</a></li>'.
-		'<li><a href="#help">'.__('Go to help').'</a></li>'.
-		'</ul>'."\n".
-		'<div id="header" role="banner">'.
-		'<h1><a href="'.$core->adminurl->get("admin.home").'"><span class="hidden">'.DC_VENDOR_NAME.'</span></a></h1>'."\n";
-
-		echo
-		'<form action="'.$core->adminurl->get("admin.home").'" method="post" id="top-info-blog">'.
-		$blog_box.
-		'<p><a href="'.$core->blog->url.'" class="outgoing" title="'.__('Go to site').
-		'">'.__('Go to site').'<img src="images/outgoing.png" alt="" /></a>'.
-		'</p></form>'.
-		'<ul id="top-info-user">'.
-		'<li><a class="'.(preg_match('/'.preg_quote($core->adminurl->get('admin.home')).'$/',$_SERVER['REQUEST_URI']) ? ' active' : '').'" href="'.$core->adminurl->get("admin.home").'">'.__('My dashboard').'</a></li>'.
-		'<li><a class="smallscreen'.(preg_match('/'.preg_quote($core->adminurl->get('admin.user.preferences')).'(\?.*)?$/',$_SERVER['REQUEST_URI']) ? ' active' : '').
-		'" href="'.$core->adminurl->get("admin.user.preferences").'">'.__('My preferences').'</a></li>'.
-		'<li><a href="'.$core->adminurl->get("admin.home",array('logout' => 1)).'" class="logout"><span class="nomobile">'.sprintf(__('Logout %s'),$core->auth->userID()).
-		'</span><img src="images/logout.png" alt="" /></a></li>'.
-		'</ul>'.
-		'</div>'; // end header
-
-		echo
-		'<div id="wrapper" class="clearfix">'."\n".
-		'<div class="hidden-if-no-js collapser-box"><button type="button" id="collapser" class="void-btn">'.
-		'<img class="collapse-mm visually-hidden" src="images/collapser-hide.png" alt="'.__('Hide main menu').'" />'.
-		'<img class="expand-mm visually-hidden" src="images/collapser-show.png" alt="'.__('Show main menu').'" />'.
-		'</button></div>'.
-		'<div id="main" role="main">'."\n".
-		'<div id="content" class="clearfix">'."\n";
-
-		# Safe mode
-		if ($safe_mode)
-		{
-			echo
-			'<div class="warning" role="alert"><h3>'.__('Safe mode').'</h3>'.
-			'<p>'.__('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities').'</p>'.
-			'</div>';
-		}
-
-		// Display breadcrumb (if given) before any error messages
-		echo $breadcrumb;
-
-		// Display notices and errors
-		echo self::notices();
-	}
-
-	public static function notices()
-	{
-		global $core;
-		static $error_displayed = false;
-
-		$res = '';
-
-		// return error messages if any
-		if ($core->error->flag() && !$error_displayed) {
-
-			# --BEHAVIOR-- adminPageNotificationError
-			$notice_error = $core->callBehavior('adminPageNotificationError',$core,$core->error);
-
-			if (isset($notice_error) && !empty($notice_error)) {
-				$res .= $notice_error;
-			} else {
-				$res .= '<div class="error"><p>'.
-					'<strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</strong>'.
-					'</p>'.$core->error->toHTML().'</div>';
-			}
-			$error_displayed = true;
-		}
-
-		// return notices if any
-		if (isset($_SESSION['notifications'])) {
-			foreach ($_SESSION['notifications'] as $notification) {
-
-				# --BEHAVIOR-- adminPageNotification
-				$notice = $core->callBehavior('adminPageNotification',$core,$notification);
-
-				$res .= (isset($notice) && !empty($notice) ? $notice : self::getNotification($notification));
-			}
-			unset($_SESSION['notifications']);
-		}
-		return $res;
-	}
-
-	public static function addNotice($type,$message,$options=array())
-	{
-		if (isset(self::$N_TYPES[$type])){
-			$class = self::$N_TYPES[$type];
-		} else {
-			$class=$type;
-		}
-		if (isset($_SESSION['notifications']) && is_array($_SESSION['notifications'])) {
-			$notifications = $_SESSION['notifications'];
-		} else {
-			$notifications = array();
-		}
-
-		$n = array_merge($options,array('class' => $class,'ts' => time(), 'text' => $message));
-		if ($type != "static") {
-			$notifications[] = $n;
-		} else {
-			array_unshift($notifications, $n);
-		}
-		$_SESSION['notifications'] = $notifications;
-	}
-
-	public static function addSuccessNotice($message,$options=array())
-	{
-		self::addNotice("success",$message,$options);
-	}
-
-	public static function addWarningNotice($message,$options=array())
-	{
-		self::addNotice("warning",$message,$options);
-	}
-
-	public static function addErrorNotice($message,$options=array())
-	{
-		self::addNotice("error",$message,$options);
-	}
-
-	protected static function getNotification($n)
-	{
-		global $core;
-		$tag = (isset($n['divtag']) && $n['divtag']) ? 'div' : 'p';
-		$ts = '';
-		if (!isset($n['with_ts']) || ($n['with_ts'] == true)) {
-			$ts = dt::str(__('[%H:%M:%S]'),$n['ts'],$core->auth->getInfo('user_tz')).' ';
-		}
-		$res = '<'.$tag.' class="'.$n['class'].'" role="alert">'.$ts.$n['text'].'</'.$tag.'>';
-		return $res;
-	}
-
-	public static function close()
-	{
-		global $core;
-
-		if (!$GLOBALS['__resources']['ctxhelp']) {
-			if (!$core->auth->user_prefs->interface->hidehelpbutton) {
-				echo
-				'<p id="help-button"><a href="'.$core->adminurl->get("admin.help").'" class="outgoing" title="'.
-				__('Global help').'">'.__('Global help').'</a></p>';
-			}
-		}
-
-		$menu =& $GLOBALS['_menu'];
-
-		echo
-		"</div>\n".		// End of #content
-		"</div>\n".		// End of #main
-
-		'<div id="main-menu" role="navigation">'."\n".
-
-		'<form id="search-menu" action="'.$core->adminurl->get("admin.search").'" method="get" role="search">'.
-		'<p><label for="qx" class="hidden">'.__('Search:').' </label>'.form::field('qx',30,255,'').
-		'<input type="submit" value="'.__('OK').'" /></p>'.
-		'</form>';
-
-		foreach ($menu as $k => $v) {
-			echo $menu[$k]->draw();
-		}
-
-		$text = sprintf(__('Thank you for using %s.'),'Dotclear '.DC_VERSION);
-
-		# --BEHAVIOR-- adminPageFooter
-		$textAlt = $core->callBehavior('adminPageFooter',$core,$text);
-		if ($textAlt != '') {
-			$text = $textAlt;
-		}
-		$text = html::escapeHTML($text);
-
-		echo
-		'</div>'."\n".		// End of #main-menu
-		"</div>\n";		// End of #wrapper
-
-		echo '<p id="gototop"><a href="#wrapper">'.__('Page top').'</a></p>'."\n";
-
-		$figure = "
+    private static $loaded_js     = array();
+    private static $loaded_css    = array();
+    private static $xframe_loaded = false;
+    private static $N_TYPES       = array(
+        "success" => "success",
+        "warning" => "warning-msg",
+        "error"   => "error",
+        "message" => "message",
+        "static"  => "static-msg");
+
+    # Auth check
+    public static function check($permissions)
+    {
+        global $core;
+
+        if ($core->blog && $core->auth->check($permissions, $core->blog->id)) {
+            return;
+        }
+
+        if (session_id()) {
+            $core->session->destroy();
+        }
+        http::redirect(DC_AUTH_PAGE);
+    }
+
+    # Check super admin
+    public static function checkSuper()
+    {
+        global $core;
+
+        if (!$core->auth->isSuperAdmin()) {
+            if (session_id()) {
+                $core->session->destroy();
+            }
+            http::redirect(DC_AUTH_PAGE);
+        }
+    }
+
+    # Top of admin page
+    public static function open($title = '', $head = '', $breadcrumb = '', $options = array())
+    {
+        global $core;
+
+        # List of user's blogs
+        if ($core->auth->getBlogCount() == 1 || $core->auth->getBlogCount() > 20) {
+            $blog_box =
+            '<p>' . __('Blog:') . ' <strong title="' . html::escapeHTML($core->blog->url) . '">' .
+            html::escapeHTML($core->blog->name) . '</strong>';
+
+            if ($core->auth->getBlogCount() > 20) {
+                $blog_box .= ' - <a href="' . $core->adminurl->get("admin.blogs") . '">' . __('Change blog') . '</a>';
+            }
+            $blog_box .= '</p>';
+        } else {
+            $rs_blogs = $core->getBlogs(array('order' => 'LOWER(blog_name)', 'limit' => 20));
+            $blogs    = array();
+            while ($rs_blogs->fetch()) {
+                $blogs[html::escapeHTML($rs_blogs->blog_name . ' - ' . $rs_blogs->blog_url)] = $rs_blogs->blog_id;
+            }
+            $blog_box =
+            '<p><label for="switchblog" class="classic">' .
+            __('Blogs:') . '</label> ' .
+            $core->formNonce() .
+            form::combo('switchblog', $blogs, $core->blog->id) .
+            '<input type="submit" value="' . __('ok') . '" class="hidden-if-js" /></p>';
+        }
+
+        $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode'];
+
+        # Display
+        $headers = new ArrayObject(array());
+
+        # Content-Type
+        $headers['content-type'] = 'Content-Type: text/html; charset=UTF-8';
+
+        # Referrer Policy for admin pages
+        $headers['referrer'] = 'Referrer-Policy: strict-origin';
+
+        # Prevents Clickjacking as far as possible
+        if (isset($options['x-frame-allow'])) {
+            self::setXFrameOptions($headers, $options['x-frame-allow']);
+        } else {
+            self::setXFrameOptions($headers);
+        }
+
+        # Content-Security-Policy (only if safe mode if not active, it may help)
+        if (!$safe_mode && $core->blog->settings->system->csp_admin_on) {
+            // Get directives from settings if exist, else set defaults
+            $csp = new ArrayObject(array());
+
+                                                                                // SQlite Clearbricks driver does not allow using single quote at beginning or end of a field value
+                                                                                // so we have to use neutral values (localhost and 127.0.0.1) for some CSP directives
+            $csp_prefix = $core->con->driver() == 'sqlite' ? 'localhost ' : ''; // Hack for SQlite Clearbricks driver
+            $csp_suffix = $core->con->driver() == 'sqlite' ? ' 127.0.0.1' : ''; // Hack for SQlite Clearbricks driver
+
+            $csp['default-src'] = $core->blog->settings->system->csp_admin_default ?:
+            $csp_prefix . "'self'" . $csp_suffix;
+            $csp['script-src'] = $core->blog->settings->system->csp_admin_script ?:
+            $csp_prefix . "'self' 'unsafe-inline' 'unsafe-eval'" . $csp_suffix;
+            $csp['style-src'] = $core->blog->settings->system->csp_admin_style ?:
+            $csp_prefix . "'self' 'unsafe-inline'" . $csp_suffix;
+            $csp['img-src'] = $core->blog->settings->system->csp_admin_img ?:
+            $csp_prefix . "'self' data: http://media.dotaddict.org blob:";
+
+            # Cope with blog post preview (via public URL in iframe)
+            if (!is_null($core->blog->host)) {
+                $csp['default-src'] .= ' ' . parse_url($core->blog->host, PHP_URL_HOST);
+                $csp['script-src'] .= ' ' . parse_url($core->blog->host, PHP_URL_HOST);
+                $csp['style-src'] .= ' ' . parse_url($core->blog->host, PHP_URL_HOST);
+            }
+            # Cope with media display in media manager (via public URL)
+            if (!is_null($core->media)) {
+                $csp['img-src'] .= ' ' . parse_url($core->media->root_url, PHP_URL_HOST);
+            }
+            # Allow everything in iframe (used by editors to preview public content)
+            $csp['child-src'] = "*";
+
+            # --BEHAVIOR-- adminPageHTTPHeaderCSP
+            $core->callBehavior('adminPageHTTPHeaderCSP', $csp);
+
+            // Construct CSP header
+            $directives = array();
+            foreach ($csp as $key => $value) {
+                if ($value) {
+                    $directives[] = $key . ' ' . $value;
+                }
+            }
+            if (count($directives)) {
+                if (version_compare(phpversion(), '5.4', '>=')) {
+                    // csp_report.php needs PHP ≥ 5.4
+                    $directives[] = "report-uri " . DC_ADMIN_URL . "csp_report.php";
+                }
+                $report_only    = ($core->blog->settings->system->csp_admin_report_only) ? '-Report-Only' : '';
+                $headers['csp'] = "Content-Security-Policy" . $report_only . ": " . implode(" ; ", $directives);
+            }
+        }
+
+        # --BEHAVIOR-- adminPageHTTPHeaders
+        $core->callBehavior('adminPageHTTPHeaders', $headers);
+        foreach ($headers as $key => $value) {
+            header($value);
+        }
+
+        echo
+        '<!DOCTYPE html>' .
+        '<html lang="' . $core->auth->getInfo('user_lang') . '">' . "\n" .
+        "<head>\n" .
+        '  <meta charset="UTF-8" />' . "\n" .
+        '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />' . "\n" .
+        '  <meta name="GOOGLEBOT" content="NOSNIPPET" />' . "\n" .
+        '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />' . "\n" .
+        '  <title>' . $title . ' - ' . html::escapeHTML($core->blog->name) . ' - ' . html::escapeHTML(DC_VENDOR_NAME) . ' - ' . DC_VERSION . '</title>' . "\n" .
+
+        self::cssLoad('style/default.css');
+        if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
+            echo self::cssLoad('style/default-rtl.css');
+        }
+
+        $core->auth->user_prefs->addWorkspace('interface');
+        if (!$core->auth->user_prefs->interface->hide_std_favicon) {
+            echo
+                '<link rel="icon" type="image/png" href="images/favicon96-login.png" />' . "\n" .
+                '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />' . "\n";
+        }
+
+        if ($core->auth->user_prefs->interface->htmlfontsize) {
+            echo
+            '<script type="text/javascript">' . "\n" .
+            self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" .
+                "</script>\n";
+        }
+
+        echo
+        self::jsCommon() .
+        self::jsToggles() .
+            $head;
+
+        if ($core->auth->user_prefs->interface->hidemoreinfo) {
+            echo
+                '<script type="text/javascript">' . "\n" .
+                'dotclear.hideMoreInfo = true;' . "\n" .
+                "</script>\n";
+        }
+        if ($core->auth->user_prefs->interface->showajaxloader) {
+            echo
+                '<script type="text/javascript">' . "\n" .
+                'dotclear.showAjaxLoader = true;' . "\n" .
+                "</script>\n";
+        }
+
+        # --BEHAVIOR-- adminPageHTMLHead
+        $core->callBehavior('adminPageHTMLHead');
+
+        echo
+        "</head>\n" .
+        '<body id="dotclear-admin' .
+        ($safe_mode ? ' safe-mode' : '') . '" class="no-js' .
+        ($core->auth->user_prefs->interface->dynfontsize ? ' responsive-font' : '') . '">' . "\n" .
+
+        '<ul id="prelude">' .
+        '<li><a href="#content">' . __('Go to the content') . '</a></li>' .
+        '<li><a href="#main-menu">' . __('Go to the menu') . '</a></li>' .
+        '<li><a href="#qx">' . __('Go to search') . '</a></li>' .
+        '<li><a href="#help">' . __('Go to help') . '</a></li>' .
+        '</ul>' . "\n" .
+        '<div id="header" role="banner">' .
+        '<h1><a href="' . $core->adminurl->get("admin.home") . '"><span class="hidden">' . DC_VENDOR_NAME . '</span></a></h1>' . "\n";
+
+        echo
+        '<form action="' . $core->adminurl->get("admin.home") . '" method="post" id="top-info-blog">' .
+        $blog_box .
+        '<p><a href="' . $core->blog->url . '" class="outgoing" title="' . __('Go to site') .
+        '">' . __('Go to site') . '<img src="images/outgoing.png" alt="" /></a>' .
+        '</p></form>' .
+        '<ul id="top-info-user">' .
+        '<li><a class="' . (preg_match('/' . preg_quote($core->adminurl->get('admin.home')) . '$/', $_SERVER['REQUEST_URI']) ? ' active' : '') . '" href="' . $core->adminurl->get("admin.home") . '">' . __('My dashboard') . '</a></li>' .
+        '<li><a class="smallscreen' . (preg_match('/' . preg_quote($core->adminurl->get('admin.user.preferences')) . '(\?.*)?$/', $_SERVER['REQUEST_URI']) ? ' active' : '') .
+        '" href="' . $core->adminurl->get("admin.user.preferences") . '">' . __('My preferences') . '</a></li>' .
+        '<li><a href="' . $core->adminurl->get("admin.home", array('logout' => 1)) . '" class="logout"><span class="nomobile">' . sprintf(__('Logout %s'), $core->auth->userID()) .
+            '</span><img src="images/logout.png" alt="" /></a></li>' .
+            '</ul>' .
+            '</div>'; // end header
+
+        echo
+        '<div id="wrapper" class="clearfix">' . "\n" .
+        '<div class="hidden-if-no-js collapser-box"><button type="button" id="collapser" class="void-btn">' .
+        '<img class="collapse-mm visually-hidden" src="images/collapser-hide.png" alt="' . __('Hide main menu') . '" />' .
+        '<img class="expand-mm visually-hidden" src="images/collapser-show.png" alt="' . __('Show main menu') . '" />' .
+            '</button></div>' .
+            '<div id="main" role="main">' . "\n" .
+            '<div id="content" class="clearfix">' . "\n";
+
+        # Safe mode
+        if ($safe_mode) {
+            echo
+            '<div class="warning" role="alert"><h3>' . __('Safe mode') . '</h3>' .
+            '<p>' . __('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities') . '</p>' .
+                '</div>';
+        }
+
+        // Display breadcrumb (if given) before any error messages
+        echo $breadcrumb;
+
+        // Display notices and errors
+        echo self::notices();
+    }
+
+    public static function notices()
+    {
+        global $core;
+        static $error_displayed = false;
+
+        $res = '';
+
+        // return error messages if any
+        if ($core->error->flag() && !$error_displayed) {
+
+            # --BEHAVIOR-- adminPageNotificationError
+            $notice_error = $core->callBehavior('adminPageNotificationError', $core, $core->error);
+
+            if (isset($notice_error) && !empty($notice_error)) {
+                $res .= $notice_error;
+            } else {
+                $res .= '<div class="error"><p>' .
+                '<strong>' . (count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')) . '</strong>' .
+                '</p>' . $core->error->toHTML() . '</div>';
+            }
+            $error_displayed = true;
+        }
+
+        // return notices if any
+        if (isset($_SESSION['notifications'])) {
+            foreach ($_SESSION['notifications'] as $notification) {
+
+                # --BEHAVIOR-- adminPageNotification
+                $notice = $core->callBehavior('adminPageNotification', $core, $notification);
+
+                $res .= (isset($notice) && !empty($notice) ? $notice : self::getNotification($notification));
+            }
+            unset($_SESSION['notifications']);
+        }
+        return $res;
+    }
+
+    public static function addNotice($type, $message, $options = array())
+    {
+        if (isset(self::$N_TYPES[$type])) {
+            $class = self::$N_TYPES[$type];
+        } else {
+            $class = $type;
+        }
+        if (isset($_SESSION['notifications']) && is_array($_SESSION['notifications'])) {
+            $notifications = $_SESSION['notifications'];
+        } else {
+            $notifications = array();
+        }
+
+        $n = array_merge($options, array('class' => $class, 'ts' => time(), 'text' => $message));
+        if ($type != "static") {
+            $notifications[] = $n;
+        } else {
+            array_unshift($notifications, $n);
+        }
+        $_SESSION['notifications'] = $notifications;
+    }
+
+    public static function addSuccessNotice($message, $options = array())
+    {
+        self::addNotice("success", $message, $options);
+    }
+
+    public static function addWarningNotice($message, $options = array())
+    {
+        self::addNotice("warning", $message, $options);
+    }
+
+    public static function addErrorNotice($message, $options = array())
+    {
+        self::addNotice("error", $message, $options);
+    }
+
+    protected static function getNotification($n)
+    {
+        global $core;
+        $tag = (isset($n['divtag']) && $n['divtag']) ? 'div' : 'p';
+        $ts  = '';
+        if (!isset($n['with_ts']) || ($n['with_ts'] == true)) {
+            $ts = dt::str(__('[%H:%M:%S]'), $n['ts'], $core->auth->getInfo('user_tz')) . ' ';
+        }
+        $res = '<' . $tag . ' class="' . $n['class'] . '" role="alert">' . $ts . $n['text'] . '</' . $tag . '>';
+        return $res;
+    }
+
+    public static function close()
+    {
+        global $core;
+
+        if (!$GLOBALS['__resources']['ctxhelp']) {
+            if (!$core->auth->user_prefs->interface->hidehelpbutton) {
+                echo
+                '<p id="help-button"><a href="' . $core->adminurl->get("admin.help") . '" class="outgoing" title="' .
+                __('Global help') . '">' . __('Global help') . '</a></p>';
+            }
+        }
+
+        $menu = &$GLOBALS['_menu'];
+
+        echo
+        "</div>\n" . // End of #content
+        "</div>\n" . // End of #main
+
+        '<div id="main-menu" role="navigation">' . "\n" .
+
+        '<form id="search-menu" action="' . $core->adminurl->get("admin.search") . '" method="get" role="search">' .
+        '<p><label for="qx" class="hidden">' . __('Search:') . ' </label>' . form::field('qx', 30, 255, '') .
+        '<input type="submit" value="' . __('OK') . '" /></p>' .
+            '</form>';
+
+        foreach ($menu as $k => $v) {
+            echo $menu[$k]->draw();
+        }
+
+        $text = sprintf(__('Thank you for using %s.'), 'Dotclear ' . DC_VERSION);
+
+        # --BEHAVIOR-- adminPageFooter
+        $textAlt = $core->callBehavior('adminPageFooter', $core, $text);
+        if ($textAlt != '') {
+            $text = $textAlt;
+        }
+        $text = html::escapeHTML($text);
+
+        echo
+        '</div>' . "\n" . // End of #main-menu
+        "</div>\n";       // End of #wrapper
+
+        echo '<p id="gototop"><a href="#wrapper">' . __('Page top') . '</a></p>' . "\n";
+
+        $figure = "
    /\_/\
   (='.'=)
   (\")-(\")";
 
-		echo
-		'<div id="footer" role="contentinfo">'.
-		'<a href="http://dotclear.org/" title="'.$text.'">'.
-		'<img src="style/dc_logos/w-dotclear90.png" alt="'.$text.'" /></a></div>'."\n".
-		"<!-- "."\n".
-		$figure.
-		" -->"."\n";
-
-		if (defined('DC_DEV') && DC_DEV === true) {
-			echo self::debugInfo();
-		}
-
-		echo
-		'</body></html>';
-	}
-
-	public static function openPopup($title='',$head='',$breadcrumb='')
-	{
-		global $core;
-
-		# Display
-		header('Content-Type: text/html; charset=UTF-8');
-
-		# Referrer Policy for admin pages
-		header('Referrer-Policy: strict-origin');
-
-		# Prevents Clickjacking as far as possible
-		header('X-Frame-Options: SAMEORIGIN'); // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+
-
-		echo
-		'<!DOCTYPE html>'.
-		'<html lang="'.$core->auth->getInfo('user_lang').'">'."\n".
-		"<head>\n".
-		'  <meta charset="UTF-8" />'."\n".
-		'  <meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n".
-		'  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n".
-
-		'  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n".
-		'  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n".
-
-		self::cssLoad('style/default.css');
-		if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
-			echo self::cssLoad('style/default-rtl.css');
-		}
-
-		$core->auth->user_prefs->addWorkspace('interface');
-		if ($core->auth->user_prefs->interface->htmlfontsize) {
-			echo
-			'<script type="text/javascript">'."\n".
-			self::jsVar('dotclear_htmlFontSize',$core->auth->user_prefs->interface->htmlfontsize)."\n".
-			"</script>\n";
-		}
-
-		echo
-		self::jsCommon().
-		self::jsToggles().
-		$head;
-
-		if ($core->auth->user_prefs->interface->hidemoreinfo) {
-			echo
-			'<script type="text/javascript">'."\n".
-			'dotclear.hideMoreInfo = true;'."\n".
-			"</script>\n";
-		}
-		if ($core->auth->user_prefs->interface->showajaxloader) {
-			echo
-			'<script type="text/javascript">'."\n".
-			'dotclear.showAjaxLoader = true;'."\n".
-			"</script>\n";
-		}
-
-		# --BEHAVIOR-- adminPageHTMLHead
-		$core->callBehavior('adminPageHTMLHead');
-
-		echo
-		"</head>\n".
-		'<body id="dotclear-admin" class="popup'.
-		($core->auth->user_prefs->interface->dynfontsize ? ' responsive-font' : '').'">'."\n".
-
-		'<h1>'.DC_VENDOR_NAME.'</h1>'."\n";
-
-		echo
-		'<div id="wrapper">'."\n".
-		'<div id="main" role="main">'."\n".
-		'<div id="content">'."\n";
-
-		// display breadcrumb if given
-		echo $breadcrumb;
-
-		// Display notices and errors
-		echo self::notices();
-	}
-
-	public static function closePopup()
-	{
-		echo
-		"</div>\n".		// End of #content
-		"</div>\n".		// End of #main
-		"</div>\n".		// End of #wrapper
-
-		'<p id="gototop"><a href="#wrapper">'.__('Page top').'</a></p>'."\n".
-
-		'<div id="footer" role="contentinfo"><p>&nbsp;</p></div>'."\n".
-		'</body></html>';
-	}
-
-	public static function breadcrumb($elements=null,$options=array())
-	{
-		global $core;
-		$with_home_link = isset($options['home_link']) ? $options['home_link'] : true;
-		$hl = isset($options['hl']) ? $options['hl'] : true;
-		$hl_pos = isset($options['hl_pos']) ? $options['hl_pos'] : -1;
-		// First item of array elements should be blog's name, System or Plugins
-		$res = '<h2>'.($with_home_link ?
-			'<a class="go_home" href="'.$core->adminurl->get("admin.home").'"><img src="style/dashboard.png" alt="'.__('Go to dashboard').'" /></a>' :
-			'<img src="style/dashboard-alt.png" alt="" />');
-		$index = 0;
-		if ($hl_pos < 0) {
-			$hl_pos = count($elements)+$hl_pos;
-		}
-		foreach ($elements as $element => $url) {
-			if ($hl && $index == $hl_pos) {
-				$element = sprintf('<span class="page-title">%s</span>',$element);
-			}
-			$res .= ($with_home_link ? ($index == 1 ? ' : ' : ' &rsaquo; ') : ($index == 0 ? ' ' : ' &rsaquo; ')).
-				($url ? '<a href="'.$url.'">' : '').$element.($url ? '</a>' : '');
-			$index++;
-		}
-		$res .= '</h2>';
-		return $res;
-	}
-
-	public static function message($msg,$timestamp=true,$div=false,$echo=true,$class='message')
-	{
-		global $core;
-
-		$res = '';
-		if ($msg != '') {
-			$res = ($div ? '<div class="'.$class.'">' : '').'<p'.($div ? '' : ' class="'.$class.'"').'>'.
-			($timestamp ? dt::str(__('[%H:%M:%S]'),null,$core->auth->getInfo('user_tz')).' ' : '').$msg.
-			'</p>'.($div ? '</div>' : '');
-			if ($echo) {
-				echo $res;
-			}
-		}
-		return $res;
-	}
-
-	public static function success($msg,$timestamp=true,$div=false,$echo=true)
-	{
-		return self::message($msg,$timestamp,$div,$echo,"success");
-	}
-
-	public static function warning($msg,$timestamp=true,$div=false,$echo=true)
-	{
-		return self::message($msg,$timestamp,$div,$echo,"warning-msg");
-	}
-
-	private static function debugInfo()
-	{
-		$global_vars = implode(', ',array_keys($GLOBALS));
-
-		$res =
-		'<div id="debug"><div>'.
-		'<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>';
-
-		if (function_exists('xdebug_get_profiler_filename'))
-		{
-			$res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>';
-
-			$prof_file = xdebug_get_profiler_filename();
-			if ($prof_file) {
-				$res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>';
-			} else {
-				$prof_url = http::getSelfURI();
-				$prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&';
-				$prof_url .= 'XDEBUG_PROFILE';
-				$res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>';
-			}
-
-			/* xdebug configuration:
-			zend_extension = /.../xdebug.so
-			xdebug.auto_trace = On
-			xdebug.trace_format = 0
-			xdebug.trace_options = 1
-			xdebug.show_mem_delta = On
-			xdebug.profiler_enable = 0
-			xdebug.profiler_enable_trigger = 1
-			xdebug.profiler_output_dir = /tmp
-			xdebug.profiler_append = 0
-			xdebug.profiler_output_name = timestamp
-			*/
-		}
-
-		$res .=
-		'<p>Global vars: '.$global_vars.'</p>'.
-		'</div></div>';
-
-		return $res;
-	}
-
-	public static function help($page,$index='')
-	{
-		# Deprecated but we keep this for plugins.
-	}
-
-	public static function helpBlock()
-	{
-		global $core;
-
-		if ($core->auth->user_prefs->interface->hidehelpbutton) {
-			return;
-		}
-
-		$args = func_get_args();
-		$args = new ArrayObject($args);
-
-		# --BEHAVIOR-- adminPageHelpBlock
-		$GLOBALS['core']->callBehavior('adminPageHelpBlock',$args);
-
-		if (empty($args)) {
-			return;
-		};
-
-		global $__resources;
-		if (empty($__resources['help'])) {
-			return;
-		}
-
-		$content = '';
-		foreach ($args as $v)
-		{
-			if (is_object($v) && isset($v->content)) {
-				$content .= $v->content;
-				continue;
-			}
-
-			if (!isset($__resources['help'][$v])) {
-				continue;
-			}
-			$f = $__resources['help'][$v];
-			if (!file_exists($f) || !is_readable($f)) {
-				continue;
-			}
-
-			$fc = file_get_contents($f);
-			if (preg_match('|<body[^>]*?>(.*?)</body>|ms',$fc,$matches)) {
-				$content .= $matches[1];
-			} else {
-				$content .= $fc;
-			}
-		}
-
-		if (trim($content) == '') {
-			return;
-		}
-
-		// Set contextual help global flag
-		$GLOBALS['__resources']['ctxhelp'] = true;
-
-		echo
-		'<div id="help"><hr /><div class="help-content clear"><h3>'.__('Help about this page').'</h3>'.
-		$content.
-		'</div>'.
-		'<div id="helplink"><hr />'.
-		'<p>'.
-		sprintf(__('See also %s'),sprintf('<a href="'.$core->adminurl->get("admin.help").'">%s</a>',__('the global help'))).
-		'.</p>'.
-		'</div></div>';
-	}
-
-	public static function cssLoad($src,$media='screen',$v='')
-	{
-		$escaped_src = html::escapeHTML($src);
-		if (!isset(self::$loaded_css[$escaped_src])) {
-			self::$loaded_css[$escaped_src] = true;
-			$escaped_src = self::appendVersion($escaped_src,$v);
-
-			return '<link rel="stylesheet" href="'.$escaped_src.'" type="text/css" media="'.$media.'" />'."\n";
-		}
-	}
-
-	public static function jsLoad($src,$v='')
-	{
-		$escaped_src = html::escapeHTML($src);
-		if (!isset(self::$loaded_js[$escaped_src])) {
-			self::$loaded_js[$escaped_src] = true;
-			$escaped_src = self::appendVersion($escaped_src,$v);
-			return '<script type="text/javascript" src="'.$escaped_src.'"></script>'."\n";
-		}
-	}
-
-	private static function appendVersion($src,$v='')
-	{
-		$src .= (strpos($src,'?') === false ? '?' : '&amp;').'v=';
-		if (defined('DC_DEV') && DC_DEV === true) {
-			$src .= md5(uniqid());
-		} else {
-			$src .= ($v === '' ? DC_VERSION : $v);
-		}
-		return $src;
-	}
-
-	public static function jsVar($n,$v)
-	{
-		return $n." = '".html::escapeJS($v)."';\n";
-	}
-
-	public static function jsToggles()
-	{
-		if($GLOBALS['core']->auth->user_prefs->toggles) {
-			$unfolded_sections = explode(',',$GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections);
-			foreach ($unfolded_sections as $k=>&$v) {
-				if ($v == '') {
-					unset($unfolded_sections[$k]);
-				} else {
-					$v = "'".html::escapeJS($v)."':true";
-				}
-			}
-		} else {
-			$unfolded_sections=array();
-		}
-		return '<script type="text/javascript">'."\n".
-				'dotclear.unfolded_sections = {'.join(",",$unfolded_sections)."};\n".
-				"</script>\n";
-	}
-
-	public static function jsCommon()
-	{
-		$mute_or_no = '';
-		if (empty($GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) {
-			$mute_or_no .=
-				'<script type="text/javascript">'."\n".
-				'jQuery.migrateMute = true;'."\n".
-				"</script>\n";
-		}
-
-		return
-		self::jsLoad('js/jquery/jquery.js').
-		$mute_or_no.
-		self::jsLoad('js/jquery/jquery-migrate.js').
-		self::jsLoad('js/jquery/jquery.biscuit.js').
-		self::jsLoad('js/common.js').
-		self::jsLoad('js/prelude.js').
-
-		'<script type="text/javascript">'."\n".
-		'jsToolBar = {}, jsToolBar.prototype = { elements : {} };'."\n".
-
-		self::jsVar('dotclear.nonce',$GLOBALS['core']->getNonce()).
-
-		self::jsVar('dotclear.img_plus_src','images/expand.png').
-		self::jsVar('dotclear.img_plus_alt',__('uncover')).
-		self::jsVar('dotclear.img_minus_src','images/hide.png').
-		self::jsVar('dotclear.img_minus_alt',__('hide')).
-		self::jsVar('dotclear.img_menu_on','images/menu_on.png').
-		self::jsVar('dotclear.img_menu_off','images/menu_off.png').
-
-		self::jsVar('dotclear.img_plus_theme_src','images/plus-theme.png').
-		self::jsVar('dotclear.img_plus_theme_alt',__('uncover')).
-		self::jsVar('dotclear.img_minus_theme_src','images/minus-theme.png').
-		self::jsVar('dotclear.img_minus_theme_alt',__('hide')).
-
-		self::jsVar('dotclear.msg.help',
-			__('Need help?')).
-		self::jsVar('dotclear.msg.new_window',
-			__('new window')).
-		self::jsVar('dotclear.msg.help_hide',
-			__('Hide')).
-		self::jsVar('dotclear.msg.to_select',
-			__('Select:')).
-		self::jsVar('dotclear.msg.no_selection',
-			__('no selection')).
-		self::jsVar('dotclear.msg.select_all',
-			__('select all')).
-		self::jsVar('dotclear.msg.invert_sel',
-			__('Invert selection')).
-		self::jsVar('dotclear.msg.website',
-			__('Web site:')).
-		self::jsVar('dotclear.msg.email',
-			__('Email:')).
-		self::jsVar('dotclear.msg.ip_address',
-			__('IP address:')).
-		self::jsVar('dotclear.msg.error',
-			__('Error:')).
-		self::jsVar('dotclear.msg.entry_created',
-			__('Entry has been successfully created.')).
-		self::jsVar('dotclear.msg.edit_entry',
-			__('Edit entry')).
-		self::jsVar('dotclear.msg.view_entry',
-			__('view entry')).
-		self::jsVar('dotclear.msg.confirm_delete_posts',
-			__("Are you sure you want to delete selected entries (%s)?")).
-		self::jsVar('dotclear.msg.confirm_delete_medias',
-			__("Are you sure you want to delete selected medias (%d)?")).
-		self::jsVar('dotclear.msg.confirm_delete_categories',
-			__("Are you sure you want to delete selected categories (%s)?")).
-		self::jsVar('dotclear.msg.confirm_delete_post',
-			__("Are you sure you want to delete this entry?")).
-		self::jsVar('dotclear.msg.click_to_unlock',
-			__("Click here to unlock the field")).
-		self::jsVar('dotclear.msg.confirm_spam_delete',
-			__('Are you sure you want to delete all spams?')).
-		self::jsVar('dotclear.msg.confirm_delete_comments',
-			__('Are you sure you want to delete selected comments (%s)?')).
-		self::jsVar('dotclear.msg.confirm_delete_comment',
-			__('Are you sure you want to delete this comment?')).
-		self::jsVar('dotclear.msg.cannot_delete_users',
-			__('Users with posts cannot be deleted.')).
-		self::jsVar('dotclear.msg.confirm_delete_user',
-			__('Are you sure you want to delete selected users (%s)?')).
-		self::jsVar('dotclear.msg.confirm_delete_blog',
-			__('Are you sure you want to delete selected blogs (%s)?')).
-		self::jsVar('dotclear.msg.confirm_delete_category',
-			__('Are you sure you want to delete category "%s"?')).
-		self::jsVar('dotclear.msg.confirm_reorder_categories',
-			__('Are you sure you want to reorder all categories?')).
-		self::jsVar('dotclear.msg.confirm_delete_media',
-			__('Are you sure you want to remove media "%s"?')).
-		self::jsVar('dotclear.msg.confirm_delete_directory',
-			__('Are you sure you want to remove directory "%s"?')).
-		self::jsVar('dotclear.msg.confirm_extract_current',
-			__('Are you sure you want to extract archive in current directory?')).
-		self::jsVar('dotclear.msg.confirm_remove_attachment',
-			__('Are you sure you want to remove attachment "%s"?')).
-		self::jsVar('dotclear.msg.confirm_delete_lang',
-			__('Are you sure you want to delete "%s" language?')).
-		self::jsVar('dotclear.msg.confirm_delete_plugin',
-			__('Are you sure you want to delete "%s" plugin?')).
-		self::jsVar('dotclear.msg.confirm_delete_plugins',
-			__('Are you sure you want to delete selected plugins?')).
-		self::jsVar('dotclear.msg.use_this_theme',
-			__('Use this theme')).
-		self::jsVar('dotclear.msg.remove_this_theme',
-			__('Remove this theme')).
-		self::jsVar('dotclear.msg.confirm_delete_theme',
-			__('Are you sure you want to delete "%s" theme?')).
-		self::jsVar('dotclear.msg.confirm_delete_themes',
-			__('Are you sure you want to delete selected themes?')).
-		self::jsVar('dotclear.msg.confirm_delete_backup',
-			__('Are you sure you want to delete this backup?')).
-		self::jsVar('dotclear.msg.confirm_revert_backup',
-			__('Are you sure you want to revert to this backup?')).
-		self::jsVar('dotclear.msg.zip_file_content',
-			__('Zip file content')).
-		self::jsVar('dotclear.msg.xhtml_validator',
-			__('XHTML markup validator')).
-		self::jsVar('dotclear.msg.xhtml_valid',
-			__('XHTML content is valid.')).
-		self::jsVar('dotclear.msg.xhtml_not_valid',
-			__('There are XHTML markup errors.')).
-		self::jsVar('dotclear.msg.warning_validate_no_save_content',
-			__('Attention: an audit of a content not yet registered.')).
-		self::jsVar('dotclear.msg.confirm_change_post_format',
-			__('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')).
-		self::jsVar('dotclear.msg.confirm_change_post_format_noconvert',
-			__("Warning: post format change will not convert existing content. You will need to apply new format by yourself. Proceed anyway?")).
-		self::jsVar('dotclear.msg.load_enhanced_uploader',
-			__('Loading enhanced uploader, please wait.')).
-
-		self::jsVar('dotclear.msg.module_author',
-			__('Author:')).
-		self::jsVar('dotclear.msg.module_details',
-			__('Details')).
-		self::jsVar('dotclear.msg.module_support',
-			__('Support')).
-		self::jsVar('dotclear.msg.module_help',
-			__('Help:')).
-		self::jsVar('dotclear.msg.module_section',
-			__('Section:')).
-		self::jsVar('dotclear.msg.module_tags',
-			__('Tags:')).
-
-		self::jsVar('dotclear.msg.close_notice',
-			__('Hide this notice')).
-
-			"\n".
-		"</script>\n";
-	}
-
-	/**
-	@deprecated since version 2.11
-	*/
-	public static function jsLoadIE7()
-	{
-		return '';
-	}
-
-	public static function jsConfirmClose()
-	{
-		$args = func_get_args();
-		if (count($args) > 0) {
-			foreach ($args as $k => $v) {
-				$args[$k] = "'".html::escapeJS($v)."'";
-			}
-			$args = implode(',',$args);
-		} else {
-			$args = '';
-		}
-
-		return
-		self::jsLoad('js/confirm-close.js').
-		'<script type="text/javascript">'."\n".
-		"confirmClosePage = new confirmClose(".$args."); ".
-		"confirmClose.prototype.prompt = '".html::escapeJS(__('You have unsaved changes.'))."'; ".
-		"</script>\n";
-	}
-
-	public static function jsPageTabs($default=null)
-	{
-		if ($default) {
-			$default = "'".html::escapeJS($default)."'";
-		}
-
-		return
-		self::jsLoad('js/jquery/jquery.pageTabs.js').
-		'<script type="text/javascript">'."\n".
-		'$(function() {'."\n".
-		'	$.pageTabs('.$default.');'."\n".
-		'});'.
-		"</script>\n";
-	}
-
-	public static function jsModal()
-	{
-		return
-		self::jsLoad('js/jquery/jquery.magnific-popup.js');
-	}
-
-	public static function jsColorPicker()
-	{
-		return
-		self::cssLoad('style/farbtastic/farbtastic.css').
-		self::jsLoad('js/jquery/jquery.farbtastic.js').
-		self::jsLoad('js/color-picker.js');
-	}
-
-	public static function jsDatePicker()
-	{
-		return
-		self::cssLoad('style/date-picker.css').
-		self::jsLoad('js/date-picker.js').
-		'<script type="text/javascript">'."\n".
-
-		"datePicker.prototype.months[0] = '".html::escapeJS(__('January'))."'; ".
-		"datePicker.prototype.months[1] = '".html::escapeJS(__('February'))."'; ".
-		"datePicker.prototype.months[2] = '".html::escapeJS(__('March'))."'; ".
-		"datePicker.prototype.months[3] = '".html::escapeJS(__('April'))."'; ".
-		"datePicker.prototype.months[4] = '".html::escapeJS(__('May'))."'; ".
-		"datePicker.prototype.months[5] = '".html::escapeJS(__('June'))."'; ".
-		"datePicker.prototype.months[6] = '".html::escapeJS(__('July'))."'; ".
-		"datePicker.prototype.months[7] = '".html::escapeJS(__('August'))."'; ".
-		"datePicker.prototype.months[8] = '".html::escapeJS(__('September'))."'; ".
-		"datePicker.prototype.months[9] = '".html::escapeJS(__('October'))."'; ".
-		"datePicker.prototype.months[10] = '".html::escapeJS(__('November'))."'; ".
-		"datePicker.prototype.months[11] = '".html::escapeJS(__('December'))."'; ".
-
-		"datePicker.prototype.days[0] = '".html::escapeJS(__('Monday'))."'; ".
-		"datePicker.prototype.days[1] = '".html::escapeJS(__('Tuesday'))."'; ".
-		"datePicker.prototype.days[2] = '".html::escapeJS(__('Wednesday'))."'; ".
-		"datePicker.prototype.days[3] = '".html::escapeJS(__('Thursday'))."'; ".
-		"datePicker.prototype.days[4] = '".html::escapeJS(__('Friday'))."'; ".
-		"datePicker.prototype.days[5] = '".html::escapeJS(__('Saturday'))."'; ".
-		"datePicker.prototype.days[6] = '".html::escapeJS(__('Sunday'))."'; ".
-
-		"datePicker.prototype.img_src = 'images/date-picker.png'; ".
-		"datePicker.prototype.img_alt = '".html::escapeJS(__('Choose date'))."'; ".
-
-		"datePicker.prototype.close_msg = '".html::escapeJS(__('close'))."'; ".
-		"datePicker.prototype.now_msg = '".html::escapeJS(__('now'))."'; ".
-
-		"</script>\n";
-	}
-
-
-	public static function jsToolBar()
-	{
-		# Deprecated but we keep this for plugins.
-	}
-
-	public static function jsUpload($params=array(),$base_url=null)
-	{
-		if (!$base_url) {
-			$base_url = path::clean(dirname(preg_replace('/(\?.*$)?/','',$_SERVER['REQUEST_URI']))).'/';
-		}
-
-		$params = array_merge($params,array(
-			'sess_id='.session_id(),
-			'sess_uid='.$_SESSION['sess_browser_uid'],
-			'xd_check='.$GLOBALS['core']->getNonce()
-		));
-
-		return
-		'<script type="text/javascript">'."\n".
-		"dotclear.jsUpload = {};\n".
-		"dotclear.jsUpload.msg = {};\n".
-		self::jsVar('dotclear.msg.enhanced_uploader_activate',__('Temporarily activate enhanced uploader')).
-		self::jsVar('dotclear.msg.enhanced_uploader_disable',__('Temporarily disable enhanced uploader')).
-		self::jsVar('dotclear.jsUpload.msg.limit_exceeded',__('Limit exceeded.')).
-		self::jsVar('dotclear.jsUpload.msg.size_limit_exceeded',__('File size exceeds allowed limit.')).
-		self::jsVar('dotclear.jsUpload.msg.canceled',__('Canceled.')).
-		self::jsVar('dotclear.jsUpload.msg.http_error',__('HTTP Error:')).
-		self::jsVar('dotclear.jsUpload.msg.error',__('Error:')).
-		self::jsVar('dotclear.jsUpload.msg.choose_file',__('Choose file')).
-		self::jsVar('dotclear.jsUpload.msg.choose_files',__('Choose files')).
-		self::jsVar('dotclear.jsUpload.msg.cancel',__('Cancel')).
-		self::jsVar('dotclear.jsUpload.msg.clean',__('Clean')).
-		self::jsVar('dotclear.jsUpload.msg.upload',__('Upload')).
-		self::jsVar('dotclear.jsUpload.msg.send',__('Send')).
-		self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded',__('File successfully uploaded.')).
-		self::jsVar('dotclear.jsUpload.msg.no_file_in_queue',__('No file in queue.')).
-		self::jsVar('dotclear.jsUpload.msg.file_in_queue',__('1 file in queue.')).
-		self::jsVar('dotclear.jsUpload.msg.files_in_queue',__('%d files in queue.')).
-		self::jsVar('dotclear.jsUpload.msg.queue_error',__('Queue error:')).
-		self::jsVar('dotclear.jsUpload.base_url',$base_url).
-		"</script>\n".
-
-		self::jsLoad('js/jquery/jquery-ui.custom.js').
-		self::jsLoad('js/jsUpload/tmpl.js').
-		self::jsLoad('js/jsUpload/template-upload.js').
-		self::jsLoad('js/jsUpload/template-download.js').
-		self::jsLoad('js/jsUpload/load-image.js').
-		self::jsLoad('js/jsUpload/jquery.iframe-transport.js').
-		self::jsLoad('js/jsUpload/jquery.fileupload.js').
-		self::jsLoad('js/jsUpload/jquery.fileupload-process.js').
-		self::jsLoad('js/jsUpload/jquery.fileupload-resize.js').
-		self::jsLoad('js/jsUpload/jquery.fileupload-ui.js');
-	}
-
-	public static function jsMetaEditor()
-	{
-		return self::jsLoad('js/meta-editor.js');
-	}
-
-	public static function jsFilterControl($show=true)
-	{
-		return
-		self::jsLoad('js/filter-controls.js').
-		'<script type="text/javascript">'."\n".
-		self::jsVar('dotclear.msg.show_filters', $show ? 'true':'false')."\n".
-		self::jsVar('dotclear.msg.filter_posts_list',__('Show filters and display options'))."\n".
-		self::jsVar('dotclear.msg.cancel_the_filter',__('Cancel filters and display options'))."\n".
-		"</script>";
-	}
-
-	public static function jsLoadCodeMirror($theme = '',$multi = true,$modes = array('css','htmlmixed','javascript','php','xml'))
-	{
-		$ret =
-			self::cssLoad('js/codemirror/lib/codemirror.css').
-			self::jsLoad('js/codemirror/lib/codemirror.js');
-		if ($multi) {
-			$ret .= self::jsLoad('js/codemirror/addon/mode/multiplex.js');
-		}
-		foreach ($modes as $mode) {
-			$ret .= self::jsLoad('js/codemirror/mode/'.$mode.'/'.$mode.'.js');
-		}
-		$ret .=
-			self::jsLoad('js/codemirror/addon/edit/closebrackets.js').
-			self::jsLoad('js/codemirror/addon/edit/matchbrackets.js').
-			self::cssLoad('js/codemirror/addon/display/fullscreen.css').
-			self::jsLoad('js/codemirror/addon/display/fullscreen.js');
-		if ($theme != '') {
-			$ret .= self::cssLoad('js/codemirror/theme/'.$theme.'.css');
-		}
-		return $ret;
-	}
-
-	public static function jsRunCodeMirror($name,$id,$mode,$theme = '')
-	{
-		$ret =
-			'<script type="text/javascript">'."\n".
-			'var '.$name.' = CodeMirror.fromTextArea('.$id.',{'."\n".
-			'	mode: "'.$mode.'",'."\n".
-			'	tabMode: "indent",'."\n".
-			'	lineWrapping: 1,'."\n".
-			'	lineNumbers: 1,'."\n".
-			'	matchBrackets: 1,'."\n".
-			'	autoCloseBrackets: 1,'."\n".
-			'	extraKeys: {"F11": function(cm) {cm.setOption("fullScreen",!cm.getOption("fullScreen"));}}';
-		if ($theme) {
-			$ret .=
-				','."\n".
-				'	theme: "'.$theme.'"';
-		}
-		$ret .= "\n".
-			'});'."\n".
-			'</script>';
-		return $ret;
-	}
-
-	public static function getCodeMirrorThemes()
-	{
-		$themes = array();
-		$themes_root = dirname(__FILE__).'/../../admin'.'/js/codemirror/theme/';
-		if (is_dir($themes_root) && is_readable($themes_root)) {
-			if (($d = @dir($themes_root)) !== false) {
-				while (($entry = $d->read()) !== false) {
-					if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_readable($themes_root.'/'.$entry)) {
-						$themes[] = substr($entry,0,-4); // remove .css extension
-					}
-				}
-				sort($themes);
-			}
-		}
-		return $themes;
-	}
-
-	public static function getPF($file)
-	{
-		return $GLOBALS['core']->adminurl->get('load.plugin.file',array('pf' => $file));
-	}
-
-	public static function getVF($file)
-	{
-		return $GLOBALS['core']->adminurl->get('load.var.file',array('vf' => $file));
-	}
-
-	public static function setXFrameOptions($headers,$origin = null)
-	{
-		if (self::$xframe_loaded) {
-			return;
-		}
-
-		if ($origin !== null) {
-			$url = parse_url($origin);
-			$headers['x-frame-options'] = sprintf('X-Frame-Options: %s',is_array($url) && isset($url['host']) ?
-				("ALLOW-FROM ".(isset($url['scheme']) ? $url['scheme'].':' : '' ).'//'.$url['host']) :
-				'SAMEORIGIN');
-		} else {
-			$headers['x-frame-options'] = 'X-Frame-Options: SAMEORIGIN'; // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+
-		}
-		self::$xframe_loaded = true;
-	}
+        echo
+            '<div id="footer" role="contentinfo">' .
+            '<a href="http://dotclear.org/" title="' . $text . '">' .
+            '<img src="style/dc_logos/w-dotclear90.png" alt="' . $text . '" /></a></div>' . "\n" .
+            "<!-- " . "\n" .
+            $figure .
+            " -->" . "\n";
+
+        if (defined('DC_DEV') && DC_DEV === true) {
+            echo self::debugInfo();
+        }
+
+        echo
+            '</body></html>';
+    }
+
+    public static function openPopup($title = '', $head = '', $breadcrumb = '')
+    {
+        global $core;
+
+        # Display
+        header('Content-Type: text/html; charset=UTF-8');
+
+        # Referrer Policy for admin pages
+        header('Referrer-Policy: strict-origin');
+
+        # Prevents Clickjacking as far as possible
+        header('X-Frame-Options: SAMEORIGIN'); // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+
+
+        echo
+        '<!DOCTYPE html>' .
+        '<html lang="' . $core->auth->getInfo('user_lang') . '">' . "\n" .
+        "<head>\n" .
+        '  <meta charset="UTF-8" />' . "\n" .
+        '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />' . "\n" .
+        '  <title>' . $title . ' - ' . html::escapeHTML($core->blog->name) . ' - ' . html::escapeHTML(DC_VENDOR_NAME) . ' - ' . DC_VERSION . '</title>' . "\n" .
+
+        '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />' . "\n" .
+        '  <meta name="GOOGLEBOT" content="NOSNIPPET" />' . "\n" .
+
+        self::cssLoad('style/default.css');
+        if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
+            echo self::cssLoad('style/default-rtl.css');
+        }
+
+        $core->auth->user_prefs->addWorkspace('interface');
+        if ($core->auth->user_prefs->interface->htmlfontsize) {
+            echo
+            '<script type="text/javascript">' . "\n" .
+            self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" .
+                "</script>\n";
+        }
+
+        echo
+        self::jsCommon() .
+        self::jsToggles() .
+            $head;
+
+        if ($core->auth->user_prefs->interface->hidemoreinfo) {
+            echo
+                '<script type="text/javascript">' . "\n" .
+                'dotclear.hideMoreInfo = true;' . "\n" .
+                "</script>\n";
+        }
+        if ($core->auth->user_prefs->interface->showajaxloader) {
+            echo
+                '<script type="text/javascript">' . "\n" .
+                'dotclear.showAjaxLoader = true;' . "\n" .
+                "</script>\n";
+        }
+
+        # --BEHAVIOR-- adminPageHTMLHead
+        $core->callBehavior('adminPageHTMLHead');
+
+        echo
+            "</head>\n" .
+            '<body id="dotclear-admin" class="popup' .
+            ($core->auth->user_prefs->interface->dynfontsize ? ' responsive-font' : '') . '">' . "\n" .
+
+            '<h1>' . DC_VENDOR_NAME . '</h1>' . "\n";
+
+        echo
+            '<div id="wrapper">' . "\n" .
+            '<div id="main" role="main">' . "\n" .
+            '<div id="content">' . "\n";
+
+        // display breadcrumb if given
+        echo $breadcrumb;
+
+        // Display notices and errors
+        echo self::notices();
+    }
+
+    public static function closePopup()
+    {
+        echo
+        "</div>\n" . // End of #content
+        "</div>\n" . // End of #main
+        "</div>\n" . // End of #wrapper
+
+        '<p id="gototop"><a href="#wrapper">' . __('Page top') . '</a></p>' . "\n" .
+
+            '<div id="footer" role="contentinfo"><p>&nbsp;</p></div>' . "\n" .
+            '</body></html>';
+    }
+
+    public static function breadcrumb($elements = null, $options = array())
+    {
+        global $core;
+        $with_home_link = isset($options['home_link']) ? $options['home_link'] : true;
+        $hl             = isset($options['hl']) ? $options['hl'] : true;
+        $hl_pos         = isset($options['hl_pos']) ? $options['hl_pos'] : -1;
+        // First item of array elements should be blog's name, System or Plugins
+        $res = '<h2>' . ($with_home_link ?
+            '<a class="go_home" href="' . $core->adminurl->get("admin.home") . '"><img src="style/dashboard.png" alt="' . __('Go to dashboard') . '" /></a>' :
+            '<img src="style/dashboard-alt.png" alt="" />');
+        $index = 0;
+        if ($hl_pos < 0) {
+            $hl_pos = count($elements) + $hl_pos;
+        }
+        foreach ($elements as $element => $url) {
+            if ($hl && $index == $hl_pos) {
+                $element = sprintf('<span class="page-title">%s</span>', $element);
+            }
+            $res .= ($with_home_link ? ($index == 1 ? ' : ' : ' &rsaquo; ') : ($index == 0 ? ' ' : ' &rsaquo; ')) .
+                ($url ? '<a href="' . $url . '">' : '') . $element . ($url ? '</a>' : '');
+            $index++;
+        }
+        $res .= '</h2>';
+        return $res;
+    }
+
+    public static function message($msg, $timestamp = true, $div = false, $echo = true, $class = 'message')
+    {
+        global $core;
+
+        $res = '';
+        if ($msg != '') {
+            $res = ($div ? '<div class="' . $class . '">' : '') . '<p' . ($div ? '' : ' class="' . $class . '"') . '>' .
+                ($timestamp ? dt::str(__('[%H:%M:%S]'), null, $core->auth->getInfo('user_tz')) . ' ' : '') . $msg .
+                '</p>' . ($div ? '</div>' : '');
+            if ($echo) {
+                echo $res;
+            }
+        }
+        return $res;
+    }
+
+    public static function success($msg, $timestamp = true, $div = false, $echo = true)
+    {
+        return self::message($msg, $timestamp, $div, $echo, "success");
+    }
+
+    public static function warning($msg, $timestamp = true, $div = false, $echo = true)
+    {
+        return self::message($msg, $timestamp, $div, $echo, "warning-msg");
+    }
+
+    private static function debugInfo()
+    {
+        $global_vars = implode(', ', array_keys($GLOBALS));
+
+        $res =
+        '<div id="debug"><div>' .
+        '<p>memory usage: ' . memory_get_usage() . ' (' . files::size(memory_get_usage()) . ')</p>';
+
+        if (function_exists('xdebug_get_profiler_filename')) {
+            $res .= '<p>Elapsed time: ' . xdebug_time_index() . ' seconds</p>';
+
+            $prof_file = xdebug_get_profiler_filename();
+            if ($prof_file) {
+                $res .= '<p>Profiler file : ' . xdebug_get_profiler_filename() . '</p>';
+            } else {
+                $prof_url = http::getSelfURI();
+                $prof_url .= (strpos($prof_url, '?') === false) ? '?' : '&';
+                $prof_url .= 'XDEBUG_PROFILE';
+                $res .= '<p><a href="' . html::escapeURL($prof_url) . '">Trigger profiler</a></p>';
+            }
+
+            /* xdebug configuration:
+        zend_extension = /.../xdebug.so
+        xdebug.auto_trace = On
+        xdebug.trace_format = 0
+        xdebug.trace_options = 1
+        xdebug.show_mem_delta = On
+        xdebug.profiler_enable = 0
+        xdebug.profiler_enable_trigger = 1
+        xdebug.profiler_output_dir = /tmp
+        xdebug.profiler_append = 0
+        xdebug.profiler_output_name = timestamp
+         */
+        }
+
+        $res .=
+            '<p>Global vars: ' . $global_vars . '</p>' .
+            '</div></div>';
+
+        return $res;
+    }
+
+    public static function help($page, $index = '')
+    {
+        # Deprecated but we keep this for plugins.
+    }
+
+    public static function helpBlock()
+    {
+        global $core;
+
+        if ($core->auth->user_prefs->interface->hidehelpbutton) {
+            return;
+        }
+
+        $args = func_get_args();
+        $args = new ArrayObject($args);
+
+        # --BEHAVIOR-- adminPageHelpBlock
+        $GLOBALS['core']->callBehavior('adminPageHelpBlock', $args);
+
+        if (empty($args)) {
+            return;
+        };
+
+        global $__resources;
+        if (empty($__resources['help'])) {
+            return;
+        }
+
+        $content = '';
+        foreach ($args as $v) {
+            if (is_object($v) && isset($v->content)) {
+                $content .= $v->content;
+                continue;
+            }
+
+            if (!isset($__resources['help'][$v])) {
+                continue;
+            }
+            $f = $__resources['help'][$v];
+            if (!file_exists($f) || !is_readable($f)) {
+                continue;
+            }
+
+            $fc = file_get_contents($f);
+            if (preg_match('|<body[^>]*?>(.*?)</body>|ms', $fc, $matches)) {
+                $content .= $matches[1];
+            } else {
+                $content .= $fc;
+            }
+        }
+
+        if (trim($content) == '') {
+            return;
+        }
+
+        // Set contextual help global flag
+        $GLOBALS['__resources']['ctxhelp'] = true;
+
+        echo
+        '<div id="help"><hr /><div class="help-content clear"><h3>' . __('Help about this page') . '</h3>' .
+        $content .
+        '</div>' .
+        '<div id="helplink"><hr />' .
+        '<p>' .
+        sprintf(__('See also %s'), sprintf('<a href="' . $core->adminurl->get("admin.help") . '">%s</a>', __('the global help'))) .
+            '.</p>' .
+            '</div></div>';
+    }
+
+    public static function cssLoad($src, $media = 'screen', $v = '')
+    {
+        $escaped_src = html::escapeHTML($src);
+        if (!isset(self::$loaded_css[$escaped_src])) {
+            self::$loaded_css[$escaped_src] = true;
+            $escaped_src                    = self::appendVersion($escaped_src, $v);
+
+            return '<link rel="stylesheet" href="' . $escaped_src . '" type="text/css" media="' . $media . '" />' . "\n";
+        }
+    }
+
+    public static function jsLoad($src, $v = '')
+    {
+        $escaped_src = html::escapeHTML($src);
+        if (!isset(self::$loaded_js[$escaped_src])) {
+            self::$loaded_js[$escaped_src] = true;
+            $escaped_src                   = self::appendVersion($escaped_src, $v);
+            return '<script type="text/javascript" src="' . $escaped_src . '"></script>' . "\n";
+        }
+    }
+
+    private static function appendVersion($src, $v = '')
+    {
+        $src .= (strpos($src, '?') === false ? '?' : '&amp;') . 'v=';
+        if (defined('DC_DEV') && DC_DEV === true) {
+            $src .= md5(uniqid());
+        } else {
+            $src .= ($v === '' ? DC_VERSION : $v);
+        }
+        return $src;
+    }
+
+    public static function jsVar($n, $v)
+    {
+        return $n . " = '" . html::escapeJS($v) . "';\n";
+    }
+
+    public static function jsVars($vars)
+    {
+        $ret = '<script type="text/javascript">' . "\n";
+        foreach ($vars as $var => $value) {
+            $ret .= $var . ' = ' . (is_string($value) ? "'" . html::escapeJS($value) . "'" : $value) . ';' . "\n";
+        }
+        $ret .= "</script>\n";
+
+        return $ret;
+    }
+
+    public static function jsToggles()
+    {
+        if ($GLOBALS['core']->auth->user_prefs->toggles) {
+            $unfolded_sections = explode(',', $GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections);
+            foreach ($unfolded_sections as $k => &$v) {
+                if ($v == '') {
+                    unset($unfolded_sections[$k]);
+                } else {
+                    $v = "'" . html::escapeJS($v) . "':true";
+                }
+            }
+        } else {
+            $unfolded_sections = array();
+        }
+        return '<script type="text/javascript">' . "\n" .
+        'dotclear.unfolded_sections = {' . join(",", $unfolded_sections) . "};\n" .
+            "</script>\n";
+    }
+
+    public static function jsCommon()
+    {
+        $mute_or_no = '';
+        if (empty($GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) {
+            $mute_or_no .=
+                '<script type="text/javascript">' . "\n" .
+                'jQuery.migrateMute = true;' . "\n" .
+                "</script>\n";
+        }
+
+        return
+        self::jsLoad('js/jquery/jquery.js') .
+        $mute_or_no .
+        self::jsLoad('js/jquery/jquery-migrate.js') .
+        self::jsLoad('js/jquery/jquery.biscuit.js') .
+        self::jsLoad('js/common.js') .
+        self::jsLoad('js/prelude.js') .
+
+        '<script type="text/javascript">' . "\n" .
+        'jsToolBar = {}, jsToolBar.prototype = { elements : {} };' . "\n" .
+
+        self::jsVar('dotclear.nonce', $GLOBALS['core']->getNonce()) .
+
+        self::jsVar('dotclear.img_plus_src', 'images/expand.png') .
+        self::jsVar('dotclear.img_plus_alt', __('uncover')) .
+        self::jsVar('dotclear.img_minus_src', 'images/hide.png') .
+        self::jsVar('dotclear.img_minus_alt', __('hide')) .
+        self::jsVar('dotclear.img_menu_on', 'images/menu_on.png') .
+        self::jsVar('dotclear.img_menu_off', 'images/menu_off.png') .
+
+        self::jsVar('dotclear.img_plus_theme_src', 'images/plus-theme.png') .
+        self::jsVar('dotclear.img_plus_theme_alt', __('uncover')) .
+        self::jsVar('dotclear.img_minus_theme_src', 'images/minus-theme.png') .
+        self::jsVar('dotclear.img_minus_theme_alt', __('hide')) .
+
+        self::jsVar('dotclear.msg.help',
+            __('Need help?')) .
+        self::jsVar('dotclear.msg.new_window',
+            __('new window')) .
+        self::jsVar('dotclear.msg.help_hide',
+            __('Hide')) .
+        self::jsVar('dotclear.msg.to_select',
+            __('Select:')) .
+        self::jsVar('dotclear.msg.no_selection',
+            __('no selection')) .
+        self::jsVar('dotclear.msg.select_all',
+            __('select all')) .
+        self::jsVar('dotclear.msg.invert_sel',
+            __('Invert selection')) .
+        self::jsVar('dotclear.msg.website',
+            __('Web site:')) .
+        self::jsVar('dotclear.msg.email',
+            __('Email:')) .
+        self::jsVar('dotclear.msg.ip_address',
+            __('IP address:')) .
+        self::jsVar('dotclear.msg.error',
+            __('Error:')) .
+        self::jsVar('dotclear.msg.entry_created',
+            __('Entry has been successfully created.')) .
+        self::jsVar('dotclear.msg.edit_entry',
+            __('Edit entry')) .
+        self::jsVar('dotclear.msg.view_entry',
+            __('view entry')) .
+        self::jsVar('dotclear.msg.confirm_delete_posts',
+            __("Are you sure you want to delete selected entries (%s)?")) .
+        self::jsVar('dotclear.msg.confirm_delete_medias',
+            __("Are you sure you want to delete selected medias (%d)?")) .
+        self::jsVar('dotclear.msg.confirm_delete_categories',
+            __("Are you sure you want to delete selected categories (%s)?")) .
+        self::jsVar('dotclear.msg.confirm_delete_post',
+            __("Are you sure you want to delete this entry?")) .
+        self::jsVar('dotclear.msg.click_to_unlock',
+            __("Click here to unlock the field")) .
+        self::jsVar('dotclear.msg.confirm_spam_delete',
+            __('Are you sure you want to delete all spams?')) .
+        self::jsVar('dotclear.msg.confirm_delete_comments',
+            __('Are you sure you want to delete selected comments (%s)?')) .
+        self::jsVar('dotclear.msg.confirm_delete_comment',
+            __('Are you sure you want to delete this comment?')) .
+        self::jsVar('dotclear.msg.cannot_delete_users',
+            __('Users with posts cannot be deleted.')) .
+        self::jsVar('dotclear.msg.confirm_delete_user',
+            __('Are you sure you want to delete selected users (%s)?')) .
+        self::jsVar('dotclear.msg.confirm_delete_blog',
+            __('Are you sure you want to delete selected blogs (%s)?')) .
+        self::jsVar('dotclear.msg.confirm_delete_category',
+            __('Are you sure you want to delete category "%s"?')) .
+        self::jsVar('dotclear.msg.confirm_reorder_categories',
+            __('Are you sure you want to reorder all categories?')) .
+        self::jsVar('dotclear.msg.confirm_delete_media',
+            __('Are you sure you want to remove media "%s"?')) .
+        self::jsVar('dotclear.msg.confirm_delete_directory',
+            __('Are you sure you want to remove directory "%s"?')) .
+        self::jsVar('dotclear.msg.confirm_extract_current',
+            __('Are you sure you want to extract archive in current directory?')) .
+        self::jsVar('dotclear.msg.confirm_remove_attachment',
+            __('Are you sure you want to remove attachment "%s"?')) .
+        self::jsVar('dotclear.msg.confirm_delete_lang',
+            __('Are you sure you want to delete "%s" language?')) .
+        self::jsVar('dotclear.msg.confirm_delete_plugin',
+            __('Are you sure you want to delete "%s" plugin?')) .
+        self::jsVar('dotclear.msg.confirm_delete_plugins',
+            __('Are you sure you want to delete selected plugins?')) .
+        self::jsVar('dotclear.msg.use_this_theme',
+            __('Use this theme')) .
+        self::jsVar('dotclear.msg.remove_this_theme',
+            __('Remove this theme')) .
+        self::jsVar('dotclear.msg.confirm_delete_theme',
+            __('Are you sure you want to delete "%s" theme?')) .
+        self::jsVar('dotclear.msg.confirm_delete_themes',
+            __('Are you sure you want to delete selected themes?')) .
+        self::jsVar('dotclear.msg.confirm_delete_backup',
+            __('Are you sure you want to delete this backup?')) .
+        self::jsVar('dotclear.msg.confirm_revert_backup',
+            __('Are you sure you want to revert to this backup?')) .
+        self::jsVar('dotclear.msg.zip_file_content',
+            __('Zip file content')) .
+        self::jsVar('dotclear.msg.xhtml_validator',
+            __('XHTML markup validator')) .
+        self::jsVar('dotclear.msg.xhtml_valid',
+            __('XHTML content is valid.')) .
+        self::jsVar('dotclear.msg.xhtml_not_valid',
+            __('There are XHTML markup errors.')) .
+        self::jsVar('dotclear.msg.warning_validate_no_save_content',
+            __('Attention: an audit of a content not yet registered.')) .
+        self::jsVar('dotclear.msg.confirm_change_post_format',
+            __('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')) .
+        self::jsVar('dotclear.msg.confirm_change_post_format_noconvert',
+            __("Warning: post format change will not convert existing content. You will need to apply new format by yourself. Proceed anyway?")) .
+        self::jsVar('dotclear.msg.load_enhanced_uploader',
+            __('Loading enhanced uploader, please wait.')) .
+
+        self::jsVar('dotclear.msg.module_author',
+            __('Author:')) .
+        self::jsVar('dotclear.msg.module_details',
+            __('Details')) .
+        self::jsVar('dotclear.msg.module_support',
+            __('Support')) .
+        self::jsVar('dotclear.msg.module_help',
+            __('Help:')) .
+        self::jsVar('dotclear.msg.module_section',
+            __('Section:')) .
+        self::jsVar('dotclear.msg.module_tags',
+            __('Tags:')) .
+
+        self::jsVar('dotclear.msg.close_notice',
+            __('Hide this notice')) .
+
+            "\n" .
+            "</script>\n";
+    }
+
+    /**
+    @deprecated since version 2.11
+     */
+    public static function jsLoadIE7()
+    {
+        return '';
+    }
+
+    public static function jsConfirmClose()
+    {
+        $args = func_get_args();
+        if (count($args) > 0) {
+            foreach ($args as $k => $v) {
+                $args[$k] = "'" . html::escapeJS($v) . "'";
+            }
+            $args = implode(',', $args);
+        } else {
+            $args = '';
+        }
+
+        return
+        self::jsLoad('js/confirm-close.js') .
+        '<script type="text/javascript">' . "\n" .
+        "confirmClosePage = new confirmClose(" . $args . "); " .
+        "confirmClose.prototype.prompt = '" . html::escapeJS(__('You have unsaved changes.')) . "'; " .
+            "</script>\n";
+    }
+
+    public static function jsPageTabs($default = null)
+    {
+        if ($default) {
+            $default = "'" . html::escapeJS($default) . "'";
+        }
+
+        return
+        self::jsLoad('js/jquery/jquery.pageTabs.js') .
+            '<script type="text/javascript">' . "\n" .
+            '$(function() {' . "\n" .
+            '   $.pageTabs(' . $default . ');' . "\n" .
+            '});' .
+            "</script>\n";
+    }
+
+    public static function jsModal()
+    {
+        return
+        self::jsLoad('js/jquery/jquery.magnific-popup.js');
+    }
+
+    public static function jsColorPicker()
+    {
+        return
+        self::cssLoad('style/farbtastic/farbtastic.css') .
+        self::jsLoad('js/jquery/jquery.farbtastic.js') .
+        self::jsLoad('js/color-picker.js');
+    }
+
+    public static function jsDatePicker()
+    {
+        return
+        self::cssLoad('style/date-picker.css') .
+        self::jsLoad('js/date-picker.js') .
+        '<script type="text/javascript">' . "\n" .
+
+        "datePicker.prototype.months[0] = '" . html::escapeJS(__('January')) . "'; " .
+        "datePicker.prototype.months[1] = '" . html::escapeJS(__('February')) . "'; " .
+        "datePicker.prototype.months[2] = '" . html::escapeJS(__('March')) . "'; " .
+        "datePicker.prototype.months[3] = '" . html::escapeJS(__('April')) . "'; " .
+        "datePicker.prototype.months[4] = '" . html::escapeJS(__('May')) . "'; " .
+        "datePicker.prototype.months[5] = '" . html::escapeJS(__('June')) . "'; " .
+        "datePicker.prototype.months[6] = '" . html::escapeJS(__('July')) . "'; " .
+        "datePicker.prototype.months[7] = '" . html::escapeJS(__('August')) . "'; " .
+        "datePicker.prototype.months[8] = '" . html::escapeJS(__('September')) . "'; " .
+        "datePicker.prototype.months[9] = '" . html::escapeJS(__('October')) . "'; " .
+        "datePicker.prototype.months[10] = '" . html::escapeJS(__('November')) . "'; " .
+        "datePicker.prototype.months[11] = '" . html::escapeJS(__('December')) . "'; " .
+
+        "datePicker.prototype.days[0] = '" . html::escapeJS(__('Monday')) . "'; " .
+        "datePicker.prototype.days[1] = '" . html::escapeJS(__('Tuesday')) . "'; " .
+        "datePicker.prototype.days[2] = '" . html::escapeJS(__('Wednesday')) . "'; " .
+        "datePicker.prototype.days[3] = '" . html::escapeJS(__('Thursday')) . "'; " .
+        "datePicker.prototype.days[4] = '" . html::escapeJS(__('Friday')) . "'; " .
+        "datePicker.prototype.days[5] = '" . html::escapeJS(__('Saturday')) . "'; " .
+        "datePicker.prototype.days[6] = '" . html::escapeJS(__('Sunday')) . "'; " .
+
+        "datePicker.prototype.img_src = 'images/date-picker.png'; " .
+        "datePicker.prototype.img_alt = '" . html::escapeJS(__('Choose date')) . "'; " .
+
+        "datePicker.prototype.close_msg = '" . html::escapeJS(__('close')) . "'; " .
+        "datePicker.prototype.now_msg = '" . html::escapeJS(__('now')) . "'; " .
+
+            "</script>\n";
+    }
+
+    public static function jsToolBar()
+    {
+        # Deprecated but we keep this for plugins.
+    }
+
+    public static function jsUpload($params = array(), $base_url = null)
+    {
+        if (!$base_url) {
+            $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/', '', $_SERVER['REQUEST_URI']))) . '/';
+        }
+
+        $params = array_merge($params, array(
+            'sess_id=' . session_id(),
+            'sess_uid=' . $_SESSION['sess_browser_uid'],
+            'xd_check=' . $GLOBALS['core']->getNonce()
+        ));
+
+        return
+        '<script type="text/javascript">' . "\n" .
+        "dotclear.jsUpload = {};\n" .
+        "dotclear.jsUpload.msg = {};\n" .
+        self::jsVar('dotclear.msg.enhanced_uploader_activate', __('Temporarily activate enhanced uploader')) .
+        self::jsVar('dotclear.msg.enhanced_uploader_disable', __('Temporarily disable enhanced uploader')) .
+        self::jsVar('dotclear.jsUpload.msg.limit_exceeded', __('Limit exceeded.')) .
+        self::jsVar('dotclear.jsUpload.msg.size_limit_exceeded', __('File size exceeds allowed limit.')) .
+        self::jsVar('dotclear.jsUpload.msg.canceled', __('Canceled.')) .
+        self::jsVar('dotclear.jsUpload.msg.http_error', __('HTTP Error:')) .
+        self::jsVar('dotclear.jsUpload.msg.error', __('Error:')) .
+        self::jsVar('dotclear.jsUpload.msg.choose_file', __('Choose file')) .
+        self::jsVar('dotclear.jsUpload.msg.choose_files', __('Choose files')) .
+        self::jsVar('dotclear.jsUpload.msg.cancel', __('Cancel')) .
+        self::jsVar('dotclear.jsUpload.msg.clean', __('Clean')) .
+        self::jsVar('dotclear.jsUpload.msg.upload', __('Upload')) .
+        self::jsVar('dotclear.jsUpload.msg.send', __('Send')) .
+        self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded', __('File successfully uploaded.')) .
+        self::jsVar('dotclear.jsUpload.msg.no_file_in_queue', __('No file in queue.')) .
+        self::jsVar('dotclear.jsUpload.msg.file_in_queue', __('1 file in queue.')) .
+        self::jsVar('dotclear.jsUpload.msg.files_in_queue', __('%d files in queue.')) .
+        self::jsVar('dotclear.jsUpload.msg.queue_error', __('Queue error:')) .
+        self::jsVar('dotclear.jsUpload.base_url', $base_url) .
+        "</script>\n" .
+
+        self::jsLoad('js/jquery/jquery-ui.custom.js') .
+        self::jsLoad('js/jsUpload/tmpl.js') .
+        self::jsLoad('js/jsUpload/template-upload.js') .
+        self::jsLoad('js/jsUpload/template-download.js') .
+        self::jsLoad('js/jsUpload/load-image.js') .
+        self::jsLoad('js/jsUpload/jquery.iframe-transport.js') .
+        self::jsLoad('js/jsUpload/jquery.fileupload.js') .
+        self::jsLoad('js/jsUpload/jquery.fileupload-process.js') .
+        self::jsLoad('js/jsUpload/jquery.fileupload-resize.js') .
+        self::jsLoad('js/jsUpload/jquery.fileupload-ui.js');
+    }
+
+    public static function jsMetaEditor()
+    {
+        return self::jsLoad('js/meta-editor.js');
+    }
+
+    public static function jsFilterControl($show = true)
+    {
+        return
+        self::jsLoad('js/filter-controls.js') .
+        '<script type="text/javascript">' . "\n" .
+        self::jsVar('dotclear.msg.show_filters', $show ? 'true' : 'false') . "\n" .
+        self::jsVar('dotclear.msg.filter_posts_list', __('Show filters and display options')) . "\n" .
+        self::jsVar('dotclear.msg.cancel_the_filter', __('Cancel filters and display options')) . "\n" .
+            "</script>";
+    }
+
+    public static function jsLoadCodeMirror($theme = '', $multi = true, $modes = array('css', 'htmlmixed', 'javascript', 'php', 'xml'))
+    {
+        $ret =
+        self::cssLoad('js/codemirror/lib/codemirror.css') .
+        self::jsLoad('js/codemirror/lib/codemirror.js');
+        if ($multi) {
+            $ret .= self::jsLoad('js/codemirror/addon/mode/multiplex.js');
+        }
+        foreach ($modes as $mode) {
+            $ret .= self::jsLoad('js/codemirror/mode/' . $mode . '/' . $mode . '.js');
+        }
+        $ret .=
+        self::jsLoad('js/codemirror/addon/edit/closebrackets.js') .
+        self::jsLoad('js/codemirror/addon/edit/matchbrackets.js') .
+        self::cssLoad('js/codemirror/addon/display/fullscreen.css') .
+        self::jsLoad('js/codemirror/addon/display/fullscreen.js');
+        if ($theme != '') {
+            $ret .= self::cssLoad('js/codemirror/theme/' . $theme . '.css');
+        }
+        return $ret;
+    }
+
+    public static function jsRunCodeMirror($name, $id, $mode, $theme = '')
+    {
+        $ret =
+            '<script type="text/javascript">' . "\n" .
+            'var ' . $name . ' = CodeMirror.fromTextArea(' . $id . ',{' . "\n" .
+            '   mode: "' . $mode . '",' . "\n" .
+            '   tabMode: "indent",' . "\n" .
+            '   lineWrapping: 1,' . "\n" .
+            '   lineNumbers: 1,' . "\n" .
+            '   matchBrackets: 1,' . "\n" .
+            '   autoCloseBrackets: 1,' . "\n" .
+            '   extraKeys: {"F11": function(cm) {cm.setOption("fullScreen",!cm.getOption("fullScreen"));}}';
+        if ($theme) {
+            $ret .=
+                ',' . "\n" .
+                '   theme: "' . $theme . '"';
+        }
+        $ret .= "\n" .
+            '});' . "\n" .
+            '</script>';
+        return $ret;
+    }
+
+    public static function getCodeMirrorThemes()
+    {
+        $themes      = array();
+        $themes_root = dirname(__FILE__) . '/../../admin' . '/js/codemirror/theme/';
+        if (is_dir($themes_root) && is_readable($themes_root)) {
+            if (($d = @dir($themes_root)) !== false) {
+                while (($entry = $d->read()) !== false) {
+                    if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_readable($themes_root . '/' . $entry)) {
+                        $themes[] = substr($entry, 0, -4); // remove .css extension
+                    }
+                }
+                sort($themes);
+            }
+        }
+        return $themes;
+    }
+
+    public static function getPF($file)
+    {
+        return $GLOBALS['core']->adminurl->get('load.plugin.file', array('pf' => $file));
+    }
+
+    public static function getVF($file)
+    {
+        return $GLOBALS['core']->adminurl->get('load.var.file', array('vf' => $file));
+    }
+
+    public static function setXFrameOptions($headers, $origin = null)
+    {
+        if (self::$xframe_loaded) {
+            return;
+        }
+
+        if ($origin !== null) {
+            $url                        = parse_url($origin);
+            $headers['x-frame-options'] = sprintf('X-Frame-Options: %s', is_array($url) && isset($url['host']) ?
+                ("ALLOW-FROM " . (isset($url['scheme']) ? $url['scheme'] . ':' : '') . '//' . $url['host']) :
+                'SAMEORIGIN');
+        } else {
+            $headers['x-frame-options'] = 'X-Frame-Options: SAMEORIGIN'; // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+
+        }
+        self::$xframe_loaded = true;
+    }
 }
Index: plugins/aboutConfig/index.php
===================================================================
--- plugins/aboutConfig/index.php	(revision 3421)
+++ plugins/aboutConfig/index.php	(revision 3709)
@@ -10,94 +10,88 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
+if (!defined('DC_CONTEXT_ADMIN')) {return;}
 
 # Local navigation
 if (!empty($_POST['gs_nav'])) {
-	http::redirect($p_url.$_POST['gs_nav']);
-	exit;
+    http::redirect($p_url . $_POST['gs_nav']);
+    exit;
 }
 if (!empty($_POST['ls_nav'])) {
-	http::redirect($p_url.$_POST['ls_nav']);
-	exit;
+    http::redirect($p_url . $_POST['ls_nav']);
+    exit;
 }
 
 # Local settings update
-if (!empty($_POST['s']) && is_array($_POST['s']))
+if (!empty($_POST['s']) && is_array($_POST['s'])) {
+    try
+    {
+        foreach ($_POST['s'] as $ns => $s) {
+            $core->blog->settings->addNamespace($ns);
+            foreach ($s as $k => $v) {
+                if ($_POST['s_type'][$ns][$k] == 'array') {
+                    $v = json_decode($v, true);
+                }
+                $core->blog->settings->$ns->put($k, $v);
+            }
+            $core->blog->triggerBlog();
+        }
+
+        dcPage::addSuccessNotice(__('Configuration successfully updated'));
+        http::redirect($p_url);
+    } catch (Exception $e) {
+        $core->error->add($e->getMessage());
+    }
+}
+
+# Global settings update
+if (!empty($_POST['gs']) && is_array($_POST['gs'])) {
+    try
+    {
+        foreach ($_POST['gs'] as $ns => $s) {
+            $core->blog->settings->addNamespace($ns);
+            foreach ($s as $k => $v) {
+                if ($_POST['gs_type'][$ns][$k] == 'array') {
+                    $v = json_decode($v, true);
+                }
+                $core->blog->settings->$ns->put($k, $v, null, null, true, true);
+            }
+            $core->blog->triggerBlog();
+        }
+
+        dcPage::addSuccessNotice(__('Configuration successfully updated'));
+        http::redirect($p_url . '&part=global');
+    } catch (Exception $e) {
+        $core->error->add($e->getMessage());
+    }
+}
+
+$part = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local';
+
+function settingLine($id, $s, $ns, $field_name, $strong_label)
 {
-	try
-	{
-		foreach ($_POST['s'] as $ns => $s) {
-			$core->blog->settings->addNamespace($ns);
-			foreach ($s as $k => $v) {
-				if ($_POST['s_type'][$ns][$k] == 'array') {
-					$v = json_decode($v,true);
-				}
-				$core->blog->settings->$ns->put($k,$v);
-			}
-			$core->blog->triggerBlog();
-		}
-
-		dcPage::addSuccessNotice(__('Configuration successfully updated'));
-		http::redirect($p_url);
-	}
-	catch (Exception $e)
-	{
-		$core->error->add($e->getMessage());
-	}
-}
-
-# Global settings update
-if (!empty($_POST['gs']) && is_array($_POST['gs']))
-{
-	try
-	{
-		foreach ($_POST['gs'] as $ns => $s) {
-			$core->blog->settings->addNamespace($ns);
-			foreach ($s as $k => $v) {
-				if ($_POST['gs_type'][$ns][$k] == 'array') {
-					$v = json_decode($v,true);
-				}
-				$core->blog->settings->$ns->put($k,$v,null,null,true,true);
-			}
-			$core->blog->triggerBlog();
-		}
-
-		dcPage::addSuccessNotice(__('Configuration successfully updated'));
-		http::redirect($p_url.'&part=global');
-	}
-	catch (Exception $e)
-	{
-		$core->error->add($e->getMessage());
-	}
-}
-
-$part = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local';
-
-function settingLine($id,$s,$ns,$field_name,$strong_label)
-{
-	if ($s['type'] == 'boolean') {
-		$field = form::combo(array($field_name.'['.$ns.']['.$id.']',$field_name.'_'.$ns.'_'.$id),
-		array(__('yes') => 1, __('no') => 0),$s['value'] ? 1 : 0);
-	} else {
-		if ($s['type'] == 'array') {
-			$field = form::field(array($field_name.'['.$ns.']['.$id.']',$field_name.'_'.$ns.'_'.$id),40,null,
-			html::escapeHTML(json_encode($s['value'])));
-		} else {
-			$field = form::field(array($field_name.'['.$ns.']['.$id.']',$field_name.'_'.$ns.'_'.$id),40,null,
-			html::escapeHTML($s['value']));
-		}
-	}
-	$type = form::hidden(array($field_name.'_type'.'['.$ns.']['.$id.']',$field_name.'_'.$ns.'_'.$id.'_type'),
-		html::escapeHTML($s['type']));
-
-	$slabel = $strong_label ? '<strong>%s</strong>' : '%s';
-
-	return
-	'<tr class="line">'.
-	'<td scope="row"><label for="'.$field_name.'_'.$ns.'_'.$id.'">'.sprintf($slabel,html::escapeHTML($id)).'</label></td>'.
-	'<td>'.$field.'</td>'.
-	'<td>'.$s['type'].$type.'</td>'.
-	'<td>'.html::escapeHTML($s['label']).'</td>'.
-	'</tr>';
+    if ($s['type'] == 'boolean') {
+        $field = form::combo(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id),
+            array(__('yes') => 1, __('no') => 0), $s['value'] ? 1 : 0);
+    } else {
+        if ($s['type'] == 'array') {
+            $field = form::field(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id), 40, null,
+                html::escapeHTML(json_encode($s['value'])));
+        } else {
+            $field = form::field(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id), 40, null,
+                html::escapeHTML($s['value']));
+        }
+    }
+    $type = form::hidden(array($field_name . '_type' . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id . '_type'),
+        html::escapeHTML($s['type']));
+
+    $slabel = $strong_label ? '<strong>%s</strong>' : '%s';
+
+    return
+    '<tr class="line">' .
+    '<td scope="row"><label for="' . $field_name . '_' . $ns . '_' . $id . '">' . sprintf($slabel, html::escapeHTML($id)) . '</label></td>' .
+    '<td>' . $field . '</td>' .
+    '<td>' . $s['type'] . $type . '</td>' .
+    '<td>' . html::escapeHTML($s['label']) . '</td>' .
+        '</tr>';
 }
 ?>
@@ -105,17 +99,5 @@
 <head>
   <title>about:config</title>
-  <?php echo dcPage::jsPageTabs($part); ?>
-  <script type="text/javascript">
-	$(function() {
-		$("#gs_submit").hide();
-		$("#ls_submit").hide();
-		$("#gs_nav").change(function() {
-			window.location = $("#gs_nav option:selected").val();
-		})
-		$("#ls_nav").change(function() {
-			window.location = $("#ls_nav option:selected").val();
-		})
-	});
-	</script>
+  <?php echo dcPage::jsPageTabs($part) . dcPage::jsLoad(dcPage::getPF('aboutConfig/js/index.js')); ?>
 </head>
 
@@ -123,47 +105,47 @@
 <?php
 echo dcPage::breadcrumb(
-	array(
-		__('System') => '',
-		html::escapeHTML($core->blog->name) => '',
-		__('about:config') => ''
-	)).
-	dcPage::notices();
-?>
-
-<div id="local" class="multi-part" title="<?php echo sprintf(__('Settings for %s'),html::escapeHTML($core->blog->name)); ?>">
-<h3 class="out-of-screen-if-js"><?php echo sprintf(__('Settings for %s'),html::escapeHTML($core->blog->name)); ?></h3>
-
-<?php
-$table_header = '<div class="table-outer"><table class="settings" id="%s"><caption class="as_h3">%s</caption>'.
-'<thead>'.
-'<tr>'."\n".
-'  <th class="nowrap">'.__('Setting ID').'</th>'."\n".
-'  <th>'.__('Value').'</th>'."\n".
-'  <th>'.__('Type').'</th>'."\n".
-'  <th class="maximalx">'.__('Description').'</th>'."\n".
-'</tr>'."\n".
-'</thead>'."\n".
-'<tbody>';
+    array(
+        __('System')                        => '',
+        html::escapeHTML($core->blog->name) => '',
+        __('about:config')                  => ''
+    )) .
+dcPage::notices();
+?>
+
+<div id="local" class="multi-part" title="<?php echo sprintf(__('Settings for %s'), html::escapeHTML($core->blog->name)); ?>">
+<h3 class="out-of-screen-if-js"><?php echo sprintf(__('Settings for %s'), html::escapeHTML($core->blog->name)); ?></h3>
+
+<?php
+$table_header = '<div class="table-outer"><table class="settings" id="%s"><caption class="as_h3">%s</caption>' .
+'<thead>' .
+'<tr>' . "\n" .
+'  <th class="nowrap">' . __('Setting ID') . '</th>' . "\n" .
+'  <th>' . __('Value') . '</th>' . "\n" .
+'  <th>' . __('Type') . '</th>' . "\n" .
+'  <th class="maximalx">' . __('Description') . '</th>' . "\n" .
+    '</tr>' . "\n" .
+    '</thead>' . "\n" .
+    '<tbody>';
 $table_footer = '</tbody></table></div>';
 
 $settings = array();
 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) {
-	foreach ($namespace->dumpSettings() as $k => $v) {
-		$settings[$ns][$k] = $v;
-	}
+    foreach ($namespace->dumpSettings() as $k => $v) {
+        $settings[$ns][$k] = $v;
+    }
 }
 ksort($settings);
 if (count($settings) > 0) {
-	$ns_combo = array();
-	foreach ($settings as $ns => $s) {
-		$ns_combo[$ns] = '#l_'.$ns;
-	}
-	echo
-		'<form action="'.$core->adminurl->get('admin.plugin').'" method="post">'.
-		'<p class="anchor-nav">'.
-		'<label for="ls_nav" class="classic">'.__('Goto:').'</label> '.form::combo('ls_nav',$ns_combo).
-		' <input type="submit" value="'.__('Ok').'" id="ls_submit" />'.
-		'<input type="hidden" name="p" value="aboutConfig" />'.
-		$core->formNonce().'</p></form>';
+    $ns_combo = array();
+    foreach ($settings as $ns => $s) {
+        $ns_combo[$ns] = '#l_' . $ns;
+    }
+    echo
+    '<form action="' . $core->adminurl->get('admin.plugin') . '" method="post">' .
+    '<p class="anchor-nav">' .
+    '<label for="ls_nav" class="classic">' . __('Goto:') . '</label> ' . form::combo('ls_nav', $ns_combo) .
+    ' <input type="submit" value="' . __('Ok') . '" id="ls_submit" />' .
+    '<input type="hidden" name="p" value="aboutConfig" />' .
+    $core->formNonce() . '</p></form>';
 }
 ?>
@@ -172,13 +154,11 @@
 
 <?php
-foreach ($settings as $ns => $s)
-{
-	ksort($s);
-	echo sprintf($table_header,'l_'.$ns,$ns);
-	foreach ($s as $k => $v)
-	{
-		echo settingLine($k,$v,$ns,'s',!$v['global']);
-	}
-	echo $table_footer;
+foreach ($settings as $ns => $s) {
+    ksort($s);
+    echo sprintf($table_header, 'l_' . $ns, $ns);
+    foreach ($s as $k => $v) {
+        echo settingLine($k, $v, $ns, 's', !$v['global']);
+    }
+    echo $table_footer;
 }
 ?>
@@ -197,7 +177,7 @@
 
 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) {
-	foreach ($namespace->dumpGlobalSettings() as $k => $v) {
-		$settings[$ns][$k] = $v;
-	}
+    foreach ($namespace->dumpGlobalSettings() as $k => $v) {
+        $settings[$ns][$k] = $v;
+    }
 }
 
@@ -205,15 +185,15 @@
 
 if (count($settings) > 0) {
-	$ns_combo = array();
-	foreach ($settings as $ns => $s) {
-		$ns_combo[$ns] = '#g_'.$ns;
-	}
-	echo
-		'<form action="'.$core->adminurl->get('admin.plugin').'" method="post">'.
-		'<p class="anchor-nav">'.
-		'<label for="gs_nav" class="classic">'.__('Goto:').'</label> '.form::combo('gs_nav',$ns_combo).' '.
-		'<input type="submit" value="'.__('Ok').'" id="gs_submit" />'.
-		'<input type="hidden" name="p" value="aboutConfig" />'.
-		$core->formNonce().'</p></form>';
+    $ns_combo = array();
+    foreach ($settings as $ns => $s) {
+        $ns_combo[$ns] = '#g_' . $ns;
+    }
+    echo
+    '<form action="' . $core->adminurl->get('admin.plugin') . '" method="post">' .
+    '<p class="anchor-nav">' .
+    '<label for="gs_nav" class="classic">' . __('Goto:') . '</label> ' . form::combo('gs_nav', $ns_combo) . ' ' .
+    '<input type="submit" value="' . __('Ok') . '" id="gs_submit" />' .
+    '<input type="hidden" name="p" value="aboutConfig" />' .
+    $core->formNonce() . '</p></form>';
 }
 ?>
@@ -222,13 +202,11 @@
 
 <?php
-foreach ($settings as $ns => $s)
-{
-	ksort($s);
-	echo sprintf($table_header,'g_'.$ns,$ns);
-	foreach ($s as $k => $v)
-	{
-		echo settingLine($k,$v,$ns,'gs',false);
-	}
-	echo $table_footer;
+foreach ($settings as $ns => $s) {
+    ksort($s);
+    echo sprintf($table_header, 'g_' . $ns, $ns);
+    foreach ($s as $k => $v) {
+        echo settingLine($k, $v, $ns, 'gs', false);
+    }
+    echo $table_footer;
 }
 ?>
@@ -240,5 +218,5 @@
 </div>
 
-<?php dcPage::helpBlock('aboutConfig'); ?>
+<?php dcPage::helpBlock('aboutConfig');?>
 
 </body>
Index: plugins/aboutConfig/js/index.js
===================================================================
--- plugins/aboutConfig/js/index.js	(revision 3709)
+++ plugins/aboutConfig/js/index.js	(revision 3709)
@@ -0,0 +1,13 @@
+/*global $ */
+'use strict';
+
+$(function() {
+  $('#gs_submit').hide();
+  $('#ls_submit').hide();
+  $('#gs_nav').change(function() {
+    window.location = $('#gs_nav option:selected').val();
+  });
+  $('#ls_nav').change(function() {
+    window.location = $('#ls_nav option:selected').val();
+  });
+});
Index: plugins/antispam/antispam.js
===================================================================
--- plugins/antispam/antispam.js	(revision 2207)
+++ plugins/antispam/antispam.js	(revision 3709)
@@ -1,5 +1,8 @@
+/*global $, dotclear */
+'use strict';
+
 $(function() {
-	$("#filters-list").sortable({'cursor':'move'});
-	$("#filters-list tr").hover(function () {
+	$('#filters-list').sortable({'cursor':'move'});
+	$('#filters-list tr').hover(function () {
 		$(this).css({'cursor':'move'});
 	}, function () {
@@ -8,12 +11,12 @@
 	$('#filters-list-form').submit(function() {
 		var order=[];
-		$("#filters-list tr td input.position").each(function() {
+		$('#filters-list tr td input.position').each(function() {
 			order.push(this.name.replace(/^f_order\[([^\]]+)\]$/,'$1'));
 		});
-		$("input[name=filters_order]")[0].value = order.join(',');
+		$('input[name=filters_order]')[0].value = order.join(',');
 		return true;
 	});
-	$("#filters-list tr td input.position").hide();
-	$("#filters-list tr td.handle").addClass('handler');
+	$('#filters-list tr td input.position').hide();
+	$('#filters-list tr td.handle').addClass('handler');
 
 	$('form input[type=submit][name=delete_all]').click(function(){
Index: plugins/attachments/js/post.js
===================================================================
--- plugins/attachments/js/post.js	(revision 1699)
+++ plugins/attachments/js/post.js	(revision 3709)
@@ -1,6 +1,9 @@
+/*global $ */
+'use strict';
+
 $(function() {
-	$('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'),{
-		user_pref: 'dcx_attachments',
-		legend_click: true
-	});
+  $('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'), {
+    user_pref: 'dcx_attachments',
+    legend_click: true
+  });
 });
Index: lugins/blogroll/blogroll.js
===================================================================
--- plugins/blogroll/blogroll.js	(revision 3182)
+++ 	(revision )
@@ -1,19 +1,0 @@
-$(function() {
-	$("#links-list").sortable({'cursor':'move'});
-	$("#links-list tr").hover(function () {
-		$(this).css({'cursor':'move'});
-	}, function () {
-		$(this).css({'cursor':'auto'});
-	});
-	$('#links-form').submit(function() {
-		var order=[];
-		$("#links-list tr td input.position").each(function() {
-			order.push(this.name.replace(/^order\[([^\]]+)\]$/,'$1'));
-		});
-		$("input[name=links_order]")[0].value = order.join(',');
-		return true;
-	});
-	$("#links-list tr td input.position").hide();
-	$("#links-list tr td.handle").addClass('handler');
-	dotclear.condSubmit('#links-form td input[type="checkbox"]','#links-form #remove-action');
-});
Index: plugins/blogroll/index.php
===================================================================
--- plugins/blogroll/index.php	(revision 3707)
+++ plugins/blogroll/index.php	(revision 3709)
@@ -169,5 +169,5 @@
     dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
     dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
-    dcPage::jsLoad(dcPage::getPF('blogroll/blogroll.js'));
+    dcPage::jsLoad(dcPage::getPF('blogroll/js/blogroll.js'));
 }
 ?>
@@ -328,11 +328,11 @@
             echo
             '<tr><td>' . form::checkbox(array('entries[]'), $i) . '</td>' .
-            '<td nowrap><a href="' . $url . '">' . $title . '</a>' .
-            '<input type="hidden" name="url[' . $i . ']" value="' . $url . '" />' .
-            '<input type="hidden" name="title[' . $i . ']" value="' . $title . '" />' .
-            '</td>' .
-            '<td>' . $desc .
-            '<input type="hidden" name="desc[' . $i . ']" value="' . $desc . '" />' .
-            '</td></tr>' . "\n";
+                '<td nowrap><a href="' . $url . '">' . $title . '</a>' .
+                '<input type="hidden" name="url[' . $i . ']" value="' . $url . '" />' .
+                '<input type="hidden" name="title[' . $i . ']" value="' . $title . '" />' .
+                '</td>' .
+                '<td>' . $desc .
+                '<input type="hidden" name="desc[' . $i . ']" value="' . $desc . '" />' .
+                '</td></tr>' . "\n";
             $i++;
         }
Index: plugins/blogroll/js/blogroll.js
===================================================================
--- plugins/blogroll/js/blogroll.js	(revision 3709)
+++ plugins/blogroll/js/blogroll.js	(revision 3709)
@@ -0,0 +1,22 @@
+/*global $, dotclear */
+'use strict';
+
+$(function() {
+	$('#links-list').sortable({'cursor':'move'});
+	$('#links-list tr').hover(function () {
+		$(this).css({'cursor':'move'});
+	}, function () {
+		$(this).css({'cursor':'auto'});
+	});
+	$('#links-form').submit(function() {
+		var order=[];
+		$('#links-list tr td input.position').each(function() {
+			order.push(this.name.replace(/^order\[([^\]]+)\]$/,'$1'));
+		});
+		$('input[name=links_order]')[0].value = order.join(',');
+		return true;
+	});
+	$('#links-list tr td input.position').hide();
+	$('#links-list tr td.handle').addClass('handler');
+	dotclear.condSubmit('#links-form td input[type="checkbox"]','#links-form #remove-action');
+});
Index: lugins/blowupConfig/config.js
===================================================================
--- plugins/blowupConfig/config.js	(revision 2566)
+++ 	(revision )
@@ -1,157 +1,0 @@
-$(function() {
-	// Hide main title
-	if ($('#blog_title_hide').prop('checked')) {
-		toggleDisable($('#blog_title_f'));
-		toggleDisable($('#blog_title_s'));
-		toggleDisable($('#blog_title_c'));
-		toggleDisable($('#blog_title_a'));
-		toggleDisable($('#blog_title_p'));
-	}
-
-	$('#blog_title_hide').click(function() {
-		toggleDisable($('#blog_title_f'));
-		toggleDisable($('#blog_title_s'));
-		toggleDisable($('#blog_title_c'));
-		toggleDisable($('#blog_title_a'));
-		toggleDisable($('#blog_title_p'));
-	});
-
-	// Upload form
-	if ($('#top_image').val() == 'custom') {
-		$('#uploader').show();
-	} else {
-		$('#uploader').hide();
-	}
-
-	$('#top_image').change(function() {
-		if (this.value == 'custom') {
-			$('#uploader').show();
-			$('#image-preview').attr('src',dotclear.blowup_public_url+'/page-t.png');
-		} else {
-			$('#uploader').hide();
-			$('#uploader input').val('');
-			$('#image-preview').attr('src','index.php?pf=blowupConfig/alpha-img/page-t/' + this.value + '.png');
-		}
-	});
-
-	// Predefined styles
-	var styles_combo = document.createElement('select');
-	$(styles_combo).append('<option value="">&nbsp;</option>');
-	$(styles_combo).append('<option value="none">none</option>');
-	$(styles_combo).attr('title',dotclear.msg.predefined_style_title);
-
-	for (var style in dotclear.blowup_styles) {
-		styles_option = document.createElement('option');
-		styles_option.value = dotclear.blowup_styles[style];
-		$(styles_option).append(style);
-		$(styles_combo).append(styles_option);
-	}
-
-	$('#theme_config').prepend(styles_combo);
-	$(styles_combo).wrap('<div class="fieldset"></div>').before('<h3>' + dotclear.msg.predefined_styles + '</h3>').wrap('<p></p>');
-
-	$(styles_combo).change(function() {
-		$(this.form).find('input[type=text]').val('').css({backgroundColor: '#FFF', color: '#000'});
-		$(this.form).find('select').not($(this)).val('');
-		$(this.form).find('#extra_css').val('');
-		$('#top_image').val('default');
-		if (this.value != 'none') {
-			applyBlowupValues(this.value);
-		}
-	});
-
-	// Code import
-	var e = $('#bu_export_content');
-	e.toggle();
-
-	var img = document.createElement('img');
-	img.src = dotclear.img_plus_src;
-	img.alt = dotclear.img_plus_alt;
-	img.className = 'expand';
-	$(img).css('cursor','pointer');
-	$(document.createTextNode(' ')).prependTo('#bu_export');
-	$(img).prependTo('#bu_export');
-
-	$(img).click(function() {
-		if (e.css('display') == 'none') {
-			this.src = dotclear.img_minus_src;
-			this.alt = dotclear.img_minus_alt;
-		} else {
-			this.src = dotclear.img_plus_src;
-			this.alt = dotclear.img_plus_alt;
-		}
-		e.toggle();
-	});
-
-	var a = document.createElement('a');
-	a.href = '#';
-	$(a).text(dotclear.msg.apply_code);
-
-	e.append(a);
-
-	$(a).click(function() {
-		var code = e.find('#export_code');
-		if (code.size() == 0) { return false; }
-
-		applyBlowupValues(code.val());
-		return false;
-	});
-
-	function toggleDisable(e) {
-		if (e.attr('disabled')) {
-			e.removeAttr('disabled');
-		} else {
-			e.attr('disabled','disabled');
-		}
-	}
-
-	function applyBlowupValues(code) {
-		code = code.replace("\n","");
-		var re = /(^| )([a-zA-Z0-9_]+):"([^"]*?)"(;|$)/g;
-		var reg = /^(.+):"([^"]*)"(;?)\s*$/;
-		var s = code.match(re);
-
-		if (typeof(s) == 'object' && s.length > 0) {
-			var member, target, value, t_e;
-			for (var i=0,s_length=s.length; i<s_length; i++) {
-				member = reg.exec(s[i]);
-				target = member[1].replace(' ','');
-				value = member[2].replace(' ','');
-				updateValueField($('#' + target),value);
-			}
-		}
-	}
-
-	function updateValueField(e,v) {
-		e.val(v);
-		if (v.match(/^#[0-9A-F]{6}$/)) {
-			e.css({
-				backgroundColor: v,
-				color: getColorLum(v) > 0.5 ? '#000' : '#fff'
-			});
-		}
-	}
-
-	function getColorLum(color)
-	{
-		var rgb = [parseInt('0x' + color.substring(1, 3)) / 255,
-				parseInt('0x' + color.substring(3, 5)) / 255,
-				parseInt('0x' + color.substring(5, 7)) / 255];
-
-		return (Math.min(rgb[0], Math.min(rgb[1], rgb[2])) + Math.max(rgb[0], Math.max(rgb[1], rgb[2]))) / 2;
-	}
-});
-
-dotclear.blowup_styles = {
-	'Plumetis 2.6'			:'body_bg_c:"#F5F5F5"; body_bg_g:"solid"; body_txt_f:"ss1"; body_txt_s:"14px"; body_txt_c:"#333333"; body_line_height:"24px"; top_image:"plumetis"; blog_title_hide:"0"; blog_title_f:"ss1"; blog_title_s:"36px"; blog_title_c:"#333333"; blog_title_a:"left"; blog_title_p:"20:94"; body_link_c:"#000000"; body_link_f_c:"#D33800"; body_link_v_c:"#333333"; sidebar_position:""; sidebar_text_f:"ss1"; sidebar_text_s:"12px"; sidebar_text_c:""; sidebar_title_f:""; sidebar_title_s:"14px"; sidebar_title_c:"#666666"; sidebar_title2_f:""; sidebar_title2_s:"12px"; sidebar_title2_c:"#000000"; sidebar_line_c:"#A6D9DC"; sidebar_link_c:""; sidebar_link_f_c:"#D33800"; sidebar_link_v_c:""; date_title_f:""; date_title_s:"12px"; date_title_c:"#666666"; post_title_f:"ss1"; post_title_s:"24px"; post_title_c:"#D33800"; post_comment_bg_c:"#E2EDED"; post_comment_c:"#333333"; post_commentmy_bg_c:"#A6D9DC"; post_commentmy_c:"#000000"; prelude_c:"#A6D9DC"; footer_f:""; footer_s:"12px"; footer_c:"#FFFFFF"; footer_l_c:"#FFFFFF"; footer_bg_c:"#999999"; extra_css:"h1, .post-title {font-weight: normal;text-shadow: 1px 1px 0 #fff;}#footer {background-image: none}body {border-top: 72px solid #A6D9DC}#top {margin-top: -36px}.post a {border-bottom: 1px solid #999}.post-title a, .post-info-co a {border-bottom: none}a:hover {background-color: #eee;text-decoration:none;}"',
-	'Forest'			:'body_bg_c:"#80661A"; body_bg_g:"light"; body_txt_f:""; body_txt_s:""; body_txt_c:"#0A0A00"; body_line_height:"1.4em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s3"; blog_title_s:"4em"; blog_title_c:"#D9D9BF"; blog_title_a:""; blog_title_p:""; body_link_c:"#666600"; body_link_f_c:"#CC9933"; body_link_v_c:"#8D8D40"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#0A0A00"; sidebar_title_f:"s2"; sidebar_title_s:"1.6em"; sidebar_title_c:"#4D4D00"; sidebar_title2_f:"s2"; sidebar_title2_s:""; sidebar_title2_c:"#575700"; sidebar_line_c:"#D9D9BF"; sidebar_link_c:"#40330D"; sidebar_link_f_c:"#666600"; sidebar_link_v_c:"#40330D"; date_title_f:""; date_title_s:""; date_title_c:"#B3B380"; post_title_f:"s2"; post_title_s:"2em"; post_title_c:"#4D4D00"; post_comment_bg_c:"#F0F0E6"; post_comment_c:"#0A0A00"; prelude_c:"#140F05"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:"#D9AD2B"; footer_bg_c:"#33260D"',
-	'Flamingo'		:'body_bg_c:"#CC9999"; body_bg_g:"light"; body_txt_f:"ss3"; body_txt_s:"1.2em"; body_txt_c:"#1A1A00"; body_line_height:"1.5em"; top_image:"flamingo"; blog_title_hide:"0"; blog_title_f:"ss1"; blog_title_s:"3.5em"; blog_title_c:"#FFFFFF"; blog_title_a:""; blog_title_p:""; body_link_c:"#AD8282"; body_link_f_c:"#8282D9"; body_link_v_c:"#997373"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss4"; sidebar_title_s:"1.4em"; sidebar_title_c:"#8282D9"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#AD8282"; sidebar_line_c:"#CDCDFF"; sidebar_link_c:"#262640"; sidebar_link_f_c:"#AD8282"; sidebar_link_v_c:"#262640"; date_title_f:"ss4"; date_title_s:""; date_title_c:"#D9B3B3"; post_title_f:"ss4"; post_title_s:"1.8em"; post_title_c:"#8282D9"; post_comment_bg_c:"#F2E5E5"; post_comment_c:""; prelude_c:"#140F0F"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#140F0F"',
-	'Iceberg'			:'body_bg_c:"#5280A3"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#757575"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3em"; blog_title_c:"#FFFFFF"; blog_title_a:""; blog_title_p:""; body_link_c:"#BDB000"; body_link_f_c:"#F3E66D"; body_link_v_c:"#BDB000"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.4em"; sidebar_title_c:"#689B9C"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#66664D"; sidebar_link_f_c:"#5280A3"; sidebar_link_v_c:"#66664D"; date_title_f:""; date_title_s:""; date_title_c:"#000000"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#6F6800"; post_comment_bg_c:"#E4E4E2"; post_comment_c:""; prelude_c:"#0E2734"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#0E2734"',
-	'Night'			:'body_bg_c:"#0D1A26"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#050A0F"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3.5em"; blog_title_c:"#F2F2E5"; blog_title_a:""; body_link_c:"#336699"; body_link_f_c:"#66664D"; body_link_v_c:"#2B5782"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.4em"; sidebar_title_c:"#336699"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#66664D"; sidebar_link_f_c:"#336699"; sidebar_link_v_c:"#66664D"; date_title_f:""; date_title_s:""; date_title_c:"#ADAD82"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#737300"; post_comment_bg_c:"#E6E6CD"; post_comment_c:""; prelude_c:"#070E14"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#14140F"; blog_title_p:""',
-	'Peas & Carrots'	:'body_bg_c:"#9DCA25"; body_bg_g:"light"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#383839"; body_line_height:"1.5em"; top_image:"butterflies"; blog_title_hide:"0"; blog_title_f:"ss4"; blog_title_s:"3em"; blog_title_c:"#DBDB9D"; blog_title_a:"left"; blog_title_p:""; body_link_c:"#646B10"; body_link_f_c:"#DF6C01"; body_link_v_c:"#919924"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss4"; sidebar_title_s:""; sidebar_title_c:"#FE9017"; sidebar_title2_f:"s2"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#826228"; sidebar_line_c:"#D3EB8B"; sidebar_link_c:"#858547"; sidebar_link_f_c:"#FE9017"; sidebar_link_v_c:"#8F9645"; date_title_f:""; date_title_s:""; date_title_c:"#826228"; post_title_f:"ss4"; post_title_s:"1.8em"; post_title_c:"#806432"; post_comment_bg_c:"#EFFDCC"; post_comment_c:"#826228"; prelude_c:"#C8E186"; footer_f:""; footer_s:"1em"; footer_c:"#FFFFFF"; footer_l_c:"#FFFFFF"; footer_bg_c:"#484432"',
-	'Rabbit'			:'body_bg_c:"#8F9645"; body_bg_g:"solid"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#625D47"; body_line_height:"1.4em"; top_image:"rabbit"; blog_title_hide:"0"; blog_title_f:"ss1"; blog_title_s:"3.5em"; blog_title_c:"#DBDB9D"; blog_title_a:""; blog_title_p:"130:70"; body_link_c:"#646B10"; body_link_f_c:"#484C12"; body_link_v_c:"#919924"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#858547"; sidebar_title_f:""; sidebar_title_s:""; sidebar_title_c:"#8F9645"; sidebar_title2_f:"s2"; sidebar_title2_s:""; sidebar_title2_c:"#826228"; sidebar_line_c:"#95956B"; sidebar_link_c:"#858547"; sidebar_link_f_c:"#826228"; sidebar_link_v_c:"#8F9645"; date_title_f:"s2"; date_title_s:"1em"; date_title_c:"#826228"; post_title_f:"s2"; post_title_s:"1.6em"; post_title_c:"#806432"; post_comment_bg_c:"#D6DE91"; post_comment_c:"#826228"; prelude_c:"#484432"; footer_f:""; footer_s:"1em"; footer_c:"#A6AF50"; footer_l_c:"#DBDB9D"; footer_bg_c:"#484432"',
-	'Rec Room'		:'body_bg_c:"#9B5E1C"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#757575"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3em"; blog_title_c:"#F9FAD6"; blog_title_a:""; blog_title_p:""; body_link_c:"#D1BF1D"; body_link_f_c:"#EEE168"; body_link_v_c:"#D1BF1D"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.2em"; sidebar_title_c:"#689B9C"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#66664D"; sidebar_link_f_c:"#689B9C"; sidebar_link_v_c:"#66664D"; date_title_f:""; date_title_s:""; date_title_c:"#000000"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#689B9C"; post_comment_bg_c:"#E4E4E2"; post_comment_c:""; prelude_c:"#3B2C16"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#3B2C16"',
-	'Seville'			:'body_bg_c:"#B51A0D"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#383839"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3em"; blog_title_c:"#FFFFFF"; blog_title_a:""; blog_title_p:""; body_link_c:"#F18A32"; body_link_f_c:"#F1B232"; body_link_v_c:"#F18A32"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.4em"; sidebar_title_c:"#97471C"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#6E6E72"; sidebar_link_f_c:"#F18A32"; sidebar_link_v_c:"#6E6E72"; date_title_f:""; date_title_s:""; date_title_c:"#97471C"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#F18A32"; post_comment_bg_c:"#E4E4E2"; post_comment_c:""; prelude_c:"#381A1A"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#381A1A"',
-	'Spring Time'		:'body_bg_c:"#E0E0E0"; body_bg_g:"light"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#6B6B6B"; body_line_height:"1.4em"; top_image:"light-trails-1"; blog_title_hide:"0"; blog_title_f:""; blog_title_s:"3.5em"; blog_title_c:"#9AC528"; blog_title_a:"center"; blog_title_p:""; body_link_c:"#279AC4"; body_link_f_c:"#6D8824"; body_link_v_c:"#279AC4"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#6B6B6B"; sidebar_title_f:""; sidebar_title_s:""; sidebar_title_c:"#8FB22F"; sidebar_title2_f:""; sidebar_title2_s:""; sidebar_title2_c:"#279AC4"; sidebar_line_c:"#FFD02C"; sidebar_link_c:"#6B6B6B"; sidebar_link_f_c:"#9AC528"; sidebar_link_v_c:"#6B6B6B"; date_title_f:""; date_title_s:"1em"; date_title_c:"#279AC4"; post_title_f:""; post_title_s:"1.7em"; post_title_c:"#9AC528"; post_comment_bg_c:"#FFFAD1"; post_comment_c:"#6B6B6B"; post_commentmy_bg_c:"#F5F9D9"; post_commentmy_c:"#6B6B6B"; prelude_c:"#EDEDED"; footer_f:""; footer_s:"1.2em"; footer_c:"#9AC528"; footer_l_c:"#6D8824"; footer_bg_c:"#E0E0E0"',
-	'Typo'			:'body_bg_c:"#FFFFFF"; body_bg_g:"solid"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#000000"; body_line_height:"1.4em"; top_image:"typo"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3.5em"; blog_title_c:"#B11508"; blog_title_a:"left"; blog_title_p:"140:50"; body_link_c:"#B11508"; body_link_f_c:"#000000"; body_link_v_c:"#4D4D4D"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#000000"; sidebar_title_f:"s2"; sidebar_title_s:""; sidebar_title_c:"#B11508"; sidebar_title2_f:"s2"; sidebar_title2_s:""; sidebar_title2_c:"#000000"; sidebar_line_c:"#000000"; sidebar_link_c:"#000000"; sidebar_link_f_c:"#B11508"; sidebar_link_v_c:"#000000"; date_title_f:"s2"; date_title_s:"1em"; date_title_c:"#000000"; post_title_f:"s2"; post_title_s:"1.6em"; post_title_c:"#B11508"; post_comment_bg_c:"#FFFFFF"; post_comment_c:"#000000"; prelude_c:"#FFFFFF"; footer_f:""; footer_s:"1em"; footer_c:"#000000"; footer_l_c:"#B11508"; footer_bg_c:"#FFFFFF"'
-};
Index: plugins/blowupConfig/index.php
===================================================================
--- plugins/blowupConfig/index.php	(revision 3421)
+++ plugins/blowupConfig/index.php	(revision 3709)
@@ -10,75 +10,75 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
-
-require dirname(__FILE__).'/lib/class.blowup.config.php';
+if (!defined('DC_CONTEXT_ADMIN')) {return;}
+
+require dirname(__FILE__) . '/lib/class.blowup.config.php';
 
 $can_write_images = blowupConfig::canWriteImages();
-$can_write_css = blowupConfig::canWriteCss();
+$can_write_css    = blowupConfig::canWriteCss();
 
 if ($core->error->flag()) {
-		$notices = $core->error->toHTML();
-		$core->error->reset();
+    $notices = $core->error->toHTML();
+    $core->error->reset();
 }
 
 $blowup_base = array(
-	'body_bg_c' => null,
-	'body_bg_g' => 'light',
-
-	'body_txt_f' => null,
-	'body_txt_s' => null,
-	'body_txt_c' => null,
-	'body_line_height' => null,
-
-	'top_image' => 'default',
-	'top_height' => null,
-	'uploaded' => null,
-
-	'blog_title_hide' => null,
-	'blog_title_f' => null,
-	'blog_title_s' => null,
-	'blog_title_c' => null,
-	'blog_title_a' => null,
-	'blog_title_p' => null,
-
-	'body_link_c' => null,
-	'body_link_f_c' => null,
-	'body_link_v_c' => null,
-
-	'sidebar_position' => null,
-	'sidebar_text_f' => null,
-	'sidebar_text_s' => null,
-	'sidebar_text_c' => null,
-	'sidebar_title_f' => null,
-	'sidebar_title_s' => null,
-	'sidebar_title_c' => null,
-	'sidebar_title2_f' => null,
-	'sidebar_title2_s' => null,
-	'sidebar_title2_c' => null,
-	'sidebar_line_c' => null,
-	'sidebar_link_c' => null,
-	'sidebar_link_f_c' => null,
-	'sidebar_link_v_c' => null,
-
-	'date_title_f' => null,
-	'date_title_s' => null,
-	'date_title_c' => null,
-
-	'post_title_f' => null,
-	'post_title_s' => null,
-	'post_title_c' => null,
-	'post_comment_bg_c' => null,
-	'post_comment_c' => null,
-	'post_commentmy_bg_c' => null,
-	'post_commentmy_c' => null,
-
-	'prelude_c' => null,
-	'footer_f' => null,
-	'footer_s' => null,
-	'footer_c' => null,
-	'footer_l_c' => null,
-	'footer_bg_c' => null,
-
-	'extra_css' => null
+    'body_bg_c'           => null,
+    'body_bg_g'           => 'light',
+
+    'body_txt_f'          => null,
+    'body_txt_s'          => null,
+    'body_txt_c'          => null,
+    'body_line_height'    => null,
+
+    'top_image'           => 'default',
+    'top_height'          => null,
+    'uploaded'            => null,
+
+    'blog_title_hide'     => null,
+    'blog_title_f'        => null,
+    'blog_title_s'        => null,
+    'blog_title_c'        => null,
+    'blog_title_a'        => null,
+    'blog_title_p'        => null,
+
+    'body_link_c'         => null,
+    'body_link_f_c'       => null,
+    'body_link_v_c'       => null,
+
+    'sidebar_position'    => null,
+    'sidebar_text_f'      => null,
+    'sidebar_text_s'      => null,
+    'sidebar_text_c'      => null,
+    'sidebar_title_f'     => null,
+    'sidebar_title_s'     => null,
+    'sidebar_title_c'     => null,
+    'sidebar_title2_f'    => null,
+    'sidebar_title2_s'    => null,
+    'sidebar_title2_c'    => null,
+    'sidebar_line_c'      => null,
+    'sidebar_link_c'      => null,
+    'sidebar_link_f_c'    => null,
+    'sidebar_link_v_c'    => null,
+
+    'date_title_f'        => null,
+    'date_title_s'        => null,
+    'date_title_c'        => null,
+
+    'post_title_f'        => null,
+    'post_title_s'        => null,
+    'post_title_c'        => null,
+    'post_comment_bg_c'   => null,
+    'post_comment_c'      => null,
+    'post_commentmy_bg_c' => null,
+    'post_commentmy_c'    => null,
+
+    'prelude_c'           => null,
+    'footer_f'            => null,
+    'footer_s'            => null,
+    'footer_c'            => null,
+    'footer_l_c'          => null,
+    'footer_bg_c'         => null,
+
+    'extra_css'           => null
 );
 
@@ -87,124 +87,115 @@
 $blowup_user = @unserialize($blowup_user);
 if (!is_array($blowup_user)) {
-	$blowup_user = array();
-}
-
-$blowup_user = array_merge($blowup_base,$blowup_user);
+    $blowup_user = array();
+}
+
+$blowup_user = array_merge($blowup_base, $blowup_user);
 
 $gradient_types = array(
-	__('Light linear gradient') => 'light',
-	__('Medium linear gradient') => 'medium',
-	__('Dark linear gradient') => 'dark',
-	__('Solid color') => 'solid'
+    __('Light linear gradient')  => 'light',
+    __('Medium linear gradient') => 'medium',
+    __('Dark linear gradient')   => 'dark',
+    __('Solid color')            => 'solid'
 );
 
 $top_images = array(__('Custom...') => 'custom');
-$top_images = array_merge($top_images,array_flip(blowupConfig::$top_images));
-
-
-if (!empty($_POST))
-{
-	try
-	{
-		$blowup_user['body_txt_f'] = $_POST['body_txt_f'];
-		$blowup_user['body_txt_s'] = dcThemeConfig::adjustFontSize($_POST['body_txt_s']);
-		$blowup_user['body_txt_c'] = dcThemeConfig::adjustColor($_POST['body_txt_c']);
-		$blowup_user['body_line_height'] = dcThemeConfig::adjustFontSize($_POST['body_line_height']);
-
-		$blowup_user['blog_title_hide'] = (integer) !empty($_POST['blog_title_hide']);
-		$update_blog_title = !$blowup_user['blog_title_hide'] && (
-			!empty($_POST['blog_title_f']) || !empty($_POST['blog_title_s']) ||
-			!empty($_POST['blog_title_c']) || !empty($_POST['blog_title_a']) ||
-			!empty($_POST['blog_title_p'])
-		);
-
-		if ($update_blog_title)
-		{
-			$blowup_user['blog_title_f'] = $_POST['blog_title_f'];
-			$blowup_user['blog_title_s'] = dcThemeConfig::adjustFontSize($_POST['blog_title_s']);
-			$blowup_user['blog_title_c'] = dcThemeConfig::adjustColor($_POST['blog_title_c']);
-			$blowup_user['blog_title_a'] = preg_match('/^(left|center|right)$/',$_POST['blog_title_a']) ? $_POST['blog_title_a'] : null;
-			$blowup_user['blog_title_p'] = dcThemeConfig::adjustPosition($_POST['blog_title_p']);
-		}
-
-		$blowup_user['body_link_c'] = dcThemeConfig::adjustColor($_POST['body_link_c']);
-		$blowup_user['body_link_f_c'] = dcThemeConfig::adjustColor($_POST['body_link_f_c']);
-		$blowup_user['body_link_v_c'] = dcThemeConfig::adjustColor($_POST['body_link_v_c']);
-
-		$blowup_user['sidebar_text_f'] = $_POST['sidebar_text_f'];
-		$blowup_user['sidebar_text_s'] = dcThemeConfig::adjustFontSize($_POST['sidebar_text_s']);
-		$blowup_user['sidebar_text_c'] = dcThemeConfig::adjustColor($_POST['sidebar_text_c']);
-		$blowup_user['sidebar_title_f'] = $_POST['sidebar_title_f'];
-		$blowup_user['sidebar_title_s'] = dcThemeConfig::adjustFontSize($_POST['sidebar_title_s']);
-		$blowup_user['sidebar_title_c'] = dcThemeConfig::adjustColor($_POST['sidebar_title_c']);
-		$blowup_user['sidebar_title2_f'] = $_POST['sidebar_title2_f'];
-		$blowup_user['sidebar_title2_s'] = dcThemeConfig::adjustFontSize($_POST['sidebar_title2_s']);
-		$blowup_user['sidebar_title2_c'] = dcThemeConfig::adjustColor($_POST['sidebar_title2_c']);
-		$blowup_user['sidebar_line_c'] = dcThemeConfig::adjustColor($_POST['sidebar_line_c']);
-		$blowup_user['sidebar_link_c'] = dcThemeConfig::adjustColor($_POST['sidebar_link_c']);
-		$blowup_user['sidebar_link_f_c'] = dcThemeConfig::adjustColor($_POST['sidebar_link_f_c']);
-		$blowup_user['sidebar_link_v_c'] = dcThemeConfig::adjustColor($_POST['sidebar_link_v_c']);
-
-		$blowup_user['sidebar_position'] = ($_POST['sidebar_position'] == 'left') ? 'left' : null;
-
-		$blowup_user['date_title_f'] = $_POST['date_title_f'];
-		$blowup_user['date_title_s'] = dcThemeConfig::adjustFontSize($_POST['date_title_s']);
-		$blowup_user['date_title_c'] = dcThemeConfig::adjustColor($_POST['date_title_c']);
-
-		$blowup_user['post_title_f'] = $_POST['post_title_f'];
-		$blowup_user['post_title_s'] = dcThemeConfig::adjustFontSize($_POST['post_title_s']);
-		$blowup_user['post_title_c'] = dcThemeConfig::adjustColor($_POST['post_title_c']);
-		$blowup_user['post_comment_c'] = dcThemeConfig::adjustColor($_POST['post_comment_c']);
-		$blowup_user['post_commentmy_c'] = dcThemeConfig::adjustColor($_POST['post_commentmy_c']);
-
-
-		$blowup_user['footer_f'] = $_POST['footer_f'];
-		$blowup_user['footer_s'] = dcThemeConfig::adjustFontSize($_POST['footer_s']);
-		$blowup_user['footer_c'] = dcThemeConfig::adjustColor($_POST['footer_c']);
-		$blowup_user['footer_l_c'] = dcThemeConfig::adjustColor($_POST['footer_l_c']);
-		$blowup_user['footer_bg_c'] = dcThemeConfig::adjustColor($_POST['footer_bg_c']);
-
-
-		$blowup_user['extra_css'] = dcThemeConfig::cleanCSS($_POST['extra_css']);
-
-		if ($can_write_images)
-		{
-			$uploaded = null;
-			if ($blowup_user['uploaded'] && is_file(blowupConfig::imagesPath().'/'.$blowup_user['uploaded'])) {
-				$uploaded = blowupConfig::imagesPath().'/'.$blowup_user['uploaded'];
-			}
-
-			if (!empty($_FILES['upfile']) && !empty($_FILES['upfile']['name'])) {
-				files::uploadStatus($_FILES['upfile']);
-				$uploaded = blowupConfig::uploadImage($_FILES['upfile']);
-				$blowup_user['uploaded'] = basename($uploaded);
-			}
-
-			$blowup_user['top_image'] = in_array($_POST['top_image'],$top_images) ? $_POST['top_image'] : 'default';
-
-			$blowup_user['body_bg_c'] = dcThemeConfig::adjustColor($_POST['body_bg_c']);
-			$blowup_user['body_bg_g'] = in_array($_POST['body_bg_g'],$gradient_types) ? $_POST['body_bg_g'] : '';
-			$blowup_user['post_comment_bg_c'] = dcThemeConfig::adjustColor($_POST['post_comment_bg_c']);
-			$blowup_user['post_commentmy_bg_c'] = dcThemeConfig::adjustColor($_POST['post_commentmy_bg_c']);
-			$blowup_user['prelude_c'] = dcThemeConfig::adjustColor($_POST['prelude_c']);
-			blowupConfig::createImages($blowup_user,$uploaded);
-		}
-
-		if ($can_write_css)
-		{
-			blowupConfig::createCss($blowup_user);
-		}
-
-		$core->blog->settings->addNamespace('themes');
-		$core->blog->settings->themes->put('blowup_style',serialize($blowup_user));
-		$core->blog->triggerBlog();
-
-		dcPage::addSuccessNotice(__('Theme configuration has been successfully updated.'));
-		http::redirect($p_url);
-	}
-	catch (Exception $e)
-	{
-		$core->error->add($e->getMessage());
-	}
+$top_images = array_merge($top_images, array_flip(blowupConfig::$top_images));
+
+if (!empty($_POST)) {
+    try
+    {
+        $blowup_user['body_txt_f']       = $_POST['body_txt_f'];
+        $blowup_user['body_txt_s']       = dcThemeConfig::adjustFontSize($_POST['body_txt_s']);
+        $blowup_user['body_txt_c']       = dcThemeConfig::adjustColor($_POST['body_txt_c']);
+        $blowup_user['body_line_height'] = dcThemeConfig::adjustFontSize($_POST['body_line_height']);
+
+        $blowup_user['blog_title_hide'] = (integer) !empty($_POST['blog_title_hide']);
+        $update_blog_title              = !$blowup_user['blog_title_hide'] && (
+            !empty($_POST['blog_title_f']) || !empty($_POST['blog_title_s']) ||
+            !empty($_POST['blog_title_c']) || !empty($_POST['blog_title_a']) ||
+            !empty($_POST['blog_title_p'])
+        );
+
+        if ($update_blog_title) {
+            $blowup_user['blog_title_f'] = $_POST['blog_title_f'];
+            $blowup_user['blog_title_s'] = dcThemeConfig::adjustFontSize($_POST['blog_title_s']);
+            $blowup_user['blog_title_c'] = dcThemeConfig::adjustColor($_POST['blog_title_c']);
+            $blowup_user['blog_title_a'] = preg_match('/^(left|center|right)$/', $_POST['blog_title_a']) ? $_POST['blog_title_a'] : null;
+            $blowup_user['blog_title_p'] = dcThemeConfig::adjustPosition($_POST['blog_title_p']);
+        }
+
+        $blowup_user['body_link_c']   = dcThemeConfig::adjustColor($_POST['body_link_c']);
+        $blowup_user['body_link_f_c'] = dcThemeConfig::adjustColor($_POST['body_link_f_c']);
+        $blowup_user['body_link_v_c'] = dcThemeConfig::adjustColor($_POST['body_link_v_c']);
+
+        $blowup_user['sidebar_text_f']   = $_POST['sidebar_text_f'];
+        $blowup_user['sidebar_text_s']   = dcThemeConfig::adjustFontSize($_POST['sidebar_text_s']);
+        $blowup_user['sidebar_text_c']   = dcThemeConfig::adjustColor($_POST['sidebar_text_c']);
+        $blowup_user['sidebar_title_f']  = $_POST['sidebar_title_f'];
+        $blowup_user['sidebar_title_s']  = dcThemeConfig::adjustFontSize($_POST['sidebar_title_s']);
+        $blowup_user['sidebar_title_c']  = dcThemeConfig::adjustColor($_POST['sidebar_title_c']);
+        $blowup_user['sidebar_title2_f'] = $_POST['sidebar_title2_f'];
+        $blowup_user['sidebar_title2_s'] = dcThemeConfig::adjustFontSize($_POST['sidebar_title2_s']);
+        $blowup_user['sidebar_title2_c'] = dcThemeConfig::adjustColor($_POST['sidebar_title2_c']);
+        $blowup_user['sidebar_line_c']   = dcThemeConfig::adjustColor($_POST['sidebar_line_c']);
+        $blowup_user['sidebar_link_c']   = dcThemeConfig::adjustColor($_POST['sidebar_link_c']);
+        $blowup_user['sidebar_link_f_c'] = dcThemeConfig::adjustColor($_POST['sidebar_link_f_c']);
+        $blowup_user['sidebar_link_v_c'] = dcThemeConfig::adjustColor($_POST['sidebar_link_v_c']);
+
+        $blowup_user['sidebar_position'] = ($_POST['sidebar_position'] == 'left') ? 'left' : null;
+
+        $blowup_user['date_title_f'] = $_POST['date_title_f'];
+        $blowup_user['date_title_s'] = dcThemeConfig::adjustFontSize($_POST['date_title_s']);
+        $blowup_user['date_title_c'] = dcThemeConfig::adjustColor($_POST['date_title_c']);
+
+        $blowup_user['post_title_f']     = $_POST['post_title_f'];
+        $blowup_user['post_title_s']     = dcThemeConfig::adjustFontSize($_POST['post_title_s']);
+        $blowup_user['post_title_c']     = dcThemeConfig::adjustColor($_POST['post_title_c']);
+        $blowup_user['post_comment_c']   = dcThemeConfig::adjustColor($_POST['post_comment_c']);
+        $blowup_user['post_commentmy_c'] = dcThemeConfig::adjustColor($_POST['post_commentmy_c']);
+
+        $blowup_user['footer_f']    = $_POST['footer_f'];
+        $blowup_user['footer_s']    = dcThemeConfig::adjustFontSize($_POST['footer_s']);
+        $blowup_user['footer_c']    = dcThemeConfig::adjustColor($_POST['footer_c']);
+        $blowup_user['footer_l_c']  = dcThemeConfig::adjustColor($_POST['footer_l_c']);
+        $blowup_user['footer_bg_c'] = dcThemeConfig::adjustColor($_POST['footer_bg_c']);
+
+        $blowup_user['extra_css'] = dcThemeConfig::cleanCSS($_POST['extra_css']);
+
+        if ($can_write_images) {
+            $uploaded = null;
+            if ($blowup_user['uploaded'] && is_file(blowupConfig::imagesPath() . '/' . $blowup_user['uploaded'])) {
+                $uploaded = blowupConfig::imagesPath() . '/' . $blowup_user['uploaded'];
+            }
+
+            if (!empty($_FILES['upfile']) && !empty($_FILES['upfile']['name'])) {
+                files::uploadStatus($_FILES['upfile']);
+                $uploaded                = blowupConfig::uploadImage($_FILES['upfile']);
+                $blowup_user['uploaded'] = basename($uploaded);
+            }
+
+            $blowup_user['top_image'] = in_array($_POST['top_image'], $top_images) ? $_POST['top_image'] : 'default';
+
+            $blowup_user['body_bg_c']           = dcThemeConfig::adjustColor($_POST['body_bg_c']);
+            $blowup_user['body_bg_g']           = in_array($_POST['body_bg_g'], $gradient_types) ? $_POST['body_bg_g'] : '';
+            $blowup_user['post_comment_bg_c']   = dcThemeConfig::adjustColor($_POST['post_comment_bg_c']);
+            $blowup_user['post_commentmy_bg_c'] = dcThemeConfig::adjustColor($_POST['post_commentmy_bg_c']);
+            $blowup_user['prelude_c']           = dcThemeConfig::adjustColor($_POST['prelude_c']);
+            blowupConfig::createImages($blowup_user, $uploaded);
+        }
+
+        if ($can_write_css) {
+            blowupConfig::createCss($blowup_user);
+        }
+
+        $core->blog->settings->addNamespace('themes');
+        $core->blog->settings->themes->put('blowup_style', serialize($blowup_user));
+        $core->blog->triggerBlog();
+
+        dcPage::addSuccessNotice(__('Theme configuration has been successfully updated.'));
+        http::redirect($p_url);
+    } catch (Exception $e) {
+        $core->error->add($e->getMessage());
+    }
 }
 ?>
@@ -212,14 +203,14 @@
 <head>
   <title><?php echo __('Blowup configuration'); ?></title>
-  <?php echo dcPage::jsLoad(dcPage::getPF('blowupConfig/config.js')); ?>
-  <?php echo dcPage::jsColorPicker(); ?>
-  <script type="text/javascript">
   <?php
-  echo dcPage::jsVar('dotclear.blowup_public_url',blowupConfig::imagesURL());
-  echo dcPage::jsVar('dotclear.msg.predefined_styles',__('Predefined styles'));
-  echo dcPage::jsVar('dotclear.msg.apply_code',__('Apply code'));
-  echo dcPage::jsVar('dotclear.msg.predefined_style_title',__('Choose a predefined style'));
-  ?>
-  </script>
+echo dcPage::jsLoad(dcPage::getPF('blowupConfig/js/config.js'));
+echo dcPage::jsColorPicker();
+echo dcPage::jsVars(array(
+    'dotclear.blowup_public_url'          => blowupConfig::imagesURL(),
+    'dotclear.msg.predefined_styles'      => __('Predefined styles'),
+    'dotclear.msg.apply_code'             => __('Apply code'),
+    'dotclear.msg.predefined_style_title' => __('Choose a predefined style')
+));
+?>
 </head>
 
@@ -227,239 +218,236 @@
 <?php
 echo dcPage::breadcrumb(
-	array(
-		html::escapeHTML($core->blog->name) => '',
-		__('Blog appearance') => $core->adminurl->get('admin.blog.theme'),
-		__('Blowup configuration') => ''
-	)).dcPage::notices();
-
-echo
-'<p><a class="back" href="'.$core->adminurl->get('admin.blog.theme').'">'.__('Back to Blog appearance').'</a></p>';
-
+    array(
+        html::escapeHTML($core->blog->name) => '',
+        __('Blog appearance')               => $core->adminurl->get('admin.blog.theme'),
+        __('Blowup configuration')          => ''
+    )) . dcPage::notices();
+
+echo
+'<p><a class="back" href="' . $core->adminurl->get('admin.blog.theme') . '">' . __('Back to Blog appearance') . '</a></p>';
 
 if (!$can_write_images) {
-	dcPage::message(__('For the following reasons, images cannot be created. You won\'t be able to change some background properties.').
-		$notices,false,true);
-}
-
-echo '<form id="theme_config" action="'.$p_url.'" method="post" enctype="multipart/form-data">';
-
-echo '<div class="fieldset"><h3>'.__('Customization').'</h3>'.
-'<h4>'.__('General').'</h4>';
+    dcPage::message(__('For the following reasons, images cannot be created. You won\'t be able to change some background properties.') .
+        $notices, false, true);
+}
+
+echo '<form id="theme_config" action="' . $p_url . '" method="post" enctype="multipart/form-data">';
+
+echo '<div class="fieldset"><h3>' . __('Customization') . '</h3>' .
+'<h4>' . __('General') . '</h4>';
 
 if ($can_write_images) {
-	echo
-	'<p class="field"><label for="body_bg_c">'.__('Background color:').'</label> '.
-	form::field('body_bg_c',7,7,$blowup_user['body_bg_c'],'colorpicker').'</p>'.
-
-	'<p class="field"><label for="body_bg_g">'.__('Background color fill:').'</label> '.
-	form::combo('body_bg_g',$gradient_types,$blowup_user['body_bg_g']).'</p>';
-}
-
-echo
-'<p class="field"><label for="body_txt_f">'.__('Main text font:').'</label> '.
-form::combo('body_txt_f',blowupConfig::fontsList(),$blowup_user['body_txt_f']).'</p>'.
-
-'<p class="field"><label for="body_txt_s">'.__('Main text font size:').'</label> '.
-form::field('body_txt_s',7,7,$blowup_user['body_txt_s']).'</p>'.
-
-'<p class="field"><label for="body_txt_c">'.__('Main text color:').'</label> '.
-form::field('body_txt_c',7,7,$blowup_user['body_txt_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="body_line_height">'.__('Text line height:').'</label> '.
-form::field('body_line_height',7,7,$blowup_user['body_line_height']).'</p>'.
-
-'<h4 class="border-top">'.__('Links').'</h4>'.
-'<p class="field"><label for="body_link_c">'.__('Links color:').'</label> '.
-form::field('body_link_c',7,7,$blowup_user['body_link_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="body_link_v_c">'.__('Visited links color:').'</label> '.
-form::field('body_link_v_c',7,7,$blowup_user['body_link_v_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="body_link_f_c">'.__('Focus links color:').'</label> '.
-form::field('body_link_f_c',7,7,$blowup_user['body_link_f_c'],'colorpicker').'</p>'.
-
-'<h4 class="border-top">'.__('Page top').'</h4>';
+    echo
+    '<p class="field"><label for="body_bg_c">' . __('Background color:') . '</label> ' .
+    form::field('body_bg_c', 7, 7, $blowup_user['body_bg_c'], 'colorpicker') . '</p>' .
+
+    '<p class="field"><label for="body_bg_g">' . __('Background color fill:') . '</label> ' .
+    form::combo('body_bg_g', $gradient_types, $blowup_user['body_bg_g']) . '</p>';
+}
+
+echo
+'<p class="field"><label for="body_txt_f">' . __('Main text font:') . '</label> ' .
+form::combo('body_txt_f', blowupConfig::fontsList(), $blowup_user['body_txt_f']) . '</p>' .
+
+'<p class="field"><label for="body_txt_s">' . __('Main text font size:') . '</label> ' .
+form::field('body_txt_s', 7, 7, $blowup_user['body_txt_s']) . '</p>' .
+
+'<p class="field"><label for="body_txt_c">' . __('Main text color:') . '</label> ' .
+form::field('body_txt_c', 7, 7, $blowup_user['body_txt_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="body_line_height">' . __('Text line height:') . '</label> ' .
+form::field('body_line_height', 7, 7, $blowup_user['body_line_height']) . '</p>' .
+
+'<h4 class="border-top">' . __('Links') . '</h4>' .
+'<p class="field"><label for="body_link_c">' . __('Links color:') . '</label> ' .
+form::field('body_link_c', 7, 7, $blowup_user['body_link_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="body_link_v_c">' . __('Visited links color:') . '</label> ' .
+form::field('body_link_v_c', 7, 7, $blowup_user['body_link_v_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="body_link_f_c">' . __('Focus links color:') . '</label> ' .
+form::field('body_link_f_c', 7, 7, $blowup_user['body_link_f_c'], 'colorpicker') . '</p>' .
+
+'<h4 class="border-top">' . __('Page top') . '</h4>';
 
 if ($can_write_images) {
-	echo
-	'<p class="field"><label for="prelude_c">'.__('Prelude color:').'</label> '.
-	form::field('prelude_c',7,7,$blowup_user['prelude_c'],'colorpicker').'</p>';
-}
-
-echo
-'<p class="field"><label for="blog_title_hide">'.__('Hide main title').'</label> '.
-form::checkbox('blog_title_hide',1,$blowup_user['blog_title_hide']).'</p>'.
-
-'<p class="field"><label for="blog_title_f">'.__('Main title font:').'</label> '.
-form::combo('blog_title_f',blowupConfig::fontsList(),$blowup_user['blog_title_f']).'</p>'.
-
-'<p class="field"><label for="blog_title_s">'.__('Main title font size:').'</label> '.
-form::field('blog_title_s',7,7,$blowup_user['blog_title_s']).'</p>'.
-
-'<p class="field"><label for="blog_title_c">'.__('Main title color:').'</label> '.
-form::field('blog_title_c',7,7,$blowup_user['blog_title_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="blog_title_a">'.__('Main title alignment:').'</label> '.
-form::combo('blog_title_a',array(__('center')=>'center',__('left')=>'left',__('right')=>'right'),$blowup_user['blog_title_a']).'</p>'.
-
-'<p class="field"><label for="blog_title_p">'.__('Main title position (x:y)').'</label> '.
-form::field('blog_title_p',7,7,$blowup_user['blog_title_p']).'</p>';
+    echo
+    '<p class="field"><label for="prelude_c">' . __('Prelude color:') . '</label> ' .
+    form::field('prelude_c', 7, 7, $blowup_user['prelude_c'], 'colorpicker') . '</p>';
+}
+
+echo
+'<p class="field"><label for="blog_title_hide">' . __('Hide main title') . '</label> ' .
+form::checkbox('blog_title_hide', 1, $blowup_user['blog_title_hide']) . '</p>' .
+
+'<p class="field"><label for="blog_title_f">' . __('Main title font:') . '</label> ' .
+form::combo('blog_title_f', blowupConfig::fontsList(), $blowup_user['blog_title_f']) . '</p>' .
+
+'<p class="field"><label for="blog_title_s">' . __('Main title font size:') . '</label> ' .
+form::field('blog_title_s', 7, 7, $blowup_user['blog_title_s']) . '</p>' .
+
+'<p class="field"><label for="blog_title_c">' . __('Main title color:') . '</label> ' .
+form::field('blog_title_c', 7, 7, $blowup_user['blog_title_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="blog_title_a">' . __('Main title alignment:') . '</label> ' .
+form::combo('blog_title_a', array(__('center') => 'center', __('left') => 'left', __('right') => 'right'), $blowup_user['blog_title_a']) . '</p>' .
+
+'<p class="field"><label for="blog_title_p">' . __('Main title position (x:y)') . '</label> ' .
+form::field('blog_title_p', 7, 7, $blowup_user['blog_title_p']) . '</p>';
 
 if ($can_write_images) {
-	if ($blowup_user['top_image'] == 'custom' && $blowup_user['uploaded']) {
-		$preview_image = http::concatURL($core->blog->url,blowupConfig::imagesURL().'/page-t.png');
-	} else {
-		$preview_image = dcPage::getPF('blowupConfig/alpha-img/page-t/'.$blowup_user['top_image'].'.png');
-	}
-
-	echo
-	'<h5 class="pretty-title">'.__('Top image').'</h5>'.
-	'<p class="field"><label for="top_image">'.__('Top image').'</label> '.
-	form::combo('top_image',$top_images,($blowup_user['top_image'] ?: 'default')).'</p>'.
-	'<p>'.__('Choose "Custom..." to upload your own image.').'</p>'.
-
-	'<p id="uploader"><label for="upfile">'.__('Add your image:').'</label> '.
-	' ('.sprintf(__('JPEG or PNG file, 800 pixels wide, maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).')'.
-	'<input type="file" name="upfile" id="upfile" size="35" />'.
-	'</p>'.
-
-	'<h5>'.__('Preview').'</h5>'.
-	'<div class="grid" style="width:800px;border:1px solid #ccc;">'.
-	'<img style="display:block;" src="'.$preview_image.'" alt="" id="image-preview" />'.
-	'</div>';
-}
-
-echo
-'<h4 class="border-top">'.__('Sidebar').'</h4>'.
-'<p class="field"><label for="sidebar_position">'.__('Sidebar position:').'</label> '.
-form::combo('sidebar_position',array(__('right')=>'right',__('left')=>'left'),$blowup_user['sidebar_position']).'</p>'.
-
-'<p class="field"><label for="sidebar_text_f">'.__('Sidebar text font:').'</label> '.
-form::combo('sidebar_text_f',blowupConfig::fontsList(),$blowup_user['sidebar_text_f']).'</p>'.
-
-'<p class="field"><label for="sidebar_text_s">'.__('Sidebar text font size:').'</label> '.
-form::field('sidebar_text_s',7,7,$blowup_user['sidebar_text_s']).'</p>'.
-
-'<p class="field"><label for="sidebar_text_c">'.__('Sidebar text color:').'</label> '.
-form::field('sidebar_text_c',7,7,$blowup_user['sidebar_text_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="sidebar_title_f">'.__('Sidebar titles font:').'</label> '.
-form::combo('sidebar_title_f',blowupConfig::fontsList(),$blowup_user['sidebar_title_f']).'</p>'.
-
-'<p class="field"><label for="sidebar_title_s">'.__('Sidebar titles font size:').'</label> '.
-form::field('sidebar_title_s',7,7,$blowup_user['sidebar_title_s']).'</p>'.
-
-'<p class="field"><label for="sidebar_title_c">'.__('Sidebar titles color:').'</label> '.
-form::field('sidebar_title_c',7,7,$blowup_user['sidebar_title_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="sidebar_title2_f">'.__('Sidebar 2nd level titles font:').'</label> '.
-form::combo('sidebar_title2_f',blowupConfig::fontsList(),$blowup_user['sidebar_title2_f']).'</p>'.
-
-'<p class="field"><label for="sidebar_title2_s">'.__('Sidebar 2nd level titles font size:').'</label> '.
-form::field('sidebar_title2_s',7,7,$blowup_user['sidebar_title2_s']).'</p>'.
-
-'<p class="field"><label for="sidebar_title2_c">'.__('Sidebar 2nd level titles color:').'</label> '.
-form::field('sidebar_title2_c',7,7,$blowup_user['sidebar_title2_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="sidebar_line_c">'.__('Sidebar lines color:').'</label> '.
-form::field('sidebar_line_c',7,7,$blowup_user['sidebar_line_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="sidebar_link_c">'.__('Sidebar links color:').'</label> '.
-form::field('sidebar_link_c',7,7,$blowup_user['sidebar_link_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="sidebar_link_v_c">'.__('Sidebar visited links color:').'</label> '.
-form::field('sidebar_link_v_c',7,7,$blowup_user['sidebar_link_v_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="sidebar_link_f_c">'.__('Sidebar focus links color:').'</label> '.
-form::field('sidebar_link_f_c',7,7,$blowup_user['sidebar_link_f_c'],'colorpicker').'</p>'.
-
-'<h4 class="border-top">'.__('Entries').'</h4>'.
-'<p class="field"><label for="date_title_f">'.__('Date title font:').'</label> '.
-form::combo('date_title_f',blowupConfig::fontsList(),$blowup_user['date_title_f']).'</p>'.
-
-'<p class="field"><label for="date_title_s">'.__('Date title font size:').'</label> '.
-form::field('date_title_s',7,7,$blowup_user['date_title_s']).'</p>'.
-
-'<p class="field"><label for="date_title_c">'.__('Date title color:').'</label> '.
-form::field('date_title_c',7,7,$blowup_user['date_title_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="post_title_f">'.__('Entry title font:').'</label> '.
-form::combo('post_title_f',blowupConfig::fontsList(),$blowup_user['post_title_f']).'</p>'.
-
-'<p class="field"><label for="post_title_s">'.__('Entry title font size:').'</label> '.
-form::field('post_title_s',7,7,$blowup_user['post_title_s']).'</p>'.
-
-'<p class="field"><label for="post_title_c">'.__('Entry title color:').'</label> '.
-form::field('post_title_c',7,7,$blowup_user['post_title_c'],'colorpicker').'</p>';
+    if ($blowup_user['top_image'] == 'custom' && $blowup_user['uploaded']) {
+        $preview_image = http::concatURL($core->blog->url, blowupConfig::imagesURL() . '/page-t.png');
+    } else {
+        $preview_image = dcPage::getPF('blowupConfig/alpha-img/page-t/' . $blowup_user['top_image'] . '.png');
+    }
+
+    echo
+    '<h5 class="pretty-title">' . __('Top image') . '</h5>' .
+    '<p class="field"><label for="top_image">' . __('Top image') . '</label> ' .
+    form::combo('top_image', $top_images, ($blowup_user['top_image'] ?: 'default')) . '</p>' .
+    '<p>' . __('Choose "Custom..." to upload your own image.') . '</p>' .
+
+    '<p id="uploader"><label for="upfile">' . __('Add your image:') . '</label> ' .
+    ' (' . sprintf(__('JPEG or PNG file, 800 pixels wide, maximum size %s'), files::size(DC_MAX_UPLOAD_SIZE)) . ')' .
+    '<input type="file" name="upfile" id="upfile" size="35" />' .
+    '</p>' .
+
+    '<h5>' . __('Preview') . '</h5>' .
+        '<div class="grid" style="width:800px;border:1px solid #ccc;">' .
+        '<img style="display:block;" src="' . $preview_image . '" alt="" id="image-preview" />' .
+        '</div>';
+}
+
+echo
+'<h4 class="border-top">' . __('Sidebar') . '</h4>' .
+'<p class="field"><label for="sidebar_position">' . __('Sidebar position:') . '</label> ' .
+form::combo('sidebar_position', array(__('right') => 'right', __('left') => 'left'), $blowup_user['sidebar_position']) . '</p>' .
+
+'<p class="field"><label for="sidebar_text_f">' . __('Sidebar text font:') . '</label> ' .
+form::combo('sidebar_text_f', blowupConfig::fontsList(), $blowup_user['sidebar_text_f']) . '</p>' .
+
+'<p class="field"><label for="sidebar_text_s">' . __('Sidebar text font size:') . '</label> ' .
+form::field('sidebar_text_s', 7, 7, $blowup_user['sidebar_text_s']) . '</p>' .
+
+'<p class="field"><label for="sidebar_text_c">' . __('Sidebar text color:') . '</label> ' .
+form::field('sidebar_text_c', 7, 7, $blowup_user['sidebar_text_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="sidebar_title_f">' . __('Sidebar titles font:') . '</label> ' .
+form::combo('sidebar_title_f', blowupConfig::fontsList(), $blowup_user['sidebar_title_f']) . '</p>' .
+
+'<p class="field"><label for="sidebar_title_s">' . __('Sidebar titles font size:') . '</label> ' .
+form::field('sidebar_title_s', 7, 7, $blowup_user['sidebar_title_s']) . '</p>' .
+
+'<p class="field"><label for="sidebar_title_c">' . __('Sidebar titles color:') . '</label> ' .
+form::field('sidebar_title_c', 7, 7, $blowup_user['sidebar_title_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="sidebar_title2_f">' . __('Sidebar 2nd level titles font:') . '</label> ' .
+form::combo('sidebar_title2_f', blowupConfig::fontsList(), $blowup_user['sidebar_title2_f']) . '</p>' .
+
+'<p class="field"><label for="sidebar_title2_s">' . __('Sidebar 2nd level titles font size:') . '</label> ' .
+form::field('sidebar_title2_s', 7, 7, $blowup_user['sidebar_title2_s']) . '</p>' .
+
+'<p class="field"><label for="sidebar_title2_c">' . __('Sidebar 2nd level titles color:') . '</label> ' .
+form::field('sidebar_title2_c', 7, 7, $blowup_user['sidebar_title2_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="sidebar_line_c">' . __('Sidebar lines color:') . '</label> ' .
+form::field('sidebar_line_c', 7, 7, $blowup_user['sidebar_line_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="sidebar_link_c">' . __('Sidebar links color:') . '</label> ' .
+form::field('sidebar_link_c', 7, 7, $blowup_user['sidebar_link_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="sidebar_link_v_c">' . __('Sidebar visited links color:') . '</label> ' .
+form::field('sidebar_link_v_c', 7, 7, $blowup_user['sidebar_link_v_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="sidebar_link_f_c">' . __('Sidebar focus links color:') . '</label> ' .
+form::field('sidebar_link_f_c', 7, 7, $blowup_user['sidebar_link_f_c'], 'colorpicker') . '</p>' .
+
+'<h4 class="border-top">' . __('Entries') . '</h4>' .
+'<p class="field"><label for="date_title_f">' . __('Date title font:') . '</label> ' .
+form::combo('date_title_f', blowupConfig::fontsList(), $blowup_user['date_title_f']) . '</p>' .
+
+'<p class="field"><label for="date_title_s">' . __('Date title font size:') . '</label> ' .
+form::field('date_title_s', 7, 7, $blowup_user['date_title_s']) . '</p>' .
+
+'<p class="field"><label for="date_title_c">' . __('Date title color:') . '</label> ' .
+form::field('date_title_c', 7, 7, $blowup_user['date_title_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="post_title_f">' . __('Entry title font:') . '</label> ' .
+form::combo('post_title_f', blowupConfig::fontsList(), $blowup_user['post_title_f']) . '</p>' .
+
+'<p class="field"><label for="post_title_s">' . __('Entry title font size:') . '</label> ' .
+form::field('post_title_s', 7, 7, $blowup_user['post_title_s']) . '</p>' .
+
+'<p class="field"><label for="post_title_c">' . __('Entry title color:') . '</label> ' .
+form::field('post_title_c', 7, 7, $blowup_user['post_title_c'], 'colorpicker') . '</p>';
 
 if ($can_write_images) {
-	echo
-	'<p class="field"><label for="post_comment_bg_c">'.__('Comment background color:').'</label> '.
-	form::field('post_comment_bg_c',7,7,$blowup_user['post_comment_bg_c'],'colorpicker').'</p>';
-}
-
-echo
-'<p class="field"><label for="post_comment_c">'.__('Comment text color:').'</label> '.
-form::field('post_comment_c',7,7,$blowup_user['post_comment_c'],'colorpicker').'</p>';
+    echo
+    '<p class="field"><label for="post_comment_bg_c">' . __('Comment background color:') . '</label> ' .
+    form::field('post_comment_bg_c', 7, 7, $blowup_user['post_comment_bg_c'], 'colorpicker') . '</p>';
+}
+
+echo
+'<p class="field"><label for="post_comment_c">' . __('Comment text color:') . '</label> ' .
+form::field('post_comment_c', 7, 7, $blowup_user['post_comment_c'], 'colorpicker') . '</p>';
 
 if ($can_write_images) {
-	echo
-	'<p class="field"><label for="post_commentmy_bg_c">'.__('My comment background color:').'</label> '.
-	form::field('post_commentmy_bg_c',7,7,$blowup_user['post_commentmy_bg_c'],'colorpicker').'</p>';
-}
-
-echo
-'<p class="field"><label for="post_commentmy_c">'.__('My comment text color:').'</label> '.
-form::field('post_commentmy_c',7,7,$blowup_user['post_commentmy_c'],'colorpicker').'</p>'.
-
-'<h4 class="border-top">'.__('Footer').'</h4>'.
-'<p class="field"><label for="footer_f">'.__('Footer font:').'</label> '.
-form::combo('footer_f',blowupConfig::fontsList(),$blowup_user['footer_f']).'</p>'.
-
-'<p class="field"><label for="footer_s">'.__('Footer font size:').'</label> '.
-form::field('footer_s',7,7,$blowup_user['footer_s']).'</p>'.
-
-'<p class="field"><label for="footer_c">'.__('Footer color:').'</label> '.
-form::field('footer_c',7,7,$blowup_user['footer_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="footer_l_c">'.__('Footer links color:').'</label> '.
-form::field('footer_l_c',7,7,$blowup_user['footer_l_c'],'colorpicker').'</p>'.
-
-'<p class="field"><label for="footer_bg_c">'.__('Footer background color:').'</label> '.
-form::field('footer_bg_c',7,7,$blowup_user['footer_bg_c'],'colorpicker').'</p>';
-
-echo
-'<h4 class="border-top">'.__('Additional CSS').'</h4>'.
-'<p><label for="extra_css">'.__('Any additional CSS styles (must be written using the CSS syntax):').'</label> '.
-form::textarea('extra_css',72,5,html::escapeHTML($blowup_user['extra_css']),'maximal','',false,'title="'.__('Additional CSS').'"').
-'</p>'.
-'</div>';
-
-
+    echo
+    '<p class="field"><label for="post_commentmy_bg_c">' . __('My comment background color:') . '</label> ' .
+    form::field('post_commentmy_bg_c', 7, 7, $blowup_user['post_commentmy_bg_c'], 'colorpicker') . '</p>';
+}
+
+echo
+'<p class="field"><label for="post_commentmy_c">' . __('My comment text color:') . '</label> ' .
+form::field('post_commentmy_c', 7, 7, $blowup_user['post_commentmy_c'], 'colorpicker') . '</p>' .
+
+'<h4 class="border-top">' . __('Footer') . '</h4>' .
+'<p class="field"><label for="footer_f">' . __('Footer font:') . '</label> ' .
+form::combo('footer_f', blowupConfig::fontsList(), $blowup_user['footer_f']) . '</p>' .
+
+'<p class="field"><label for="footer_s">' . __('Footer font size:') . '</label> ' .
+form::field('footer_s', 7, 7, $blowup_user['footer_s']) . '</p>' .
+
+'<p class="field"><label for="footer_c">' . __('Footer color:') . '</label> ' .
+form::field('footer_c', 7, 7, $blowup_user['footer_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="footer_l_c">' . __('Footer links color:') . '</label> ' .
+form::field('footer_l_c', 7, 7, $blowup_user['footer_l_c'], 'colorpicker') . '</p>' .
+
+'<p class="field"><label for="footer_bg_c">' . __('Footer background color:') . '</label> ' .
+form::field('footer_bg_c', 7, 7, $blowup_user['footer_bg_c'], 'colorpicker') . '</p>';
+
+echo
+'<h4 class="border-top">' . __('Additional CSS') . '</h4>' .
+'<p><label for="extra_css">' . __('Any additional CSS styles (must be written using the CSS syntax):') . '</label> ' .
+form::textarea('extra_css', 72, 5, html::escapeHTML($blowup_user['extra_css']), 'maximal', '', false, 'title="' . __('Additional CSS') . '"') .
+    '</p>' .
+    '</div>';
 
 // Import / Export configuration
-$tmp_array = array();
-$tmp_exclude = array('uploaded','top_height');
+$tmp_array   = array();
+$tmp_exclude = array('uploaded', 'top_height');
 if ($blowup_user['top_image'] == 'custom') {
-	$tmp_exclude[] = 'top_image';
+    $tmp_exclude[] = 'top_image';
 }
 foreach ($blowup_user as $k => $v) {
-	if (!in_array($k,$tmp_exclude)) {
-		$tmp_array[] = $k.':'.'"'.$v.'"';
-	}
-}
-echo
-'<div class="fieldset">'.
-'<h3 id="bu_export">'.__('Configuration import / export').'</h3>'.
-'<div id="bu_export_content">'.
-'<p>'.__('You can share your configuration using the following code. To apply a configuration, paste the code, click on "Apply code" and save.').'</p>'.
-'<p>'.form::textarea('export_code',72,5,implode('; ',$tmp_array),'maximal','',false,'title="'.__('Copy this code:').'"').'</p>'.
-'</div>'.
-'</div>';
-
-echo
-'<p class="clear"><input type="submit" value="'.__('Save').'" />'.
-$core->formNonce().'</p>'.
-'</form>';
+    if (!in_array($k, $tmp_exclude)) {
+        $tmp_array[] = $k . ':' . '"' . $v . '"';
+    }
+}
+echo
+'<div class="fieldset">' .
+'<h3 id="bu_export">' . __('Configuration import / export') . '</h3>' .
+'<div id="bu_export_content">' .
+'<p>' . __('You can share your configuration using the following code. To apply a configuration, paste the code, click on "Apply code" and save.') . '</p>' .
+'<p>' . form::textarea('export_code', 72, 5, implode('; ', $tmp_array), 'maximal', '', false, 'title="' . __('Copy this code:') . '"') . '</p>' .
+    '</div>' .
+    '</div>';
+
+echo
+'<p class="clear"><input type="submit" value="' . __('Save') . '" />' .
+$core->formNonce() . '</p>' .
+    '</form>';
 
 dcPage::helpBlock('blowupConfig');
Index: plugins/blowupConfig/js/config.js
===================================================================
--- plugins/blowupConfig/js/config.js	(revision 3709)
+++ plugins/blowupConfig/js/config.js	(revision 3709)
@@ -0,0 +1,165 @@
+/*global $, dotclear */
+'use strict';
+
+$(function() {
+  // Hide main title
+  if ($('#blog_title_hide').prop('checked')) {
+    toggleDisable($('#blog_title_f'));
+    toggleDisable($('#blog_title_s'));
+    toggleDisable($('#blog_title_c'));
+    toggleDisable($('#blog_title_a'));
+    toggleDisable($('#blog_title_p'));
+  }
+
+  $('#blog_title_hide').click(function() {
+    toggleDisable($('#blog_title_f'));
+    toggleDisable($('#blog_title_s'));
+    toggleDisable($('#blog_title_c'));
+    toggleDisable($('#blog_title_a'));
+    toggleDisable($('#blog_title_p'));
+  });
+
+  // Upload form
+  if ($('#top_image').val() == 'custom') {
+    $('#uploader').show();
+  } else {
+    $('#uploader').hide();
+  }
+
+  $('#top_image').change(function() {
+    if (this.value == 'custom') {
+      $('#uploader').show();
+      $('#image-preview').attr('src', dotclear.blowup_public_url + '/page-t.png');
+    } else {
+      $('#uploader').hide();
+      $('#uploader input').val('');
+      $('#image-preview').attr('src', 'index.php?pf=blowupConfig/alpha-img/page-t/' + this.value + '.png');
+    }
+  });
+
+  // Predefined styles
+  var styles_combo = document.createElement('select');
+  $(styles_combo).append('<option value="">&nbsp;</option>');
+  $(styles_combo).append('<option value="none">none</option>');
+  $(styles_combo).attr('title', dotclear.msg.predefined_style_title);
+
+  for (var style in dotclear.blowup_styles) {
+    var styles_option = document.createElement('option');
+    styles_option.value = dotclear.blowup_styles[style];
+    $(styles_option).append(style);
+    $(styles_combo).append(styles_option);
+  }
+
+  $('#theme_config').prepend(styles_combo);
+  $(styles_combo).wrap('<div class="fieldset"></div>').before('<h3>' + dotclear.msg.predefined_styles + '</h3>').wrap('<p></p>');
+
+  $(styles_combo).change(function() {
+    $(this.form).find('input[type=text]').val('').css({
+      backgroundColor: '#FFF',
+      color: '#000'
+    });
+    $(this.form).find('select').not($(this)).val('');
+    $(this.form).find('#extra_css').val('');
+    $('#top_image').val('default');
+    if (this.value != 'none') {
+      applyBlowupValues(this.value);
+    }
+  });
+
+  // Code import
+  var e = $('#bu_export_content');
+  e.toggle();
+
+  var img = document.createElement('img');
+  img.src = dotclear.img_plus_src;
+  img.alt = dotclear.img_plus_alt;
+  img.className = 'expand';
+  $(img).css('cursor', 'pointer');
+  $(document.createTextNode(' ')).prependTo('#bu_export');
+  $(img).prependTo('#bu_export');
+
+  $(img).click(function() {
+    if (e.css('display') == 'none') {
+      this.src = dotclear.img_minus_src;
+      this.alt = dotclear.img_minus_alt;
+    } else {
+      this.src = dotclear.img_plus_src;
+      this.alt = dotclear.img_plus_alt;
+    }
+    e.toggle();
+  });
+
+  var a = document.createElement('a');
+  a.href = '#';
+  $(a).text(dotclear.msg.apply_code);
+
+  e.append(a);
+
+  $(a).click(function() {
+    var code = e.find('#export_code');
+    if (code.size() == 0) {
+      return false;
+    }
+
+    applyBlowupValues(code.val());
+    return false;
+  });
+
+  function toggleDisable(e) {
+    if (e.attr('disabled')) {
+      e.removeAttr('disabled');
+    } else {
+      e.attr('disabled', 'disabled');
+    }
+  }
+
+  function applyBlowupValues(code) {
+    code = code.replace('\n', '');
+    var re = /(^| )([a-zA-Z0-9_]+):"([^"]*?)"(;|$)/g;
+    var reg = /^(.+):"([^"]*)"(;?)\s*$/;
+    var s = code.match(re);
+
+    if (typeof(s) == 'object' && s.length > 0) {
+      var member, target, value;
+      for (var i = 0, s_length = s.length; i < s_length; i++) {
+        member = reg.exec(s[i]);
+        target = member[1].replace(' ', '');
+        value = member[2].replace(' ', '');
+        updateValueField($('#' + target), value);
+      }
+    }
+  }
+
+  function updateValueField(e, v) {
+    e.val(v);
+    if (v.match(/^#[0-9A-F]{6}$/)) {
+      e.css({
+        backgroundColor: v,
+        color: getColorLum(v) > 0.5 ? '#000' : '#fff'
+      });
+    }
+  }
+
+  function getColorLum(color) {
+    var rgb = [parseInt('0x' + color.substring(1, 3)) / 255,
+      parseInt('0x' + color.substring(3, 5)) / 255,
+      parseInt('0x' + color.substring(5, 7)) / 255
+    ];
+
+    return (Math.min(rgb[0], Math.min(rgb[1], rgb[2])) + Math.max(rgb[0], Math.max(rgb[1], rgb[2]))) / 2;
+  }
+});
+
+dotclear.blowup_styles = {
+  'Plumetis 2.6': 'body_bg_c:"#F5F5F5"; body_bg_g:"solid"; body_txt_f:"ss1"; body_txt_s:"14px"; body_txt_c:"#333333"; body_line_height:"24px"; top_image:"plumetis"; blog_title_hide:"0"; blog_title_f:"ss1"; blog_title_s:"36px"; blog_title_c:"#333333"; blog_title_a:"left"; blog_title_p:"20:94"; body_link_c:"#000000"; body_link_f_c:"#D33800"; body_link_v_c:"#333333"; sidebar_position:""; sidebar_text_f:"ss1"; sidebar_text_s:"12px"; sidebar_text_c:""; sidebar_title_f:""; sidebar_title_s:"14px"; sidebar_title_c:"#666666"; sidebar_title2_f:""; sidebar_title2_s:"12px"; sidebar_title2_c:"#000000"; sidebar_line_c:"#A6D9DC"; sidebar_link_c:""; sidebar_link_f_c:"#D33800"; sidebar_link_v_c:""; date_title_f:""; date_title_s:"12px"; date_title_c:"#666666"; post_title_f:"ss1"; post_title_s:"24px"; post_title_c:"#D33800"; post_comment_bg_c:"#E2EDED"; post_comment_c:"#333333"; post_commentmy_bg_c:"#A6D9DC"; post_commentmy_c:"#000000"; prelude_c:"#A6D9DC"; footer_f:""; footer_s:"12px"; footer_c:"#FFFFFF"; footer_l_c:"#FFFFFF"; footer_bg_c:"#999999"; extra_css:"h1, .post-title {font-weight: normal;text-shadow: 1px 1px 0 #fff;}#footer {background-image: none}body {border-top: 72px solid #A6D9DC}#top {margin-top: -36px}.post a {border-bottom: 1px solid #999}.post-title a, .post-info-co a {border-bottom: none}a:hover {background-color: #eee;text-decoration:none;}"',
+  'Forest': 'body_bg_c:"#80661A"; body_bg_g:"light"; body_txt_f:""; body_txt_s:""; body_txt_c:"#0A0A00"; body_line_height:"1.4em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s3"; blog_title_s:"4em"; blog_title_c:"#D9D9BF"; blog_title_a:""; blog_title_p:""; body_link_c:"#666600"; body_link_f_c:"#CC9933"; body_link_v_c:"#8D8D40"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#0A0A00"; sidebar_title_f:"s2"; sidebar_title_s:"1.6em"; sidebar_title_c:"#4D4D00"; sidebar_title2_f:"s2"; sidebar_title2_s:""; sidebar_title2_c:"#575700"; sidebar_line_c:"#D9D9BF"; sidebar_link_c:"#40330D"; sidebar_link_f_c:"#666600"; sidebar_link_v_c:"#40330D"; date_title_f:""; date_title_s:""; date_title_c:"#B3B380"; post_title_f:"s2"; post_title_s:"2em"; post_title_c:"#4D4D00"; post_comment_bg_c:"#F0F0E6"; post_comment_c:"#0A0A00"; prelude_c:"#140F05"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:"#D9AD2B"; footer_bg_c:"#33260D"',
+  'Flamingo': 'body_bg_c:"#CC9999"; body_bg_g:"light"; body_txt_f:"ss3"; body_txt_s:"1.2em"; body_txt_c:"#1A1A00"; body_line_height:"1.5em"; top_image:"flamingo"; blog_title_hide:"0"; blog_title_f:"ss1"; blog_title_s:"3.5em"; blog_title_c:"#FFFFFF"; blog_title_a:""; blog_title_p:""; body_link_c:"#AD8282"; body_link_f_c:"#8282D9"; body_link_v_c:"#997373"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss4"; sidebar_title_s:"1.4em"; sidebar_title_c:"#8282D9"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#AD8282"; sidebar_line_c:"#CDCDFF"; sidebar_link_c:"#262640"; sidebar_link_f_c:"#AD8282"; sidebar_link_v_c:"#262640"; date_title_f:"ss4"; date_title_s:""; date_title_c:"#D9B3B3"; post_title_f:"ss4"; post_title_s:"1.8em"; post_title_c:"#8282D9"; post_comment_bg_c:"#F2E5E5"; post_comment_c:""; prelude_c:"#140F0F"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#140F0F"',
+  'Iceberg': 'body_bg_c:"#5280A3"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#757575"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3em"; blog_title_c:"#FFFFFF"; blog_title_a:""; blog_title_p:""; body_link_c:"#BDB000"; body_link_f_c:"#F3E66D"; body_link_v_c:"#BDB000"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.4em"; sidebar_title_c:"#689B9C"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#66664D"; sidebar_link_f_c:"#5280A3"; sidebar_link_v_c:"#66664D"; date_title_f:""; date_title_s:""; date_title_c:"#000000"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#6F6800"; post_comment_bg_c:"#E4E4E2"; post_comment_c:""; prelude_c:"#0E2734"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#0E2734"',
+  'Night': 'body_bg_c:"#0D1A26"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#050A0F"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3.5em"; blog_title_c:"#F2F2E5"; blog_title_a:""; body_link_c:"#336699"; body_link_f_c:"#66664D"; body_link_v_c:"#2B5782"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.4em"; sidebar_title_c:"#336699"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#66664D"; sidebar_link_f_c:"#336699"; sidebar_link_v_c:"#66664D"; date_title_f:""; date_title_s:""; date_title_c:"#ADAD82"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#737300"; post_comment_bg_c:"#E6E6CD"; post_comment_c:""; prelude_c:"#070E14"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#14140F"; blog_title_p:""',
+  'Peas & Carrots': 'body_bg_c:"#9DCA25"; body_bg_g:"light"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#383839"; body_line_height:"1.5em"; top_image:"butterflies"; blog_title_hide:"0"; blog_title_f:"ss4"; blog_title_s:"3em"; blog_title_c:"#DBDB9D"; blog_title_a:"left"; blog_title_p:""; body_link_c:"#646B10"; body_link_f_c:"#DF6C01"; body_link_v_c:"#919924"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss4"; sidebar_title_s:""; sidebar_title_c:"#FE9017"; sidebar_title2_f:"s2"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#826228"; sidebar_line_c:"#D3EB8B"; sidebar_link_c:"#858547"; sidebar_link_f_c:"#FE9017"; sidebar_link_v_c:"#8F9645"; date_title_f:""; date_title_s:""; date_title_c:"#826228"; post_title_f:"ss4"; post_title_s:"1.8em"; post_title_c:"#806432"; post_comment_bg_c:"#EFFDCC"; post_comment_c:"#826228"; prelude_c:"#C8E186"; footer_f:""; footer_s:"1em"; footer_c:"#FFFFFF"; footer_l_c:"#FFFFFF"; footer_bg_c:"#484432"',
+  'Rabbit': 'body_bg_c:"#8F9645"; body_bg_g:"solid"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#625D47"; body_line_height:"1.4em"; top_image:"rabbit"; blog_title_hide:"0"; blog_title_f:"ss1"; blog_title_s:"3.5em"; blog_title_c:"#DBDB9D"; blog_title_a:""; blog_title_p:"130:70"; body_link_c:"#646B10"; body_link_f_c:"#484C12"; body_link_v_c:"#919924"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#858547"; sidebar_title_f:""; sidebar_title_s:""; sidebar_title_c:"#8F9645"; sidebar_title2_f:"s2"; sidebar_title2_s:""; sidebar_title2_c:"#826228"; sidebar_line_c:"#95956B"; sidebar_link_c:"#858547"; sidebar_link_f_c:"#826228"; sidebar_link_v_c:"#8F9645"; date_title_f:"s2"; date_title_s:"1em"; date_title_c:"#826228"; post_title_f:"s2"; post_title_s:"1.6em"; post_title_c:"#806432"; post_comment_bg_c:"#D6DE91"; post_comment_c:"#826228"; prelude_c:"#484432"; footer_f:""; footer_s:"1em"; footer_c:"#A6AF50"; footer_l_c:"#DBDB9D"; footer_bg_c:"#484432"',
+  'Rec Room': 'body_bg_c:"#9B5E1C"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#757575"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3em"; blog_title_c:"#F9FAD6"; blog_title_a:""; blog_title_p:""; body_link_c:"#D1BF1D"; body_link_f_c:"#EEE168"; body_link_v_c:"#D1BF1D"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.2em"; sidebar_title_c:"#689B9C"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#66664D"; sidebar_link_f_c:"#689B9C"; sidebar_link_v_c:"#66664D"; date_title_f:""; date_title_s:""; date_title_c:"#000000"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#689B9C"; post_comment_bg_c:"#E4E4E2"; post_comment_c:""; prelude_c:"#3B2C16"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#3B2C16"',
+  'Seville': 'body_bg_c:"#B51A0D"; body_bg_g:"dark"; body_txt_f:"ss3"; body_txt_s:"1.1em"; body_txt_c:"#383839"; body_line_height:"1.5em"; top_image:"default"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3em"; blog_title_c:"#FFFFFF"; blog_title_a:""; blog_title_p:""; body_link_c:"#F18A32"; body_link_f_c:"#F1B232"; body_link_v_c:"#F18A32"; sidebar_position:"left"; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:""; sidebar_title_f:"ss3"; sidebar_title_s:"1.4em"; sidebar_title_c:"#97471C"; sidebar_title2_f:"ss3"; sidebar_title2_s:"1.2em"; sidebar_title2_c:"#737300"; sidebar_line_c:"#E6E6CD"; sidebar_link_c:"#6E6E72"; sidebar_link_f_c:"#F18A32"; sidebar_link_v_c:"#6E6E72"; date_title_f:""; date_title_s:""; date_title_c:"#97471C"; post_title_f:"s2"; post_title_s:"1.8em"; post_title_c:"#F18A32"; post_comment_bg_c:"#E4E4E2"; post_comment_c:""; prelude_c:"#381A1A"; footer_f:""; footer_s:""; footer_c:"#FFFFFF"; footer_l_c:""; footer_bg_c:"#381A1A"',
+  'Spring Time': 'body_bg_c:"#E0E0E0"; body_bg_g:"light"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#6B6B6B"; body_line_height:"1.4em"; top_image:"light-trails-1"; blog_title_hide:"0"; blog_title_f:""; blog_title_s:"3.5em"; blog_title_c:"#9AC528"; blog_title_a:"center"; blog_title_p:""; body_link_c:"#279AC4"; body_link_f_c:"#6D8824"; body_link_v_c:"#279AC4"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#6B6B6B"; sidebar_title_f:""; sidebar_title_s:""; sidebar_title_c:"#8FB22F"; sidebar_title2_f:""; sidebar_title2_s:""; sidebar_title2_c:"#279AC4"; sidebar_line_c:"#FFD02C"; sidebar_link_c:"#6B6B6B"; sidebar_link_f_c:"#9AC528"; sidebar_link_v_c:"#6B6B6B"; date_title_f:""; date_title_s:"1em"; date_title_c:"#279AC4"; post_title_f:""; post_title_s:"1.7em"; post_title_c:"#9AC528"; post_comment_bg_c:"#FFFAD1"; post_comment_c:"#6B6B6B"; post_commentmy_bg_c:"#F5F9D9"; post_commentmy_c:"#6B6B6B"; prelude_c:"#EDEDED"; footer_f:""; footer_s:"1.2em"; footer_c:"#9AC528"; footer_l_c:"#6D8824"; footer_bg_c:"#E0E0E0"',
+  'Typo': 'body_bg_c:"#FFFFFF"; body_bg_g:"solid"; body_txt_f:"ss1"; body_txt_s:"1.2em"; body_txt_c:"#000000"; body_line_height:"1.4em"; top_image:"typo"; blog_title_hide:"0"; blog_title_f:"s2"; blog_title_s:"3.5em"; blog_title_c:"#B11508"; blog_title_a:"left"; blog_title_p:"140:50"; body_link_c:"#B11508"; body_link_f_c:"#000000"; body_link_v_c:"#4D4D4D"; sidebar_position:""; sidebar_text_f:""; sidebar_text_s:""; sidebar_text_c:"#000000"; sidebar_title_f:"s2"; sidebar_title_s:""; sidebar_title_c:"#B11508"; sidebar_title2_f:"s2"; sidebar_title2_s:""; sidebar_title2_c:"#000000"; sidebar_line_c:"#000000"; sidebar_link_c:"#000000"; sidebar_link_f_c:"#B11508"; sidebar_link_v_c:"#000000"; date_title_f:"s2"; date_title_s:"1em"; date_title_c:"#000000"; post_title_f:"s2"; post_title_s:"1.6em"; post_title_c:"#B11508"; post_comment_bg_c:"#FFFFFF"; post_comment_c:"#000000"; prelude_c:"#FFFFFF"; footer_f:""; footer_s:"1em"; footer_c:"#000000"; footer_l_c:"#B11508"; footer_bg_c:"#FFFFFF"'
+};
Index: plugins/dcCKEditor/js/popup_link.js
===================================================================
--- plugins/dcCKEditor/js/popup_link.js	(revision 3705)
+++ plugins/dcCKEditor/js/popup_link.js	(revision 3709)
@@ -1,4 +1,5 @@
 /*global $ */
 'use strict';
+
 $(function() {
   $('#link-insert-cancel').click(function() {
Index: plugins/dcCKEditor/js/popup_media.js
===================================================================
--- plugins/dcCKEditor/js/popup_media.js	(revision 3705)
+++ plugins/dcCKEditor/js/popup_media.js	(revision 3709)
@@ -1,4 +1,5 @@
 /*global $ */
 'use strict';
+
 $(function() {
   $('#media-insert-cancel').click(function() {
Index: plugins/dcCKEditor/js/popup_posts.js
===================================================================
--- plugins/dcCKEditor/js/popup_posts.js	(revision 3705)
+++ plugins/dcCKEditor/js/popup_posts.js	(revision 3709)
@@ -1,4 +1,5 @@
 /*global $ */
 'use strict';
+
 $(function() {
   $('#link-insert-cancel').click(function() {
Index: plugins/dcLegacyEditor/js/_post_editor.js
===================================================================
--- plugins/dcLegacyEditor/js/_post_editor.js	(revision 3666)
+++ plugins/dcLegacyEditor/js/_post_editor.js	(revision 3709)
@@ -1,69 +1,76 @@
+/*global $, dotclear, jsToolBar */
+'use strict';
+
 $(function() {
-	if ($('#edit-entry').length == 0) { return; }
-	if (dotclear.legacy_editor_context === undefined ||
-		dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context] === undefined) {
-		return;
-	}
+  if ($('#edit-entry').length == 0) {
+    return;
+  }
+  if (dotclear.legacy_editor_context === undefined ||
+    dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context] === undefined) {
+    return;
+  }
 
-	if ((dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#post_content') !== -1) &&
-		(dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#post_excerpt') !== -1)) {
-		// Get document format and prepare toolbars
-		var formatField = $('#post_format').get(0);
-		var last_post_format = $(formatField).val();
-		$(formatField).change(function() {
-			if (this.value != 'dcLegacyEditor') { return; }
+  if ((dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#post_content') !== -1) &&
+    (dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#post_excerpt') !== -1)) {
+    // Get document format and prepare toolbars
+    var formatField = $('#post_format').get(0);
+    var last_post_format = $(formatField).val();
+    $(formatField).change(function() {
+      if (this.value != 'dcLegacyEditor') {
+        return;
+      }
 
-			var post_format = this.value;
+      var post_format = this.value;
 
-			// Confirm post format change
-			if (window.confirm(dotclear.msg.confirm_change_post_format_noconvert)) {
-				excerptTb.switchMode(post_format);
-				contentTb.switchMode(post_format);
-				last_post_format = $(this).val();
-			} else {
-				// Restore last format if change cancelled
-				$(this).val(last_post_format);
-			}
+      // Confirm post format change
+      if (window.confirm(dotclear.msg.confirm_change_post_format_noconvert)) {
+        excerptTb.switchMode(post_format);
+        contentTb.switchMode(post_format);
+        last_post_format = $(this).val();
+      } else {
+        // Restore last format if change cancelled
+        $(this).val(last_post_format);
+      }
 
-			$('.format_control > *').addClass('hide');
-			$('.format_control:not(.control_no_' + post_format + ') > *').removeClass('hide');
-		});
+      $('.format_control > *').addClass('hide');
+      $('.format_control:not(.control_no_' + post_format + ') > *').removeClass('hide');
+    });
 
-		var excerptTb = new jsToolBar(document.getElementById('post_excerpt'));
-		var contentTb = new jsToolBar(document.getElementById('post_content'));
-		excerptTb.context = contentTb.context = 'post';
+    var excerptTb = new jsToolBar(document.getElementById('post_excerpt'));
+    var contentTb = new jsToolBar(document.getElementById('post_content'));
+    excerptTb.context = contentTb.context = 'post';
 
-		$('.format_control > *').addClass('hide');
-		$('.format_control:not(.control_no_' + last_post_format + ') > *').removeClass('hide');
-	}
+    $('.format_control > *').addClass('hide');
+    $('.format_control:not(.control_no_' + last_post_format + ') > *').removeClass('hide');
+  }
 
-	if (dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#comment_content') !== -1) {
-		if ($('#comment_content').length > 0) {
-			var commentTb = new jsToolBar(document.getElementById('comment_content'));
-			commentTb.draw('xhtml');
-		}
-	}
+  if (dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#comment_content') !== -1) {
+    if ($('#comment_content').length > 0) {
+      var commentTb = new jsToolBar(document.getElementById('comment_content'));
+      commentTb.draw('xhtml');
+    }
+  }
 
-	$('#edit-entry').onetabload(function() {
+  $('#edit-entry').onetabload(function() {
 
-		// Remove required attribut from #post_content in XHTML mode as textarea is not more focusable
-		if (formatField.value == 'xhtml') {
-			$('#post_content').removeAttr('required');
-		}
+    // Remove required attribut from #post_content in XHTML mode as textarea is not more focusable
+    if (formatField.value == 'xhtml') {
+      $('#post_content').removeAttr('required');
+    }
 
-		// Load toolbars
-		if (contentTb !== undefined && excerptTb !== undefined) {
-			contentTb.switchMode(formatField.value);
-			excerptTb.switchMode(formatField.value);
-		}
+    // Load toolbars
+    if (contentTb !== undefined && excerptTb !== undefined) {
+      contentTb.switchMode(formatField.value);
+      excerptTb.switchMode(formatField.value);
+    }
 
-		// Check unsaved changes before XHTML conversion
-		var excerpt = $('#post_excerpt').val();
-		var content = $('#post_content').val();
-		$('#convert-xhtml').click(function() {
-			if (excerpt != $('#post_excerpt').val() || content != $('#post_content').val()) {
-				return window.confirm(dotclear.msg.confirm_change_post_format);
-			}
-		});
-	});
+    // Check unsaved changes before XHTML conversion
+    var excerpt = $('#post_excerpt').val();
+    var content = $('#post_content').val();
+    $('#convert-xhtml').click(function() {
+      if (excerpt != $('#post_excerpt').val() || content != $('#post_content').val()) {
+        return window.confirm(dotclear.msg.confirm_change_post_format);
+      }
+    });
+  });
 });
Index: plugins/dcLegacyEditor/js/jsToolBar/popup_media.js
===================================================================
--- plugins/dcLegacyEditor/js/jsToolBar/popup_media.js	(revision 3446)
+++ plugins/dcLegacyEditor/js/jsToolBar/popup_media.js	(revision 3709)
@@ -1,107 +1,96 @@
+/*global $ */
+'use strict';
+
 $(function() {
-	var toolBar = window.opener.the_toolbar.textarea;
+  $('#media-insert').onetabload(function() {
+    $('#media-insert-cancel').click(function() {
+      window.close();
+    });
 
-	$('#media-insert').onetabload(function() {
-		$('#media-insert-cancel').click(function() {
-			window.close();
-		});
+    $('#media-insert-ok').click(function() {
+      sendClose();
+      window.close();
+    });
+  });
 
-		$('#media-insert-ok').click(function() {
-			sendClose();
-			window.close();
-		});
-	});
+  function sendClose() {
+    var insert_form = $('#media-insert-form').get(0);
+    if (insert_form == undefined) {
+      return;
+    }
 
-	function sendClose() {
-		var insert_form = $('#media-insert-form').get(0);
-		if (insert_form == undefined) { return; }
+    var tb = window.opener.the_toolbar;
+    var type = insert_form.elements.type.value;
+    var media_align_grid = {
+      left: 'float: left; margin: 0 1em 1em 0;',
+      right: 'float: right; margin: 0 0 1em 1em;',
+      center: 'text-align: center;'
+    };
+    var align, player;
 
-		var tb = window.opener.the_toolbar;
-		var type = insert_form.elements.type.value;
+    if (type == 'image') {
+      tb.elements.img_select.data.src = tb.stripBaseURL($('input[name="src"]:checked', insert_form).val());
+      tb.elements.img_select.data.alignment = $('input[name="alignment"]:checked', insert_form).val();
+      tb.elements.img_select.data.link = $('input[name="insertion"]:checked', insert_form).val() == 'link';
 
-		var media_align_grid = {
-			left: 'float: left; margin: 0 1em 1em 0;',
-			right: 'float: right; margin: 0 0 1em 1em;',
-			center: 'text-align: center;'
-		};
+      tb.elements.img_select.data.title = insert_form.elements.title.value;
+      tb.elements.img_select.data.description = $('input[name="description"]', insert_form).val();
+      tb.elements.img_select.data.url = tb.stripBaseURL(insert_form.elements.url.value);
 
-		if (type == 'image')
-		{
-			tb.elements.img_select.data.src = tb.stripBaseURL($('input[name="src"]:checked',insert_form).val());
-			tb.elements.img_select.data.alignment = $('input[name="alignment"]:checked',insert_form).val();
-			tb.elements.img_select.data.link = $('input[name="insertion"]:checked',insert_form).val() == 'link';
+      var media_legend = $('input[name="legend"]:checked', insert_form).val();
+      if (media_legend != '' && media_legend != 'title' && media_legend != 'none') {
+        media_legend = 'legend';
+      }
+      if (media_legend != 'legend') {
+        tb.elements.img_select.data.description = '';
+      }
+      if (media_legend == 'none') {
+        tb.elements.img_select.data.title = '';
+      }
 
-			tb.elements.img_select.data.title = insert_form.elements.title.value;
-			tb.elements.img_select.data.description = $('input[name="description"]',insert_form).val();
-			tb.elements.img_select.data.url = tb.stripBaseURL(insert_form.elements.url.value);
+      tb.elements.img_select.fncall[tb.mode].call(tb);
+    } else if (type == 'mp3') {
+      player = $('#public_player').val();
+      align = $('input[name="alignment"]:checked', insert_form).val();
 
-			var media_legend = $('input[name="legend"]:checked',insert_form).val();
-			if (media_legend != '' && media_legend != 'title' && media_legend != 'none') {
-				media_legend = 'legend';
-			}
-			if (media_legend != 'legend') {
-				tb.elements.img_select.data.description = '';
-			}
-			if (media_legend == 'none') {
-				tb.elements.img_select.data.title = '';
-			}
+      if (align != undefined && align != 'none') {
+        player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';
+      }
 
-			tb.elements.img_select.fncall[tb.mode].call(tb);
-		}
-		else if (type == 'mp3')
-		{
-			var player = $('#public_player').val();
-			var align = $('input[name="alignment"]:checked',insert_form).val();
+      tb.elements.mp3_insert.data.player = player.replace(/>/g, '>\n');
+      tb.elements.mp3_insert.fncall[tb.mode].call(tb);
+    } else if (type == 'flv') // may be all video media, not only flv
+    {
+      var oplayer = $('<div>' + $('#public_player').val() + '</div>');
+      var flashvars = $('[name=FlashVars]', oplayer).val();
 
-			if (align != undefined && align != 'none') {
-				player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';
-			}
+      align = $('input[name="alignment"]:checked', insert_form).val();
+      var title = insert_form.elements.title.value;
 
-			tb.elements.mp3_insert.data.player = player.replace(/>/g,'>\n');
-			tb.elements.mp3_insert.fncall[tb.mode].call(tb);
-		}
-		else if (type == 'flv') // may be all video media, not only flv
-		{
-			var oplayer = $('<div>'+$('#public_player').val()+'</div>');
-			var flashvars = $("[name=FlashVars]",oplayer).val();
+      $('video', oplayer).attr('width', $('#video_w').val());
+      $('video', oplayer).attr('height', $('#video_h').val());
 
-			var align = $('input[name="alignment"]:checked',insert_form).val();
-			var title = insert_form.elements.title.value;
+      if (title) {
+        flashvars = 'title=' + encodeURI(title) + '&amp;' + flashvars;
+      }
+      $('object', oplayer).attr('width', $('#video_w').val());
+      $('object', oplayer).attr('height', $('#video_h').val());
+      flashvars = flashvars.replace(/(width=\d*)/, 'width=' + $('#video_w').val());
+      flashvars = flashvars.replace(/(height=\d*)/, 'height=' + $('#video_h').val());
 
-			$('video',oplayer).attr('width',$('#video_w').val());
-			$('video',oplayer).attr('height',$('#video_h').val());
+      $('[name=FlashVars]', oplayer).val(flashvars);
+      player = oplayer.html();
 
-			if (title) {
-				flashvars = 'title='+encodeURI(title)+'&amp;'+flashvars;
-			}
-			$('object',oplayer).attr('width',$('#video_w').val());
-			$('object',oplayer).attr('height',$('#video_h').val());
-			flashvars = flashvars.replace(/(width=\d*)/,'width='+$('#video_w').val());
-			flashvars = flashvars.replace(/(height=\d*)/,'height='+$('#video_h').val());
+      if (align != undefined && align != 'none') {
+        player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';
+      }
 
-			$("[name=FlashVars]",oplayer).val(flashvars);
-			var player = oplayer.html();
-
-			if (align != undefined && align != 'none') {
-				player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';
-			}
-
-			tb.elements.flv_insert.data.player = player.replace(/>/g,'>\n');
-			tb.elements.flv_insert.fncall[tb.mode].call(tb);
-		}
-		else
-		{
-			tb.elements.link.data.href = tb.stripBaseURL(insert_form.elements.url.value);
-			tb.elements.link.data.content = insert_form.elements.title.value;
-			tb.elements.link.fncall[tb.mode].call(tb);
-		}
-	};
-
-	function playerFormat(s) {
-		s = s.replace(/&lt;/g,'<');
-		s = s.replace(/&gt;/g,'>\n');
-		s = s.replace(/&amp;/g,'&');
-
-		return s;
-	};
+      tb.elements.flv_insert.data.player = player.replace(/>/g, '>\n');
+      tb.elements.flv_insert.fncall[tb.mode].call(tb);
+    } else {
+      tb.elements.link.data.href = tb.stripBaseURL(insert_form.elements.url.value);
+      tb.elements.link.data.content = insert_form.elements.title.value;
+      tb.elements.link.fncall[tb.mode].call(tb);
+    }
+  }
 });
Index: plugins/importExport/js/script.js
===================================================================
--- plugins/importExport/js/script.js	(revision 2566)
+++ plugins/importExport/js/script.js	(revision 3709)
@@ -1,3 +1,13 @@
+/*global $, dotclear */
+'use strict';
 
-$(function(){if($('*.error').length>0){return;}
-$('#ie-gui form[method=post]:has(input[type=hidden][name=autosubmit])').each(function(){$('input[type=submit]',this).remove();$(this).after('<p style="font-size:2em;text-align:center">'+dotclear.msg.please_wait+'</p>');$(this).submit();});});
+$(function() {
+  if ($('*.error').length > 0) {
+    return;
+  }
+  $('#ie-gui form[method=post]:has(input[type=hidden][name=autosubmit])').each(function() {
+    $('input[type=submit]', this).remove();
+    $(this).after('<p style="font-size:2em;text-align:center">' + dotclear.msg.please_wait + '</p>');
+    $(this).submit();
+  });
+});
Index: plugins/maintenance/js/dc.maintenance.js
===================================================================
--- plugins/maintenance/js/dc.maintenance.js	(revision 2566)
+++ plugins/maintenance/js/dc.maintenance.js	(revision 3709)
@@ -1,45 +1,48 @@
-$(function(){
-	$('.step-box').each(function(){
-		var code = $('input[name=code]',this).val();
+/*global $, dotclear */
+'use strict';
 
-		$('.step-submit',this).remove();
-		$('.step-back',this).hide();
-		$('.step-msg',this).after(
-			$('<p>').addClass('step-wait').text(
-				dotclear.msg.wait
-			)
-		);
+$(function() {
+  $('.step-box').each(function() {
+    var code = $('input[name=code]', this).val();
 
-		dcMaintenanceStep(this,code);
+    $('.step-submit', this).remove();
+    $('.step-back', this).hide();
+    $('.step-msg', this).after(
+      $('<p>').addClass('step-wait').text(
+        dotclear.msg.wait
+      )
+    );
 
-		function dcMaintenanceStep(box,code) {
-			var params = {
-				f: 'dcMaintenanceStep',
-				xd_check: dotclear.nonce,
-				task: $(box).attr('id'),
-				code: code
-			}
-			$.post('services.php',params,function(data) {
-				if ($('rsp[status=failed]',data).length > 0) {
-					$('.step-msg',box).text(
-						$('rsp',data).text()
-					);
-					$('.step-wait',box).remove();
-					$('.step-back',box).show();
-				} else {
-					$('.step-msg',box).text(
-						$('rsp>step',data).attr('title')
-					);
-					var code = $('rsp>step',data).attr('code');
-					if (code > 0){
-						dcMaintenanceStep(box,code);
-					} else {
-						$('#content h2').after($('<div/>').addClass('success').append($('.step-msg',box)));
-						$('.step-wait',box).remove();
-						$('.step-back',box).show();
-					}
-				}
-			});
-		}
-	});
+    dcMaintenanceStep(this, code);
+
+    function dcMaintenanceStep(box, code) {
+      var params = {
+        f: 'dcMaintenanceStep',
+        xd_check: dotclear.nonce,
+        task: $(box).attr('id'),
+        code: code
+      };
+      $.post('services.php', params, function(data) {
+        if ($('rsp[status=failed]', data).length > 0) {
+          $('.step-msg', box).text(
+            $('rsp', data).text()
+          );
+          $('.step-wait', box).remove();
+          $('.step-back', box).show();
+        } else {
+          $('.step-msg', box).text(
+            $('rsp>step', data).attr('title')
+          );
+          var code = $('rsp>step', data).attr('code');
+          if (code > 0) {
+            dcMaintenanceStep(box, code);
+          } else {
+            $('#content h2').after($('<div/>').addClass('success').append($('.step-msg', box)));
+            $('.step-wait', box).remove();
+            $('.step-back', box).show();
+          }
+        }
+      });
+    }
+  });
 });
Index: plugins/maintenance/js/settings.js
===================================================================
--- plugins/maintenance/js/settings.js	(revision 3182)
+++ plugins/maintenance/js/settings.js	(revision 3709)
@@ -1,18 +1,21 @@
-$(function(){
-	$('.recall-for-all').attr('disabled','disabled');
-	$('#settings_recall_all').change(function(){
-		if($(this).attr('selected')!='selected'){
-			$('.recall-per-task').attr('disabled','disabled');
-			$('.recall-for-all').removeAttr('disabled');
-		}
-	});
-	$('#settings_recall_separate').change(function(){
-		if($(this).attr('selected')!='selected'){
-			$('.recall-per-task').removeAttr('disabled');
-			$('.recall-for-all').attr('disabled','disabled');
-		}
-	});
-	dotclear.condSubmit('#part-maintenance input[type="radio"]','#part-maintenance input[type="submit"]');
-	dotclear.condSubmit('#part-backup input[type="radio"]','#part-backup input[type="submit"]');
-	dotclear.condSubmit('#part-dev input[type="radio"]','#part-dev input[type="submit"]');
+/*global $, dotclear */
+'use strict';
+
+$(function() {
+  $('.recall-for-all').attr('disabled', 'disabled');
+  $('#settings_recall_all').change(function() {
+    if ($(this).attr('selected') != 'selected') {
+      $('.recall-per-task').attr('disabled', 'disabled');
+      $('.recall-for-all').removeAttr('disabled');
+    }
+  });
+  $('#settings_recall_separate').change(function() {
+    if ($(this).attr('selected') != 'selected') {
+      $('.recall-per-task').removeAttr('disabled');
+      $('.recall-for-all').attr('disabled', 'disabled');
+    }
+  });
+  dotclear.condSubmit('#part-maintenance input[type="radio"]', '#part-maintenance input[type="submit"]');
+  dotclear.condSubmit('#part-backup input[type="radio"]', '#part-backup input[type="submit"]');
+  dotclear.condSubmit('#part-dev input[type="radio"]', '#part-dev input[type="submit"]');
 });
Index: plugins/pages/_admin.php
===================================================================
--- plugins/pages/_admin.php	(revision 3265)
+++ plugins/pages/_admin.php	(revision 3709)
@@ -10,86 +10,85 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
+if (!defined('DC_CONTEXT_ADMIN')) {return;}
 
-$core->addBehavior('adminColumnsLists',array('pagesColumnsLists','adminColumnsLists'));
-$core->addBehavior('adminDashboardFavorites',array('pagesDashboard','pagesDashboardFavs'));
-$core->addBehavior('adminUsersActionsHeaders','pages_users_actions_headers');
+$core->addBehavior('adminColumnsLists', array('pagesColumnsLists', 'adminColumnsLists'));
+$core->addBehavior('adminDashboardFavorites', array('pagesDashboard', 'pagesDashboardFavs'));
+$core->addBehavior('adminUsersActionsHeaders', 'pages_users_actions_headers');
 
 class pagesColumnsLists
 {
-	public static function adminColumnsLists($core,$cols)
-	{
-		// Set optional columns in pages lists
-		$cols['pages'] = array(__('Pages'), array(
-			'date' => array(true,__('Date')),
-			'author' => array(true,__('Author')),
-			'comments' => array(true,__('Comments')),
-			'trackbacks' => array(true,__('Trackbacks'))
-		));
-	}
+    public static function adminColumnsLists($core, $cols)
+    {
+        // Set optional columns in pages lists
+        $cols['pages'] = array(__('Pages'), array(
+            'date'       => array(true, __('Date')),
+            'author'     => array(true, __('Author')),
+            'comments'   => array(true, __('Comments')),
+            'trackbacks' => array(true, __('Trackbacks'))
+        ));
+    }
 }
 
 class pagesDashboard
 {
-	public static function pagesDashboardFavs($core,$favs)
-	{
-		$favs->register('pages', array(
-			'title' => __('Pages'),
-			'url' => $core->adminurl->get('admin.plugin.pages'),
-			'small-icon' => dcPage::getPF('pages/icon.png'),
-			'large-icon' => dcPage::getPF('pages/icon-big.png'),
-			'permissions' => 'contentadmin,pages',
-			'dashboard_cb' => array('pagesDashboard','pagesDashboardCB'),
-			'active_cb' => array('pagesDashboard','pagesActiveCB')
-		));
-		$favs->register('newpage', array(
-			'title' => __('New page'),
-			'url' => $core->adminurl->get('admin.plugin.pages',array('act' => 'page')),
-			'small-icon' => dcPage::getPF('pages/icon-np.png'),
-			'large-icon' => dcPage::getPF( 'pages/icon-np-big.png'),
-			'permissions' => 'contentadmin,pages',
-			'active_cb' => array('pagesDashboard','newPageActiveCB')
-		));
-	}
+    public static function pagesDashboardFavs($core, $favs)
+    {
+        $favs->register('pages', array(
+            'title'        => __('Pages'),
+            'url'          => $core->adminurl->get('admin.plugin.pages'),
+            'small-icon'   => dcPage::getPF('pages/icon.png'),
+            'large-icon'   => dcPage::getPF('pages/icon-big.png'),
+            'permissions'  => 'contentadmin,pages',
+            'dashboard_cb' => array('pagesDashboard', 'pagesDashboardCB'),
+            'active_cb'    => array('pagesDashboard', 'pagesActiveCB')
+        ));
+        $favs->register('newpage', array(
+            'title'       => __('New page'),
+            'url'         => $core->adminurl->get('admin.plugin.pages', array('act' => 'page')),
+            'small-icon'  => dcPage::getPF('pages/icon-np.png'),
+            'large-icon'  => dcPage::getPF('pages/icon-np-big.png'),
+            'permissions' => 'contentadmin,pages',
+            'active_cb'   => array('pagesDashboard', 'newPageActiveCB')
+        ));
+    }
 
-	public static function pagesDashboardCB($core,$v)
-	{
-		$params = new ArrayObject();
-		$params['post_type'] = 'page';
-		$page_count = $core->blog->getPosts($params,true)->f(0);
-		if ($page_count > 0) {
-			$str_pages = ($page_count > 1) ? __('%d pages') : __('%d page');
-			$v['title'] = sprintf($str_pages,$page_count);
-		}
-	}
+    public static function pagesDashboardCB($core, $v)
+    {
+        $params              = new ArrayObject();
+        $params['post_type'] = 'page';
+        $page_count          = $core->blog->getPosts($params, true)->f(0);
+        if ($page_count > 0) {
+            $str_pages  = ($page_count > 1) ? __('%d pages') : __('%d page');
+            $v['title'] = sprintf($str_pages, $page_count);
+        }
+    }
 
-	public static function pagesActiveCB($request,$params)
-	{
-		return ($request == "plugin.php") &&
-			isset($params['p']) && $params['p'] == 'pages'
-			&& !(isset($params['act']) && $params['act']=='page');
-	}
+    public static function pagesActiveCB($request, $params)
+    {
+        return ($request == "plugin.php") &&
+        isset($params['p']) && $params['p'] == 'pages'
+        && !(isset($params['act']) && $params['act'] == 'page');
+    }
 
-	public static function newPageActiveCB($request,$params)
-	{
-		return ($request == "plugin.php") &&
-			isset($params['p']) && $params['p'] == 'pages'
-			&& isset($params['act']) && $params['act']=='page';
-	}
+    public static function newPageActiveCB($request, $params)
+    {
+        return ($request == "plugin.php") &&
+        isset($params['p']) && $params['p'] == 'pages'
+        && isset($params['act']) && $params['act'] == 'page';
+    }
 }
-
 
 function pages_users_actions_headers()
 {
-	return dcPage::jsLoad('index.php?pf=pages/_users_actions.js');
+    return dcPage::jsLoad('index.php?pf=pages/js/_users_actions.js');
 }
 
 $_menu['Blog']->addItem(__('Pages'),
-	$core->adminurl->get('admin.plugin.pages'),
-	dcPage::getPF('pages/icon.png'),
-	preg_match('/plugin.php(.*)$/',$_SERVER['REQUEST_URI']) && !empty($_REQUEST['p']) && $_REQUEST['p']=='pages',
-	$core->auth->check('contentadmin,pages',$core->blog->id));
+    $core->adminurl->get('admin.plugin.pages'),
+    dcPage::getPF('pages/icon.png'),
+    preg_match('/plugin.php(.*)$/', $_SERVER['REQUEST_URI']) && !empty($_REQUEST['p']) && $_REQUEST['p'] == 'pages',
+    $core->auth->check('contentadmin,pages', $core->blog->id));
 
-$core->auth->setPermissionType('pages',__('manage pages'));
+$core->auth->setPermissionType('pages', __('manage pages'));
 
-require dirname(__FILE__).'/_widgets.php';
+require dirname(__FILE__) . '/_widgets.php';
Index: lugins/pages/_users_actions.js
===================================================================
--- plugins/pages/_users_actions.js	(revision 2566)
+++ 	(revision )
@@ -1,47 +1,0 @@
-jQuery.fn.updatePagesPermissionsForm = function() {
-	return this.each(function() {
-
-		var perms = {};
-		var re = /^perm\[(.+?)\]\[(.+?)\]$/;
-		var e,prop;
-
-		// Building a nice object of form elements
-		for (var i=0; i<this.elements.length; i++) {
-			e = this.elements[i];
-
-			if (e.name == undefined) {
-				continue;
-			}
-			var prop;
-			prop = e.name.match(re);
-			if (!prop) {
-				continue;
-			}
-			if (perms[prop[1]] == undefined) {
-				perms[prop[1]] = {};
-			}
-			perms[prop[1]][prop[2]] = e;
-
-			// select related permissions for admin
-			if (prop[2] == 'admin') {
-				if (e.checked) {
-					admin(e,perms,re);
-				}
-				$(e).click(function(){
-					admin(this,perms,re);
-				});
-			}
-		}
-
-		function admin(E,perms,re) {
-					P = E.name.match(re);
-
-					perms[P[1]]['pages'].checked = E.checked;
-					perms[P[1]]['pages'].disabled = E.checked;
-		}
-	});
-};
-
-$(function() {
-	$('#permissions-form').updatePagesPermissionsForm();
-});
Index: plugins/pages/js/_users_actions.js
===================================================================
--- plugins/pages/js/_users_actions.js	(revision 3709)
+++ plugins/pages/js/_users_actions.js	(revision 3709)
@@ -0,0 +1,49 @@
+/*global $, jQuery */
+'use strict';
+
+jQuery.fn.updatePagesPermissionsForm = function() {
+  return this.each(function() {
+
+    var perms = {};
+    var re = /^perm\[(.+?)\]\[(.+?)\]$/;
+    var e, prop;
+
+    // Building a nice object of form elements
+    for (var i = 0; i < this.elements.length; i++) {
+      e = this.elements[i];
+
+      if (e.name == undefined) {
+        continue;
+      }
+      prop = e.name.match(re);
+      if (!prop) {
+        continue;
+      }
+      if (perms[prop[1]] == undefined) {
+        perms[prop[1]] = {};
+      }
+      perms[prop[1]][prop[2]] = e;
+
+      // select related permissions for admin
+      if (prop[2] == 'admin') {
+        if (e.checked) {
+          admin(e, perms, re);
+        }
+        $(e).click(function() {
+          admin(this, perms, re);
+        });
+      }
+    }
+
+    function admin(E, perms, re) {
+      var P = E.name.match(re);
+
+      perms[P[1]].pages.checked = E.checked;
+      perms[P[1]].pages.disabled = E.checked;
+    }
+  });
+};
+
+$(function() {
+  $('#permissions-form').updatePagesPermissionsForm();
+});
Index: plugins/pages/js/list.js
===================================================================
--- plugins/pages/js/list.js	(revision 3709)
+++ plugins/pages/js/list.js	(revision 3709)
@@ -0,0 +1,128 @@
+/*global $, dotclear */
+'use strict';
+
+dotclear.viewPostContent = function(line, action) {
+  action = action || 'toggle';
+  if ($(line).attr('id') == undefined) {
+    return;
+  }
+
+  var postId = $(line).attr('id').substr(1);
+  var tr = document.getElementById('pe' + postId);
+
+  if (!tr && (action == 'toggle' || action == 'open')) {
+    tr = document.createElement('tr');
+    tr.id = 'pe' + postId;
+    var td = document.createElement('td');
+    td.colSpan = 8;
+    td.className = 'expand';
+    tr.appendChild(td);
+
+    // Get post content
+    $.get('services.php', {
+      f: 'getPostById',
+      id: postId,
+      post_type: ''
+    }, function(data) {
+      var rsp = $(data).children('rsp')[0];
+
+      if (rsp.attributes[0].value == 'ok') {
+        var post = $(rsp).find('post_display_content').text();
+        var post_excerpt = $(rsp).find('post_display_excerpt').text();
+        var res = '';
+
+        if (post) {
+          if (post_excerpt) {
+            res += post_excerpt + '<hr />';
+          }
+          res += post;
+          $(td).append(res);
+        }
+      } else {
+        window.alert($(rsp).find('message').text());
+      }
+    });
+
+    $(line).addClass('expand');
+    line.parentNode.insertBefore(tr, line.nextSibling);
+  } else if (tr && tr.style.display == 'none' && (action == 'toggle' || action == 'open')) {
+    $(tr).css('display', 'table-row');
+    $(line).addClass('expand');
+  } else if (tr && tr.style.display != 'none' && (action == 'toggle' || action == 'close')) {
+    $(tr).css('display', 'none');
+    $(line).removeClass('expand');
+  }
+};
+
+$(function() {
+  $('#pageslist tr.line').prepend('<td class="expander"></td>');
+  $('#form-entries tr:not(.line) th:first').attr('colspan', 4);
+  $.expandContent({
+    line: $('#form-entries tr:not(.line)'),
+    lines: $('#form-entries tr.line'),
+    callback: dotclear.viewPostContent
+  });
+  $('.checkboxes-helpers').each(function() {
+    var p = $('<p></p>');
+    $(this).prepend(p);
+    dotclear.checkboxesHelpers(p, undefined, '#pageslist td input[type=checkbox]', '#form-entries #do-action');
+  });
+  $('#pageslist td input[type=checkbox]').enableShiftClick();
+  dotclear.condSubmit('#pageslist td input[type=checkbox]', '#form-entries #do-action');
+
+  $('#pageslist tr.line td:not(.expander)').mousedown(function() {
+    $('#pageslist tr.line').each(function() {
+      var td = this.firstChild;
+      dotclear.viewPostContent(td.firstChild, td.firstChild.line, 'close');
+    });
+    $('#pageslist tr:not(.line)').remove();
+  });
+
+  $('#pageslist').sortable({
+    cursor: 'move',
+    stop: function() {
+      $('#pageslist tr td input.position').each(function(i) {
+        $(this).val(i + 1);
+      });
+    }
+  });
+  $('#pageslist tr').hover(function() {
+    $(this).css({
+      'cursor': 'move'
+    });
+  }, function() {
+    $(this).css({
+      'cursor': 'auto'
+    });
+  });
+  $('#pageslist tr td input.position').hide();
+  $('#pageslist tr td.handle').addClass('handler');
+
+  $('form input[type=submit]').click(function() {
+    $('input[type=submit]', $(this).parents('form')).removeAttr('clicked');
+    $(this).attr('clicked', 'true');
+  });
+
+  $('#form-entries').submit(function() {
+    var action = $(this).find('select[name="action"]').val();
+    var checked = false;
+    if ($('input[name="reorder"][clicked=true]').val()) {
+      return true;
+    }
+    $(this).find('input[name="entries[]"]').each(function() {
+      if (this.checked) {
+        checked = true;
+      }
+    });
+
+    if (!checked) {
+      return false;
+    }
+
+    if (action == 'delete') {
+      return window.confirm(dotclear.msg.confirm_delete_posts.replace('%s', $('input[name="entries[]"]:checked').size()));
+    }
+
+    return true;
+  });
+});
Index: lugins/pages/list.js
===================================================================
--- plugins/pages/list.js	(revision 3182)
+++ 	(revision )
@@ -1,117 +1,0 @@
-dotclear.viewPostContent = function(line,action) {
-	var action = action || 'toggle';
-	if ($(line).attr('id') == undefined) { return; }
-
-	var postId = $(line).attr('id').substr(1);
-	var tr = document.getElementById('pe'+postId);
-
-	if ( !tr && ( action == 'toggle' || action == 'open' ) ) {
-		tr = document.createElement('tr');
-		tr.id = 'pe'+postId;
-		var td = document.createElement('td');
-		td.colSpan = 8;
-		td.className = 'expand';
-		tr.appendChild(td);
-
-		// Get post content
-		$.get('services.php',{f:'getPostById', id: postId, post_type: ''},function(data) {
-			var rsp = $(data).children('rsp')[0];
-
-			if (rsp.attributes[0].value == 'ok') {
-				var post = $(rsp).find('post_display_content').text();
-				var post_excerpt = $(rsp).find('post_display_excerpt').text();
-				var res = '';
-
-				if (post) {
-					if (post_excerpt) {
-						res += post_excerpt + '<hr />';
-					}
-					res += post;
-					$(td).append(res);
-				}
-			} else {
-				alert($(rsp).find('message').text());
-			}
-		});
-
-		$(line).addClass('expand');
-		line.parentNode.insertBefore(tr,line.nextSibling);
-	}
-	else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) )
-	{
-		$(tr).css('display', 'table-row');
-		$(line).addClass('expand');
-	}
-	else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) )
-	{
-		$(tr).css('display', 'none');
-		$(line).removeClass('expand');
-	}
-};
-
-$(function() {
-	$('#pageslist tr.line').prepend('<td class="expander"></td>');
-	$('#form-entries tr:not(.line) th:first').attr('colspan',4);
-	$.expandContent({
-		line:$('#form-entries tr:not(.line)'),
-		lines:$('#form-entries tr.line'),
-		callback:dotclear.viewPostContent
-	});
-	$('.checkboxes-helpers').each(function() {
-		p = $('<p></p>');
-		$(this).prepend(p);
-		dotclear.checkboxesHelpers(p,undefined,'#pageslist td input[type=checkbox]','#form-entries #do-action');
-	});
-	$('#pageslist td input[type=checkbox]').enableShiftClick();
-	dotclear.condSubmit('#pageslist td input[type=checkbox]','#form-entries #do-action');
-
-	$("#pageslist tr.line td:not(.expander)").mousedown(function(){
-		$('#pageslist tr.line').each(function() {
-			var td = this.firstChild;
-			dotclear.viewPostContent(td.firstChild,td.firstChild.line,'close');
-		});
-		$('#pageslist tr:not(.line)').remove();
-	});
-
-	$("#pageslist").sortable({
-		cursor:'move',
-		stop: function( event, ui ) {
-			$("#pageslist tr td input.position").each(function(i) {
-				$(this).val(i+1);
-			});
-		}
-	});
-	$("#pageslist tr").hover(function () {
-		$(this).css({'cursor':'move'});
-	}, function () {
-		$(this).css({'cursor':'auto'});
-	});
-	$("#pageslist tr td input.position").hide();
-	$("#pageslist tr td.handle").addClass('handler');
-
-	$("form input[type=submit]").click(function() {
-		$("input[type=submit]", $(this).parents("form")).removeAttr("clicked");
-		$(this).attr("clicked", "true");
-	})
-
-	$('#form-entries').submit(function() {
-		var action = $(this).find('select[name="action"]').val();
-		var checked = false;
-		if ($("input[name=reorder][clicked=true]").val()) {
-			return true;
-		}
-		$(this).find('input[name="entries[]"]').each(function() {
-			if (this.checked) {
-				checked = true;
-			}
-		});
-
-		if (!checked) { return false; }
-
-		if (action == 'delete') {
-			return window.confirm(dotclear.msg.confirm_delete_posts.replace('%s',$('input[name="entries[]"]:checked').size()));
-		}
-
-		return true;
-	});
-});
Index: plugins/pages/list.php
===================================================================
--- plugins/pages/list.php	(revision 3421)
+++ plugins/pages/list.php	(revision 3709)
@@ -10,5 +10,5 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
+if (!defined('DC_CONTEXT_ADMIN')) {return;}
 dcPage::check('pages,contentadmin');
 
@@ -16,52 +16,51 @@
 -------------------------------------------------------- */
 $params = array(
-	'post_type' => 'page'
+    'post_type' => 'page'
 );
 
-$page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1;
-$nb_per_page =  30;
+$page        = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1;
+$nb_per_page = 30;
 
 if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) {
-	$nb_per_page = (integer) $_GET['nb'];
+    $nb_per_page = (integer) $_GET['nb'];
 }
 
-$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
+$params['limit']      = array((($page - 1) * $nb_per_page), $nb_per_page);
 $params['no_content'] = true;
-$params['order'] = 'post_position ASC, post_title ASC';
+$params['order']      = 'post_position ASC, post_title ASC';
 
 try {
-	$pages = $core->blog->getPosts($params);
-	$counter = $core->blog->getPosts($params,true);
-	$post_list = new adminPagesList($core,$pages,$counter->f(0));
+    $pages     = $core->blog->getPosts($params);
+    $counter   = $core->blog->getPosts($params, true);
+    $post_list = new adminPagesList($core, $pages, $counter->f(0));
 } catch (Exception $e) {
-	$core->error->add($e->getMessage());
+    $core->error->add($e->getMessage());
 }
 
 # Actions combo box
 
-$pages_actions_page = new dcPagesActionsPage($core,'plugin.php',array('p'=>'pages'));
+$pages_actions_page = new dcPagesActionsPage($core, 'plugin.php', array('p' => 'pages'));
 
 if (!$pages_actions_page->process()) {
 
-
 # --BEHAVIOR-- adminPagesActionsCombo
-$core->callBehavior('adminPagesActionsCombo',array(&$combo_action));
+    $core->callBehavior('adminPagesActionsCombo', array(&$combo_action));
 
 /* Display
 -------------------------------------------------------- */
-?>
+    ?>
 <html>
 <head>
   <title><?php echo __('Pages'); ?></title>
   <?php
-  	echo
-  		dcPage::jsLoad('js/jquery/jquery-ui.custom.js').
-		dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js').
-		dcPage::jsLoad(dcPage::getPF('pages/list.js')).
-		'<script type="text/javascript">'."\n".
-		dcPage::jsVar('dotclear.msg.confirm_delete_posts',__("Are you sure you want to delete selected pages?")).
-		'</script>';
+echo
+    dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
+    dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
+    dcPage::jsLoad(dcPage::getPF('pages/js/list.js')) .
+    '<script type="text/javascript">' . "\n" .
+    dcPage::jsVar('dotclear.msg.confirm_delete_posts', __("Are you sure you want to delete selected pages?")) .
+        '</script>';
 
-  ?>
+    ?>
 </head>
 
@@ -69,47 +68,46 @@
 <?php
 echo dcPage::breadcrumb(
-	array(
-		html::escapeHTML($core->blog->name) => '',
-		__('Pages') => ''
-	)).dcPage::notices();
+        array(
+            html::escapeHTML($core->blog->name) => '',
+            __('Pages')                         => ''
+        )) . dcPage::notices();
 
-if (!empty($_GET['upd'])) {
-	dcPage::success(__('Selected pages have been successfully updated.'));
-} elseif (!empty($_GET['del'])) {
-	dcPage::success(__('Selected pages have been successfully deleted.'));
-} elseif (!empty($_GET['reo'])) {
-	dcPage::success(__('Selected pages have been successfully reordered.'));
-}
-echo
-'<p class="top-add"><a class="button add" href="'.$p_url.'&amp;act=page">'.__('New page').'</a></p>';
+    if (!empty($_GET['upd'])) {
+        dcPage::success(__('Selected pages have been successfully updated.'));
+    } elseif (!empty($_GET['del'])) {
+        dcPage::success(__('Selected pages have been successfully deleted.'));
+    } elseif (!empty($_GET['reo'])) {
+        dcPage::success(__('Selected pages have been successfully reordered.'));
+    }
+    echo
+    '<p class="top-add"><a class="button add" href="' . $p_url . '&amp;act=page">' . __('New page') . '</a></p>';
 
-if (!$core->error->flag())
-{
-	# Show pages
-	$post_list->display($page,$nb_per_page,
-	'<form action="'.$core->adminurl->get('admin.plugin').'" method="post" id="form-entries">'.
+    if (!$core->error->flag()) {
+        # Show pages
+        $post_list->display($page, $nb_per_page,
+            '<form action="' . $core->adminurl->get('admin.plugin') . '" method="post" id="form-entries">' .
 
-	'%s'.
+            '%s' .
 
-	'<div class="two-cols">'.
-	'<p class="col checkboxes-helpers"></p>'.
+            '<div class="two-cols">' .
+            '<p class="col checkboxes-helpers"></p>' .
 
-	'<p class="col right"><label for="action" class="classic">'.__('Selected pages action:').'</label> '.
-	form::combo('action',$pages_actions_page->getCombo()).
-	'<input id="do-action" type="submit" value="'.__('ok').'" />'.
-	form::hidden(array('post_type'),'page').
-	form::hidden(array('p'),'pages').
-	form::hidden(array('act'),'list').
-	$core->formNonce().
-	'</p></div>'.
-	'<p class="clear form-note hidden-if-js">'.
-	__('To rearrange pages order, change number at the begining of the line, then click on “Save pages order” button.').'</p>'.
-	'<p class="clear form-note hidden-if-no-js">'.
-	__('To rearrange pages order, move items by drag and drop, then click on “Save pages order” button.').'</p>'.
-	'<p><input type="submit" value="'.__('Save pages order').'" name="reorder" class="clear" /></p>'.
-	'</form>');
-}
-dcPage::helpBlock('pages');
-?>
+            '<p class="col right"><label for="action" class="classic">' . __('Selected pages action:') . '</label> ' .
+            form::combo('action', $pages_actions_page->getCombo()) .
+            '<input id="do-action" type="submit" value="' . __('ok') . '" />' .
+            form::hidden(array('post_type'), 'page') .
+            form::hidden(array('p'), 'pages') .
+            form::hidden(array('act'), 'list') .
+            $core->formNonce() .
+            '</p></div>' .
+            '<p class="clear form-note hidden-if-js">' .
+            __('To rearrange pages order, change number at the begining of the line, then click on “Save pages order” button.') . '</p>' .
+            '<p class="clear form-note hidden-if-no-js">' .
+            __('To rearrange pages order, move items by drag and drop, then click on “Save pages order” button.') . '</p>' .
+            '<p><input type="submit" value="' . __('Save pages order') . '" name="reorder" class="clear" /></p>' .
+            '</form>');
+    }
+    dcPage::helpBlock('pages');
+    ?>
 </body>
 </html>
Index: plugins/pings/js/post.js
===================================================================
--- plugins/pings/js/post.js	(revision 3709)
+++ plugins/pings/js/post.js	(revision 3709)
@@ -0,0 +1,17 @@
+/*global $, dotclear */
+'use strict';
+
+$(function() {
+	$('#edit-entry').onetabload(function() {
+		if ($('p.ping-services').length > 0) {
+			var p = $('<p></p>');
+			p.addClass('ping-services');
+			$('p.ping-services:last').after(p);
+			dotclear.checkboxesHelpers($('p.ping-services:last').get(0), $('.check-ping-services'));
+		}
+		$('h5.ping-services').toggleWithLegend($('p.ping-services'),{
+			user_pref: 'dcx_ping_services',
+			legend_click: true
+		});
+	});
+});
Index: plugins/pings/lib.pings.php
===================================================================
--- plugins/pings/lib.pings.php	(revision 3428)
+++ plugins/pings/lib.pings.php	(revision 3709)
@@ -10,119 +10,116 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_RC_PATH')) { return; }
+if (!defined('DC_RC_PATH')) {return;}
 
 class pingsAPI extends xmlrpcClient
 {
-	public static function doPings($srv_uri,$site_name,$site_url)
-	{
-		$o = new self($srv_uri);
-		$o->timeout = 3;
+    public static function doPings($srv_uri, $site_name, $site_url)
+    {
+        $o          = new self($srv_uri);
+        $o->timeout = 3;
 
-		$rsp = $o->query('weblogUpdates.ping',$site_name,$site_url);
+        $rsp = $o->query('weblogUpdates.ping', $site_name, $site_url);
 
-		if (isset($rsp['flerror']) && $rsp['flerror']) {
-			throw new Exception($rsp['message']);
-		}
+        if (isset($rsp['flerror']) && $rsp['flerror']) {
+            throw new Exception($rsp['message']);
+        }
 
-		return true;
-	}
+        return true;
+    }
 }
 
 class pingsAdminBehaviors
 {
-	public static function pingJS()
-	{
-		global $core;
+    public static function pingJS()
+    {
+        global $core;
 
-		$res =
-		"<script type=\"text/javascript\">\n".
-		dcPage::jsVar('dotclear.msg.check_all',__('Check all'))."\n".
-		"</script>\n".
-		dcPage::jsLoad(dcPage::getPF('pings/post.js'));
+        $res =
+        "<script type=\"text/javascript\">\n" .
+        dcPage::jsVar('dotclear.msg.check_all', __('Check all')) . "\n" .
+        "</script>\n" .
+        dcPage::jsLoad(dcPage::getPF('pings/js/post.js'));
 
-		return $res;
-	}
+        return $res;
+    }
 
-	public static function pingsFormItems($main,$sidebar,$post)
-	{
-		$core =& $GLOBALS['core'];
-		if (!$core->blog->settings->pings->pings_active) {
-			return;
-		}
+    public static function pingsFormItems($main, $sidebar, $post)
+    {
+        $core = &$GLOBALS['core'];
+        if (!$core->blog->settings->pings->pings_active) {
+            return;
+        }
 
-		$pings_uris = $core->blog->settings->pings->pings_uris;
-		if (empty($pings_uris) || !is_array($pings_uris)) {
-			return;
-		}
+        $pings_uris = $core->blog->settings->pings->pings_uris;
+        if (empty($pings_uris) || !is_array($pings_uris)) {
+            return;
+        }
 
-		if (!empty($_POST['pings_do']) && is_array($_POST['pings_do'])) {
-			$pings_do = $_POST['pings_do'];
-		} else {
-			$pings_do = array();
-		}
+        if (!empty($_POST['pings_do']) && is_array($_POST['pings_do'])) {
+            $pings_do = $_POST['pings_do'];
+        } else {
+            $pings_do = array();
+        }
 
-		$item = '<h5 class="ping-services">'.__('Pings').'</h5>';
-		$i = 0;
-		foreach ($pings_uris as $k => $v)
-		{
-			$item .=
-			'<p class="ping-services"><label for="pings_do-'.$i.'" class="classic">'.
-			form::checkbox(array('pings_do[]','pings_do-'.$i),html::escapeHTML($v),in_array($v,$pings_do), 'check-ping-services').' '.
-			html::escapeHTML($k).'</label></p>';
-			$i++;
-		}
-		$sidebar['options-box']['items']['pings']=$item;
+        $item = '<h5 class="ping-services">' . __('Pings') . '</h5>';
+        $i    = 0;
+        foreach ($pings_uris as $k => $v) {
+            $item .=
+            '<p class="ping-services"><label for="pings_do-' . $i . '" class="classic">' .
+            form::checkbox(array('pings_do[]', 'pings_do-' . $i), html::escapeHTML($v), in_array($v, $pings_do), 'check-ping-services') . ' ' .
+            html::escapeHTML($k) . '</label></p>';
+            $i++;
+        }
+        $sidebar['options-box']['items']['pings'] = $item;
 
-	}
+    }
 
-	public static function doPings($cur,$post_id)
-	{
-		if (empty($_POST['pings_do']) || !is_array($_POST['pings_do'])) {
-			return;
-		}
+    public static function doPings($cur, $post_id)
+    {
+        if (empty($_POST['pings_do']) || !is_array($_POST['pings_do'])) {
+            return;
+        }
 
-		$core =& $GLOBALS['core'];
-		if (!$core->blog->settings->pings->pings_active) {
-			return;
-		}
+        $core = &$GLOBALS['core'];
+        if (!$core->blog->settings->pings->pings_active) {
+            return;
+        }
 
-		$pings_uris = $core->blog->settings->pings->pings_uris;
-		if (empty($pings_uris) || !is_array($pings_uris)) {
-			return;
-		}
+        $pings_uris = $core->blog->settings->pings->pings_uris;
+        if (empty($pings_uris) || !is_array($pings_uris)) {
+            return;
+        }
 
-		foreach ($_POST['pings_do'] as $uri)
-		{
-			if (in_array($uri,$pings_uris)) {
-				try {
-					pingsAPI::doPings($uri,$core->blog->name,$core->blog->url);
-				} catch (Exception $e) {}
-			}
-		}
-	}
+        foreach ($_POST['pings_do'] as $uri) {
+            if (in_array($uri, $pings_uris)) {
+                try {
+                    pingsAPI::doPings($uri, $core->blog->name, $core->blog->url);
+                } catch (Exception $e) {}
+            }
+        }
+    }
 }
 
 class pingsCoreBehaviour
 {
-	public static function doPings($blog,$ids)
-	{
-		if (!$blog->settings->pings->pings_active) {
-			return;
-		}
-		if (!$blog->settings->pings->pings_auto) {
-			return;
-		}
+    public static function doPings($blog, $ids)
+    {
+        if (!$blog->settings->pings->pings_active) {
+            return;
+        }
+        if (!$blog->settings->pings->pings_auto) {
+            return;
+        }
 
-		$pings_uris = $blog->settings->pings->pings_uris;
-		if (empty($pings_uris) || !is_array($pings_uris)) {
-			return;
-		}
+        $pings_uris = $blog->settings->pings->pings_uris;
+        if (empty($pings_uris) || !is_array($pings_uris)) {
+            return;
+        }
 
-		foreach ($pings_uris as $uri)
-		{
-			try {
-				pingsAPI::doPings($uri,$blog->name,$blog->url);
-			} catch (Exception $e) {}
-		}
-	}
+        foreach ($pings_uris as $uri) {
+            try {
+                pingsAPI::doPings($uri, $blog->name, $blog->url);
+            } catch (Exception $e) {}
+        }
+    }
 }
Index: lugins/pings/post.js
===================================================================
--- plugins/pings/post.js	(revision 1818)
+++ 	(revision )
@@ -1,14 +1,0 @@
-$(function() {
-	$('#edit-entry').onetabload(function() {
-		if ($('p.ping-services').length > 0) {
-			p = $('<p></p>');
-			p.addClass('ping-services');
-			$('p.ping-services:last').after(p);
-			dotclear.checkboxesHelpers($('p.ping-services:last').get(0), $('.check-ping-services'));
-		}
-		$('h5.ping-services').toggleWithLegend($('p.ping-services'),{
-			user_pref: 'dcx_ping_services',
-			legend_click: true
-		});
-	});
-});
Index: plugins/simpleMenu/index.php
===================================================================
--- plugins/simpleMenu/index.php	(revision 3703)
+++ plugins/simpleMenu/index.php	(revision 3709)
@@ -384,5 +384,5 @@
     dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
     dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
-    dcPage::jsLoad(dcPage::getPF('simpleMenu/simplemenu.js'));
+    dcPage::jsLoad(dcPage::getPF('simpleMenu/js/simplemenu.js'));
 }
 echo dcPage::jsConfirmClose('settings', 'menuitemsappend', 'additem', 'menuitems');
Index: plugins/simpleMenu/js/simplemenu.js
===================================================================
--- plugins/simpleMenu/js/simplemenu.js	(revision 3709)
+++ plugins/simpleMenu/js/simplemenu.js	(revision 3709)
@@ -0,0 +1,28 @@
+/*global $, dotclear */
+'use strict';
+
+$(function() {
+  $('#menuitemslist').sortable({
+    'cursor': 'move'
+  });
+  $('#menuitemslist tr').hover(function() {
+    $(this).css({
+      'cursor': 'move'
+    });
+  }, function() {
+    $(this).css({
+      'cursor': 'auto'
+    });
+  });
+  $('#menuitems').submit(function() {
+    var order = [];
+    $('#menuitemslist tr td input.position').each(function() {
+      order.push(this.name.replace(/^order\[([^\]]+)\]$/, '$1'));
+    });
+    $('input[name=im_order]')[0].value = order.join(',');
+    return true;
+  });
+  $('#menuitemslist tr td input.position').hide();
+  $('#menuitemslist tr td.handle').addClass('handler');
+  dotclear.condSubmit('#menuitems tr td input[name^=items_selected]', '#menuitems #remove-action');
+});
Index: lugins/simpleMenu/simplemenu.js
===================================================================
--- plugins/simpleMenu/simplemenu.js	(revision 3591)
+++ 	(revision )
@@ -1,19 +1,0 @@
-$(function() {
-	$("#menuitemslist").sortable({'cursor':'move'});
-	$("#menuitemslist tr").hover(function () {
-		$(this).css({'cursor':'move'});
-	}, function () {
-		$(this).css({'cursor':'auto'});
-	});
-	$('#menuitems').submit(function() {
-		var order=[];
-		$("#menuitemslist tr td input.position").each(function() {
-			order.push(this.name.replace(/^order\[([^\]]+)\]$/,'$1'));
-		});
-		$("input[name=im_order]")[0].value = order.join(',');
-		return true;
-	});
-	$("#menuitemslist tr td input.position").hide();
-	$("#menuitemslist tr td.handle").addClass('handler');
-	dotclear.condSubmit('#menuitems tr td input[name^=items_selected]','#menuitems #remove-action');
-});
Index: plugins/tags/js/ckeditor-tags-plugin.js
===================================================================
--- plugins/tags/js/ckeditor-tags-plugin.js	(revision 2939)
+++ plugins/tags/js/ckeditor-tags-plugin.js	(revision 3709)
@@ -1,25 +1,28 @@
+/*global $, dotclear, CKEDITOR */
+'use strict';
+
 (function() {
-	CKEDITOR.plugins.add('dctags', {
-		init: function(editor) {
-			editor.addCommand('dcTagsCommand', {
-				exec: function(editor) {
-					if (editor.getSelection().getNative().toString().replace(/\s*/,'')!='') {
-						var str = editor.getSelection().getNative().toString().replace(/\s*/,'');
-						var url = dotclear.msg.tag_url;
-						window.dc_tag_editor.addMeta(str);
-						var link = '<a href="'+$.stripBaseURL(url+'/'+str)+'">'+str+'</a>';
-						var element = CKEDITOR.dom.element.createFromHtml(link);
-						editor.insertElement(element);
-					}
-				}
-			});
+  CKEDITOR.plugins.add('dctags', {
+    init: function(editor) {
+      editor.addCommand('dcTagsCommand', {
+        exec: function(editor) {
+          if (editor.getSelection().getNative().toString().replace(/\s*/, '') != '') {
+            var str = editor.getSelection().getNative().toString().replace(/\s*/, '');
+            var url = dotclear.msg.tag_url;
+            window.dc_tag_editor.addMeta(str);
+            var link = '<a href="' + $.stripBaseURL(url + '/' + str) + '">' + str + '</a>';
+            var element = CKEDITOR.dom.element.createFromHtml(link);
+            editor.insertElement(element);
+          }
+        }
+      });
 
-			editor.ui.addButton('dcTags', {
-				label: dotclear.msg.tag_title,
-				command: 'dcTagsCommand',
-				toolbar: 'insert',
-				icon: this.path + 'tag.png'
-			});
-		}
-	});
+      editor.ui.addButton('dcTags', {
+        label: dotclear.msg.tag_title,
+        command: 'dcTagsCommand',
+        toolbar: 'insert',
+        icon: this.path + 'tag.png'
+      });
+    }
+  });
 })();
Index: plugins/tags/js/legacy-post.js
===================================================================
--- plugins/tags/js/legacy-post.js	(revision 2924)
+++ plugins/tags/js/legacy-post.js	(revision 3709)
@@ -1,62 +1,83 @@
+/*global dotclear, jsToolBar */
+'use strict';
+
 // Toolbar button for tags
 jsToolBar.prototype.elements.tagSpace = {
-	type: 'space',
-	format:{
-		wysiwyg:true,
-		wiki:true,
-		xhtml:true,
-		markdown:true
-	}
+  type: 'space',
+  format: {
+    wysiwyg:  true,
+    wiki:     true,
+    xhtml:    true,
+    markdown: true
+  }
 };
 
-jsToolBar.prototype.elements.tag = {type: 'button', title: 'Keyword', fn:{} };
+jsToolBar.prototype.elements.tag = {
+  type: 'button',
+  title: 'Keyword',
+  fn: {}
+};
 jsToolBar.prototype.elements.tag.context = 'post';
 jsToolBar.prototype.elements.tag.icon = 'index.php?pf=tags/img/tag-add.png';
 jsToolBar.prototype.elements.tag.fn.wiki = function() {
-	this.encloseSelection('','',function(str) {
-		if (str == '') { window.alert(dotclear.msg.no_selection); return ''; }
-		if (str.indexOf(',') != -1) {
-			return str;
-		} else {
-			window.dc_tag_editor.addMeta(str);
-			return '['+str+'|tag:'+str+']';
-		}
-	});
+  this.encloseSelection('', '', function(str) {
+    if (str == '') {
+      window.alert(dotclear.msg.no_selection);
+      return '';
+    }
+    if (str.indexOf(',') != -1) {
+      return str;
+    } else {
+      window.dc_tag_editor.addMeta(str);
+      return '[' + str + '|tag:' + str + ']';
+    }
+  });
 };
 jsToolBar.prototype.elements.tag.fn.markdown = function() {
-	var url = this.elements.tag.url;
-	this.encloseSelection('','',function(str) {
-		if (str == '') { window.alert(dotclear.msg.no_selection); return ''; }
-		if (str.indexOf(',') != -1) {
-			return str;
-		} else {
-			window.dc_tag_editor.addMeta(str);
-			return '['+str+']('+this.stripBaseURL(url+'/'+str)+')';
-		}
-	});
+  var url = this.elements.tag.url;
+  this.encloseSelection('', '', function(str) {
+    if (str == '') {
+      window.alert(dotclear.msg.no_selection);
+      return '';
+    }
+    if (str.indexOf(',') != -1) {
+      return str;
+    } else {
+      window.dc_tag_editor.addMeta(str);
+      return '[' + str + '](' + this.stripBaseURL(url + '/' + str) + ')';
+    }
+  });
 };
 jsToolBar.prototype.elements.tag.fn.xhtml = function() {
-	var url = this.elements.tag.url;
-	this.encloseSelection('','',function(str) {
-		if (str == '') { window.alert(dotclear.msg.no_selection); return ''; }
-		if (str.indexOf(',') != -1) {
-			return str;
-		} else {
-			window.dc_tag_editor.addMeta(str);
-			return '<a href="'+this.stripBaseURL(url+'/'+str)+'">'+str+'</a>';
-		}
-	});
+  var url = this.elements.tag.url;
+  this.encloseSelection('', '', function(str) {
+    if (str == '') {
+      window.alert(dotclear.msg.no_selection);
+      return '';
+    }
+    if (str.indexOf(',') != -1) {
+      return str;
+    } else {
+      window.dc_tag_editor.addMeta(str);
+      return '<a href="' + this.stripBaseURL(url + '/' + str) + '">' + str + '</a>';
+    }
+  });
 };
 jsToolBar.prototype.elements.tag.fn.wysiwyg = function() {
-	var t = this.getSelectedText();
+  var t = this.getSelectedText();
 
-	if (t == '') { window.alert(dotclear.msg.no_selection); return; }
-	if (t.indexOf(',') != -1) { return; }
+  if (t == '') {
+    window.alert(dotclear.msg.no_selection);
+    return;
+  }
+  if (t.indexOf(',') != -1) {
+    return;
+  }
 
-	var n = this.getSelectedNode();
-	var a = document.createElement('a');
-	a.href = this.stripBaseURL(this.elements.tag.url+'/'+t);
-	a.appendChild(n);
-	this.insertNode(a);
-	window.dc_tag_editor.addMeta(t);
+  var n = this.getSelectedNode();
+  var a = document.createElement('a');
+  a.href = this.stripBaseURL(this.elements.tag.url + '/' + t);
+  a.appendChild(n);
+  this.insertNode(a);
+  window.dc_tag_editor.addMeta(t);
 };
Index: plugins/tags/js/post.js
===================================================================
--- plugins/tags/js/post.js	(revision 2924)
+++ plugins/tags/js/post.js	(revision 3709)
@@ -1,67 +1,71 @@
+/*global $, dotclear, metaEditor, editor_tags_options */
+'use strict';
+
 $(function() {
-	$('#edit-entry').onetabload(function() {
-		var tags_edit = $('#tags-edit');
-		var post_id = $('#id');
-		var meta_field = null;
+  $('#edit-entry').onetabload(function() {
+    var tags_edit = $('#tags-edit');
+    var post_id = $('#id');
+    var meta_field = null;
+    var mEdit = null;
 
-		if (tags_edit.length > 0) {
-			post_id = (post_id.length > 0) ? post_id.get(0).value : false;
-			if (post_id == false) {
-				meta_field = $('<input type="hidden" name="post_tags" />');
-				meta_field.val($('#post_tags').val());
-			}
-			var mEdit = new metaEditor(tags_edit,meta_field,'tag',editor_tags_options);
-			mEdit.meta_url = 'plugin.php?p=tags&m=tag_posts&amp;tag=';
-			mEdit.displayMeta('tag',post_id);
+    if (tags_edit.length > 0) {
+      post_id = (post_id.length > 0) ? post_id.get(0).value : false;
+      if (post_id == false) {
+        meta_field = $('<input type="hidden" name="post_tags" />');
+        meta_field.val($('#post_tags').val());
+      }
+      mEdit = new metaEditor(tags_edit, meta_field, 'tag', editor_tags_options);
+      mEdit.meta_url = 'plugin.php?p=tags&m=tag_posts&amp;tag=';
+      mEdit.displayMeta('tag', post_id);
 
-			// mEdit object reference for toolBar
-			window.dc_tag_editor = mEdit;
-		}
+      // mEdit object reference for toolBar
+      window.dc_tag_editor = mEdit;
+    }
 
-		$('#post_meta_input').autocomplete(mEdit.service_uri, {
-			extraParams: {
-				'f': 'searchMeta',
-				'metaType': 'tag'
-			},
-			delay: 1000,
-			multiple: true,
-			multipleSeparator: ", ",
-			matchSubset: false,
-			matchContains: true,
-			parse: function(xml) {
-				var results = [];
-				$(xml).find('meta').each(function(){
-					results[results.length] = {
-						data: {
-							"id": $(this).text(),
-							"count": $(this).attr("count"),
-							"percent":  $(this).attr("roundpercent")
-						},
-						result: $(this).text()
-					};
-				});
-				return results;
-			},
-			formatItem: function(tag) {
-				return tag.id + ' <em>(' +
-				dotclear.msg.tags_autocomplete.
-					replace('%p',tag.percent).
-					replace('%e',tag.count + ' ' +
-						(tag.count > 1 ?
-						dotclear.msg.entries :
-						dotclear.msg.entry)
-					) +
-				')</em>';
-			},
-			formatResult: function(tag) {
-				return tag.result;
-			}
-		});
-	});
+    $('#post_meta_input').autocomplete(mEdit.service_uri, {
+      extraParams: {
+        'f': 'searchMeta',
+        'metaType': 'tag'
+      },
+      delay: 1000,
+      multiple: true,
+      multipleSeparator: ', ',
+      matchSubset: false,
+      matchContains: true,
+      parse: function(xml) {
+        var results = [];
+        $(xml).find('meta').each(function() {
+          results[results.length] = {
+            data: {
+              'id': $(this).text(),
+              'count': $(this).attr('count'),
+              'percent': $(this).attr('roundpercent')
+            },
+            result: $(this).text()
+          };
+        });
+        return results;
+      },
+      formatItem: function(tag) {
+        return tag.id + ' <em>(' +
+          dotclear.msg.tags_autocomplete.
+        replace('%p', tag.percent).
+        replace('%e', tag.count + ' ' +
+            (tag.count > 1 ?
+              dotclear.msg.entries :
+              dotclear.msg.entry)
+          ) +
+          ')</em>';
+      },
+      formatResult: function(tag) {
+        return tag.result;
+      }
+    });
+  });
 
-	$('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{
-		user_pref: 'post_tags',
-		legend_click: true
-	});
+  $('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'), {
+    user_pref: 'post_tags',
+    legend_click: true
+  });
 
 });
Index: plugins/tags/js/posts_actions.js
===================================================================
--- plugins/tags/js/posts_actions.js	(revision 2546)
+++ plugins/tags/js/posts_actions.js	(revision 3709)
@@ -1,2 +1,5 @@
+/*global $, dotclear, metaEditor, editor_tags_options */
+'use strict';
+
 $(function() {
 	var tag_field = $('#new_tags');
@@ -22,5 +25,5 @@
 	$('#post_meta_input').autocomplete(mEdit.service_uri, {
 		extraParams: {
-			'f': 'searchMeta',
+			'f':        'searchMeta',
 			'metaType': 'tag'
 		},
@@ -34,7 +37,7 @@
 				results[results.length] = {
 					data: {
-						"id": $(this).text(),
-						"count": $(this).attr("count"),
-						"percent":  $(this).attr("roundpercent")
+						'id':      $(this).text(),
+						'count':   $(this).attr('count'),
+						'percent': $(this).attr('roundpercent')
 					},
 					result: $(this).text()
Index: plugins/themeEditor/index.php
===================================================================
--- plugins/themeEditor/index.php	(revision 3421)
+++ plugins/themeEditor/index.php	(revision 3709)
@@ -10,18 +10,18 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
+if (!defined('DC_CONTEXT_ADMIN')) {return;}
 
-require dirname(__FILE__).'/class.themeEditor.php';
+require dirname(__FILE__) . '/class.themeEditor.php';
 
-$file_default = $file = array('c'=>null, 'w'=>false, 'type'=>null, 'f'=>null, 'default_file'=>false);
+$file_default = $file = array('c' => null, 'w' => false, 'type' => null, 'f' => null, 'default_file' => false);
 
 # Get interface setting
 $core->auth->user_prefs->addWorkspace('interface');
-$user_ui_colorsyntax = $core->auth->user_prefs->interface->colorsyntax;
+$user_ui_colorsyntax       = $core->auth->user_prefs->interface->colorsyntax;
 $user_ui_colorsyntax_theme = $core->auth->user_prefs->interface->colorsyntax_theme;
 
 # Loading themes
 $core->themes = new dcThemes($core);
-$core->themes->loadModules($core->blog->themes_path,null);
+$core->themes->loadModules($core->blog->themes_path, null);
 $T = $core->themes->getModules($core->blog->settings->system->theme);
 $o = new dcThemeEditor($core);
@@ -29,40 +29,34 @@
 try
 {
-	try
-	{
-		if (!empty($_REQUEST['tpl'])) {
-			$file = $o->getFileContent('tpl',$_REQUEST['tpl']);
-		} elseif (!empty($_REQUEST['css'])) {
-			$file = $o->getFileContent('css',$_REQUEST['css']);
-		} elseif (!empty($_REQUEST['js'])) {
-			$file = $o->getFileContent('js',$_REQUEST['js']);
-		} elseif (!empty($_REQUEST['po'])) {
-			$file = $o->getFileContent('po',$_REQUEST['po']);
-		}
-	}
-	catch (Exception $e)
-	{
-		$file = $file_default;
-		throw $e;
-	}
+    try
+    {
+        if (!empty($_REQUEST['tpl'])) {
+            $file = $o->getFileContent('tpl', $_REQUEST['tpl']);
+        } elseif (!empty($_REQUEST['css'])) {
+            $file = $o->getFileContent('css', $_REQUEST['css']);
+        } elseif (!empty($_REQUEST['js'])) {
+            $file = $o->getFileContent('js', $_REQUEST['js']);
+        } elseif (!empty($_REQUEST['po'])) {
+            $file = $o->getFileContent('po', $_REQUEST['po']);
+        }
+    } catch (Exception $e) {
+        $file = $file_default;
+        throw $e;
+    }
 
-	# Write file
-	if (!empty($_POST['write']))
-	{
-		$file['c'] = $_POST['file_content'];
-		$o->writeFile($file['type'],$file['f'],$file['c']);
-	}
+    # Write file
+    if (!empty($_POST['write'])) {
+        $file['c'] = $_POST['file_content'];
+        $o->writeFile($file['type'], $file['f'], $file['c']);
+    }
 
-	# Delete file
-	if (!empty($_POST['delete']))
-	{
-		$o->deleteFile($file['type'],$file['f']);
-		dcPage::addSuccessNotice(__('The file has been reset.'));
-		http::redirect($p_url.'&'.$file['type'].'='.$file['f']);
-	}
-}
-catch (Exception $e)
-{
-	$core->error->add($e->getMessage());
+    # Delete file
+    if (!empty($_POST['delete'])) {
+        $o->deleteFile($file['type'], $file['f']);
+        dcPage::addSuccessNotice(__('The file has been reset.'));
+        http::redirect($p_url . '&' . $file['type'] . '=' . $file['f']);
+    }
+} catch (Exception $e) {
+    $core->error->add($e->getMessage());
 }
 ?>
@@ -70,18 +64,20 @@
 <html>
 <head>
-	<title><?php echo __('Edit theme files'); ?></title>
-	<script type="text/javascript">
-		<?php echo dcPage::jsVar('dotclear.msg.saving_document',__("Saving document...")); ?>
-		<?php echo dcPage::jsVar('dotclear.msg.document_saved',__("Document saved")); ?>
-		<?php echo dcPage::jsVar('dotclear.msg.error_occurred',__("An error occurred:")); ?>
-		<?php echo dcPage::jsVar('dotclear.msg.confirm_reset_file',__("Are you sure you want to reset this file?")); ?>
-		<?php echo dcPage::jsVar('dotclear.colorsyntax',$user_ui_colorsyntax); ?>
-	</script>
-	<?php echo dcPage::jsConfirmClose('file-form'); ?>
-	<script type="text/javascript" src="<?php echo dcPage::getPF('themeEditor/script.js'); ?>"></script>
-	<?php if ($user_ui_colorsyntax) { ?>
-	<?php echo dcPage::jsLoadCodeMirror($user_ui_colorsyntax_theme); ?>
-	<?php } ?>
-	<?php echo dcPage::cssLoad(dcPage::getPF('themeEditor/style.css'));?>
+    <title><?php echo __('Edit theme files'); ?></title>
+    <?php
+echo dcPage::jsVars(array(
+    'dotclear.msg.saving_document'    => __("Saving document..."),
+    'dotclear.msg.document_saved'     => __("Document saved"),
+    'dotclear.msg.error_occurred'     => __("An error occurred:"),
+    'dotclear.msg.confirm_reset_file' => __("Are you sure you want to reset this file?"),
+    'dotclear.colorsyntax'            => $user_ui_colorsyntax
+)) .
+dcPage::jsConfirmClose('file-form') .
+dcPage::jsLoad(dcPage::getPF('themeEditor/js/script.js'));
+if ($user_ui_colorsyntax) {
+    echo dcPage::jsLoadCodeMirror($user_ui_colorsyntax_theme);
+}
+echo dcPage::cssLoad(dcPage::getPF('themeEditor/style.css'));
+?>
 </head>
 
@@ -89,75 +85,69 @@
 <?php
 echo dcPage::breadcrumb(
-	array(
-		html::escapeHTML($core->blog->name) => '',
-		__('Blog appearance') => $core->adminurl->get('admin.blog.theme'),
-		__('Edit theme files') => ''
-	)).
-	dcPage::notices();
+    array(
+        html::escapeHTML($core->blog->name) => '',
+        __('Blog appearance')               => $core->adminurl->get('admin.blog.theme'),
+        __('Edit theme files')              => ''
+    )) .
+dcPage::notices();
 ?>
 
-<p><strong><?php echo sprintf(__('Your current theme on this blog is "%s".'),html::escapeHTML($T['name'])); ?></strong></p>
+<p><strong><?php echo sprintf(__('Your current theme on this blog is "%s".'), html::escapeHTML($T['name'])); ?></strong></p>
 
-<?php if ($core->blog->settings->system->theme == 'default') { ?>
-	<div class="error"><p><?php echo __("You can't edit default theme."); ?></p></div>
-	</body></html>
-<?php } ?>
+<?php if ($core->blog->settings->system->theme == 'default') {?>
+    <div class="error"><p><?php echo __("You can't edit default theme."); ?></p></div>
+    </body></html>
+<?php }?>
 
 <div id="file-box">
 <div id="file-editor">
 <?php
-if ($file['c'] === null)
-{
-	echo '<p>'.__('Please select a file to edit.').'</p>';
-}
-else
-{
-	echo
-	'<form id="file-form" action="'.$p_url.'" method="post">'.
-	'<div class="fieldset"><h3>'.__('File editor').'</h3>'.
-	'<p><label for="file_content">'.sprintf(__('Editing file %s'),'<strong>'.$file['f']).'</strong></label></p>'.
-	'<p>'.form::textarea('file_content',72,25,html::escapeHTML($file['c']),'maximal','',!$file['w']).'</p>';
+if ($file['c'] === null) {
+    echo '<p>' . __('Please select a file to edit.') . '</p>';
+} else {
+    echo
+    '<form id="file-form" action="' . $p_url . '" method="post">' .
+    '<div class="fieldset"><h3>' . __('File editor') . '</h3>' .
+    '<p><label for="file_content">' . sprintf(__('Editing file %s'), '<strong>' . $file['f']) . '</strong></label></p>' .
+    '<p>' . form::textarea('file_content', 72, 25, html::escapeHTML($file['c']), 'maximal', '', !$file['w']) . '</p>';
 
-	if ($file['w'])
-	{
-		echo
-		'<p><input type="submit" name="write" value="'.__('Save').' (s)" accesskey="s" /> '.
-		($o->deletableFile($file['type'],$file['f']) ? '<input type="submit" name="delete" class="delete" value="'.__('Reset').'" />' : '').
-		$core->formNonce().
-		($file['type'] ? form::hidden(array($file['type']),$file['f']) : '').
-		'</p>';
-	}
-	else
-	{
-		echo '<p>'.__('This file is not writable. Please check your theme files permissions.').'</p>';
-	}
+    if ($file['w']) {
+        echo
+        '<p><input type="submit" name="write" value="' . __('Save') . ' (s)" accesskey="s" /> ' .
+        ($o->deletableFile($file['type'], $file['f']) ? '<input type="submit" name="delete" class="delete" value="' . __('Reset') . '" />' : '') .
+        $core->formNonce() .
+            ($file['type'] ? form::hidden(array($file['type']), $file['f']) : '') .
+            '</p>';
+    } else {
+        echo '<p>' . __('This file is not writable. Please check your theme files permissions.') . '</p>';
+    }
 
-	echo
-	'</div></form>';
+    echo
+        '</div></form>';
 
-	if ($user_ui_colorsyntax) {
-		$editorMode =
-			(!empty($_REQUEST['css']) ? "css" :
-			(!empty($_REQUEST['js']) ? "javascript" :
-			(!empty($_REQUEST['po']) ? "text/plain" : "text/html")));
-		echo
-		'<script type="text/javascript">
-			window.CodeMirror.defineMode("dotclear", function(config) {
-				return CodeMirror.multiplexingMode(
-					CodeMirror.getMode(config, "'.$editorMode.'"),
-					{open: "{{tpl:", close: "}}",
-					 mode: CodeMirror.getMode(config, "text/plain"),
-					 delimStyle: "delimit"},
-					{open: "<tpl:", close: ">",
-					 mode: CodeMirror.getMode(config, "text/plain"),
-					 delimStyle: "delimit"},
-					{open: "</tpl:", close: ">",
-					 mode: CodeMirror.getMode(config, "text/plain"),
-					 delimStyle: "delimit"}
-					);
-			});
-	    </script>';
-	    echo dcPage::jsRunCodeMirror('editor','file_content','dotclear',$user_ui_colorsyntax_theme);
-	}
+    if ($user_ui_colorsyntax) {
+        $editorMode =
+            (!empty($_REQUEST['css']) ? "css" :
+            (!empty($_REQUEST['js']) ? "javascript" :
+                (!empty($_REQUEST['po']) ? "text/plain" : "text/html")));
+        echo
+            '<script type="text/javascript">
+            window.CodeMirror.defineMode("dotclear", function(config) {
+                return CodeMirror.multiplexingMode(
+                    CodeMirror.getMode(config, "' . $editorMode . '"),
+                    {open: "{{tpl:", close: "}}",
+                     mode: CodeMirror.getMode(config, "text/plain"),
+                     delimStyle: "delimit"},
+                    {open: "<tpl:", close: ">",
+                     mode: CodeMirror.getMode(config, "text/plain"),
+                     delimStyle: "delimit"},
+                    {open: "</tpl:", close: ">",
+                     mode: CodeMirror.getMode(config, "text/plain"),
+                     delimStyle: "delimit"}
+                    );
+            });
+        </script>';
+        echo dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', $user_ui_colorsyntax_theme);
+    }
 }
 ?>
@@ -167,17 +157,17 @@
 <div id="file-chooser">
 <h3><?php echo __('Templates files'); ?></h3>
-<?php echo $o->filesList('tpl','<a href="'.$p_url.'&amp;tpl=%2$s" class="tpl-link">%1$s</a>'); ?>
+<?php echo $o->filesList('tpl', '<a href="' . $p_url . '&amp;tpl=%2$s" class="tpl-link">%1$s</a>'); ?>
 
 <h3><?php echo __('CSS files'); ?></h3>
-<?php echo $o->filesList('css','<a href="'.$p_url.'&amp;css=%2$s" class="css-link">%1$s</a>'); ?>
+<?php echo $o->filesList('css', '<a href="' . $p_url . '&amp;css=%2$s" class="css-link">%1$s</a>'); ?>
 
 <h3><?php echo __('JavaScript files'); ?></h3>
-<?php echo $o->filesList('js','<a href="'.$p_url.'&amp;js=%2$s" class="js-link">%1$s</a>'); ?>
+<?php echo $o->filesList('js', '<a href="' . $p_url . '&amp;js=%2$s" class="js-link">%1$s</a>'); ?>
 
 <h3><?php echo __('Locales files'); ?></h3>
-<?php echo $o->filesList('po','<a href="'.$p_url.'&amp;po=%2$s" class="po-link">%1$s</a>'); ?>
+<?php echo $o->filesList('po', '<a href="' . $p_url . '&amp;po=%2$s" class="po-link">%1$s</a>'); ?>
 </div>
 
-<?php dcPage::helpBlock('themeEditor'); ?>
+<?php dcPage::helpBlock('themeEditor');?>
 </body>
 </html>
Index: plugins/themeEditor/js/script.js
===================================================================
--- plugins/themeEditor/js/script.js	(revision 3709)
+++ plugins/themeEditor/js/script.js	(revision 3709)
@@ -0,0 +1,48 @@
+/*global $, dotclear, editor, confirmClosePage */
+'use strict';
+
+$(function() {
+  // Cope with saving
+  var msg = false;
+  $('#file-form input[name="write"]').click(function(e) {
+    var f = this.form;
+
+    var data = {
+      file_content: (!dotclear.colorsyntax ? $(f).find('#file_content').get(0).value : editor.getValue()),
+      xd_check: $(f).find('input[name="xd_check"]').get(0).value,
+      write: 1
+    };
+
+    if (msg == false) {
+      msg = $('<p style="font-weight:bold; color:red;"></p>');
+      $('#file_content').parent().after(msg);
+    }
+
+    msg.text(dotclear.msg.saving_document);
+
+    $.post(document.location.href, data, function(res) {
+      var err = $(res).find('div.error li:first');
+      if (err.length > 0) {
+        msg.text(dotclear.msg.error_occurred + ' ' + err.text());
+        return;
+      } else {
+        msg.text(dotclear.msg.document_saved);
+        $('#file-chooser').empty();
+        $(res).find('#file-chooser').children().appendTo('#file-chooser');
+
+        if ($.isFunction(confirmClosePage.getCurrentForms)) {
+          confirmClosePage.forms = [];
+          confirmClosePage.getCurrentForms();
+        }
+      }
+    });
+
+    e.preventDefault();
+  });
+
+  // Confirm for deleting current file
+  $('#file-form input[name="delete"]').click(function() {
+    return window.confirm(dotclear.msg.confirm_reset_file);
+  });
+
+});
Index: lugins/themeEditor/script.js
===================================================================
--- plugins/themeEditor/script.js	(revision 2905)
+++ 	(revision )
@@ -1,45 +1,0 @@
-$(function() {
-	// Cope with saving
-	var msg = false;
-	$('#file-form input[name="write"]').click(function(e) {
-		var f = this.form;
-
-		var data = {
-			file_content: (!dotclear.colorsyntax ? $(f).find('#file_content').get(0).value : editor.getValue()),
-			xd_check: $(f).find('input[name="xd_check"]').get(0).value,
-			write: 1
-		};
-
-		if (msg == false) {
-			msg = $('<p style="font-weight:bold; color:red;"></p>');
-			$('#file_content').parent().after(msg);
-		}
-
-		msg.text(dotclear.msg.saving_document);
-
-		$.post(document.location.href,data,function(res,status) {
-			var err = $(res).find('div.error li:first');
-			if (err.length > 0) {
-				msg.text(dotclear.msg.error_occurred + ' ' + err.text());
-				return;
-			} else {
-				msg.text(dotclear.msg.document_saved);
-				$('#file-chooser').empty();
-				$(res).find('#file-chooser').children().appendTo('#file-chooser');
-
-				if ($.isFunction(confirmClosePage['getCurrentForms'])) {
-					confirmClosePage.forms = [];
-					confirmClosePage.getCurrentForms();
-				}
-			}
-		});
-
-		e.preventDefault();
-	});
-
-	// Confirm for deleting current file
-	$('#file-form input[name="delete"]').click(function() {
-		return window.confirm(dotclear.msg.confirm_reset_file);
-	});
-
-});
Index: plugins/userPref/index.php
===================================================================
--- plugins/userPref/index.php	(revision 3703)
+++ plugins/userPref/index.php	(revision 3709)
@@ -97,19 +97,5 @@
 <head>
   <title>user:preferences</title>
-  <?php echo dcPage::jsPageTabs($part); ?>
-    <script type="text/javascript">
-    $(function() {
-        $("#gp_submit,#lp_submit").hide();
-        $('#part-local,#part-global').tabload(function() {
-            $('.multi-part.active select.navigation option:first').attr('selected',true);
-        });
-        $("#gp_nav").change(function() {
-            window.location = $("#gp_nav option:selected").val();
-        });
-        $("#lp_nav").change(function() {
-            window.location = $("#lp_nav option:selected").val();
-        });
-    });
-    </script>
+  <?php echo dcPage::jsPageTabs($part) . dcPage::jsLoad(dcPage::getPF('userPref/js/index.js')); ?>
 </head>
 
Index: plugins/userPref/js/index.js
===================================================================
--- plugins/userPref/js/index.js	(revision 3709)
+++ plugins/userPref/js/index.js	(revision 3709)
@@ -0,0 +1,15 @@
+/*global $ */
+'use strict';
+
+$(function() {
+  $('#gp_submit,#lp_submit').hide();
+  $('#part-local,#part-global').tabload(function() {
+    $('.multi-part.active select.navigation option:first').attr('selected', true);
+  });
+  $('#gp_nav').change(function() {
+    window.location = $('#gp_nav option:selected').val();
+  });
+  $('#lp_nav').change(function() {
+    window.location = $('#lp_nav option:selected').val();
+  });
+});
Index: lugins/widgets/dragdrop.js
===================================================================
--- plugins/widgets/dragdrop.js	(revision 2980)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
-# -- BEGIN LICENSE BLOCK ---------------------------------------
-#
-# This file is part of Dotclear 2.
-#
-# Copyright (c) 2003-2015 Olivier Meunier & Association Dotclear
-# Licensed under the GPL version 2.0 license.
-# See LICENSE file or
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-#
-# -- END LICENSE BLOCK -----------------------------------------
-*/
-
-$(function() {
-
-	// clean
-	$('.remove-if-drag').remove();
-	$('.hidden-if-drag').hide();
-	$('.widgets, .sortable-delete').addClass('if-drag');
-
-	// move
-	$( ".connected, .sortable-delete" ).sortable({
-		tolerance: "move",
-		cursor: "move",
-		axis: "y",
-		dropOnEmpty: true,
-		handle: ".widget-name",
-		placeholder: "ui-sortable-placeholder",
-		items: "li:not(.sortable-delete-placeholder,.empty-widgets)",
-		connectWith: ".connected, .sortable-delete",
-		start: function( event, ui ) {
-			// petit décalage esthétique
-			ui.item.css('left', ui.item.position().left + 20);
-		},
-		update: function(event, ui) {
-			ul = $(this);
-			widget = ui.item;
-			field = ul.parents('.widgets');
-
-			// met a zéro le décalage
-			ui.item.css('left', 'auto');
-			// Fixes issue #2080
-			ui.item.css('width', 'auto');
-			ui.item.css('height', 'auto');
-
-			// signale les zones vides
-			if( ul.find('li:not(.empty-widgets)').length == 0 ) {
-				ul.find('li.empty-widgets').show();
-				field.find('ul.sortable-delete').hide();
-			} else {
-				ul.find('li.empty-widgets').hide();
-				field.find('ul.sortable-delete').show();
-			}
-
-			// remove
-			if( widget.parents('ul').is('.sortable-delete') ) {
-				widget.hide('slow', function() {
-					$(this).remove();
-				});
-			}
-
-			// réordonne
-			reorder(ul);
-
-			// expand
-			if(widget.find('img.expand').length == 0) {
-				dotclear.postExpander(widget);
-				dotclear.viewPostContent(widget, 'close');
-			}
-		}
-	});
-
-	// add
-	$( "#widgets-ref > li" ).draggable({
-		tolerance: "move",
-		cursor: "move",
-		connectToSortable: ".connected",
-		helper: "clone",
-		revert: "invalid",
-		start: function( event, ui ) {
-			ui.helper.css({'width': $('#widgets-ref > li').css('width')});
-		}
-	});
-
-	$("li.ui-draggable, ul.ui-sortable li")
-		.not('ul.sortable-delete li, li.empty-widgets')
-		.css({'cursor':'move'});
-});
Index: plugins/widgets/index.php
===================================================================
--- plugins/widgets/index.php	(revision 3421)
+++ plugins/widgets/index.php	(revision 3709)
@@ -10,203 +10,192 @@
 #
 # -- END LICENSE BLOCK -----------------------------------------
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
-
-include dirname(__FILE__).'/_default_widgets.php';
+if (!defined('DC_CONTEXT_ADMIN')) {return;}
+
+include dirname(__FILE__) . '/_default_widgets.php';
 
 # Loading navigation, extra widgets and custom widgets
 $widgets_nav = null;
 if ($core->blog->settings->widgets->widgets_nav) {
-	$widgets_nav = dcWidgets::load($core->blog->settings->widgets->widgets_nav);
+    $widgets_nav = dcWidgets::load($core->blog->settings->widgets->widgets_nav);
 }
 $widgets_extra = null;
 if ($core->blog->settings->widgets->widgets_extra) {
-	$widgets_extra = dcWidgets::load($core->blog->settings->widgets->widgets_extra);
+    $widgets_extra = dcWidgets::load($core->blog->settings->widgets->widgets_extra);
 }
 $widgets_custom = null;
 if ($core->blog->settings->widgets->widgets_custom) {
-	$widgets_custom = dcWidgets::load($core->blog->settings->widgets->widgets_custom);
+    $widgets_custom = dcWidgets::load($core->blog->settings->widgets->widgets_custom);
 }
 
 $append_combo = array(
-	'-' => 0,
-	__('navigation') => 'nav',
-	__('extra') => 'extra',
-	__('custom') => 'custom'
+    '-'              => 0,
+    __('navigation') => 'nav',
+    __('extra')      => 'extra',
+    __('custom')     => 'custom'
 );
 
 function literalNullString($v)
 {
-	if ($v == '') {
-		return '&lt;'.__('empty string').'&gt;';
-	}
-	return $v;
+    if ($v == '') {
+        return '&lt;' . __('empty string') . '&gt;';
+    }
+    return $v;
 }
 
 # Adding widgets to sidebars
-if (!empty($_POST['append']) && is_array($_POST['addw']))
-{
-	# Filter selection
-	$addw = array();
-	foreach ($_POST['addw'] as $k => $v) {
-		if (($v == 'extra' || $v == 'nav' || $v == 'custom') && $__widgets->{$k} !== null ) {
-			$addw[$k] = $v;
-		}
-	}
-
-	# Append 1 widget
-	$wid = false;
-	if( gettype($_POST['append']) == 'array' && count($_POST['append']) == 1 ) {
-		$wid = array_keys($_POST['append']);
-		$wid = $wid[0];
-	}
-
-	# Append widgets
-	if (!empty($addw))
-	{
-		if (!($widgets_nav instanceof dcWidgets)) {
-			$widgets_nav = new dcWidgets;
-		}
-		if (!($widgets_extra instanceof dcWidgets)) {
-			$widgets_extra = new dcWidgets();
-		}
-		if (!($widgets_custom instanceof dcWidgets)) {
-			$widgets_custom = new dcWidgets();
-		}
-
-		foreach ($addw as $k => $v)
-		{
-			if( !$wid || $wid == $k )
-			{
-				switch ($v) {
-					case 'nav':
-						$widgets_nav->append($__widgets->{$k});
-						break;
-					case 'extra':
-						$widgets_extra->append($__widgets->{$k});
-						break;
-					case 'custom':
-						$widgets_custom->append($__widgets->{$k});
-						break;
-				}
-			}
-		}
-
-		try {
-			$core->blog->settings->addNamespace('widgets');
-			$core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store());
-			$core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store());
-			$core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store());
-			$core->blog->triggerBlog();
-			http::redirect($p_url);
-		} catch (Exception $e) {
-			$core->error->add($e->getMessage());
-		}
-	}
+if (!empty($_POST['append']) && is_array($_POST['addw'])) {
+    # Filter selection
+    $addw = array();
+    foreach ($_POST['addw'] as $k => $v) {
+        if (($v == 'extra' || $v == 'nav' || $v == 'custom') && $__widgets->{$k} !== null) {
+            $addw[$k] = $v;
+        }
+    }
+
+    # Append 1 widget
+    $wid = false;
+    if (gettype($_POST['append']) == 'array' && count($_POST['append']) == 1) {
+        $wid = array_keys($_POST['append']);
+        $wid = $wid[0];
+    }
+
+    # Append widgets
+    if (!empty($addw)) {
+        if (!($widgets_nav instanceof dcWidgets)) {
+            $widgets_nav = new dcWidgets;
+        }
+        if (!($widgets_extra instanceof dcWidgets)) {
+            $widgets_extra = new dcWidgets();
+        }
+        if (!($widgets_custom instanceof dcWidgets)) {
+            $widgets_custom = new dcWidgets();
+        }
+
+        foreach ($addw as $k => $v) {
+            if (!$wid || $wid == $k) {
+                switch ($v) {
+                    case 'nav':
+                        $widgets_nav->append($__widgets->{$k});
+                        break;
+                    case 'extra':
+                        $widgets_extra->append($__widgets->{$k});
+                        break;
+                    case 'custom':
+                        $widgets_custom->append($__widgets->{$k});
+                        break;
+                }
+            }
+        }
+
+        try {
+            $core->blog->settings->addNamespace('widgets');
+            $core->blog->settings->widgets->put('widgets_nav', $widgets_nav->store());
+            $core->blog->settings->widgets->put('widgets_extra', $widgets_extra->store());
+            $core->blog->settings->widgets->put('widgets_custom', $widgets_custom->store());
+            $core->blog->triggerBlog();
+            http::redirect($p_url);
+        } catch (Exception $e) {
+            $core->error->add($e->getMessage());
+        }
+    }
 }
 
 # Removing ?
 $removing = false;
-if ( isset($_POST['w']) && is_array($_POST['w']) ) {
-	foreach ($_POST['w'] as $nsid => $nsw) {
-		foreach ($nsw as $i => $v) {
-			if (!empty($v['_rem'])) {
-				$removing = true;
-				break 2;
-			}
-		}
-	}
+if (isset($_POST['w']) && is_array($_POST['w'])) {
+    foreach ($_POST['w'] as $nsid => $nsw) {
+        foreach ($nsw as $i => $v) {
+            if (!empty($v['_rem'])) {
+                $removing = true;
+                break 2;
+            }
+        }
+    }
 }
 
 # Move ?
 $move = false;
-if ( isset($_POST['w']) && is_array($_POST['w']) ) {
-	foreach ($_POST['w'] as $nsid => $nsw) {
-		foreach ($nsw as $i => $v) {
-			if (!empty($v['_down'])) {
-				$oldorder = $_POST['w'][$nsid][$i]['order'];
-				$neworder = $oldorder + 1;
-				if( isset($_POST['w'][$nsid][$neworder]) ) {
-					$_POST['w'][$nsid][$i]['order'] = $neworder;
-					$_POST['w'][$nsid][$neworder]['order'] = $oldorder;
-					$move = true;
-				}
-			}
-			if (!empty($v['_up'])) {
-				$oldorder = $_POST['w'][$nsid][$i]['order'];
-				$neworder = $oldorder - 1;
-				if( isset($_POST['w'][$nsid][$neworder]) ) {
-					$_POST['w'][$nsid][$i]['order'] = $neworder;
-					$_POST['w'][$nsid][$neworder]['order'] = $oldorder;
-					$move = true;
-				}
-			}
-		}
-	}
+if (isset($_POST['w']) && is_array($_POST['w'])) {
+    foreach ($_POST['w'] as $nsid => $nsw) {
+        foreach ($nsw as $i => $v) {
+            if (!empty($v['_down'])) {
+                $oldorder = $_POST['w'][$nsid][$i]['order'];
+                $neworder = $oldorder + 1;
+                if (isset($_POST['w'][$nsid][$neworder])) {
+                    $_POST['w'][$nsid][$i]['order']        = $neworder;
+                    $_POST['w'][$nsid][$neworder]['order'] = $oldorder;
+                    $move                                  = true;
+                }
+            }
+            if (!empty($v['_up'])) {
+                $oldorder = $_POST['w'][$nsid][$i]['order'];
+                $neworder = $oldorder - 1;
+                if (isset($_POST['w'][$nsid][$neworder])) {
+                    $_POST['w'][$nsid][$i]['order']        = $neworder;
+                    $_POST['w'][$nsid][$neworder]['order'] = $oldorder;
+                    $move                                  = true;
+                }
+            }
+        }
+    }
 }
 
 # Update sidebars
-if (!empty($_POST['wup']) || $removing || $move )
-{
-	if (!isset($_POST['w']) || !is_array($_POST['w'])) {
-		$_POST['w'] = array();
-	}
-
-	try
-	{
-		# Removing mark as _rem widgets
-		foreach ($_POST['w'] as $nsid => $nsw) {
-			foreach ($nsw as $i => $v) {
-				if (!empty($v['_rem'])) {
-					unset($_POST['w'][$nsid][$i]);
-					continue;
-				}
-			}
-		}
-
-		if (!isset($_POST['w']['nav'])) {
-			$_POST['w']['nav'] = array();
-		}
-		if (!isset($_POST['w']['extra'])) {
-			$_POST['w']['extra'] = array();
-		}
-		if (!isset($_POST['w']['custom'])) {
-			$_POST['w']['custom'] = array();
-		}
-
-		$widgets_nav = dcWidgets::loadArray($_POST['w']['nav'],$__widgets);
-		$widgets_extra = dcWidgets::loadArray($_POST['w']['extra'],$__widgets);
-		$widgets_custom = dcWidgets::loadArray($_POST['w']['custom'],$__widgets);
-
-		$core->blog->settings->addNamespace('widgets');
-		$core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store());
-		$core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store());
-		$core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store());
-		$core->blog->triggerBlog();
-
-		dcPage::addSuccessNotice(__('Sidebars and their widgets have been saved.'));
-		http::redirect($p_url);
-	}
-	catch (Exception $e)
-	{
-		$core->error->add($e->getMessage());
-	}
-}
-elseif (!empty($_POST['wreset']))
-{
-	try
-	{
-		$core->blog->settings->addNamespace('widgets');
-		$core->blog->settings->widgets->put('widgets_nav','');
-		$core->blog->settings->widgets->put('widgets_extra','');
-		$core->blog->settings->widgets->put('widgets_custom','');
-		$core->blog->triggerBlog();
-
-		dcPage::addSuccessNotice(__('Sidebars have been resetting.'));
-		http::redirect($p_url);
-	}
-	catch (Exception $e)
-	{
-		$core->error->add($e->getMessage());
-	}
+if (!empty($_POST['wup']) || $removing || $move) {
+    if (!isset($_POST['w']) || !is_array($_POST['w'])) {
+        $_POST['w'] = array();
+    }
+
+    try
+    {
+        # Removing mark as _rem widgets
+        foreach ($_POST['w'] as $nsid => $nsw) {
+            foreach ($nsw as $i => $v) {
+                if (!empty($v['_rem'])) {
+                    unset($_POST['w'][$nsid][$i]);
+                    continue;
+                }
+            }
+        }
+
+        if (!isset($_POST['w']['nav'])) {
+            $_POST['w']['nav'] = array();
+        }
+        if (!isset($_POST['w']['extra'])) {
+            $_POST['w']['extra'] = array();
+        }
+        if (!isset($_POST['w']['custom'])) {
+            $_POST['w']['custom'] = array();
+        }
+
+        $widgets_nav    = dcWidgets::loadArray($_POST['w']['nav'], $__widgets);
+        $widgets_extra  = dcWidgets::loadArray($_POST['w']['extra'], $__widgets);
+        $widgets_custom = dcWidgets::loadArray($_POST['w']['custom'], $__widgets);
+
+        $core->blog->settings->addNamespace('widgets');
+        $core->blog->settings->widgets->put('widgets_nav', $widgets_nav->store());
+        $core->blog->settings->widgets->put('widgets_extra', $widgets_extra->store());
+        $core->blog->settings->widgets->put('widgets_custom', $widgets_custom->store());
+        $core->blog->triggerBlog();
+
+        dcPage::addSuccessNotice(__('Sidebars and their widgets have been saved.'));
+        http::redirect($p_url);
+    } catch (Exception $e) {
+        $core->error->add($e->getMessage());
+    }
+} elseif (!empty($_POST['wreset'])) {
+    try
+    {
+        $core->blog->settings->addNamespace('widgets');
+        $core->blog->settings->widgets->put('widgets_nav', '');
+        $core->blog->settings->widgets->put('widgets_extra', '');
+        $core->blog->settings->widgets->put('widgets_custom', '');
+        $core->blog->triggerBlog();
+
+        dcPage::addSuccessNotice(__('Sidebars have been resetting.'));
+        http::redirect($p_url);
+    } catch (Exception $e) {
+        $core->error->add($e->getMessage());
+    }
 }
 ?>
@@ -214,193 +203,180 @@
 <head>
   <title><?php echo __('Widgets'); ?></title>
-  <?php echo dcPage::cssLoad(dcPage::getPF('widgets/style.css'));?>
-  <?php
-		echo
-			dcPage::jsLoad('js/jquery/jquery-ui.custom.js').
-			dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js').
-			dcPage::jsLoad(dcPage::getPF('widgets/widgets.js'));
-  ?>
-  <?php
-	$core->auth->user_prefs->addWorkspace('accessibility');
-	$user_dm_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop;
-  ?>
-  <?php if (!$user_dm_nodragdrop) : ?>
-  <?php echo dcPage::jsLoad(dcPage::getPF('widgets/dragdrop.js'));?>
-  <?php endif; ?>
-  <script type="text/javascript">
-  <?php echo dcPage::jsVar('dotclear.msg.confirm_widgets_reset',
-  	__('Are you sure you want to reset sidebars?')); ?>
-  </script>
-  <?php
-  		$widget_editor = $core->auth->getOption('editor');
-		$rte_flag = true;
-		$rte_flags  = @$core->auth->user_prefs->interface->rte_flags;
-		if (is_array($rte_flags) && in_array('widgets_text',$rte_flags)) {
-			$rte_flag = $rte_flags['widgets_text'];
-		}
-		if ($rte_flag) {
-	  		echo $core->callBehavior('adminPostEditor',$widget_editor['xhtml'],'widget',array('#sidebarsWidgets textarea'),'xhtml');
-		}
-  ?>
-  <?php echo(dcPage::jsConfirmClose('sidebarsWidgets')); ?>
+<?php
+echo dcPage::cssLoad(dcPage::getPF('widgets/style.css')) .
+    dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
+    dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
+    dcPage::jsLoad(dcPage::getPF('widgets/js/widgets.js'));
+
+$core->auth->user_prefs->addWorkspace('accessibility');
+$user_dm_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop;
+if (!$user_dm_nodragdrop) {
+    echo dcPage::jsLoad(dcPage::getPF('widgets/js/dragdrop.js'));
+}
+echo dcPage::jsVars(array('dotclear.msg.confirm_widgets_reset' => __('Are you sure you want to reset sidebars?')));
+
+$widget_editor = $core->auth->getOption('editor');
+$rte_flag      = true;
+$rte_flags     = @$core->auth->user_prefs->interface->rte_flags;
+if (is_array($rte_flags) && in_array('widgets_text', $rte_flags)) {
+    $rte_flag = $rte_flags['widgets_text'];
+}
+if ($rte_flag) {
+    echo $core->callBehavior('adminPostEditor', $widget_editor['xhtml'], 'widget', array('#sidebarsWidgets textarea'), 'xhtml');
+}
+echo (dcPage::jsConfirmClose('sidebarsWidgets'));
+?>
 </head>
 <body>
 <?php
 echo dcPage::breadcrumb(
-	array(
-		html::escapeHTML($core->blog->name) => '',
-		__('Widgets') => ''
-	)).
-	dcPage::notices();
+    array(
+        html::escapeHTML($core->blog->name) => '',
+        __('Widgets')                       => ''
+    )) .
+dcPage::notices();
 
 # All widgets
 echo
-'<form id="listWidgets" action="'.$p_url.'" method="post"  class="widgets">'.
-'<h3>'.__('Available widgets').'</h3>'.
-'<p>'.__('Drag widgets from this list to one of the sidebars, for add.').'</p>'.
-'<ul id="widgets-ref">';
+'<form id="listWidgets" action="' . $p_url . '" method="post"  class="widgets">' .
+'<h3>' . __('Available widgets') . '</h3>' .
+'<p>' . __('Drag widgets from this list to one of the sidebars, for add.') . '</p>' .
+    '<ul id="widgets-ref">';
 
 $j = 0;
 foreach ($__widgets->elements(true) as $w) {
-	echo
-	'<li>'.form::hidden(array('w[void][0][id]'),html::escapeHTML($w->id())).
-	'<p class="widget-name">'.form::field(array('w[void][0][order]'),2,3,0,'hide','',0,'title="'.__('order').'"').' '.$w->name().
-	($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'.
-	'<p class="manual-move remove-if-drag"><label class="classic">'.__('Append to:').'</label> '.
-	form::combo(array('addw['.$w->id().']'),$append_combo).
-	'<input type="submit" name="append['.$w->id().']" value="'.__('Add').'" /></p>'.
-	'<div class="widgetSettings hidden-if-drag">'.$w->formSettings('w[void][0]',$j).'</div>'.
-	'</li>';
-	$j++;
-}
-
-echo
-'</ul>'.
-'<p>'.$core->formNonce().'</p>'.
-'<p class="remove-if-drag"><input type="submit" name="append" value="'.__('Add widgets to sidebars').'" /></p>'.
-'</form>';
-
-echo '<form id="sidebarsWidgets" action="'.$p_url.'" method="post">';
+    echo
+    '<li>' . form::hidden(array('w[void][0][id]'), html::escapeHTML($w->id())) .
+    '<p class="widget-name">' . form::field(array('w[void][0][order]'), 2, 3, 0, 'hide', '', 0, 'title="' . __('order') . '"') . ' ' . $w->name() .
+    ($w->desc() != '' ? ' <span class="form-note">' . __($w->desc()) . '</span>' : '') . '</p>' .
+    '<p class="manual-move remove-if-drag"><label class="classic">' . __('Append to:') . '</label> ' .
+    form::combo(array('addw[' . $w->id() . ']'), $append_combo) .
+    '<input type="submit" name="append[' . $w->id() . ']" value="' . __('Add') . '" /></p>' .
+    '<div class="widgetSettings hidden-if-drag">' . $w->formSettings('w[void][0]', $j) . '</div>' .
+        '</li>';
+    $j++;
+}
+
+echo
+'</ul>' .
+'<p>' . $core->formNonce() . '</p>' .
+'<p class="remove-if-drag"><input type="submit" name="append" value="' . __('Add widgets to sidebars') . '" /></p>' .
+    '</form>';
+
+echo '<form id="sidebarsWidgets" action="' . $p_url . '" method="post">';
 # Nav sidebar
 echo
-'<div id="sidebarNav" class="widgets fieldset">'.
-sidebarWidgets('dndnav',__('Navigation sidebar'),$widgets_nav,'nav',$__default_widgets['nav'],$j);
+'<div id="sidebarNav" class="widgets fieldset">' .
+sidebarWidgets('dndnav', __('Navigation sidebar'), $widgets_nav, 'nav', $__default_widgets['nav'], $j);
 echo '</div>';
 
 # Extra sidebar
 echo
-'<div id="sidebarExtra" class="widgets fieldset">'.
-sidebarWidgets('dndextra',__('Extra sidebar'),$widgets_extra,'extra',$__default_widgets['extra'],$j);
+'<div id="sidebarExtra" class="widgets fieldset">' .
+sidebarWidgets('dndextra', __('Extra sidebar'), $widgets_extra, 'extra', $__default_widgets['extra'], $j);
 echo '</div>';
 
 # Custom sidebar
 echo
-'<div id="sidebarCustom" class="widgets fieldset">'.
-sidebarWidgets('dndcustom',__('Custom sidebar'),$widgets_custom,'custom',$__default_widgets['custom'],$j);
+'<div id="sidebarCustom" class="widgets fieldset">' .
+sidebarWidgets('dndcustom', __('Custom sidebar'), $widgets_custom, 'custom', $__default_widgets['custom'], $j);
 echo '</div>';
 
 echo
-'<p id="sidebarsControl">'.
-$core->formNonce().
-'<input type="submit" name="wup" value="'.__('Update sidebars').'" /> '.
-'<input type="submit" class="reset" name="wreset" value="'.__('Reset sidebars').'" /></p>'.
-'</form>';
-
-$widget_elements = new stdClass;
+'<p id="sidebarsControl">' .
+$core->formNonce() .
+'<input type="submit" name="wup" value="' . __('Update sidebars') . '" /> ' .
+'<input type="submit" class="reset" name="wreset" value="' . __('Reset sidebars') . '" /></p>' .
+    '</form>';
+
+$widget_elements          = new stdClass;
 $widget_elements->content = '<dl>';
-foreach ($__widgets->elements() as $w)
+foreach ($__widgets->elements() as $w) {
+    $widget_elements->content .=
+    '<dt><strong>' . html::escapeHTML($w->name()) . '</strong> (' .
+    __('Widget ID:') . ' <strong>' . html::escapeHTML($w->id()) . '</strong>)' .
+        ($w->desc() != '' ? ' <span class="form-note">' . __($w->desc()) . '</span>' : '') . '</dt>' .
+        '<dd>';
+
+    $w_settings = $w->settings();
+    if (empty($w_settings)) {
+        $widget_elements->content .= '<p>' . __('No setting for this widget') . '</p>';
+    } else {
+        $widget_elements->content .= '<ul>';
+        foreach ($w->settings() as $n => $s) {
+            switch ($s['type']) {
+                case 'check':
+                    $s_type = __('boolean') . ", " . __('possible values:') . " <code>0</code> " . __('or') . " <code>1</code>";
+                    break;
+                case 'combo':
+                    $s['options'] = array_map("literalNullString", $s['options']);
+                    $s_type       = __('listitem') . ", " . __('possible values:') . " <code>" . implode('</code>, <code>', $s['options']) . "</code>";
+                    break;
+                case 'text':
+                case 'textarea':
+                default:
+                    $s_type = __('string');
+                    break;
+            }
+
+            $widget_elements->content .=
+            '<li>' .
+            __('Setting name:') . ' <strong>' . html::escapeHTML($n) . '</strong>' .
+                ' (' . $s_type . ')' .
+                '</li>';
+        }
+        $widget_elements->content .= '</ul>';
+    }
+    $widget_elements->content .= '</dd>';
+}
+$widget_elements->content .= '</dl></div>';
+
+dcPage::helpBlock('widgets', $widget_elements);
+
+function sidebarWidgets($id, $title, $widgets, $pr, $default_widgets, &$j)
 {
-	$widget_elements->content .=
-	'<dt><strong>'.html::escapeHTML($w->name()).'</strong> ('.
-	__('Widget ID:').' <strong>'.html::escapeHTML($w->id()).'</strong>)'.
-	($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</dt>'.
-	'<dd>';
-
-	$w_settings = $w->settings();
-	if (empty($w_settings))
-	{
-		$widget_elements->content .= '<p>'.__('No setting for this widget').'</p>';
-	}
-	else
-	{
-		$widget_elements->content .= '<ul>';
-		foreach ($w->settings() as $n => $s)
-		{
-			switch ($s['type']) {
-				case 'check':
-					$s_type = __('boolean').", ".__('possible values:')." <code>0</code> ".__('or')." <code>1</code>";
-					break;
-				case 'combo':
-					$s['options'] = array_map("literalNullString", $s['options']);
-					$s_type = __('listitem').", ".__('possible values:')." <code>".implode('</code>, <code>',$s['options'])."</code>";
-					break;
-				case 'text':
-				case 'textarea':
-				default:
-					$s_type = __('string');
-					break;
-			}
-
-			$widget_elements->content .=
-			'<li>'.
-			__('Setting name:').' <strong>'.html::escapeHTML($n).'</strong>'.
-			' ('.$s_type.')'.
-			'</li>';
-		}
-		$widget_elements->content .= '</ul>';
-	}
-	$widget_elements->content .= '</dd>';
-}
-$widget_elements->content .= '</dl></div>';
-
-dcPage::helpBlock('widgets',$widget_elements);
-
-function sidebarWidgets($id,$title,$widgets,$pr,$default_widgets,&$j)
-{
-	$res = '<h3>'.$title.'</h3>';
-
-	if (!($widgets instanceof dcWidgets))
-	{
-		$widgets = $default_widgets;
-	}
-
-	$res .= '<ul id="'.$id.'" class="connected">';
-
-	$res .= '<li class="empty-widgets" '.(!$widgets->isEmpty() ? 'style="display: none;"' : '').'>'.__('No widget as far.').'</li>';
-
-	$i = 0;
-	foreach ($widgets->elements() as $w)
-	{
-		$upDisabled = $i == 0 ? ' disabled" src="images/disabled_' : '" src="images/';
-		$downDisabled = $i == count($widgets->elements())-1 ? ' disabled" src="images/disabled_' : '" src="images/';
-		$altUp = $i == 0 ? ' alt=""' : ' alt="'.__('Up the widget').'"';
-		$altDown = $i == count($widgets->elements())-1 ? ' alt=""' : ' alt="'.__('Down the widget').'"';
-
-		$iname = 'w['.$pr.']['.$i.']';
-
-		$res .=
-		'<li>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id())).
-		'<p class="widget-name">'.form::field(array($iname.'[order]'),2,3,(string) $i,'hidden','',0,'title="'.__('order').'"').
-		' '.$w->name().
-		($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').
-		'<span class="toolsWidget remove-if-drag">'.
-		'<input type="image" class="upWidget'.$upDisabled.'up.png" name="'.$iname.'[_up]" value="'.__('Up the widget').'"'.$altUp.' /> '.
-		'<input type="image" class="downWidget'.$downDisabled.'down.png" name="'.$iname.'[_down]" value="'.__('Down the widget').'"'.$altDown.' /> '.' '.
-		'<input type="image" class="removeWidget" src="images/trash.png" name="'.$iname.'[_rem]" value="'.__('Remove widget').'" alt="'.__('Remove the widget').'" />'.
-		'</span>'.
-		'<br class="clear"/></p>'.
-		'<div class="widgetSettings hidden-if-drag">'.$w->formSettings($iname,$j).'</div>'.
-		'</li>';
-
-		$i++;
-		$j++;
-	}
-
-	$res .= '</ul>';
-
-	$res .= '<ul class="sortable-delete"'.($i > 0 ? '':' style="display: none;"').'><li class="sortable-delete-placeholder">'.
-			__('Drag widgets here to remove.').'</li></ul>';
-
-	return $res;
+    $res = '<h3>' . $title . '</h3>';
+
+    if (!($widgets instanceof dcWidgets)) {
+        $widgets = $default_widgets;
+    }
+
+    $res .= '<ul id="' . $id . '" class="connected">';
+
+    $res .= '<li class="empty-widgets" ' . (!$widgets->isEmpty() ? 'style="display: none;"' : '') . '>' . __('No widget as far.') . '</li>';
+
+    $i = 0;
+    foreach ($widgets->elements() as $w) {
+        $upDisabled   = $i == 0 ? ' disabled" src="images/disabled_' : '" src="images/';
+        $downDisabled = $i == count($widgets->elements()) - 1 ? ' disabled" src="images/disabled_' : '" src="images/';
+        $altUp        = $i == 0 ? ' alt=""' : ' alt="' . __('Up the widget') . '"';
+        $altDown      = $i == count($widgets->elements()) - 1 ? ' alt=""' : ' alt="' . __('Down the widget') . '"';
+
+        $iname = 'w[' . $pr . '][' . $i . ']';
+
+        $res .=
+        '<li>' . form::hidden(array($iname . '[id]'), html::escapeHTML($w->id())) .
+        '<p class="widget-name">' . form::field(array($iname . '[order]'), 2, 3, (string) $i, 'hidden', '', 0, 'title="' . __('order') . '"') .
+        ' ' . $w->name() .
+        ($w->desc() != '' ? ' <span class="form-note">' . __($w->desc()) . '</span>' : '') .
+        '<span class="toolsWidget remove-if-drag">' .
+        '<input type="image" class="upWidget' . $upDisabled . 'up.png" name="' . $iname . '[_up]" value="' . __('Up the widget') . '"' . $altUp . ' /> ' .
+        '<input type="image" class="downWidget' . $downDisabled . 'down.png" name="' . $iname . '[_down]" value="' . __('Down the widget') . '"' . $altDown . ' /> ' . ' ' .
+        '<input type="image" class="removeWidget" src="images/trash.png" name="' . $iname . '[_rem]" value="' . __('Remove widget') . '" alt="' . __('Remove the widget') . '" />' .
+        '</span>' .
+        '<br class="clear"/></p>' .
+        '<div class="widgetSettings hidden-if-drag">' . $w->formSettings($iname, $j) . '</div>' .
+            '</li>';
+
+        $i++;
+        $j++;
+    }
+
+    $res .= '</ul>';
+
+    $res .= '<ul class="sortable-delete"' . ($i > 0 ? '' : ' style="display: none;"') . '><li class="sortable-delete-placeholder">' .
+    __('Drag widgets here to remove.') . '</li></ul>';
+
+    return $res;
 }
 ?>
Index: plugins/widgets/js/dragdrop.js
===================================================================
--- plugins/widgets/js/dragdrop.js	(revision 3709)
+++ plugins/widgets/js/dragdrop.js	(revision 3709)
@@ -0,0 +1,81 @@
+/*global $, reorder, dotclear */
+'use strict';
+
+$(function() {
+  // clean
+  $('.remove-if-drag').remove();
+  $('.hidden-if-drag').hide();
+  $('.widgets, .sortable-delete').addClass('if-drag');
+
+  // move
+  $('.connected, .sortable-delete').sortable({
+    tolerance: 'move',
+    cursor: 'move',
+    axis: 'y',
+    dropOnEmpty: true,
+    handle: '.widget-name',
+    placeholder: 'ui-sortable-placeholder',
+    items: 'li:not(.sortable-delete-placeholder,.empty-widgets)',
+    connectWith: '.connected, .sortable-delete',
+    start: function(event, ui) {
+      // petit décalage esthétique
+      ui.item.css('left', ui.item.position().left + 20);
+    },
+    update: function(event, ui) {
+      var ul = $(this);
+      var widget = ui.item;
+      var field = ul.parents('.widgets');
+
+      // met a zéro le décalage
+      ui.item.css('left', 'auto');
+      // Fixes issue #2080
+      ui.item.css('width', 'auto');
+      ui.item.css('height', 'auto');
+
+      // signale les zones vides
+      if (ul.find('li:not(.empty-widgets)').length == 0) {
+        ul.find('li.empty-widgets').show();
+        field.find('ul.sortable-delete').hide();
+      } else {
+        ul.find('li.empty-widgets').hide();
+        field.find('ul.sortable-delete').show();
+      }
+
+      // remove
+      if (widget.parents('ul').is('.sortable-delete')) {
+        widget.hide('slow', function() {
+          $(this).remove();
+        });
+      }
+
+      // réordonne
+      reorder(ul);
+
+      // expand
+      if (widget.find('img.expand').length == 0) {
+        dotclear.postExpander(widget);
+        dotclear.viewPostContent(widget, 'close');
+      }
+    }
+  });
+
+  // add
+  $('#widgets-ref > li').draggable({
+    tolerance: 'move',
+    cursor: 'move',
+    connectToSortable: '.connected',
+    helper: 'clone',
+    revert: 'invalid',
+    start: function(event, ui) {
+      ui.helper.css({
+        'width': $('#widgets-ref > li').css('width')
+      });
+    }
+  });
+
+  $('li.ui-draggable, ul.ui-sortable li')
+    .not('ul.sortable-delete li, li.empty-widgets')
+    .css({
+      'cursor': 'move'
+    });
+});
Index: plugins/widgets/js/widgets.js
===================================================================
--- plugins/widgets/js/widgets.js	(revision 3709)
+++ plugins/widgets/js/widgets.js	(revision 3709)
@@ -0,0 +1,130 @@
+/*global $, dotclear, jsToolBar */
+'use strict';
+
+dotclear.postExpander = function(line) {
+
+  var title = $(line).find('.widget-name');
+  title.find('.form-note').remove();
+
+  var order = title.find('input[name*=order]');
+  var link = $('<a href="#" alt="expand" class="aexpand"/>').append(title.text());
+  var tools = title.find('.toolsWidget');
+  var br = title.find('br');
+  title.empty().append(order).append(link).append(tools).append(br);
+
+  var img = document.createElement('img');
+  img.src = dotclear.img_plus_src;
+  img.alt = dotclear.img_plus_alt;
+  img.className = 'expand';
+  $(img).css('cursor', 'pointer');
+  img.onclick = function() {
+    dotclear.viewPostContent($(this).parents('li'));
+  };
+  link.click(function(e) {
+    e.preventDefault();
+    dotclear.viewPostContent($(this).parents('li'));
+  });
+  title.prepend(img);
+};
+
+dotclear.viewPostContent = function(line, action) {
+  action = action || 'toogle';
+  var img = line.find('.expand');
+  var isopen = img.attr('alt') == dotclear.img_plus_alt;
+
+  if (action == 'close' || (action == 'toogle' && !isopen)) {
+    line.find('.widgetSettings').hide();
+    img.attr('src', dotclear.img_plus_src);
+    img.attr('alt', dotclear.img_plus_alt);
+  } else if (action == 'open' || (action == 'toogle' && isopen)) {
+    line.find('.widgetSettings').show();
+    img.attr('src', dotclear.img_minus_src);
+    img.attr('alt', dotclear.img_minus_alt);
+  }
+
+};
+
+function reorder(ul) {
+  // réordonne
+  if (ul.attr('id')) {
+    var $list = ul.find('li').not('.empty-widgets');
+    $list.each(function(i) {
+      var $this = $(this);
+
+      // trouve la zone de réception
+      var name = ul.attr('id').split('dnd').join('');
+
+      // modifie le name en conséquence
+      $this.find('*[name^=w]').each(function() {
+        var tab = $(this).attr('name').split('][');
+        tab[0] = 'w[' + name;
+        tab[1] = i;
+        $(this).attr('name', tab.join(']['));
+      });
+
+      // ainsi que le champ d'ordre sans js (au cas ou)
+      $this.find('input[name*=order]').val(i);
+
+      // active ou désactive les fléches
+      if (i == 0) {
+        $this.find('input.upWidget').prop('disabled', true);
+        $this.find('input.upWidget').prop('src', 'images/disabled_up.png');
+      } else {
+        $this.find('input.upWidget').removeAttr('disabled');
+        $this.find('input.upWidget').prop('src', 'images/up.png');
+      }
+      if (i == $list.length - 1) {
+        $this.find('input.downWidget').prop('disabled', true);
+        $this.find('input.downWidget').prop('src', 'images/disabled_down.png');
+      } else {
+        $this.find('input.downWidget').removeAttr('disabled');
+        $this.find('input.downWidget').prop('src', 'images/down.png');
+      }
+
+    });
+  }
+}
+
+$(function() {
+  // reset
+  $('input[name="wreset"]').click(function() {
+    return window.confirm(dotclear.msg.confirm_widgets_reset);
+  });
+
+  // plier/déplier
+  $('#dndnav > li, #dndextra > li, #dndcustom > li').each(function() {
+    dotclear.postExpander(this);
+    dotclear.viewPostContent($(this), 'close');
+  });
+
+  // remove
+  $('input[name*=_rem]').click(function(e) {
+    e.preventDefault();
+    $(this).parents('li').remove();
+  });
+
+  // move
+  $('input[name*=_down]').click(function(e) {
+    e.preventDefault();
+    var $this = $(this);
+    var $li = $this.parents('li');
+    $li.next().after($li);
+    reorder($this.parents('ul.connected'));
+  });
+  $('input[name*=_up]').click(function(e) {
+    e.preventDefault();
+    var $this = $(this);
+    var $li = $this.parents('li');
+    $li.prev().before($li);
+    reorder($this.parents('ul.connected'));
+  });
+
+  // HTML text editor
+  if ($.isFunction(jsToolBar)) {
+    $('#sidebarsWidgets textarea').each(function() {
+      var tbWidgetText = new jsToolBar(this);
+      tbWidgetText.draw('xhtml');
+    });
+  }
+
+});
Index: lugins/widgets/widgets.js
===================================================================
--- plugins/widgets/widgets.js	(revision 3223)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
-# -- BEGIN LICENSE BLOCK ---------------------------------------
-#
-# This file is part of Dotclear 2.
-#
-# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
-# Licensed under the GPL version 2.0 license.
-# See LICENSE file or
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-#
-# -- END LICENSE BLOCK -----------------------------------------
-*/
-
-dotclear.postExpander = function(line) {
-	var title = $(line).find('.widget-name');
-	title.find('.form-note').remove();
-	order = title.find('input[name*=order]');
-	link = $('<a href="#" alt="expand" class="aexpand"/>').append(title.text());
-	tools = title.find('.toolsWidget');
-	br = title.find('br');
-	title.empty().append(order).append(link).append(tools).append(br);
-
-	var img = document.createElement('img');
-	img.src = dotclear.img_plus_src;
-	img.alt = dotclear.img_plus_alt;
-	img.className = 'expand';
-	$(img).css('cursor','pointer');
-	img.onclick = function() { dotclear.viewPostContent($(this).parents('li')); };
-	link.click(function(e) {
-		e.preventDefault();
-		dotclear.viewPostContent($(this).parents('li'));
-	});
-
-	title.prepend(img);
-};
-
-dotclear.viewPostContent = function(line,action) {
-	var action = action || 'toogle';
-	var img = line.find('.expand');
-	var isopen = img.attr('alt') == dotclear.img_plus_alt;
-
-	if( action == 'close' || ( action == 'toogle' && !isopen ) ) {
-		line.find('.widgetSettings').hide();
-		img.attr('src', dotclear.img_plus_src);
-		img.attr('alt', dotclear.img_plus_alt);
-	} else if ( action == 'open' || ( action == 'toogle' && isopen ) ) {
-		line.find('.widgetSettings').show();
-		img.attr('src', dotclear.img_minus_src);
-		img.attr('alt', dotclear.img_minus_alt);
-	}
-
-};
-
-function reorder(ul) {
-	// réordonne
-	if( ul.attr('id') ) {
-		$list = ul.find('li').not('.empty-widgets');
-		$list.each(function(i) {
-			$this = $(this);
-
-			// trouve la zone de réception
-			var name = ul.attr('id').split('dnd').join('');
-
-			// modifie le name en conséquence
-			$this.find('*[name^=w]').each(function(){
-				tab = $(this).attr('name').split('][');
-				tab[0] = "w["+name;
-				tab[1] = i;
-				$(this).attr('name', tab.join(']['));
-			});
-
-			// ainsi que le champ d'ordre sans js (au cas ou)
-			$this.find('input[name*=order]').val(i);
-
-			// active ou désactive les fléches
-			if( i == 0 ) {
-				$this.find('input.upWidget').prop('disabled', true);
-				$this.find('input.upWidget').prop('src', 'images/disabled_up.png' );
-			} else {
-				$this.find('input.upWidget').removeAttr('disabled');
-				$this.find('input.upWidget').prop('src', 'images/up.png' );
-			}
-			if( i == $list.length-1 ) {
-				$this.find('input.downWidget').prop('disabled', true);
-				$this.find('input.downWidget').prop('src', 'images/disabled_down.png' );
-			} else {
-				$this.find('input.downWidget').removeAttr('disabled');
-				$this.find('input.downWidget').prop('src', 'images/down.png' );
-			}
-
-		});
-	}
-}
-
-$(function() {
-	// reset
-	$('input[name="wreset"]').click(function() {
-		return window.confirm(dotclear.msg.confirm_widgets_reset);
-	});
-
-	// plier/déplier
-	$('#dndnav > li, #dndextra > li, #dndcustom > li').each(function() {
-		dotclear.postExpander(this);
-		dotclear.viewPostContent($(this), 'close');
-	});
-
-	// remove
-	$('input[name*=_rem]').click(function (e) {
-		e.preventDefault();
-		$(this).parents('li').remove();
-	});
-
-	// move
-	$('input[name*=_down]').click(function (e) {
-		e.preventDefault();
-		$this = $(this);
-		$li = $this.parents('li');
-		$li.next().after($li);
-		reorder($this.parents('ul.connected'));
-	});
-	$('input[name*=_up]').click(function (e) {
-		e.preventDefault();
-		$this = $(this);
-		$li = $this.parents('li');
-		$li.prev().before($li);
-		reorder($this.parents('ul.connected'));
-	});
-
-	// HTML text editor
-	if ($.isFunction(jsToolBar)) {
-		$('#sidebarsWidgets textarea').each(function() {
-			var tbWidgetText = new jsToolBar(this);
-			tbWidgetText.draw('xhtml');
-		});
-	}
-
-});
Index: themes/berlin/js/berlin.js
===================================================================
--- themes/berlin/js/berlin.js	(revision 3709)
+++ themes/berlin/js/berlin.js	(revision 3709)
@@ -0,0 +1,41 @@
+/*global $, dotclear_berlin_navigation, dotclear_berlin_show_menu, dotclear_berlin_hide_menu */
+'use strict';
+
+$('html').addClass('js');
+// Show/Hide main menu
+$('.header__nav').
+before('<button id="hamburger" type="button"><span class="visually-hidden">' + dotclear_berlin_navigation + '</span></button>').
+toggle();
+$('#hamburger').click(function() {
+  $(this).toggleClass('open');
+  $('.header__nav').toggle('easing');
+});
+// Show/Hide sidebar on small screens
+$('#main').prepend('<button id="offcanvas-on" type="button"><span class="visually-hidden">' + dotclear_berlin_show_menu + '</span></button>');
+$('#offcanvas-on').click(function() {
+  var btn = $('<button id="offcanvas-off" type="button"><span class="visually-hidden">' + dotclear_berlin_hide_menu + '</span></button>');
+  $('#wrapper').addClass('off-canvas');
+  $('#footer').addClass('off-canvas');
+  $('#sidebar').prepend(btn);
+  btn.click(function(evt) {
+    $('#wrapper').removeClass('off-canvas');
+    $('#footer').removeClass('off-canvas');
+    evt.target.remove();
+  });
+});
+$(document).ready(function() {
+  // totop scroll
+  $(window).scroll(function() {
+    if ($(this).scrollTop() != 0) {
+      $('#gotop').fadeIn();
+    } else {
+      $('#gotop').fadeOut();
+    }
+  });
+  $('#gotop').click(function(e) {
+    $('body,html').animate({
+      scrollTop: 0
+    }, 800);
+    e.preventDefault();
+  });
+});
Index: themes/berlin/tpl/user_footer.html
===================================================================
--- themes/berlin/tpl/user_footer.html	(revision 3706)
+++ themes/berlin/tpl/user_footer.html	(revision 3709)
@@ -1,41 +1,1 @@
-<script type="text/javascript">
-  'use strict';
-  $('html').addClass('js');
-  // Show/Hide main menu
-  $('.header__nav').
-  before('<button id="hamburger" type="button"><span class="visually-hidden">' + dotclear_berlin_navigation + '</span></button>').
-  toggle();
-  $('#hamburger').click(function() {
-    $(this).toggleClass('open');
-    $('.header__nav').toggle('easing');
-  });
-  // Show/Hide sidebar on small screens
-  $('#main').prepend('<button id="offcanvas-on" type="button"><span class="visually-hidden">' + dotclear_berlin_show_menu + '</span></button>');
-  $('#offcanvas-on').click(function() {
-    var btn = $('<button id="offcanvas-off" type="button"><span class="visually-hidden">' + dotclear_berlin_hide_menu + '</span></button>');
-    $('#wrapper').addClass('off-canvas');
-    $('#footer').addClass('off-canvas');
-    $('#sidebar').prepend(btn);
-    btn.click(function(evt) {
-      $('#wrapper').removeClass('off-canvas');
-      $('#footer').removeClass('off-canvas');
-      evt.target.remove();
-    });
-  });
-  $(document).ready(function() {
-    // totop scroll
-    $(window).scroll(function() {
-      if ($(this).scrollTop() != 0) {
-        $('#gotop').fadeIn();
-      } else {
-        $('#gotop').fadeOut();
-      }
-    });
-    $('#gotop').click(function(e) {
-      $('body,html').animate({
-        scrollTop: 0
-      }, 800);
-      e.preventDefault();
-    });
-  });
-</script>
+<script type="text/javascript" src="{{tpl:BlogThemeURL}}/js/berlin.js"></script>
Index: themes/ductile/_prepend.php
===================================================================
--- themes/ductile/_prepend.php	(revision 3531)
+++ themes/ductile/_prepend.php	(revision 3709)
@@ -37,6 +37,6 @@
 <script type="text/javascript">
 $(function() {
-	$("#stickerslist").sortable({'cursor':'move'});
-	$("#stickerslist tr").hover(function () {
+	$('#stickerslist').sortable({'cursor':'move'});
+	$('#stickerslist tr').hover(function () {
 		$(this).css({'cursor':'move'});
 	}, function () {
@@ -45,12 +45,12 @@
 	$('#theme_config').submit(function() {
 		var order=[];
-		$("#stickerslist tr td input.position").each(function() {
+		$('#stickerslist tr td input.position').each(function() {
 			order.push(this.name.replace(/^order\[([^\]]+)\]$/,'$1'));
 		});
-		$("input[name=ds_order]")[0].value = order.join(',');
+		$('input[name=ds_order]')[0].value = order.join(',');
 		return true;
 	});
-	$("#stickerslist tr td input.position").hide();
-	$("#stickerslist tr td.handle").addClass('handler');
+	$('#stickerslist tr td input.position').hide();
+	$('#stickerslist tr td.handle').addClass('handler');
 });
 </script>
