Index: admin/media.php
===================================================================
--- admin/media.php	(revision 2512)
+++ admin/media.php	(revision 2529)
@@ -314,4 +314,9 @@
 	);
 
+if ($popup) {
+	// Display notices
+	echo dcPage::notices();
+}
+
 if (!$core_media_writable) {
 	dcPage::warning(__('You do not have sufficient permissions to write to this folder.'));
Index: admin/media_item.php
===================================================================
--- admin/media_item.php	(revision 2510)
+++ admin/media_item.php	(revision 2529)
@@ -46,16 +46,16 @@
 {
 	$core->media = new dcMedia($core);
-	
+
 	if ($id) {
 		$file = $core->media->getFile($id);
 	}
-	
+
 	if ($file === null) {
 		throw new Exception(__('Not a valid file'));
 	}
-	
+
 	$core->media->chdir(dirname($file->relname));
 	$core_media_writable = $core->media->writable();
-	
+
 	# Prepare directories combo box
 	$dirs_combo = array();
@@ -93,7 +93,7 @@
 {
 	$newFile = clone $file;
-	
+
 	$newFile->basename = $_POST['media_file'];
-	
+
 	if ($_POST['media_path']) {
 		$newFile->dir = $_POST['media_path'];
@@ -107,5 +107,5 @@
 	$newFile->media_dtstr = $_POST['media_dt'];
 	$newFile->media_priv = !empty($_POST['media_private']);
-	
+
 	try {
 		$core->media->updateFile($file,$newFile);
@@ -124,5 +124,5 @@
 		$foo = null;
 		$core->media->mediaFireRecreateEvent($file);
-		
+
 		dcPage::addSuccessNotice(__('Thumbnails have been successfully updated.'));
 		http::redirect($page_url.'&id='.$id.'&tab=media-details-tab');
@@ -137,5 +137,5 @@
 	try {
 		$unzip_dir = $core->media->inflateZipFile($file,$_POST['inflate_mode'] == 'new');
-		
+
 		dcPage::addSuccessNotice(__('Zip file has been successfully extracted.'));
 		http::redirect($media_page_url.'&d='.$unzip_dir);
@@ -162,5 +162,5 @@
 		$core->blog->settings->system->put('media_img_default_link',($_POST['pref_insertion'] == 'link'));
 	}
-	
+
 	dcPage::addSuccessNotice(__('Default media insertion settings have been successfully updated.'));
 	http::redirect($page_url.'&id='.$id);
@@ -173,5 +173,5 @@
 	$pattern = preg_split('/\s*;;\s*/',$pattern);
 	$sep = ', ';
-	
+
 	foreach ($pattern as $v) {
 		if ($v == 'Title') {
@@ -200,5 +200,5 @@
 /* DISPLAY Main page
 -------------------------------------------------------- */
-$starting_scripts = 
+$starting_scripts =
 	'<script type="text/javascript">'."\n".
 	"//<![CDATA["."\n".
@@ -228,4 +228,9 @@
 );
 
+if ($popup) {
+	// Display notices
+	echo dcPage::notices();
+}
+
 if ($file === null) {
 	call_user_func($close_f);
@@ -247,10 +252,10 @@
 {
 	$media_desc = $file->media_title;
-	
+
 	echo
 	'<div id="media-insert" class="multi-part" title="'.__('Insert media item').'">'.
 	'<h3>'.__('Insert media item').'</h3>'.
 	'<form id="media-insert-form" action="" method="get">';
-	
+
 	$media_img_default_size = $core->blog->settings->system->media_img_default_size;
 	if ($media_img_default_size == '') {
@@ -275,5 +280,5 @@
 		echo
 		'<h3>'.__('Image size:').'</h3> ';
-		
+
 		$s_checked = false;
 		echo '<p>';
@@ -288,7 +293,7 @@
 		form::radio(array('src'),$file->file_url,$s_checked).' '.__('original').'</label><br /> ';
 		echo '</p>';
-		
-		echo
-		'<div class="two-boxes">'.		
+
+		echo
+		'<div class="two-boxes">'.
 		'<h3>'.__('Image alignment').'</h3>';
 		$i_align = array(
@@ -298,5 +303,5 @@
 			'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
 		);
-		
+
 		echo '<p>';
 		foreach ($i_align as $k => $v) {
@@ -306,5 +311,5 @@
 		echo '</p>';
 		echo '</div>';
-		
+
 		echo
 		'<div class="two-boxes">'.
@@ -321,10 +326,10 @@
 	{
 		$media_type = 'mp3';
-		
-		echo 
+
+		echo
 		'<div class="two-boxes">'.
 		'<h3>'.__('MP3 disposition').'</h3>';
 		dcPage::message(__("Please note that you cannot insert mp3 files with visual editor."),false);
-		
+
 		$i_align = array(
 			'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
@@ -333,5 +338,5 @@
 			'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
 		);
-		
+
 		echo '<p>';
 		foreach ($i_align as $k => $v) {
@@ -339,5 +344,5 @@
 			form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
 		}
-		
+
 		$public_player_style = unserialize($core->blog->settings->themes->mp3player_style);
 		$public_player = dcMedia::mp3player($file->file_url,$core->blog->getQmarkURL().'pf=player_mp3.swf',$public_player_style);
@@ -349,7 +354,7 @@
 	{
 		$media_type = 'flv';
-		
+
 		dcPage::message(__("Please note that you cannot insert video files with visual editor."),false);
-		
+
 		echo
 		'<div class="two-boxes">'.
@@ -362,9 +367,9 @@
 		'</div>';
 
-		
-		echo 
+
+		echo
 		'<div class="two-boxes">'.
 		'<h3>'.__('Video disposition').'</h3>';
-		
+
 		$i_align = array(
 			'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
@@ -373,5 +378,5 @@
 			'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
 		);
-		
+
 		echo '<p>';
 		foreach ($i_align as $k => $v) {
@@ -379,5 +384,5 @@
 			form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
 		}
-		
+
 		$public_player_style = unserialize($core->blog->settings->themes->flvplayer_style);
 		$public_player = dcMedia::flvplayer($file->file_url,$core->blog->getQmarkURL().'pf=player_flv.swf',$public_player_style);
@@ -401,5 +406,5 @@
 	form::hidden(array('url'),$file->file_url).
 	'</p>';
-	
+
 	echo '</form>';
 
@@ -437,9 +442,9 @@
 {
 	$thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's';
-	
+
 	if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') {
 		$thumb_size = 's';
 	}
-	
+
 	if (isset($file->media_thumb[$thumb_size])) {
 		echo '<p><img src="'.$file->media_thumb[$thumb_size].'?'.time()*rand().'" alt="" /></p>';
@@ -450,5 +455,5 @@
 		echo '<p id="media-original-image"'.$class.'><img src="'.$file->file_url.'?'.time()*rand().'" alt="" /></p>';
 	}
-	
+
 	echo '<p>'.__('Available sizes:').' ';
 	foreach (array_reverse($file->media_thumb) as $s => $v)
@@ -498,5 +503,5 @@
 			"OR post_excerpt_xhtml LIKE '%".$core->con->escape($file->relname)."%' "
 	);
-	
+
 	if ($file->media_image)
 	{ # We look for thumbnails too
@@ -512,9 +517,9 @@
 		}
 	}
-	
+
 	$params['sql'] .= ') ';
-	
+
 	$rs = $core->blog->getPosts($params);
-	
+
 	if ($rs->isEmpty())
 	{
@@ -552,5 +557,5 @@
 {
 	echo '<h3>'.__('Image details').'</h3>';
-	
+
 	$details = '';
 	if (count($file->media_meta) > 0)
@@ -587,5 +592,5 @@
 		'</form>';
 	}
-	
+
 	if ($file->type == 'application/zip')
 	{
@@ -594,5 +599,5 @@
 			__('Extract in current directory') => 'current'
 		);
-		
+
 		echo
 		'<form class="clear fieldset" id="file-unzip" action="'.html::escapeURL($page_url).'" method="post">'.
@@ -611,5 +616,5 @@
 		'</form>';
 	}
-	
+
 	echo
 	'<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
@@ -629,5 +634,5 @@
 	$core->formNonce().'</p>'.
 	'</form>';
-	
+
 	echo
 	'<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post" enctype="multipart/form-data">'.
