Index: admin/install/index.php
===================================================================
--- admin/install/index.php	(revision 3557)
+++ admin/install/index.php	(revision 3599)
@@ -186,5 +186,5 @@
 			$csp_prefix."'self' 'unsafe-inline'".$csp_suffix,'string','CSP style-src directive',true,true);
 		$blog_settings->system->put('csp_admin_img',
-			$csp_prefix."'self' data: media.dotaddict.org blob:",'string','CSP img-src directive',true,true);
+			$csp_prefix."'self' data: http://media.dotaddict.org blob:",'string','CSP img-src directive',true,true);
 
 		# Add Dotclear version
Index: inc/admin/lib.dc.page.php
===================================================================
--- inc/admin/lib.dc.page.php	(revision 3619)
+++ inc/admin/lib.dc.page.php	(revision 3622)
@@ -122,5 +122,5 @@
 				$csp_prefix."'self' 'unsafe-inline'".$csp_suffix;
 			$csp['img-src'] = $core->blog->settings->system->csp_admin_img ?:
-				$csp_prefix."'self' data: media.dotaddict.org blob:";
+				$csp_prefix."'self' data: http://media.dotaddict.org blob:";
 
 			# Cope with blog post preview (via public URL in iframe)
Index: inc/core/class.dc.blog.php
===================================================================
--- inc/core/class.dc.blog.php	(revision 3565)
+++ inc/core/class.dc.blog.php	(revision 3622)
@@ -1940,9 +1940,11 @@
 		{
 			if ($this->con->driver() == 'mysql' || $this->con->driver() == 'mysqli' || $this->con->driver() == 'mysqlimb4') {
-				$clause = "REGEXP '^".$this->con->escape($url)."[0-9]+$'";
+				$clause = "REGEXP '^".$this->con->escape(preg_quote($url))."[0-9]+$'";
 			} elseif ($this->con->driver() == 'pgsql') {
-				$clause = "~ '^".$this->con->escape($url)."[0-9]+$'";
+				$clause = "~ '^".$this->con->escape(preg_quote($url))."[0-9]+$'";
 			} else {
-				$clause = "LIKE '".$this->con->escape($url)."%'";
+				$clause = "LIKE '".
+						$this->con->escape(preg_replace(array('%','_','!'),array('!%','!_','!!'),$url)).
+						"%' ESCAPE '!'";
 			}
 			$strReq = 'SELECT post_url FROM '.$this->prefix.'post '.
Index: inc/dbschema/upgrade.php
===================================================================
--- inc/dbschema/upgrade.php	(revision 3528)
+++ inc/dbschema/upgrade.php	(revision 3599)
@@ -697,4 +697,19 @@
 		}
 
+		if (version_compare($version,'2.12.2','<'))
+		{
+			// 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
+
+			# Update CSP img-src default directive
+			$strReq = 'UPDATE '.$core->prefix.'setting '.
+					" SET setting_value = '".$csp_prefix."''self'' data: http://media.dotaddict.org blob:' ".
+					" WHERE setting_id = 'csp_admin_img' ".
+					" AND setting_ns = 'system' ".
+					" AND setting_value = '".$csp_prefix."''self'' data: media.dotaddict.org blob:' ";
+			$core->con->execute($strReq);
+		}
+
 		$core->setVersion('core',DC_VERSION);
 		$core->blogDefaults();
Index: inc/public/class.dc.template.php
===================================================================
--- inc/public/class.dc.template.php	(revision 3479)
+++ inc/public/class.dc.template.php	(revision 3593)
@@ -2930,5 +2930,9 @@
 
 		if (isset($attr['blog_lang'])) {
-			$sign = (boolean) $attr['blog_lang'] ? '!' : '=';
+			$sign = '=';
+			if (substr($attr['blog_lang'],0,1) == '!') {
+				$sign = '!';
+				$attr['blog_lang'] = substr($attr['blog_lang'],1);
+			}
 			$if[] = "\$core->blog->settings->system->lang ".$sign."= '".addslashes($attr['blog_lang'])."'";
 		}
Index: inc/public/default-templates/currywurst/_entry-content.html
===================================================================
--- inc/public/default-templates/currywurst/_entry-content.html	(revision 3167)
+++ inc/public/default-templates/currywurst/_entry-content.html	(revision 3601)
@@ -1,3 +1,3 @@
-<div class="post simple" id="p{{tpl:EntryID}}" role="article">
+<div class="post simple" id="p{{tpl:EntryID}}" role="article" lang="{{tpl:EntryLang}}">
 	<h2 class="post-title">{{tpl:EntryTitle encode_html="1"}}</h2>
 
Index: inc/public/default-templates/dotty/_entry-content.html
===================================================================
--- inc/public/default-templates/dotty/_entry-content.html	(revision 3331)
+++ inc/public/default-templates/dotty/_entry-content.html	(revision 3601)
@@ -1,3 +1,3 @@
-<article class="post simple" id="p{{tpl:EntryID}}" role="article">
+<article class="post simple" id="p{{tpl:EntryID}}" role="article" lang="{{tpl:EntryLang}}">
 	<header>
 		<h2 class="post-title">{{tpl:EntryTitle encode_html="1"}}</h2>
