Index: inc/admin/class.dc.admincontext.php
===================================================================
--- inc/admin/class.dc.admincontext.php	(revision 1087)
+++ inc/admin/class.dc.admincontext.php	(revision 1088)
@@ -145,4 +145,11 @@
 		$this->protected_globals['current_page'] = $p['base'];
 		$this->protected_globals['blog_count'] = $this->core->auth->blog_count;
+		$this->protected_globals['rtl'] = l10n::getTextDirection(
+			$this->protected_globals['current_user']['lang']) == 'rtl';
+		$this->protected_globals['session'] = array(
+			'id' => session_id(),
+			'uid' => isset($_SESSION['sess_browser_uid']) ? $_SESSION['sess_browser_uid'] : '',
+			'nonce' => $this->core->getNonce()
+		);
 		
 		# Keep protected globals safe
@@ -324,6 +331,10 @@
 			'id' => '',
 			'super' => false,
-			'options' => array(),
-			'prefs' => array()
+			'lang' => 'en',
+			'options' => $this->core->userDefaults(),
+			'prefs' => array(),
+			'rights' => array(
+				'media' => false
+			)
 		);
 		
@@ -337,5 +348,8 @@
 				'id' => $this->core->auth->userID(),
 				'super' => $this->core->auth->isSuperAdmin(),
-				'options' => $this->core->auth->getOptions()
+				'options' => $this->core->auth->getOptions(),
+				'rights' => array(
+					'media' => $this->core->auth->check('media,media_admin',$this->core->blog->id)
+				)
 			);
 			
Index: inc/admin/default-templates/index.html.twig
===================================================================
--- inc/admin/default-templates/index.html.twig	(revision 1087)
+++ inc/admin/default-templates/index.html.twig	(revision 1088)
@@ -31,5 +31,5 @@
 				<fieldset><legend>{{__('New entry')}}</legend>
 					<p class="col">{{ form_field('post_title',{'class':'maximal'}) }}</p>
-					<p class="area">{{ form_field('post_content',{'rows':edit_size,'cols':5}) }}</p>
+					<p class="area">{{ form_field('post_content',{'rows':current_user.options.edit_size,'cols':5}) }}</p>
 					<p>{{ form_field('cat_id')}}</p>
 					<p>{{ form_field('save')}}</p>
Index: inc/admin/default-templates/js_helpers.html.twig
===================================================================
--- inc/admin/default-templates/js_helpers.html.twig	(revision 1085)
+++ inc/admin/default-templates/js_helpers.html.twig	(revision 1088)
@@ -11,5 +11,5 @@
 	<script type="text/javascript">
 	//<![CDATA[
-		dotclear.nonce = '{{Nonce}}';
+		dotclear.nonce = '{{session.nonce}}';
 		dotclear.img_plus_src = '{{theme_url}}images/expand.png';
 		dotclear.img_plus_alt = '{{__('uncover')}}';
@@ -143,5 +143,5 @@
 	<script type="text/javascript" src="{{theme_url}}js/jsToolBar/jsToolBar.js"></script>
 	
-	{% if enable_wysiwyg %}
+	{% if current_user.options.enable_wysiwyg %}
 		<script type="text/javascript" src="{{theme_url}}js/jsToolBar/jsToolBar.wysiwyg.js"></script>
 	{% endif %}
@@ -208,5 +208,5 @@
 		jsToolBar.prototype.elements.post_link.title = '{{__('Link to an entry')}}';
 		
-		{% if media_manage %}
+		{% if current_user.rights.media %}
 			jsToolBar.prototype.elements.img_select.disabled = true;
 		{% endif %}
@@ -217,5 +217,5 @@
 {% macro candy_upload(params) %}
 	{% if params is empty %}{% set params = {} %} {% endif %}
-	{% set params = params|merge(['sess_id={{sess_id}}','sess_uid={{sess_uid}}','xd_check={{Nonce}}']) %}
+	{% set params = params|merge(['sess_id={{session.id}}','sess_uid={{session.uid}}','xd_check={{session.nonce}}']) %}
 	<!-- jsCandyUpload -->
 	<link rel="stylesheet" href="{{theme_url}}style/candyUpload/style.css" type="text/css" media="screen" />
Index: inc/admin/default-templates/post.html.twig
===================================================================
--- inc/admin/default-templates/post.html.twig	(revision 1075)
+++ inc/admin/default-templates/post.html.twig	(revision 1088)
@@ -22,5 +22,5 @@
 			<p class="col">{{ form_field('post_title',{'class':'maximal'}) }}</p>
 			<p class="area" id="excerpt-area">{{ form_field('post_excerpt',{'rows':5,'cols':50}) }}</p>
-			<p class="area" id="content-area">{{ form_field('post_content',{'rows':edit_size,'cols':5}) }}</p>
+			<p class="area" id="content-area">{{ form_field('post_content',{'rows':current_user.options.edit_size,'cols':5}) }}</p>
 			<p class="area" id="notes-area">{{ form_field('post_notes',{'rows':5,'cols':50}) }}</p>
 			<p>{{ form_field('save')}} {{form_field('delete',{'class':'delete'})}}</p>
