Index: extensions/ContestResults/admin.php
===================================================================
--- extensions/ContestResults/admin.php	(revision 9745)
+++ extensions/ContestResults/admin.php	(revision 9745)
@@ -0,0 +1,32 @@
+<?php
+if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// +-----------------------------------------------------------------------+
+//				Tabsheet
+// +-----------------------------------------------------------------------+
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'manage';
+	
+$tabsheet = new tabsheet();
+$tabsheet->add('manage', l10n('CR_manage_tab'), CR_ADMIN . '-manage'); 	// Gestion des concours
+$tabsheet->add('new', l10n('CR_new_tab'), CR_ADMIN . '-new'); 			// Ajouter un nouveau concours
+if (isset($_GET['contest_id'])) { 												// Editer le concours | Résultats du concours
+	$tabsheet->add($page['tab'], l10n('CR_'.$page['tab'].'_tab'), CR_ADMIN . '-' . $page['tab'] . '&amp;contest_id=' . $_GET['contest_id']);
+}
+$tabsheet->add('config', l10n('Configuration'), CR_ADMIN . '-config'); 	// Configuration
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// +-----------------------------------------------------------------------+
+//				Template
+// +-----------------------------------------------------------------------+
+$template->assign(array(
+	'CR_VERSION' => CR_NAME . ' ' . CR_VERSION,
+	'CR_PATH' => CR_PATH,
+	'CR_ADMIN' => CR_ADMIN,
+));
+
+if ($page['tab'] == 'edit') { $page['tab'] = 'new'; } // L'édition se fait sur la page de création
+include(CR_PATH.'admin/' . $page['tab'] . '.php');
+
+?>
Index: extensions/ContestResults/admin/admin.php
===================================================================
--- extensions/ContestResults/admin/admin.php	(revision 9744)
+++ 	(revision )
@@ -1,30 +1,0 @@
-<?php
-if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-load_language('plugin.lang', CR_PATH);
-$conf['ContestResults'] = unserialize($conf['ContestResults']);
-
-// +-----------------------------------------------------------------------+
-//				Tabsheet
-// +-----------------------------------------------------------------------+
-include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
-$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'manage';
-	
-$tabsheet = new tabsheet();
-$tabsheet->add('manage', l10n('CR_manage_tab'), CR_ADMIN . '&amp;tab=manage'); 	// Gestion des concours
-$tabsheet->add('new', l10n('CR_new_tab'), CR_ADMIN . '&amp;tab=new'); 			// Ajouter un nouveau concours
-if (isset($_GET['contest_id'])) { 												// Editer le concours | Résultats du concours
-	$tabsheet->add($page['tab'], l10n('CR_'.$page['tab'].'_tab'), CR_ADMIN . '&amp;tab=' . $page['tab'] . '&amp;contest_id=' . $_GET['contest_id']);
-}
-$tabsheet->add('config', l10n('Configuration'), CR_ADMIN . '&amp;tab=config'); 	// Configuration
-$tabsheet->select($page['tab']);
-$tabsheet->assign();
-
-// +-----------------------------------------------------------------------+
-//				Template
-// +-----------------------------------------------------------------------+
-$template->assign('CR_VERSION', CR_NAME . ' ' . CR_VERSION);
-$template->assign('CR_PATH', CR_PATH);
-if ($page['tab'] == 'edit') { $page['tab'] = 'new'; } // L'édition se fait sur la page de création
-include(CR_PATH.'admin/'.$page['tab'].'.php');
-?>
Index: extensions/ContestResults/admin/config.php
===================================================================
--- extensions/ContestResults/admin/config.php	(revision 9744)
+++ extensions/ContestResults/admin/config.php	(revision 9745)
@@ -6,5 +6,5 @@
 // +-----------------------------------------------------------------------+
 if (isset($_POST['config_submit'])) {
-	$user_config = array(
+	$conf['ContestResults'] = array(
 		'menubar_mode' => array(
 			'link' => (isset($_POST['menubar_mode_link'])) ? 1 : 0,
@@ -18,8 +18,9 @@
 			'number' => $_POST['menubar_block_number'],
 		),
+		'truncate_summary' => $_POST['truncate_summary'],
 	);
 	
-	pwg_query("UPDATE " . CONFIG_TABLE . " SET `value` = '" . serialize($user_config) . "' WHERE `param` = 'ContestResults';");
-	redirect(CR_ADMIN . '&amp;tab=config&amp;msg=saved');
+	pwg_query("UPDATE " . CONFIG_TABLE . " SET `value` = '" . serialize($conf['ContestResults']) . "' WHERE `param` = 'ContestResults';");
+	$page['infos'][] = l10n('Information data registered in database');
 }	
 
@@ -27,8 +28,4 @@
 //				Définition des variables template
 // +-----------------------------------------------------------------------+
-if (isset($_GET['msg']) AND $_GET['msg'] == 'saved')
-	array_push($page['infos'], l10n('Information data registered in database'));
-	
-
 $template->assign(array(
 	'MODE_LINK' => ($conf['ContestResults']['menubar_mode']['link']) ? 'checked="checked"' : '',
@@ -37,4 +34,5 @@
 	'LINK_SPECIALS' => ($conf['ContestResults']['menubar_link']['specials']) ? 'checked="checked"' : '',
 	'BLOCK_NUMBER' => $conf['ContestResults']['menubar_block']['number'],
+	'TRUNCATE_SUMMARY' => $conf['ContestResults']['truncate_summary'],
 ));
 
@@ -44,3 +42,4 @@
 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/config.tpl'));
 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
 ?>
Index: extensions/ContestResults/admin/get_tn.php
===================================================================
--- extensions/ContestResults/admin/get_tn.php	(revision 9744)
+++ extensions/ContestResults/admin/get_tn.php	(revision 9745)
@@ -9,5 +9,5 @@
 
 if (!pwg_db_num_rows($image)) {
-	$themeconf = $template->get_template_vars('themeconf');
+	//$themeconf = $template->get_template_vars('themeconf');
 	//$data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
 	$data['TN_SRC'] = 'admin/themes/default/icon/errors.png';
Index: extensions/ContestResults/admin/manage.php
===================================================================
--- extensions/ContestResults/admin/manage.php	(revision 9744)
+++ extensions/ContestResults/admin/manage.php	(revision 9745)
@@ -8,9 +8,10 @@
 	pwg_query('DELETE FROM ' . CR_TABLE_1 . ' WHERE id = ' . $_GET['delete_contest'] . ';');
 	pwg_query('DELETE FROM ' . CR_TABLE_2 . ' WHERE contest_id = ' . $_GET['delete_contest'] . ';');
-	redirect(CR_ADMIN .'&amp;tab=manage&amp;msg=deleted');
+	$page['infos'][] = l10n('CR_contest_deleted');
 }
 
 if (isset($_GET['msg'])){
-	array_push($page['infos'], l10n('CR_contest_'. $_GET['msg']));
+	$_GET['msg'] = explode('.', $_GET['msg']);
+	$page[$_GET['msg'][0]][] = l10n('CR_'. $_GET['msg'][1]);
 }
 
@@ -29,20 +30,17 @@
 
 while ($contest = pwg_db_fetch_assoc($contests)) {
-	if (is_date_passed($contest['date_end'])) {
-		$contest['status'] = 'finished';
-	} else { 
-		$contest['status'] = 'pending';
-	}
+	$contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end']));
+
 	$template->append('contests_'.$contest['status'], array(
-		'NAME' => trigger_event('render_CR_content', $contest['name']),
-		'VISIBLE' => $contest['visible'],
+		'NAME' => 		trigger_event('render_CR_content', $contest['name']),
+		'VISIBLE' => 	$contest['visible'],
 		'DATE_BEGIN' => format_date($contest['date_begin']),
-		'DATE_END' => format_date($contest['date_end']),
-		'LOGO' => $contest['logo'],
-		'U_RESULTS' => CR_ADMIN . '&amp;tab=results&amp;contest_id=' . $contest['id'],
-		'U_EDIT' => CR_ADMIN . '&amp;tab=edit&amp;contest_id=' . $contest['id'],
-		'U_DELETE' => CR_ADMIN . '&amp;delete_contest=' . $contest['id'],
-		'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
-		'DAYS' => DateDiff($contest['date_end'],date('Y-m-d')),
+		'DATE_END' => 	format_date($contest['date_end']),
+		'LOGO' => 		$contest['logo'],
+		'U_RESULTS' => 	CR_ADMIN . '-results&amp;contest_id=' . $contest['id'],
+		'U_EDIT' => 	CR_ADMIN . '-edit&amp;contest_id=' . $contest['id'],
+		'U_DELETE' => 	CR_ADMIN . '-manage&amp;delete_contest=' . $contest['id'],
+		'URL' => 		CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
+		'DAYS' => 		$contest['days'],
 	));
 }
@@ -53,3 +51,4 @@
 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/manage.tpl'));
 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
 ?>
Index: extensions/ContestResults/admin/new.php
===================================================================
--- extensions/ContestResults/admin/new.php	(revision 9744)
+++ extensions/ContestResults/admin/new.php	(revision 9745)
@@ -8,18 +8,16 @@
 	if ($_POST['name'] != null) {
 		// Mise en forme des descriptions
-		if (isset($_POST['description'])) {
-			$new_description = array();
-			foreach ($_POST['description'] as $data) {
-				$new_description[] = array(
-					'name' => $data['name'],
-					'content' => $data['content']
-				);
+		if (isset($_POST['description'])) {				
+			for ($i=0; $i<=count($_POST['description']); $i++) {
+				unset($_POST['description'][$i]['rank']);
 			}
 			// encoder le tableau sérialisé est le seul moyen que j'ai trouvé pour pas perdre les caractères spéciaux et planter unserialize
-			$_POST['description'] = base64_encode(serialize($new_description));
+			$_POST['description'] = base64_encode(serialize($_POST['description']));
+		} else {
+			$_POST['description'] = null;
 		}
 			
 		// Modification d'un concours
-		if (isset($_GET['contest_id'])) {	
+		if (isset($_GET['contest_id']) AND get_contest_name($_GET['contest_id'])) {	
 			pwg_query("UPDATE " . CR_TABLE_1 . " SET
 				`name` = '" . $_POST['name'] ."',
@@ -37,5 +35,5 @@
 				redirect(CR_PUBLIC . $_GET['contest_id'] . '-' . str2url(trigger_event('render_CR_content', $_POST['name'])));
 			} else {
-				redirect(CR_ADMIN .'&amp;tab=manage&amp;msg=saved');
+				redirect(CR_ADMIN .'-manage&amp;msg=infos.contest_saved');
 			}
 			
@@ -63,9 +61,10 @@
 					'" . $_POST['description'] ."'
 				);");
-			redirect(CR_ADMIN .'&amp;tab=manage&amp;msg=added');
+			
+			redirect(CR_ADMIN .'-manage&amp;msg=infos.contest_added');
 		}
 		
 	} else {
-		array_push($page['errors'], l10n('CR_name_empty'));
+		$page['errors'][] = l10n('CR_name_empty');
 	}
 }
@@ -75,5 +74,5 @@
 //				Définition des variables template
 // +-----------------------------------------------------------------------+	
-// Formulaire incomplet ##############################################################################################################################################################
+// Formulaire incomplet
 if ($page['errors']) {
 	$template->assign(array(
@@ -100,5 +99,5 @@
 
 // Edition d'un concours
-} else if (isset($_GET['contest_id'])) {
+} else if (isset($_GET['contest_id']) AND get_contest_name($_GET['contest_id'])) {
 	$query = "SELECT * FROM " . CR_TABLE_1 . " WHERE id = " . $_GET['contest_id'] . ";";
 	$contest = pwg_db_fetch_assoc(pwg_query($query));
@@ -115,5 +114,5 @@
 	));
 	
-	if ($contest['description'] != null) {
+	if (!empty($contest['description'])) {
 		$contest['description'] = unserialize(base64_decode($contest['description']));
 		$i=0;
@@ -146,3 +145,4 @@
 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/new.tpl'));
 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
 ?>
Index: extensions/ContestResults/admin/results.php
===================================================================
--- extensions/ContestResults/admin/results.php	(revision 9744)
+++ extensions/ContestResults/admin/results.php	(revision 9745)
@@ -8,23 +8,37 @@
 	pwg_query("DELETE FROM " . CR_TABLE_2 . " WHERE `contest_id` = " . $_GET['contest_id'] .";");
 	
+	$registered_ids = array();
+	$_DUPLICATE = array();
+	
 	foreach ($_POST['results'] AS $i => $data) {
-		pwg_query("INSERT INTO " . CR_TABLE_2 . "
-			(
-				image_id, 
-				contest_id, 
-				rank,
-				comment, 
-				author
-			)
-			VALUES(
-				'" . $data['image_id'] ."',
-				'" . $_GET['contest_id'] ."',
-				'" . $data['rank'] ."',
-				'" . $data['comment'] ."',
-				'" . $data['author'] . "'
-			);");
+		if (!in_array($data['image_id'], $registered_ids)) {
+			$registered_ids[] = $data['image_id'];
+			
+			pwg_query("INSERT INTO " . CR_TABLE_2 . "
+				(
+					image_id, 
+					contest_id, 
+					rank,
+					comment, 
+					author
+				)
+				VALUES(
+					'" . $data['image_id'] ."',
+					'" . $_GET['contest_id'] ."',
+					'" . $data['rank'] ."',
+					'" . $data['comment'] ."',
+					'" . $data['author'] . "'
+				);");
+		
+		} else {
+			$_DUPLICATE[] = $data;
+		}
 	}
 	
-	redirect(CR_ADMIN . '&amp;tab=results&amp;msg=saved&amp;contest_id=' . $_GET['contest_id']);
+	if (isset($_GET['redirect']) AND $_GET['redirect'] == 'page') {
+		redirect(CR_PUBLIC . $_GET['contest_id'] . '-' . str2url(trigger_event('render_CR_content', get_contest_name($_GET['contest_id']))) . '#results');
+	} else if (!isset($_DUPLICATE)) {
+		$page['infos'][] = l10n('CR_results_saved');
+	}
 }
 
@@ -32,52 +46,86 @@
 //				Affichage des résultats
 // +-----------------------------------------------------------------------+
-if (isset($_GET['msg']) AND $_GET['msg'] == 'saved')
-	array_push($page['infos'], l10n('CR_results_saved'));
+
+if (!get_contest_name($_GET['contest_id'])) {
+	redirect(CR_ADMIN .'-manage&amp;msg=errors.notavailable');
 	
-	
-// Nom du concours
-$query = "SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $_GET['contest_id'] . ";";
-$contest = pwg_db_fetch_assoc(pwg_query($query));
+} else {
+	// Nom du concours
+	$query = "SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $_GET['contest_id'] . ";";
+	$contest = pwg_db_fetch_assoc(pwg_query($query));
 
-$template->assign(array(
-	'NAME' => trigger_event('render_CR_content', $contest['name']),
-	'CONTEST_ID' => $_GET['contest_id']
-));
+	$template->assign(array(
+		'NAME' => trigger_event('render_CR_content', $contest['name']),
+		'CONTEST_ID' => $_GET['contest_id']
+	));
 
-// Résultats
-$results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id = " . $_GET['contest_id'] . " ORDER BY rank;");
+	// Résultats en double
+	if (isset($_DUPLICATE)) {
+		foreach ($_DUPLICATE AS $result) {
+			$data = array(
+				'RANK' => 0,
+				'IMAGE_ID' => $result['image_id'],
+				'AUTHOR' => $result['author'],
+				'COMMENT' => $result['comment'],
+				'ERROR' => true,
+			);
+			
+			// Infos de l'image
+			$image = pwg_query("SELECT id, name, file, path, tn_ext
+				FROM " . IMAGES_TABLE . "
+				WHERE id = " . $result['image_id'] . ";");
+			
+			if (!pwg_db_num_rows($image)) {
+				$themeconf = $template->get_template_vars('themeconf');
+				$data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
+				$data['IMAGE_NAME'] = 'N/A';		
+			} else {
+				$image = pwg_db_fetch_assoc($image);
+				$data['TN_SRC'] = get_thumbnail_url($image);
+				$data['IMAGE_NAME'] = (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'];
+			}
+			
+			$page['errors'][] = l10n_dec('CR_duplicate_result %d', 'CR_duplicate_result %d', $result['image_id']);
+			$template->append('results', $data);
+		}
+	}
 
-while ($result = pwg_db_fetch_assoc($results)) {
-	$data = array(
-		'RANK' => $result['rank'],
-		'IMAGE_ID' => $result['image_id'],
-		'AUTHOR' => $result['author'],
-		'COMMENT' => $result['comment'],
-	);
-	
-	// Infos de l'image
-	$image = pwg_query("SELECT id, name, file, path, tn_ext
-		FROM " . IMAGES_TABLE . "
-		WHERE id = " . $result['image_id'] . ";");
-	
-	if (!pwg_db_num_rows($image)) {
-		$themeconf = $template->get_template_vars('themeconf');
-		$data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
-		$data['IMAGE_NAME'] = 'N/A';
-		$page['errors'][] = l10n_dec('CR_id_unknown %d', 'CR_id_unknown %d', $result['image_id']);
+	// Résultats enregistrés
+	$results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id = " . $_GET['contest_id'] . " ORDER BY rank;");
+
+	while ($result = pwg_db_fetch_assoc($results)) {
+		$data = array(
+			'RANK' => $result['rank'],
+			'IMAGE_ID' => $result['image_id'],
+			'AUTHOR' => $result['author'],
+			'COMMENT' => $result['comment'],
+		);
 		
-	} else {
-		$image = pwg_db_fetch_assoc($image);
-		$data['TN_SRC'] = get_thumbnail_url($image);
-		$data['IMAGE_NAME'] = (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'];
+		// Infos de l'image
+		$image = pwg_query("SELECT id, name, file, path, tn_ext
+			FROM " . IMAGES_TABLE . "
+			WHERE id = " . $result['image_id'] . ";");
+		
+		if (!pwg_db_num_rows($image)) {
+			$themeconf = $template->get_template_vars('themeconf');
+			$data['TN_SRC'] = $themeconf['admin_icon_dir'] . '/errors.png';
+			$data['IMAGE_NAME'] = 'N/A';
+			$data['ERROR'] = true;
+			$page['errors'][] = l10n_dec('CR_id_unknown %d', 'CR_id_unknown %d', $result['image_id']);
+		} else {
+			$image = pwg_db_fetch_assoc($image);
+			$data['TN_SRC'] = get_thumbnail_url($image);
+			$data['IMAGE_NAME'] = (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'];
+		}
+		
+		$template->append('results', $data);
 	}
-	
-	$template->append('results', $data);
+
+	// +-----------------------------------------------------------------------+
+	//				Template
+	// +-----------------------------------------------------------------------+
+	$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/results.tpl'));
+	$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 }
 
-// +-----------------------------------------------------------------------+
-//				Template
-// +-----------------------------------------------------------------------+
-$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/results.tpl'));
-$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 ?>
Index: extensions/ContestResults/admin/template/config.tpl
===================================================================
--- extensions/ContestResults/admin/template/config.tpl	(revision 9744)
+++ extensions/ContestResults/admin/template/config.tpl	(revision 9745)
@@ -1,26 +1,21 @@
-{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
-{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
+{combine_css path=$CR_PATH|@cat:'admin/template/style.css'}
 
-{html_head}
-	<style type="text/css">
-		tr td:first-child {ldelim} 
-			max-width:300px; 
-			min-width:300px;
+{footer_script require='jquery'}
+{literal}
+	function ToggleConfig(sel, section) {
+		var obj = jQuery('#config_'+section);
+		if (sel.checked) {
+			obj.show();
+		} else {
+			obj.hide();
 		}
-	</style>
+	}
 	
-	<script type="text/javascript">
-		function ToggleConfig(sel, section){ldelim}
-			var obj = jQuery('#config_'+section);
-			if(sel.checked){ldelim}
-				obj.show();
-			}else{ldelim}
-				obj.hide();
-			}
-		}
-	</script>
-{/html_head}
+	ToggleConfig(document.forms['CR_config'].elements['menubar_mode_link'], 'link');
+	ToggleConfig(document.forms['CR_config'].elements['menubar_mode_block'], 'block');
+{/literal}
+{/footer_script}
 
-<h2 style="float:right;top:-24px;position:relative;font-style:italic;margin-bottom:-20px;font-size:12px;font-weight:normal;">{$CR_VERSION}</h2>
+<h2 class="version_title">{$CR_VERSION}</h2>
 
 <div class="titrePage">
@@ -28,5 +23,16 @@
 </div>
 
-<form method="post" action="" class="properties">
+<form method="post" action="" class="properties" id="CR_config">
+	<fieldset>
+		<legend>{'Preferences'|@translate}</legend>
+		
+		<table>	
+			<tr>
+				<td><span class="title">{'CR_truncate_summary'|@translate}</span></td>
+				<td><input type="text" size="3" name="truncate_summary" value="{$TRUNCATE_SUMMARY}"/></td>
+			</tr>
+		</table>
+	</fieldset>
+	
 	<fieldset>
 		<legend>{'Menu'|@translate}</legend>
@@ -56,5 +62,5 @@
 			<tr>
 				<td><span class="title">{'CR_menubar_block_number'|@translate}</span></td>
-				<td><input type="text" size="2" maxlength="2" name="menubar_block_number" value="{$BLOCK_NUMBER}"/></td>
+				<td><input type="text" size="2" name="menubar_block_number" value="{$BLOCK_NUMBER}"/></td>
 			</tr>
 		</table>
@@ -63,7 +69,2 @@
 	<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="config_submit"/></p>
 </form>
-
-<script type="text/javascript">
-	ToggleConfig(document.forms[0].elements['menubar_mode_link'], 'link');
-	ToggleConfig(document.forms[0].elements['menubar_mode_block'], 'block');
-</script>
Index: extensions/ContestResults/admin/template/manage.tpl
===================================================================
--- extensions/ContestResults/admin/template/manage.tpl	(revision 9744)
+++ extensions/ContestResults/admin/template/manage.tpl	(revision 9745)
@@ -1,5 +1,5 @@
-{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
+{combine_css path=$CR_PATH|@cat:'admin/template/style.css'}
 
-<h2 style="float:right;top:-24px;position:relative;font-style:italic;margin-bottom:-20px;font-size:12px;font-weight:normal;">{$CR_VERSION}</h2>
+<h2 class="version_title">{$CR_VERSION}</h2>
 
 <div class="titrePage">
@@ -7,77 +7,109 @@
 </div>
 
-{if !isset($contests_pending) and !isset($contests_finished)}
+{if !isset($contests_pending) and !isset($contests_running) and !isset($contests_finished)}
 	{'CR_no_contest'|@translate}<br>
-	<a href="admin.php?page=plugin&section=ContestResults/admin/admin.php&tab=new">{'CR_new_tab'|@translate}</a>
+	<a href="{$CR_ADMIN}&tab=new">{'CR_new_tab'|@translate}</a>
 {/if}
 
 {if isset($contests_pending)}
-	<fieldset>
-		<legend>{'CR_pending_title'|@translate}</legend>
-		<form id="categoryOrdering">
-			<ul class="categoryUl">
-				{foreach from=$contests_pending item=contest name=pending_loop}
-					<li class="categoryLi {if $smarty.foreach.pending_loop.index is odd}virtual_cat{/if} {if $contest.VISIBLE == 0}novisible{/if}">
-						<ul class="categoryActions">
-							<li>
-								<a href="{$contest.U_EDIT}" title="{'CR_edit_tab'|@translate}">
-									<img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'CR_edit_tab'|@translate}"/>
-								</a>
-							</li>
-							<li>
-								<a href="{$contest.U_RESULTS}" title="{'CR_results_tab'|@translate}">
-									<img src="{$themeconf.admin_icon_dir}/category_elements.png" class="button" alt="{'CR_results_tab'|@translate}"/>
-								</a>
-							</li>
-							<li>
-								<a href="{$contest.U_DELETE}" title="{'CR_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
-									<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete'|@translate}" />
-								</a>
-							</li>
-						</ul>
-						<p>
-							{if !empty($contest.LOGO)}<img src="{$contest.LOGO}" width="13px" class="button"/>{/if}
-							<strong><a href="{$contest.URL}" title="{'CR_go'|@translate}">{$contest.NAME}</a></strong> - {$contest.DATE_BEGIN} | {$contest.DATE_END}
-							<span class="CR_finished">{$contest.DAYS} {'CR_days'|@translate}</span>
-						</p>
+<fieldset>
+	<legend>{'CR_pending_title'|@translate}</legend>
+	<form id="categoryOrdering">
+		<ul class="categoryUl">
+			{foreach from=$contests_pending item=contest name=pending_loop}
+			<li class="categoryLi {if $smarty.foreach.pending_loop.index is odd}virtual_cat{/if} {if $contest.VISIBLE == 0}novisible{/if}">
+				<ul class="categoryActions">
+					<li>
+						<a href="{$contest.U_EDIT}" title="{'CR_edit_tab'|@translate}">
+							<img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'CR_edit_tab'|@translate}"/>
+						</a>
 					</li>
-				{/foreach}
-			</ul>
-		</form>
-	</fieldset>
+					<li>
+						<a href="{$contest.U_DELETE}" title="{'CR_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
+							<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete'|@translate}" />
+						</a>
+					</li>
+				</ul>
+				<p>
+					{if !empty($contest.LOGO)}<img src="{$contest.LOGO}" width="13px" class="button"/>{/if}
+					<strong><a href="{$contest.URL}" title="{'CR_go'|@translate}">{$contest.NAME}</a></strong> - {$contest.DATE_BEGIN} | {$contest.DATE_END}
+					<span class="CR_finished">{$contest.DAYS}</span>
+				</p>
+			</li>
+			{/foreach}
+		</ul>
+	</form>
+</fieldset>
+{/if}
+
+{if isset($contests_running)}
+<fieldset>
+	<legend>{'CR_running_title'|@translate}</legend>
+	<form id="categoryOrdering">
+		<ul class="categoryUl">
+			{foreach from=$contests_running item=contest name=running_loop}
+			<li class="categoryLi {if $smarty.foreach.running_loop.index is odd}virtual_cat{/if} {if $contest.VISIBLE == 0}novisible{/if}">
+				<ul class="categoryActions">
+					<li>
+						<a href="{$contest.U_EDIT}" title="{'CR_edit_tab'|@translate}">
+							<img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'CR_edit_tab'|@translate}"/>
+						</a>
+					</li>
+					<li>
+						<a href="{$contest.U_RESULTS}" title="{'CR_results_tab'|@translate}">
+							<img src="{$themeconf.admin_icon_dir}/category_elements.png" class="button" alt="{'CR_results_tab'|@translate}"/>
+						</a>
+					</li>
+					<li>
+						<a href="{$contest.U_DELETE}" title="{'CR_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
+							<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete'|@translate}" />
+						</a>
+					</li>
+				</ul>
+				<p>
+					{if !empty($contest.LOGO)}<img src="{$contest.LOGO}" width="13px" class="button"/>{/if}
+					<strong><a href="{$contest.URL}" title="{'CR_go'|@translate}">{$contest.NAME}</a></strong> - {$contest.DATE_BEGIN} | {$contest.DATE_END}
+					<span class="CR_finished">{$contest.DAYS}</span>
+				</p>
+			</li>
+			{/foreach}
+		</ul>
+	</form>
+</fieldset>
 {/if}
 
 {if isset($contests_finished)}
-	<fieldset>
-		<legend>{'CR_finished_title'|@translate}</legend>
-		<form id="categoryOrdering">
-			<ul class="categoryUl">
-				{foreach from=$contests_finished item=contest name=finished_loop}
-					<li class="categoryLi {if $smarty.foreach.finished_loop.index is odd}virtual_cat{/if} {if $contest.VISIBLE == 0}novisible{/if}">
-						<ul class="categoryActions">
-							<li>
-								<a href="{$contest.U_EDIT}" title="{'CR_edit_tab'|@translate}">
-									<img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'CR_edit_tab'|@translate}"/>
-								</a>
-							</li>
-							<li>
-								<a href="{$contest.U_RESULTS}" title="{'CR_results_tab'|@translate}">
-									<img src="{$themeconf.admin_icon_dir}/category_elements.png" class="button" alt="{'CR_results_tab'|@translate}"/>
-								</a>
-							</li>
-							<li>
-								<a href="{$contest.U_DELETE}" title="{'CR_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
-									<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete'|@translate}" />
-								</a>
-							</li>
-						</ul>
-						<p>
-							{if !empty($contest.LOGO)}<img src="{$contest.LOGO}" width="13px" class="button"/>{/if}
-							<strong><a href="{$contest.URL}" title="{'CR_go'|@translate}">{$contest.NAME}</a></strong> - {$contest.DATE_BEGIN} | {$contest.DATE_END}
-						</p>
+<fieldset>
+	<legend>{'CR_finished_title'|@translate}</legend>
+	<form id="categoryOrdering">
+		<ul class="categoryUl">
+			{foreach from=$contests_finished item=contest name=finished_loop}
+			<li class="categoryLi {if $smarty.foreach.finished_loop.index is odd}virtual_cat{/if} {if $contest.VISIBLE == 0}novisible{/if}">
+				<ul class="categoryActions">
+					<li>
+						<a href="{$contest.U_EDIT}" title="{'CR_edit_tab'|@translate}">
+							<img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'CR_edit_tab'|@translate}"/>
+						</a>
 					</li>
-				{/foreach}
-			</ul>
-		</form>
-	</fieldset>
+					<li>
+						<a href="{$contest.U_RESULTS}" title="{'CR_results_tab'|@translate}">
+							<img src="{$themeconf.admin_icon_dir}/category_elements.png" class="button" alt="{'CR_results_tab'|@translate}"/>
+						</a>
+					</li>
+					<li>
+						<a href="{$contest.U_DELETE}" title="{'CR_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
+							<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete'|@translate}" />
+						</a>
+					</li>
+				</ul>
+				<p>
+					{if !empty($contest.LOGO)}<img src="{$contest.LOGO}" width="13px" class="button"/>{/if}
+					<strong><a href="{$contest.URL}" title="{'CR_go'|@translate}">{$contest.NAME}</a></strong> - {$contest.DATE_BEGIN} | {$contest.DATE_END}
+					<span class="CR_finished">{$contest.DAYS}</span>
+				</p>
+			</li>
+			{/foreach}
+		</ul>
+	</form>
+</fieldset>
 {/if}
Index: extensions/ContestResults/admin/template/new.tpl
===================================================================
--- extensions/ContestResults/admin/template/new.tpl	(revision 9744)
+++ extensions/ContestResults/admin/template/new.tpl	(revision 9745)
@@ -1,94 +1,85 @@
-{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
-{combine_script id='jquery.ui' path='themes/default/js/ui/minified/jquery.ui.core.min.js'}
-{combine_script id='jquery.ui.sortable' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'}
-{combine_script id='jquery.cluetip' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
-{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
+{combine_script id='jquery.ui' 			require='jquery' path='themes/default/js/ui/minified/jquery.ui.core.min.js'}
+{combine_script id='jquery.ui.sortable' require='jquery' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'}
+{combine_script id='jquery.cluetip' 	require='jquery' path='themes/default/js/plugins/jquery.cluetip.js'}
+
+{combine_css path=$CR_PATH|@cat:'admin/template/style.css'}
 {include file='include/autosize.inc.tpl'}
 {include file='include/datepicker.inc.tpl'}
 
+{footer_script require='jquery'}
+	// AJOUTE UN CHAMP DE RESULTAT
+	function CreateDescField(j, new_desc){ldelim}
+		// Si il n'y a aucun résultats on efface le message
+		if(new_desc) jQuery('#categoryUl').html('');
+		
+		// Ajoute à la fin de la liste une nouvelle ligne de résultat vide
+		jQuery('<li id="desc_'+ j +'" class="categoryLi virtual_cat"></li>').appendTo('#categoryUl');
+		
+		// Contenu de la ligne
+		jQuery('#desc_'+ j).html('<ul class="categoryActions"> '+
+				'<li> '+
+					'<a href="#" title="{'CR_delete_desc'|@translate}" onclick="jQuery(\'#desc_'+ j +'\').remove();return false;"> '+
+						'<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/> '+
+					'</a> '+
+				'</li> '+
+			'</ul> '+
+			'<p> '+
+				'<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}"> '+
+				'<input type="text" size="65" name="description['+ j +'][name]" value=""/> '+
+				'<textarea class="result_comment" name="description['+ j +'][content]"></textarea> '+
+			'</p> '+
+			'<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="description['+ j +'][rank]" value=""/></p>');
+		
+		// Remplace le lien de création
+		jQuery('#AddLink').html('<input class="submit" type="reset" onclick="CreateDescField('+ (j+1) +');return false;" value="{'CR_addfield'|@translate}"/>');
+		
+		// Réinitiliase les fonctions jQuery
+		jQuery('.catPos').hide();
+		jQuery('.drag_button').show();
+		jQuery('.categoryLi').css('cursor', 'move');
+		jQuery('textarea').autogrow();
+		jQuery('textarea').css('overflow-y', 'hidden');
+	}
+
+{literal}
+	jQuery().ready(function(){
+		//  Drag-and-Drop
+		jQuery('.catPos').hide();
+		jQuery('.drag_button').show();
+		jQuery('.categoryLi').css('cursor', 'move');
+		jQuery('.categoryUl').sortable({
+			axis: 'y',
+			opacity: 0.8
+		});
+		jQuery('#categoryOrdering').submit(function(){
+			ar = jQuery('.categoryUl').sortable('toArray');
+			for(i=0; i<ar.length; i++) {
+				cat = ar[i].split('desc_');
+				document.getElementsByName('description[' + cat[1] + '][rank]')[0].value = i+1;
+			}
+		});
+		// Cluetip
+		jQuery('.cluetip').cluetip({
+			width: 550,
+			splitTitle: '|'
+		});
+	});
+
+	$(function() {
+		$('#DateBegin').datepicker({dateFormat:'yy-mm-dd', firstDay:1});
+		$('#DateEnd').datepicker({dateFormat:'yy-mm-dd', firstDay:1});
+	});
+{/literal}
+{/footer_script}
+
 {html_head}
-	<script type="text/javascript">
-		// AJOUTE UN CHAMP DE RESULTAT
-		function CreateDescField(j, new_contest){ldelim}
-			// Si il n'y a aucun résultats on efface le message
-			if(new_contest) document.getElementById('categoryUl').innerHTML = '';
-			
-			// Ajoute à la fin de la liste une nouvelle ligne de résultat vide
-			var new_result = document.createElement('li');
-			new_result.setAttribute('id', 'desc_'+(j));
-			new_result.setAttribute('class', 'categoryLi virtual_cat');
-			document.getElementById('categoryUl').appendChild(new_result);
-			
-			// Contenu de la ligne
-			new_result.innerHTML = '<ul class="categoryActions"> '+
-					'<li> '+
-						'<a href="#" title="{'CR_delete_desc'|@translate}" onclick="DeleteDescField('+ j +');return false;"> '+
-							'<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/> '+
-						'</a> '+
-					'</li> '+
-				'</ul> '+
-				'<p> '+
-					'<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}"> '+
-					'<input type="text" size="65" name="description['+ j +'][name]" value=""/> '+
-					'<textarea class="result_comment" name="description['+ j +'][content]"></textarea> '+
-				'</p> '+
-				'<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="description['+ j +'][rank]" value=""/></p>';
-			
-			// Remplace le lien de création
-			document.getElementById('AddLink').innerHTML = '<input class="submit" type="reset" onclick="CreateDescField('+ (j+1) +');return false;" value="{'CR_addfield'|@translate}"/>';
-			
-			// Réinitiliase les fonctions jQuery
-			jQuery('.catPos').hide();
-			jQuery('.drag_button').show();
-			jQuery('.categoryLi').css('cursor', 'move');
-			jQuery('textarea').autogrow();
-			jQuery('textarea').css('overflow-y', 'hidden');
-			vtip();
-		}
-		
-		// SUPPRIME UN CHAMP DE RESULTAT
-		function DeleteDescField(k){ldelim}
-			var result = document.getElementById('desc_'+k);
-			var parent = result.parentNode;
-			parent.removeChild(result);
-		}
-
-		jQuery().ready(function(){ldelim}
-			//  Drag-and-Drop
-			jQuery('.catPos').hide();
-			jQuery('.drag_button').show();
-			jQuery('.categoryLi').css('cursor', 'move');
-			jQuery('.categoryUl').sortable({ldelim}
-				axis: 'y',
-				opacity: 0.8
-			});
-			jQuery('#categoryOrdering').submit(function(){ldelim}
-				ar = jQuery('.categoryUl').sortable('toArray');
-				for(i=0; i<ar.length; i++) {ldelim}
-					cat = ar[i].split('desc_');
-					document.getElementsByName('description[' + cat[1] + '][rank]')[0].value = i+1;
-				}
-			});
-			// Cluetip
-			jQuery('.cluetip').cluetip({ldelim}
-				width: 550,
-				splitTitle: '|'
-			});
-		});
-
-		$(function() {ldelim}
-			$('#DateBegin').datepicker({ldelim}dateFormat:'yy-mm-dd', firstDay:1});
-			$('#DateEnd').datepicker({ldelim}dateFormat:'yy-mm-dd', firstDay:1});
-		});
-	</script>
-
-	<style type="text/css">
-		.cluetip:after {ldelim}
-			content:url('{$themeconf.admin_icon_dir}/help.png');
-		}
-	</style>
+<style type="text/css">
+	.cluetip:after {ldelim}
+		content:url('{$themeconf.admin_icon_dir}/help.png');
+	}
+</style>
 {/html_head}
 
-<h2 style="float:right;top:-24px;position:relative;font-style:italic;margin-bottom:-20px;font-size:12px;font-weight:normal;">{$CR_VERSION}</h2>
+<h2 class="version_title">{$CR_VERSION}</h2>
 
 <div class="titrePage">
@@ -159,5 +150,5 @@
 					<ul class="categoryActions">
 						<li>
-							<a href="#" title="{'CR_delete_desc'|@translate}" onclick="DeleteDescField({$i});return false;">
+							<a href="#" title="{'CR_delete_desc'|@translate}" onclick="jQuery('#desc_{$i}').remove();return false;">
 								<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/>
 							</a>
Index: extensions/ContestResults/admin/template/results.tpl
===================================================================
--- extensions/ContestResults/admin/template/results.tpl	(revision 9744)
+++ extensions/ContestResults/admin/template/results.tpl	(revision 9745)
@@ -1,107 +1,99 @@
-{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
-{combine_script id='jquery.ui' path='themes/default/js/ui/minified/jquery.ui.core.min.js'}
-{combine_script id='jquery.ui.sortable' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'}
-{combine_script id='jquery.cluetip' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
-{combine_script id='jquery.vtip' path=$CR_PATH|@cat:'admin/template/vtip.js'}
-{combine_css id='cr_admin_style' path=$CR_PATH|@cat:'admin/template/style.css'}
+{combine_script id='jquery.ui' 			require='jquery' path='themes/default/js/ui/minified/jquery.ui.core.min.js'}
+{combine_script id='jquery.ui.sortable' require='jquery' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'}
+{combine_script id='jquery.cluetip' 	require='jquery' path='themes/default/js/plugins/jquery.cluetip.js'}
+{combine_script id='jquery.vtip' 		require='jquery' path=$CR_PATH|@cat:'admin/template/vtip.js'}
+
+{combine_css path=$CR_PATH|@cat:'admin/template/style.css'}
 {include file='include/autosize.inc.tpl'}
 
+{footer_script require='jquery'}
+	// AJOUTE UN CHAMP DE RESULTAT
+	function CreateResultField(j, new_contest){ldelim}
+		// Si il n'y a aucun résultats on efface le message
+		if(new_contest) jQuery('#categoryUl').html('');
+		
+		// Ajoute à la fin de la liste une nouvelle ligne de résultat vide
+		jQuery('<li id="result_'+ j +'" class="categoryLi virtual_cat"></li>').appendTo('#categoryUl');
+		
+		// Contenu de la ligne
+		jQuery('#result_'+ j).html('<ul class="categoryActions"> '+
+				'<li> '+
+					'<a href="#" title="{'CR_delete_result'|@translate}" onclick="jQuery(\'#result_'+ j +'\').remove();return false;"> '+
+						'<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/> '+
+					'</a> '+
+				'</li> '+
+			'</ul> '+
+			'<p> '+
+				'<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}"> '+
+				'{'CR_image_no'|@translate} <input type="text" size="6" name="results['+ j +'][image_id]" value="" onkeyup="UpdatePreview('+ j +', this);"/> '+
+				'<span id="preview-'+ j +'"> '+
+					'<span class="vtip" title="<img src=\'admin/themes/default/icon/errors.png\'/><br>N/A"> '+
+						'<img src="{$CR_PATH}admin/template/image/images.png"/> '+
+					'</span> '+
+				'</span> '+
+				'{'CR_author'|@translate} : <input type="text" name="results['+ j +'][author]" value=""/> '+
+				'<textarea class="result_comment" name="results['+ j +'][comment]"></textarea> '+
+			'</p> '+
+			'<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="results['+ j +'][rank]" value=""/></p>');
+		
+		// Remplace le lien de création
+		jQuery('#AddLink').html('<input class="submit" type="reset" onclick="CreateResultField('+ (j+1) +');return false;" value="{'CR_addfield'|@translate}"/>');
+		
+		// Réinitiliase les fonctions jQuery
+		jQuery('.catPos').hide();
+		jQuery('.drag_button').show();
+		jQuery('.categoryLi').css('cursor', 'move');
+		jQuery('textarea').autogrow();
+		jQuery('textarea').css('overflow-y', 'hidden');
+		vtip();
+	}
+	
+	// MET A JOUR LA PREVISUALISATION DE L'IMAGE
+	function UpdatePreview(image_id, input){ldelim}
+		$.get("{$CR_PATH}admin/get_tn.php", {ldelim}image_id: input.value},
+			function success(data){ldelim}
+				document.getElementById('preview-'+image_id).innerHTML = '<span class="vtip" title="'+ data + '">'+
+						'<img src="{$CR_PATH}admin/template/image/images.png"/>'+
+					'</span>';
+				vtip();
+			}
+		);
+	}
+		
+{literal}
+	jQuery().ready(function(){
+		//  Drag-and-Drop
+		jQuery('.catPos').hide();
+		jQuery('.drag_button').show();
+		jQuery('.categoryLi').css('cursor', 'move');
+		jQuery('.categoryUl').sortable({
+			axis: 'y',
+			opacity: 0.8
+		});
+		jQuery('#categoryOrdering').submit(function(){
+			ar = jQuery('.categoryUl').sortable('toArray');
+			for(i=0; i<ar.length; i++) {
+				cat = ar[i].split('result_');
+				document.getElementsByName('results[' + cat[1] + '][rank]')[0].value = i+1;
+			}
+		});
+		// Cluetip
+		jQuery('.cluetip').cluetip({
+			width: 550,
+			splitTitle: '|'
+		});
+	});
+{/literal}
+{/footer_script}
+
 {html_head}
-	<script type="text/javascript">
-		// AJOUTE UN CHAMP DE RESULTAT
-		function CreateResultField(j, new_contest){ldelim}
-			// Si il n'y a aucun résultats on efface le message
-			if(new_contest) document.getElementById('categoryUl').innerHTML = '';
-			
-			// Ajoute à la fin de la liste une nouvelle ligne de résultat vide
-			var new_result = document.createElement('li');
-			new_result.setAttribute('id', 'result_'+(j));
-			new_result.setAttribute('class', 'categoryLi virtual_cat');
-			document.getElementById('categoryUl').appendChild(new_result);
-			
-			// Contenu de la ligne
-			new_result.innerHTML = '<ul class="categoryActions"> '+
-					'<li> '+
-						'<a href="#" title="{'CR_delete_result'|@translate}" onclick="DeleteResultField('+ j +');return false;"> '+
-							'<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/> '+
-						'</a> '+
-					'</li> '+
-				'</ul> '+
-				'<p> '+
-					'<img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" title="{'Drag to re-order'|@translate}"> '+
-					'{'CR_image_no'|@translate} <input type="text" size="6" name="results['+ j +'][image_id]" value="" onkeyup="UpdatePreview('+ j +', this);"/> '+
-					'<span id="preview-'+ j +'"> '+
-						'<span class="vtip" title="<img src=\'admin/themes/default/icon/errors.png\'/><br>N/A"> '+
-							'<img src="{$CR_PATH}admin/template/image/images.png"/> '+
-						'</span> '+
-					'</span> '+
-					'{'CR_author'|@translate} : <input type="text" name="results['+ j +'][author]" value=""/> '+
-					'<textarea class="result_comment" name="results['+ j +'][comment]"></textarea> '+
-				'</p> '+
-				'<p class="catPos">{'CR_rank'|@translate} : <input type="text" name="results['+ j +'][rank]" value=""/></p>';
-			
-			// Remplace le lien de création
-			document.getElementById('AddLink').innerHTML = '<input class="submit" type="reset" onclick="CreateResultField('+ (j+1) +');return false;" value="{'CR_addfield'|@translate}"/>';
-			
-			// Réinitiliase les fonctions jQuery
-			jQuery('.catPos').hide();
-			jQuery('.drag_button').show();
-			jQuery('.categoryLi').css('cursor', 'move');
-			jQuery('textarea').autogrow();
-			jQuery('textarea').css('overflow-y', 'hidden');
-			vtip();
-		}
-		
-		// SUPPRIME UN CHAMP DE RESULTAT
-		function DeleteResultField(k){ldelim}
-			var result = document.getElementById('result_'+k);
-			var parent = result.parentNode;
-			parent.removeChild(result);
-		}
-
-		jQuery().ready(function(){ldelim}
-			//  Drag-and-Drop
-			jQuery('.catPos').hide();
-			jQuery('.drag_button').show();
-			jQuery('.categoryLi').css('cursor', 'move');
-			jQuery('.categoryUl').sortable({ldelim}
-				axis: 'y',
-				opacity: 0.8
-			});
-			jQuery('#categoryOrdering').submit(function(){ldelim}
-				ar = jQuery('.categoryUl').sortable('toArray');
-				for(i=0; i<ar.length; i++) {ldelim}
-					cat = ar[i].split('result_');
-					document.getElementsByName('results[' + cat[1] + '][rank]')[0].value = i+1;
-				}
-			});
-			// Cluetip
-			jQuery('.cluetip').cluetip({ldelim}
-				width: 550,
-				splitTitle: '|'
-			});
-		});
-		
-		// MET A JOUR LA PREVISUALISATION DE L'IMAGE
-		function UpdatePreview(image_id, input){ldelim}
-			$.get("{$CR_PATH}admin/get_tn.php", {ldelim}image_id: input.value},
-				function success(data){ldelim}
-					document.getElementById('preview-'+image_id).innerHTML = '<span class="vtip" title="'+ data + '">'+
-							'<img src="{$CR_PATH}admin/template/image/images.png"/>'+
-						'</span>';
-					vtip();
-				}
-			);
-		}
-	</script>
-	
-	<style type="text/css">
-		.cluetip:after {ldelim}
-			content:url('{$themeconf.admin_icon_dir}/help.png');
-		}
-	</style>
+<style type="text/css">
+	.cluetip:after {ldelim}
+		content:url('{$themeconf.admin_icon_dir}/help.png');
+	}
+</style>
 {/html_head}
 
-<h2 style="float:right;top:-24px;position:relative;font-style:italic;margin-bottom:-20px;font-size:12px;font-weight:normal;">{$CR_VERSION}</h2>
+<h2 class="version_title">{$CR_VERSION}</h2>
 
 <div class="titrePage">
@@ -114,8 +106,8 @@
 	{if isset($results)}
 		{foreach from=$results item=result}
-			<li class="categoryLi {if $result.IMAGE_NAME == 'N/A'}error_cat{/if}" id="result_{$i}">
+			<li class="categoryLi {if isset($result.ERROR)}error_cat{/if}" id="result_{$i}">
 				<ul class="categoryActions">
 					<li>
-						<a href="#" title="{'CR_delete_result'|@translate}" onclick="DeleteResultField({$i});return false;">
+						<a href="#" title="{'CR_delete_result'|@translate}" onclick="jQuery('#result_{$i}').remove();return false;">
 							<img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'CR_delete_result'|@translate}"/>
 						</a>
Index: extensions/ContestResults/admin/template/style.css
===================================================================
--- extensions/ContestResults/admin/template/style.css	(revision 9744)
+++ extensions/ContestResults/admin/template/style.css	(revision 9745)
@@ -1,9 +1,2 @@
-.titrePage {
-	clear:right;
-}
-.titrePage h2 {
-	text-align:center;
-}
-
 .result_comment {
 	width:95%;
@@ -71,2 +64,17 @@
 	color:#a00;
 }
+
+#CR_config tr td:first-child { 
+	max-width:300px; 
+	min-width:300px;
+}
+
+.version_title {
+	float:right;
+	position:relative;
+	top:-24px;
+	margin-bottom:-20px !important;
+	font-size:12px !important;
+	font-style:italic;
+	font-weight:normal;
+}
Index: extensions/ContestResults/changelog.txt
===================================================================
--- extensions/ContestResults/changelog.txt	(revision 9744)
+++ extensions/ContestResults/changelog.txt	(revision 9745)
@@ -1,3 +1,9 @@
-1.3
+1.3.b
+- Use new admin links and javascript implementation
+- Distinguish pending and running contests (both pending before)
+- Tables are created in utf8
+- New bloc for PWG Stuffs
+
+1.3.a
 - Add error and success messages on admin page
 - Add Spain (es_ES) thanks to jpr928
Index: extensions/ContestResults/include/compatibility.inc.php
===================================================================
--- extensions/ContestResults/include/compatibility.inc.php	(revision 9745)
+++ extensions/ContestResults/include/compatibility.inc.php	(revision 9745)
@@ -0,0 +1,75 @@
+<?php
+
+// compatibilité avec les versions < 1.1 (ajout d'une entrée de configuration)
+if (!isset($conf['ContestResults'])) {
+	pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');");
+}
+
+// compatibilité avec les versions < 1.2 (suppression option d'affichage)
+$field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'presentation_display'");
+if (pwg_db_num_rows($field)) {
+	pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 
+		DROP `presentation_display`,
+		DROP `rules_display`,
+		DROP `prices_display`,
+		DROP `final_display`;"
+	);
+}
+
+// compatibilité avec les versions < 1.3.a (suppression option status, regroupement des champs de description)
+$field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'status'");
+if (pwg_db_num_rows($field)) {
+	pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `status`");
+	pwg_query("ALTER TABLE `" . $prefixeTable . "contests` ADD `description` TEXT NULL");
+	
+	$contests = pwg_query("SELECT * FROM `" . $prefixeTable . "contests`");
+	while ($contest = pwg_db_fetch_assoc($contests)) {
+		$new_description = array();
+		if (!empty($contest['presentation'])) {
+			$new_description[] = array(
+				'name' => 'Presentation[lang=fr]Présentation[/lang][lang=es]Presentación[/lang][lang=lv]Prezentacija[/lang]',
+				'content' => $contest['presentation'],
+			);
+		}
+		if (!empty($contest['rules'])) {
+			$new_description[] = array(
+				'name' => 'Rules[lang=fr]Règles[/lang][lang=es]Restricciones[/lang][lang=lv]Noteikumi[/lang]',
+				'content' => $contest['rules'],
+			);
+		}
+		if (!empty($contest['prices'])) {
+			$new_description[] = array(
+				'name' => 'Prices[lang=fr]Prix[/lang][lang=es]Precios[/lang][lang=lv]Cenas[/lang]',
+				'content' => $contest['prices'],
+			);
+		}
+		if (!empty($contest['final'])) {
+			$new_description[] = array(
+				'name' => 'Conclusion[lang=fr]Conclusion[/lang][lang=es]Conclusión[/lang][lang=lv]Beigsana[/lang]',
+				'content' => $contest['final'],
+			);
+		}
+	
+		$new_description = base64_encode(serialize($new_description));
+		pwg_query("UPDATE `" . $prefixeTable . "contests`
+			SET description = '". $new_description ."'
+			WHERE id = ". $contest['id'] .";"
+		);
+	}
+	
+	pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 
+		DROP `presentation`,
+		DROP `rules`,
+		DROP `prices`,
+		DROP `final`;"
+	);
+}
+
+// compatibilité avec les versions < 1.3.b (ajout d'un paramètre de config)
+$conf['ContestResults'] = unserialize($conf['ContestResults']);
+if (!isset($conf['ContestResults']['truncate_summary'])) {
+	$conf['ContestResults']['truncate_summary'] = 350;
+	pwg_query("UPDATE " . CONFIG_TABLE . " SET value='" . serialize($conf['ContestResults']) . "' WHERE param = 'ContestResults';");
+}
+
+?>
Index: extensions/ContestResults/include/cr_main.php
===================================================================
--- extensions/ContestResults/include/cr_main.php	(revision 9744)
+++ extensions/ContestResults/include/cr_main.php	(revision 9745)
@@ -17,7 +17,7 @@
 
 while ($contest = pwg_db_fetch_assoc($contests)) {
+	$contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end']));
+		
 	if ($contest['visible'] OR is_admin()) {
-		$contest['finished'] = is_date_passed($contest['date_end']);
-		
 		// infos sur le concours
 		$item =  array(
@@ -25,15 +25,15 @@
 			'NAME' => trigger_event('render_CR_content', $contest['name']),
 			'VISIBLE' => $contest['visible'],
-			'FINISHED' => $contest['finished'],
+			'STATUS' => $contest['status'],
 			'DATE_END' => format_date($contest['date_end']),
 			'DATE_BEGIN' => format_date($contest['date_begin']),
 			'LOGO' => $contest['logo'],
-			'SUMMARY' => CR_cut_string(trigger_event('render_CR_content', $contest['summary']), 350),
+			'SUMMARY' => CR_cut_string(trigger_event('render_CR_content', $contest['summary']), $conf['ContestResults']['truncate_summary']),
 			'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
-			'DAYS' => DateDiff($contest['date_end'], date('Y-m-d')),
+			'DAYS' => $contest['days'],
 		);
 		
 		// podium si terminé
-		if ($contest['finished'] == true) {
+		if ($contest['status'] == 'finished') {
 			$results = pwg_query("SELECT
 					i.id,
Index: extensions/ContestResults/include/cr_menubar.php
===================================================================
--- extensions/ContestResults/include/cr_menubar.php	(revision 9744)
+++ extensions/ContestResults/include/cr_menubar.php	(revision 9745)
@@ -5,6 +5,5 @@
 //				Triggers
 // +-----------------------------------------------------------------------+
-$config = unserialize($conf['ContestResults']);
-if ($config['menubar_mode']['block']) {
+if ($conf['ContestResults']['menubar_mode']['block']) {
 	add_event_handler('blockmanager_register_blocks', 'CR_register_menubar_blocks');
 }
@@ -25,5 +24,5 @@
 function CR_menubar_apply($menu_ref_arr) {
 	global $template, $conf;
-	$config = unserialize($conf['ContestResults']);
+	//$config = unserialize($conf['ContestResults']);
 	$menu = &$menu_ref_arr[0];
 	
@@ -43,6 +42,8 @@
 
 		$m = 0; // compteur pour limiter le nombre de concours affichés
-		while($contest = pwg_db_fetch_assoc($contests)){
-			if (($contest['visible'] OR is_admin()) AND $m < $config['menubar_block']['number']) {
+		while ($contest = pwg_db_fetch_assoc($contests)) {
+			$contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end']));
+			
+			if (($contest['visible'] OR is_admin()) AND $m < $conf['ContestResults']['menubar_block']['number']) {
 				array_push($data, array(
 					'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
@@ -50,6 +51,6 @@
 					'DATE' => format_date($contest['date_begin']) . ' - ' . format_date($contest['date_end']),
 					'VISIBLE' => $contest['visible'],
-					'FINISHED' => is_date_passed($contest['date_end']),
-					'DAYS' => DateDiff($contest['date_end'],date('Y-m-d')),
+					'STATUS' => $contest['status'],
+					'DAYS' => $contest['days'],
 				));
 			}
@@ -67,5 +68,5 @@
 	
 	// Block Menu - ajout d'un lien dans le bloc Menu
-	if ($config['menubar_mode']['link'] AND $config['menubar_link']['menu'] AND ($block = $menu->get_block('mbMenu')) != null) {
+	if ($conf['ContestResults']['menubar_mode']['link'] AND $conf['ContestResults']['menubar_link']['menu'] AND ($block = $menu->get_block('mbMenu')) != null) {
 		array_push($block->data, array(
 			'URL' => CR_PUBLIC,
@@ -76,5 +77,5 @@
 	
 	// Block Specials - ajout d'un lien dans le bloc Specials
-	if($config['menubar_mode']['link'] AND $config['menubar_link']['specials'] AND ($block = $menu->get_block('mbSpecials')) != null){
+	if($conf['ContestResults']['menubar_mode']['link'] AND $conf['ContestResults']['menubar_link']['specials'] AND ($block = $menu->get_block('mbSpecials')) != null){
 		array_push($block->data, array(
 			'URL' => CR_PUBLIC,
Index: extensions/ContestResults/include/cr_page.php
===================================================================
--- extensions/ContestResults/include/cr_page.php	(revision 9744)
+++ extensions/ContestResults/include/cr_page.php	(revision 9745)
@@ -6,111 +6,106 @@
 // +-----------------------------------------------------------------------+
 if (is_admin()) {
-	$template->assign('U_EDIT', CR_ADMIN . '&amp;tab=edit&amp;contest_id=' . $page['contest'] . '&amp;redirect=page');
-	$template->assign('U_RESULTS', CR_ADMIN . '&amp;tab=results&amp;contest_id=' . $page['contest']);
+	$template->assign('U_EDIT', CR_ADMIN . '-edit&amp;contest_id=' . $page['contest'] . '&amp;redirect=page');
+	$template->assign('U_RESULTS', CR_ADMIN . '-results&amp;contest_id=' . $page['contest'] . '&amp;redirect=page');
 }
 
 // Infos du concours
-$contest = pwg_query("SELECT * FROM " . CR_TABLE_1 . " WHERE id=" . $page['contest'] . ";");
+$contest = pwg_db_fetch_assoc(pwg_query("SELECT * FROM " . CR_TABLE_1 . " WHERE id=" . $page['contest'] . ";"));
+$contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end']));
 
-if (pwg_db_num_rows($contest)) { 
-	$contest = pwg_db_fetch_assoc($contest);
-	$contest['finished'] = is_date_passed($contest['date_end']);
-	
-	// Concours non-publique
-	if (!$contest['visible']) {
-		check_status(ACCESS_ADMINISTRATOR);
-	}
-	
-	// Paramètres généraux
-	$template->assign(array(
-		'ID' => $contest['id'],
-		'NAME' => trigger_event('render_CR_content', $contest['name']),
-		'VISIBLE' => $contest['visible'],
-		'FINISHED' => $contest['finished'],
-		'DATE_BEGIN' => format_date($contest['date_begin']),
-		'DATE_END' => format_date($contest['date_end']),
-		'LOGO' => $contest['logo'],
-		'BANNER' => $contest['banner'],
-		'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
-		'DAYS' => DateDiff($contest['date_end'], date('Y-m-d')),
-	));
-	
-	// Les quatre zones texte
-	if (!empty($contest['description'])) {
-		$contest['description'] = unserialize(base64_decode($contest['description']));
-		foreach ($contest['description'] as $desc) {
-			$template->append('description', array(
-				'NAME' => trigger_event('render_CR_content', stripslashes($desc['name'])),
-				'CONTENT' => trigger_event('render_CR_content', stripslashes($desc['content'])),
-			));
-		}
-	}
-	
-	// Affichage des résultats
-	if ($contest['finished'] == true) {
-		// Infos des résultats
-		$results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id=" . $contest['id'] . " ORDER BY rank ASC;");
-		
-		while ($result = pwg_db_fetch_assoc($results)) {
-			// Infos de l'image
-			$query = "SELECT
-					i.id,
-					i.name,
-					i.file,
-					i.path,
-					i.tn_ext,
-					ic.category_id
-				FROM " . IMAGES_TABLE . " AS i
-				INNER JOIN " . IMAGE_CATEGORY_TABLE . " AS ic
-				ON ic.image_id = i.id
-				WHERE i.id = " . $result['image_id'] . ";";
-			$image = pwg_db_fetch_assoc(pwg_query($query));
-
-			// retrieving category informations
-			$query = "SELECT 
-					id, 
-					name, 
-					permalink, 
-					uppercats
-				FROM " . CATEGORIES_TABLE."
-				WHERE id = " . $image['category_id'] . ";";
-			$image['cat'] = pwg_db_fetch_assoc(pwg_query($query));
-	
-			// link to the full size picture
-			$image['url'] = make_picture_url(array(
-				'category' => $image['cat'],
-				'image_id' => $image['id'],
-				'image_file' => $image['file'],
-			));			
-			
-			// Template
-			if (in_array($result['rank'], array(1,2,3))) {
-				$data = array(
-					'RANK' => $result ['rank'],
-					'AUTHOR' => $result['author'],
-					'IMAGE_SRC' => str_replace('thumbnail/'.$conf['prefix_thumbnail'], null, get_thumbnail_url($image)),
-					'IMAGE_URL' => $image['url'],
-					'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'],
-					'COMMENT' => CR_cut_string(trigger_event('render_CR_content', $result['comment']), 450),
-				);
-			}else{
-				$data = array(
-					'RANK' => $result ['rank'],
-					'AUTHOR' => $result['author'],
-					'TN_SRC' => get_thumbnail_url($image),
-					'IMAGE_URL' => $image['url'],
-					'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'],
-				);
-			}
-			$template->append('RESULTS', $data);
-		}
-	}
-	
-	$template->set_filenames(array('index'=> dirname(__FILE__).'/../template/cr_page.tpl'));
-	
-} else {
-	page_not_found(l10n('CR_notavailable'));
+// Concours non-publique
+if (!$contest['visible']) {
+	check_status(ACCESS_ADMINISTRATOR);
 }
 
+// Paramètres généraux
+$template->assign(array(
+	'ID' => $contest['id'],
+	'NAME' => trigger_event('render_CR_content', $contest['name']),
+	'VISIBLE' => $contest['visible'],
+	'STATUS' => $contest['status'],
+	'DATE_BEGIN' => format_date($contest['date_begin']),
+	'DATE_END' => format_date($contest['date_end']),
+	'LOGO' => $contest['logo'],
+	'BANNER' => $contest['banner'],
+	'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
+	'DAYS' => $contest['days'],
+));
+
+// Les quatre zones texte
+if (!empty($contest['description'])) {
+	$contest['description'] = unserialize(base64_decode($contest['description']));
+	foreach ($contest['description'] as $desc) {
+		$template->append('description', array(
+			'NAME' => trigger_event('render_CR_content', stripslashes($desc['name'])),
+			'CONTENT' => trigger_event('render_CR_content', stripslashes($desc['content'])),
+		));
+	}
+}
+
+// Affichage des résultats
+if ($contest['status'] == 'finished') {
+	// Infos des résultats
+	$results = pwg_query("SELECT * FROM " . CR_TABLE_2 . " WHERE contest_id=" . $contest['id'] . " ORDER BY rank ASC;");
+	$i=0;
+	while ($result = pwg_db_fetch_assoc($results)) {
+		$i++;
+		// Infos de l'image
+		$query = "SELECT
+				i.id,
+				i.name,
+				i.file,
+				i.path,
+				i.tn_ext,
+				ic.category_id
+			FROM " . IMAGES_TABLE . " AS i
+			INNER JOIN " . IMAGE_CATEGORY_TABLE . " AS ic
+			ON ic.image_id = i.id
+			WHERE i.id = " . $result['image_id'] . ";";
+		$image = pwg_db_fetch_assoc(pwg_query($query));
+
+		// retrieving category informations
+		$query = "SELECT 
+				id, 
+				name, 
+				permalink, 
+				uppercats
+			FROM " . CATEGORIES_TABLE."
+			WHERE id = " . $image['category_id'] . ";";
+		$image['cat'] = pwg_db_fetch_assoc(pwg_query($query));
+
+		// link to the full size picture
+		$image['url'] = make_picture_url(array(
+			'category' => $image['cat'],
+			'image_id' => $image['id'],
+			'image_file' => $image['file'],
+		));			
+		
+		// Template
+		if (in_array($result['rank'], array(1,2,3))) {
+			$data = array(
+				'RANK' => $result ['rank'],
+				'AUTHOR' => $result['author'],
+				'IMAGE_SRC' => str_replace('thumbnail/'.$conf['prefix_thumbnail'], null, get_thumbnail_url($image)),
+				'IMAGE_URL' => $image['url'],
+				'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'],
+				'COMMENT' => CR_cut_string(trigger_event('render_CR_content', $result['comment']), 450),
+			);
+		}else{
+			$data = array(
+				'RANK' => $result ['rank'],
+				'AUTHOR' => $result['author'],
+				'TN_SRC' => get_thumbnail_url($image),
+				'IMAGE_URL' => $image['url'],
+				'IMAGE_NAME' => (empty($image['name'])) ? get_name_from_file($image['file']) : $image['name'],
+			);
+		}
+		$template->append('RESULTS', $data);
+	}
+	$template->assign('NB_RESULTS', $i);
+}
+
+$template->set_filenames(array('index'=> dirname(__FILE__).'/../template/cr_page.tpl'));
+	
 
 // +-----------------------------------------------------------------------+
Index: extensions/ContestResults/include/functions.php
===================================================================
--- extensions/ContestResults/include/functions.php	(revision 9744)
+++ extensions/ContestResults/include/functions.php	(revision 9745)
@@ -20,10 +20,10 @@
 		return $contest['name'];
 	} else {
-		return null;
+		return false;
 	}
 }
 
 // Nombre de jours entre deux dates
-function DateDiff($date2, $date1) {
+function date_diff($date2, $date1) {
 	return ceil((strtotime($date2)-strtotime($date1))/(3600*24));
 }
@@ -37,3 +37,19 @@
 	}
 }
+
+// Calcul le status d'un concours
+function get_contest_status($date_begin, $date_end) {
+	if (!is_date_passed($date_begin)) {
+		$contest['status'] = 'pending';
+		$contest['days'] = l10n_dec('CR_%d_days_to_begin', 'CR_%d_days_to_begin', date_diff($date_begin,date('Y-m-d')));
+	} else if (is_date_passed($date_end)) {
+		$contest['status'] = 'finished';
+		$contest['days'] = l10n('CR_finished');
+	} else { 
+		$contest['status'] = 'running';
+		$contest['days'] = l10n_dec('CR_%d_days_to_end', 'CR_%d_days_to_end', date_diff($date_end,date('Y-m-d')));
+	}
+	
+	return $contest;
+}
 ?>
Index: extensions/ContestResults/language/en_UK/plugin.lang.php
===================================================================
--- extensions/ContestResults/language/en_UK/plugin.lang.php	(revision 9744)
+++ extensions/ContestResults/language/en_UK/plugin.lang.php	(revision 9745)
@@ -1,5 +1,19 @@
 <?php
 
+/* général */
 $lang['Contests'] = 'Contests';
+$lang['CR_finished'] = 'Finished';
+$lang['CR_results'] = 'Results';
+$lang['CR_place'] = 'place';
+$lang['CR_nopublic'] = 'This page is not available for the public !';
+$lang['CR_notavailable'] = 'This contest is not available';
+$lang['CR_%d_days_to_begin'] = "Begins in %d days";
+$lang['CR_%d_days_to_end'] = "%d days remaining";
+$lang['CR_order_1'] = '1<sup>st</sup>';
+$lang['CR_order_2'] = '2<sup>nd</sup>';
+$lang['CR_order_3'] = '3<sup>rd</sup>';
+$lang['CR_order_sup'] = '<sup>th</sup>';
+
+/* admin */
 $lang['CR_edit_tab'] = 'Edit contest';
 $lang['CR_delete'] = 'Delete contest';
@@ -8,7 +22,4 @@
 $lang['CR_new_tab'] = 'Add a new contest';
 $lang['CR_results_tab'] = 'Contest results';
-$lang['CR_pending_title'] = 'Pending contests';
-$lang['CR_finished_title'] = 'Finished contest';
-$lang['CR_results'] = 'Results';
 $lang['CR_go'] = 'Go to the contest page';
 $lang['CR_title'] = 'Title';
@@ -18,6 +29,4 @@
 $lang['CR_logo'] = 'Logo';
 $lang['CR_banner'] = 'Banner';
-$lang['CR_pending'] = 'Pending';
-$lang['CR_finished'] = 'Finished';
 $lang['CR_summary'] = 'Summary';
 $lang['CR_textareas'] = 'Contest description';
@@ -30,10 +39,7 @@
 $lang['CR_comment'] = 'Comment';
 $lang['CR_rank'] = 'Rank';
-$lang['CR_place'] = 'place';
-$lang['CR_period'] = 'Period';
 $lang['CR_visible'] = 'Public';
-$lang['CR_nopublic'] = 'This page is not available for the public !';
-$lang['CR_notavailable'] = 'This contest is not available';
 $lang['CR_id_unknown %d'] = "The picture n°%d doesn't exist";
+$lang['CR_duplicate_result %d'] = "The picture n°%d appears twice";
 $lang['CR_contest_saved'] = "Contest settings saved";
 $lang['CR_contest_added'] = "Contest added";
@@ -41,17 +47,21 @@
 $lang['CR_results_saved'] = "Results saved";
 $lang['CR_name_empty'] = "The name of the contest can't be empty";
-$lang['CR_days'] = "days remaining";
+$lang['CR_pending_title'] = 'Pending contests';
+$lang['CR_running_title'] = 'Contests running';
+$lang['CR_finished_title'] = 'Finished contest';
 
-$lang['CR_order_1'] = '1<sup>st</sup>';
-$lang['CR_order_2'] = '2<sup>nd</sup>';
-$lang['CR_order_3'] = '3<sup>rd</sup>';
-$lang['CR_order_sup'] = '<sup>th</sup>';
-
-$lang['CR_menubar_mode'] = 'Add ContestResults to the menu';
+/* config */
+$lang['CR_menubar_mode'] = 'Add Contest Results to the menu';
 $lang['CR_menubar_link'] = 'Add a link to a existing menu-block';
 $lang['CR_menubar_link_display'] = 'Display the link in the following blocks';
 $lang['CR_menubar_block'] = 'New menu block';
 $lang['CR_menubar_block_number'] = 'Quantity of contests to display in the block';
+$lang['CR_truncate_summary'] = "Truncate the summary of the contest after x characters";
 
+/* stuffs */
+$lang['CR_select_contest'] = "Select one or more contests";
+$lang['CR_stuffs_desc'] = "Display one or more contests";
+
+/* cluetip */
 $lang['CR_help_lang'] = (CR_ED_STATE == 'active') ? "<b>You can use HTML and multilanguage descriptions.</b>" : "<b>You can use HTML.</b>";
 $lang['CR_help_title'] = "" . $lang['CR_help_lang'];
Index: extensions/ContestResults/language/es_ES/plugin.lang.php
===================================================================
--- extensions/ContestResults/language/es_ES/plugin.lang.php	(revision 9744)
+++ extensions/ContestResults/language/es_ES/plugin.lang.php	(revision 9745)
@@ -1,5 +1,19 @@
 <?php
 
+/* général */
 $lang['Contests'] = 'Concurso';
+$lang['CR_finished'] = 'Terminado';
+$lang['CR_results'] = 'Resultados';
+$lang['CR_place'] = 'sitio';
+$lang['CR_nopublic'] = "Esta página no es accesible al público !";
+$lang['CR_notavailable'] = "Este concurso no está disponible";
+$lang['CR_%d_days_to_begin'] = "Begins in %d days";
+$lang['CR_%d_days_to_end'] = "%d days remaining";
+$lang['CR_order_1'] = '1<sup>a</sup>';
+$lang['CR_order_2'] = '2<sup>0</sup>';
+$lang['CR_order_3'] = '3<sup>0</sup>';
+$lang['CR_order_sup'] = '<sup>0</sup>';
+
+/* admin */
 $lang['CR_edit_tab'] = 'Edición del Concurso';
 $lang['CR_delete'] = 'Suprimir el concurso';
@@ -8,7 +22,4 @@
 $lang['CR_new_tab'] = 'Añadir un nuevo concurso';
 $lang['CR_results_tab'] = 'Resultados del Concurso';
-$lang['CR_pending_title'] = 'Concursos en curso';
-$lang['CR_finished_title'] = 'Concurso terminado';
-$lang['CR_results'] = 'Resultados';
 $lang['CR_go'] = 'Ir a la página del concurso';
 $lang['CR_title'] = 'Titulo';
@@ -18,6 +29,4 @@
 $lang['CR_logo'] = 'Logo';
 $lang['CR_banner'] = 'Bandera';
-$lang['CR_pending'] = 'En curso';
-$lang['CR_finished'] = 'Terminado';
 $lang['CR_summary'] = 'Resumen';
 $lang['CR_textareas'] = 'Descripcion del concurso';
@@ -30,10 +39,7 @@
 $lang['CR_comment'] = 'Comentario';
 $lang['CR_rank'] = 'Rango';
-$lang['CR_place'] = 'sitio';
-$lang['CR_period'] = 'Periodo';
 $lang['CR_visible'] = 'Publico';
-$lang['CR_nopublic'] = "Esta página no es accesible al público !";
-$lang['CR_notavailable'] = "Este concurso no está disponible";
 $lang['CR_id_unknown %d'] = "Imagen #% d no existe";
+$lang['CR_duplicate_result %d'] = "The picture n°%d appears twice";
 $lang['CR_contest_saved'] = "Configuración del concurso guardada";
 $lang['CR_contest_added'] = "Concurso añadido";
@@ -41,11 +47,9 @@
 $lang['CR_results_saved'] = "Resultados guardado ";
 $lang['CR_name_empty'] = "El nombre del concurso no puede estar vacío";
-$lang['CR_days'] = "días restantes";
+$lang['CR_pending_title'] = 'Concursos en curso';
+$lang['CR_running_title'] = 'Contests running';
+$lang['CR_finished_title'] = 'Concurso terminado';
 
-$lang['CR_order_1'] = '1<sup>a</sup>';
-$lang['CR_order_2'] = '2<sup>0</sup>';
-$lang['CR_order_3'] = '3<sup>0</sup>';
-$lang['CR_order_sup'] = '<sup>0</sup>';
-
+/* config */
 $lang['CR_menubar_mode'] = 'Insertar ContestResults al menú';
 $lang['CR_menubar_link'] = 'Vínculo en un bloque menú existente'; 
@@ -53,5 +57,11 @@
 $lang['CR_menubar_block'] = 'Nuevo bloque menú';
 $lang['CR_menubar_block_number'] = 'Número de Concursos para mostrar en el bloque';
+$lang['CR_truncate_summary'] = "Truncate the summary of the contest after x characters";
 
+/* stuffs */
+$lang['CR_select_contest'] = "Select one or more contests";
+$lang['CR_stuffs_desc'] = "Display one or more contests";
+
+/* cluetip */
 $lang['CR_help_lang'] = (CR_ED_STATE == 'active') ? "<b>Puede usar HTML y descripciones multilingüe.</b>" : "<b>Puede usar HTML.</b>";
 $lang['CR_help_title'] = "" .$lang['CR_help_lang'];
@@ -67,4 +77,4 @@
 	- Pase el ratón sobre el icono <img src='".CR_PATH."admin/template/image/images.png'/> para ver la imagen correspondiente al identificador de entrada.<br/>
 	<br/>" .$lang['CR_help_lang'];
-	
+
 ?>
Index: extensions/ContestResults/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/ContestResults/language/fr_FR/plugin.lang.php	(revision 9744)
+++ extensions/ContestResults/language/fr_FR/plugin.lang.php	(revision 9745)
@@ -1,5 +1,19 @@
 <?php
 
+/* général */
 $lang['Contests'] = 'Concours';
+$lang['CR_finished'] = 'Terminé';
+$lang['CR_results'] = 'Résultats';
+$lang['CR_place'] = 'place';
+$lang['CR_nopublic'] = "Cette page n'est pas accessible au public !";
+$lang['CR_notavailable'] = "Ce concours n'est pas disponible";
+$lang['CR_%d_days_to_begin'] = "Commence dans %d jours";
+$lang['CR_%d_days_to_end'] = "%d jours restants";
+$lang['CR_order_1'] = '1<sup>ère</sup>';
+$lang['CR_order_2'] = '2<sup>ème</sup>';
+$lang['CR_order_3'] = '3<sup>ème</sup>';
+$lang['CR_order_sup'] = '<sup>ème</sup>';
+
+/* admin */
 $lang['CR_edit_tab'] = 'Editer le concours';
 $lang['CR_delete'] = 'Supprimer le concours';
@@ -8,7 +22,4 @@
 $lang['CR_new_tab'] = 'Ajouter un nouveau concours';
 $lang['CR_results_tab'] = 'Résultats du concours';
-$lang['CR_pending_title'] = 'Concours en cours';
-$lang['CR_finished_title'] = 'Concours terminés';
-$lang['CR_results'] = 'Résultats';
 $lang['CR_go'] = 'Aller sur la page du concours';
 $lang['CR_title'] = 'Titre';
@@ -18,6 +29,4 @@
 $lang['CR_logo'] = 'Logo';
 $lang['CR_banner'] = 'Bannière';
-$lang['CR_pending'] = 'En cours';
-$lang['CR_finished'] = 'Terminé';
 $lang['CR_summary'] = 'Résumé';
 $lang['CR_textareas'] = 'Description du concours';
@@ -30,10 +39,7 @@
 $lang['CR_comment'] = 'Commentaire';
 $lang['CR_rank'] = 'Rang';
-$lang['CR_place'] = 'place';
-$lang['CR_period'] = 'Période';
 $lang['CR_visible'] = 'Publique';
-$lang['CR_nopublic'] = "Cette page n'est pas accessible au public !";
-$lang['CR_notavailable'] = "Ce concours n'est pas disponible";
 $lang['CR_id_unknown %d'] = "L'image n°%d n'existe pas";
+$lang['CR_duplicate_result %d'] = "L'image n°%d est en double";
 $lang['CR_contest_saved'] = "Paramètres du concours sauvegardés";
 $lang['CR_contest_added'] = "Concours ajouté";
@@ -41,17 +47,21 @@
 $lang['CR_results_saved'] = "Résultats sauvegardés";
 $lang['CR_name_empty'] = "Le nom du concours ne peut être vide";
-$lang['CR_days'] = "jours restants";
+$lang['CR_pending_title'] = 'Concours en attente';
+$lang['CR_running_title'] = 'Concours en cours';
+$lang['CR_finished_title'] = 'Concours terminés';
 
-$lang['CR_order_1'] = '1<sup>ère</sup>';
-$lang['CR_order_2'] = '2<sup>ème</sup>';
-$lang['CR_order_3'] = '3<sup>ème</sup>';
-$lang['CR_order_sup'] = '<sup>ème</sup>';
-
-$lang['CR_menubar_mode'] = 'Intégrer ContestResults au menu';
+/* config */
+$lang['CR_menubar_mode'] = 'Intégrer Contest Results au menu';
 $lang['CR_menubar_link'] = 'Lien dans un bloc menu existant';
 $lang['CR_menubar_link_display'] = 'Afficher le lien dans les blocs';
 $lang['CR_menubar_block'] = 'Nouveau bloc menu';
 $lang['CR_menubar_block_number'] = 'Nombre de concours à afficher dans le bloc';
+$lang['CR_truncate_summary'] = "Tronquer le résumé du concours après x caractères";
 
+/* stuffs */
+$lang['CR_select_contest'] = "Sélectionnez un ou plusieurs concours";
+$lang['CR_stuffs_desc'] = "Afficher un ou plusieurs concours";
+
+/* cluetip */
 $lang['CR_help_lang'] = (CR_ED_STATE == 'active') ? "<b>Vous pouvez utiliser du HTML et les descriptions multilingues.</b>" : "<b>Vous pouvez utiliser du HTML.</b>";
 $lang['CR_help_title'] = "" . $lang['CR_help_lang'];
Index: extensions/ContestResults/language/lv_LV/plugin.lang.php
===================================================================
--- extensions/ContestResults/language/lv_LV/plugin.lang.php	(revision 9744)
+++ extensions/ContestResults/language/lv_LV/plugin.lang.php	(revision 9745)
@@ -1,5 +1,19 @@
 <?php
 
+/* général */
 $lang['Contests'] = 'Konkursi';
+$lang['CR_finished'] = 'Pabeigts';
+$lang['CR_results'] = 'Rezultāti';
+$lang['CR_place'] = 'vietu';
+$lang['CR_nopublic'] = 'Šī lapa nav publiski pieejama !';
+$lang['CR_notavailable'] = 'Šis konkurss nav pieejams';
+$lang['CR_%d_days_to_begin'] = "Begins in %d days";
+$lang['CR_%d_days_to_end'] = "%d days remaining";
+$lang['CR_order_1'] = '1.';
+$lang['CR_order_2'] = '2.';
+$lang['CR_order_3'] = '3.';
+$lang['CR_order_sup'] = '.';
+
+/* admin */
 $lang['CR_edit_tab'] = 'Rediģēt konkursu';
 $lang['CR_delete'] = 'Dzēst konkursu';
@@ -8,7 +22,4 @@
 $lang['CR_new_tab'] = 'Pievienot jaunu konkursu';
 $lang['CR_results_tab'] = 'Konkursa rezultāti';
-$lang['CR_pending_title'] = 'Vēl nepabeigtie konkursi';
-$lang['CR_finished_title'] = 'Pabeigtie konkursi';
-$lang['CR_results'] = 'Rezultāti';
 $lang['CR_go'] = 'Iet uz konkursa lapu';
 $lang['CR_title'] = 'Nosaukums';
@@ -18,6 +29,4 @@
 $lang['CR_logo'] = 'Logo';
 $lang['CR_banner'] = 'Baneris';
-$lang['CR_pending'] = 'Vēl nepabeigts';
-$lang['CR_finished'] = 'Pabeigts';
 $lang['CR_summary'] = 'Kopā';
 $lang['CR_textareas'] = 'Konkursa apraksts';
@@ -30,10 +39,7 @@
 $lang['CR_comment'] = 'Komentārs';
 $lang['CR_rank'] = 'Novērtējums';
-$lang['CR_place'] = 'vietu';
-$lang['CR_period'] = 'Periods';
 $lang['CR_visible'] = 'Redzams';
-$lang['CR_nopublic'] = 'Šī lapa nav publiski pieejama !';
-$lang['CR_notavailable'] = 'Šis konkurss nav pieejams';
 $lang['CR_id_unknown %d'] = "Attēls n°%d neeksistē";
+$lang['CR_duplicate_result %d'] = "The picture n°%d appears twice";
 $lang['CR_contest_saved'] = "Konkursa iestatījumi saglabāti";
 $lang['CR_contest_added'] = "Konkurss pievienots";
@@ -41,11 +47,9 @@
 $lang['CR_results_saved'] = "Rezultāti saglabāti";
 $lang['CR_name_empty'] = "Konkursa nosaukums nevar būt tukšs";
-$lang['CR_days'] = "atlikušo dienu";
+$lang['CR_pending_title'] = 'Vēl nepabeigtie konkursi';
+$lang['CR_running_title'] = 'Contests running';
+$lang['CR_finished_title'] = 'Pabeigtie konkursi';
 
-$lang['CR_order_1'] = '1.';
-$lang['CR_order_2'] = '2.';
-$lang['CR_order_3'] = '3.';
-$lang['CR_order_sup'] = '.';
-
+/* config */
 $lang['CR_menubar_mode'] = 'Pievienot Konkursa Rezultātus izvēlnei';
 $lang['CR_menubar_link'] = 'Pievienot saiti uz esošu izvēlnes bloku';
@@ -53,5 +57,11 @@
 $lang['CR_menubar_block'] = 'Jauns izvēlnes bloks';
 $lang['CR_menubar_block_number'] = 'Blokā attēlojamo konkursu skaits';
+$lang['CR_truncate_summary'] = "Truncate the summary of the contest after x characters";
 
+/* stuffs */
+$lang['CR_select_contest'] = "Select one or more contests";
+$lang['CR_stuffs_desc'] = "Display one or more contests";
+
+/* cluetip */
 $lang['CR_help_lang'] = (CR_ED_STATE == 'active') ? "<b>Iespējasm lietot HTML un multivalodu aprakstus.</b>" : "<b>Varat lietot HTML.</b>";
 $lang['CR_help_title'] = "" . $lang['CR_help_lang'];
Index: extensions/ContestResults/main.inc.php
===================================================================
--- extensions/ContestResults/main.inc.php	(revision 9744)
+++ extensions/ContestResults/main.inc.php	(revision 9745)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: ContestResults
-Version: 1.3
+Version: 1.3.b
 Description: Add contests management pages
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=439
@@ -11,5 +11,5 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-global $prefixeTable, $conf;
+global $prefixeTable, $conf, $pwg_loaded_plugins;
 
 // +-----------------------------------------------------------------------+
@@ -17,14 +17,12 @@
 // +-----------------------------------------------------------------------+
 define('CR_NAME' , 'Contest Results');
-define('CR_VERSION', '1.3');
+define('CR_VERSION', '1.3.b');
 define('CR_DIR' , basename(dirname(__FILE__)));
 define('CR_PATH' , PHPWG_PLUGINS_PATH . CR_DIR . '/');
 define('CR_TABLE_1' , $prefixeTable . 'contests');
 define('CR_TABLE_2' , $prefixeTable . 'contests_results');
-define('CR_ADMIN', PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . CR_DIR . '/admin/admin.php');
+define('CR_ADMIN', get_root_url().'admin.php?page=plugin-' . CR_DIR);
 define('CR_PUBLIC', make_index_url(array('section' => 'contests')) . '/');
-
-$ED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
-define('CR_ED_STATE', $ED['state']);
+define('CR_ED_STATE', isset($pwg_loaded_plugins['ExtendedDescription']) ? 'active' : 'unactive');
 
 
@@ -32,8 +30,10 @@
 //					Triggers
 // +-----------------------------------------------------------------------+
-add_event_handler('get_admin_plugin_menu_links', 'CR_admin_menu'); 	// Lien d'administration
-add_event_handler('loc_end_section_init', 'CR_section_init'); 		// Paramètre URL
-add_event_handler('loc_end_index', 'CR_index'); 					// Contenu du la page
-add_event_handler('loc_end_picture', 'CR_comment_picture', 10); 	// Commentaire sur la page image
+add_event_handler('loading_lang', 'CR_load_lang'); 						// Chargement des fichiers de langue
+add_event_handler('get_admin_plugin_menu_links', 'CR_admin_menu'); 		// Lien d'administration
+add_event_handler('loc_end_section_init', 'CR_section_init'); 			// Paramètre URL
+add_event_handler('loc_end_index', 'CR_index'); 						// Contenu du la page
+add_event_handler('loc_end_picture', 'CR_comment_picture', 10); 		// Commentaire sur la page image
+add_event_handler('get_stuffs_modules', 'CR_register_stuffs_module');	// Ajoute un module pour PWG Stuffs
 if(CR_ED_STATE == 'active') add_event_handler('render_CR_content', 'get_user_language_desc'); 	// Textes multilangues
 
@@ -43,6 +43,13 @@
 // +-----------------------------------------------------------------------+
 include(CR_PATH . 'include/functions.php');
+$conf['ContestResults'] = unserialize($conf['ContestResults']);
+
 // Gestion du menu
 include(CR_PATH . 'include/cr_menubar.php');
+
+// Chargement des fichiers de langue et de la config
+function CR_load_lang() {
+	load_language('plugin.lang', CR_PATH);
+}
 
 // Lien d'administration
@@ -59,6 +66,4 @@
     global $tokens, $page, $conf;
 	
-	load_language('plugin.lang', CR_PATH);
-	
     if ($tokens[0] == 'contests') { // on est dans la section concours
 		$page['section'] = 'contests';
@@ -67,7 +72,13 @@
 		if (isset($tokens[1]) AND !empty($tokens[1])) { // on est sur la page d'un concours
 			$tokens[1] = explode('-', $tokens[1]);
+			
 			if (preg_match('#^([0-9]*)$#', $tokens[1][0])) { // is_int ne marche pas parce que le chiffre est stocké en (string)
 				$page['contest'] = $tokens[1][0];
-				$page['title'] .= $conf['level_separator'] . trigger_event('render_CR_content', get_contest_name($page['contest']));
+				
+				if ($contest_name = get_contest_name($page['contest'])) { // vérifie si le concours existe
+					$page['title'] .= $conf['level_separator'] . trigger_event('render_CR_content', $contest_name);
+				} else {
+					page_not_found(l10n('CR_notavailable'));
+				}
 			}
 		}
@@ -88,4 +99,15 @@
 }
 
+// Ajoute un module pour PWG Stuffs
+function CR_register_stuffs_module($modules) {
+	array_push($modules, array(
+		'path' => CR_PATH . '/stuffs_module',
+		'name' => CR_NAME,
+		'description' => l10n('CR_stuffs_desc'),
+	));
+
+	return $modules;
+}
+
 // Ajoute le commentaire sur la page image
 function CR_comment_picture() {
Index: extensions/ContestResults/maintain.inc.php
===================================================================
--- extensions/ContestResults/maintain.inc.php	(revision 9744)
+++ extensions/ContestResults/maintain.inc.php	(revision 9745)
@@ -14,8 +14,9 @@
 	'menubar_block' => array(
 		'number' => 5
-	)
+	),
+	'truncate_summary' => 350,
 )));
 
-// Installtion
+// Installation
 function plugin_install() {
 	global $prefixeTable;
@@ -29,7 +30,8 @@
 		`logo` VARCHAR( 255 ) NULL ,
 		`banner` VARCHAR( 255 ) NULL ,
+		`summary` TEXT NULL ,
 		`description` TEXT NULL ,
 		PRIMARY KEY ( `id` )
-	);");
+	) DEFAULT CHARSET=utf8;");
 	
 	pwg_query("CREATE TABLE `" . $prefixeTable . "contests_results` (
@@ -40,5 +42,5 @@
 		`comment` TEXT NULL,
 		UNIQUE ( `image_id` , `contest_id` )
-	);");
+	) DEFAULT CHARSET=utf8;");
 	
 	pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');");
@@ -49,69 +51,5 @@
 	global $conf, $prefixeTable;
 
-	// compatibilité avec les versions < 1.1 (ajout d'une entrée de configuration)
-	if (!isset($conf['ContestResults'])) {
-		pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('ContestResults', '" . default_config . "', 'Parametres du plugin ContestResults');");
-	}
-	
-	// compatibilité avec les versions < 1.2 (suppression option d'affichage)
-	$field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'presentation_display'");
-	if (pwg_db_num_rows($field)) {
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 
-			DROP `presentation_display`,
-			DROP `rules_display`,
-			DROP `prices_display`,
-			DROP `final_display`;"
-		);
-	}
-	
-	// compatibilité avec les versions < 1.3 (suppression option status, regroupement des champs de description)
-	$field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'status'");
-	if (pwg_db_num_rows($field)) {
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `status`");
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` ADD `description` TEXT NULL");
-		
-		$contests = pwg_query("SELECT * FROM `" . $prefixeTable . "contests`");
-		while ($contest = pwg_db_fetch_assoc($contests)) {
-			$new_description = array();
-			if (!empty($contest['presentation'])) {
-				$new_description[] = array(
-					'name' => 'Presentation[lang=fr]Présentation[/lang][lang=es]Presentación[/lang][lang=lv]Prezentacija[/lang]',
-					'content' => $contest['presentation'],
-				);
-			}
-			if (!empty($contest['rules'])) {
-				$new_description[] = array(
-					'name' => 'Rules[lang=fr]Règles[/lang][lang=es]Restricciones[/lang][lang=lv]Noteikumi[/lang]',
-					'content' => $contest['rules'],
-				);
-			}
-			if (!empty($contest['prices'])) {
-				$new_description[] = array(
-					'name' => 'Prices[lang=fr]Prix[/lang][lang=es]Precios[/lang][lang=lv]Cenas[/lang]',
-					'content' => $contest['prices'],
-				);
-			}
-			if (!empty($contest['final'])) {
-				$new_description[] = array(
-					'name' => 'Conclusion[lang=fr]Conclusion[/lang][lang=es]Conclusión[/lang][lang=lv]Beigsana[/lang]',
-					'content' => $contest['final'],
-				);
-			}
-		
-			$new_description = base64_encode(serialize($new_description));
-			pwg_query("UPDATE `" . $prefixeTable . "contests`
-				SET description = '". $new_description ."'
-				WHERE id = ". $contest['id'] .";"
-			);
-		}
-		
-		pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 
-			DROP `presentation`,
-			DROP `rules`,
-			DROP `prices`,
-			DROP `final`;"
-		);
-	}
-	
+	include('include/compatibility.inc.php');
 }
 
Index: extensions/ContestResults/stuffs_module/config.inc.php
===================================================================
--- extensions/ContestResults/stuffs_module/config.inc.php	(revision 9745)
+++ extensions/ContestResults/stuffs_module/config.inc.php	(revision 9745)
@@ -0,0 +1,54 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Configuration par défaut
+if (!isset($datas)) {
+	$datas = array(
+		'contest_id' => array(0),
+		'nb_per_line' => 2,
+	);
+}
+
+// Enregistrement de la configuration
+if (isset($_POST['submit'])) {
+	$datas = array(
+		'contest_id' => implode(',', $_POST['contest_id']),
+		'nb_per_line' => $_POST['nb_per_line'],
+	);
+}
+
+// Récupère la liste des concours
+$contests = pwg_query("SELECT 
+		id,
+		name
+	FROM " . CR_TABLE_1 . "
+	ORDER BY id ASC;"
+);
+
+// Concours selectionnés
+$template->assign('COUNT',pwg_db_num_rows($contests));
+$selected_ids = explode(',', $datas['contest_id']);
+	
+// Liste des concours
+while ($contest = pwg_db_fetch_assoc($contests)) {
+	$template->append('contests', array(
+		'ID' => $contest['id'],
+		'NAME' => trigger_event('render_CR_content', $contest['name']),
+		'SELECTED' => in_array($contest['id'], $selected_ids) ? true : false,
+	));
+} 
+
+// Nombre de cadres
+$template->assign('NB_PER_LINE', array(
+	'OPTIONS' => array(1 => 1, 2 => 2, 3 => 3),
+	'SELECTED' => $datas['nb_per_line'],
+));
+
+
+// +-----------------------------------------------------------------------+
+//				Template
+// +-----------------------------------------------------------------------+
+$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
+$template->assign_var_from_handle('MODULE_OPTIONS', 'module_options');
+
+?>
Index: extensions/ContestResults/stuffs_module/config.tpl
===================================================================
--- extensions/ContestResults/stuffs_module/config.tpl	(revision 9745)
+++ extensions/ContestResults/stuffs_module/config.tpl	(revision 9745)
@@ -0,0 +1,14 @@
+<ul>
+	<li>
+		<span class="property">{'CR_select_contest'|@translate}</span>
+		<select name="contest_id[]" multiple="multiple" size="{$COUNT}">
+		{foreach from=$contests item=contest}
+			<option value="{$contest.ID}" {if $contest.SELECTED}selected="selected"{/if}>{$contest.ID} - {$contest.NAME}</option>
+		{/foreach}
+		</select>
+	</li>
+	<li>
+		<span class="property">{'lastcoms_nb_cadres'|@translate}</span>
+		{html_options name=nb_per_line options=$NB_PER_LINE.OPTIONS selected=$NB_PER_LINE.SELECTED}
+	</li>
+</ul>
Index: extensions/ContestResults/stuffs_module/cr_stuffs.tpl
===================================================================
--- extensions/ContestResults/stuffs_module/cr_stuffs.tpl	(revision 9745)
+++ extensions/ContestResults/stuffs_module/cr_stuffs.tpl	(revision 9745)
@@ -0,0 +1,35 @@
+{combine_css path=$block.CR_PATH|@cat:'template/style.css'}
+
+<ul class="thumbnailCategories">
+	{foreach from=$block.contests item=contest}
+	<li class="{$block.SIZE_CLASS} {if !$contest.VISIBLE}novisible{/if}">
+		<div class="thumbnailCategory">
+			<div class="illustration">
+				<a href="{$contest.URL}">
+				{if $contest.STATUS != 'finished' AND !empty($contest.LOGO)}
+					<img src="{$contest.LOGO}" alt="{$contest.NAME}" style="max-height:120px;max-width:120px;">
+				{elseif !empty($contest.RESULTS.1.TN_SRC)}
+					<img src="{$contest.RESULTS.1.TN_SRC}" alt="{$contest.NAME|@replace:'"':' '}">
+				{/if}
+				</a>
+			</div>
+			<div class="description">
+				<h3><a href="{$contest.URL}">{$contest.NAME}</a></h3>
+				<div class="text">
+					<p class="Nb_images">{$contest.DATE_BEGIN} - {$contest.DATE_END}</p>
+					<span class="CR_finished">({$contest.DAYS})</span>
+					<p>
+					{if $contest.STATUS != 'finished' AND !empty($contest.SUMMARY)}
+						{$contest.SUMMARY}
+					{else}
+						{foreach from=$contest.RESULTS item=result}
+							{'CR_order_'|cat:$result.RANK|@translate} {'CR_place'|@translate} - <u>{$result.AUTHOR}</u><br>
+						{/foreach}
+					{/if}
+					</p>
+				</div>
+			</div>
+		</div>
+	</li>
+	{/foreach}
+</ul>
Index: extensions/ContestResults/stuffs_module/index.php
===================================================================
--- extensions/ContestResults/stuffs_module/index.php	(revision 9745)
+++ extensions/ContestResults/stuffs_module/index.php	(revision 9745)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/ContestResults/stuffs_module/main.inc.php
===================================================================
--- extensions/ContestResults/stuffs_module/main.inc.php	(revision 9745)
+++ extensions/ContestResults/stuffs_module/main.inc.php	(revision 9745)
@@ -0,0 +1,80 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $user, $conf;
+
+$contests = pwg_query("SELECT 
+		id, 
+		name, 
+		visible, 
+		date_begin, 
+		date_end, 
+		logo, 
+		summary 
+	FROM " . CR_TABLE_1 . " 
+	WHERE id IN(" . $datas['contest_id'] . ");");
+	
+	
+while ($contest = pwg_db_fetch_assoc($contests)) {
+	$contest = array_merge($contest, get_contest_status($contest['date_begin'],$contest['date_end']));
+
+	if ($contest['visible'] OR is_admin()) {
+		// infos sur le concours
+		$block['contests'][$contest['id']] =  array(
+			'ID' => $contest['id'],
+			'NAME' => trigger_event('render_CR_content', $contest['name']),
+			'VISIBLE' => $contest['visible'],
+			'STATUS' => $contest['status'],
+			'DATE_END' => format_date($contest['date_end']),
+			'DATE_BEGIN' => format_date($contest['date_begin']),
+			'LOGO' => $contest['logo'],
+			'SUMMARY' => CR_cut_string(trigger_event('render_CR_content', $contest['summary']), $conf['ContestResults']['truncate_summary']),
+			'URL' => CR_PUBLIC . $contest['id'] . '-' . str2url(trigger_event('render_CR_content', $contest['name'])),
+			'DAYS' => $contest['days'],
+		);
+		
+		// podium si terminé
+		if ($contest['status'] == 'finished') {
+			$results = pwg_query("SELECT
+					i.id,
+					i.name,
+					i.file,
+					i.path,
+					i.tn_ext,
+					c.rank,
+					c.author
+				FROM " . IMAGES_TABLE . " AS i
+				INNER JOIN " . CR_TABLE_2 . " AS c
+				ON c.image_id = i.id
+				WHERE c.contest_id = " . $contest['id'] . "
+				ORDER BY c.rank ASC
+				LIMIT 3 OFFSET 0;");
+			
+			while ($result = pwg_db_fetch_assoc($results)) {
+				$block['contests'][$contest['id']]['RESULTS'][$result['rank']] = array(
+					'RANK' => $result['rank'],
+					'AUTHOR' => $result['author'],
+					'TN_SRC' => get_thumbnail_url($result)
+				);
+			}
+		}
+		
+	}
+}
+
+switch ($datas['nb_per_line']) {
+	case '1' :
+		$block['SIZE_CLASS'] = 'one_comment';
+		break;
+	case '2' :
+		$block['SIZE_CLASS'] = 'two_comment';
+		break;
+	case '3' :
+		$block['SIZE_CLASS'] = 'three_comment';
+		break;
+}
+
+$block['CR_PATH'] = CR_PATH;
+$block['TEMPLATE'] = dirname(__FILE__).'/cr_stuffs.tpl';
+
+?>
Index: extensions/ContestResults/template/cr_main.tpl
===================================================================
--- extensions/ContestResults/template/cr_main.tpl	(revision 9744)
+++ extensions/ContestResults/template/cr_main.tpl	(revision 9745)
@@ -1,3 +1,3 @@
-{combine_css id='cr_style' path=$CR_PATH|@cat:'template/style.css'}
+{combine_css path=$CR_PATH|@cat:'template/style.css'}
 
 {$MENUBAR}
@@ -26,36 +26,24 @@
 {else}
 	<ul class="thumbnailCategories">
-	{foreach from=$contests item=contest}
-		<li>
-			<div class="thumbnailCategory {if $contest.VISIBLE == 0}novisible{/if}">
+		{foreach from=$contests item=contest}
+		<li {if !$contest.VISIBLE}class="novisible"{/if}>
+			<div class="thumbnailCategory">
 				<div class="illustration">
-				{if !$contest.FINISHED == 'pending'}
 					<a href="{$contest.URL}">
-					{if !empty($contest.LOGO)}
+					{if $contest.STATUS != 'finished' AND !empty($contest.LOGO)}
 						<img src="{$contest.LOGO}" alt="{$contest.NAME}" style="max-height:120px;max-width:120px;">
+					{elseif !empty($contest.RESULTS.1.TN_SRC)}
+						<img src="{$contest.RESULTS.1.TN_SRC}" alt="{$contest.NAME|@replace:'"':' '}">
 					{/if}
 					</a>
-				{else}
-					<a href="{$contest.URL}">
-						<img src="{$contest.RESULTS.1.TN_SRC}" alt="{$contest.NAME|@replace:'"':' '}">
-					</a>
-				{/if}
 				</div>
 				<div class="description">
-					<h3>
-						<a href="{$contest.URL}">{$contest.NAME}</a>
-						{if $contest.FINISHED}
-							<span class="CR_finished">({'CR_finished'|@translate})</span>
-						{else}
-							<span class="CR_finished">({$contest.DAYS} {'CR_days'|@translate})</span>
-						{/if}
-					</h3>
+					<h3><a href="{$contest.URL}">{$contest.NAME}</a></h3>
 					<div class="text">
 						<p class="Nb_images">{$contest.DATE_BEGIN} - {$contest.DATE_END}</p>
+						<span class="CR_finished">({$contest.DAYS})</span>
 						<p>
-						{if !$contest.FINISHED}
-							{if !empty($contest.SUMMARY)}
-								{$contest.SUMMARY}
-							{/if}
+						{if $contest.STATUS != 'finished' AND !empty($contest.SUMMARY)}
+							{$contest.SUMMARY}
 						{else}
 							{foreach from=$contest.RESULTS item=result}
@@ -68,5 +56,5 @@
 			</div>
 		</li>
-	{/foreach}
+		{/foreach}
 	</ul>
 {/if}
Index: extensions/ContestResults/template/cr_menubar.tpl
===================================================================
--- extensions/ContestResults/template/cr_menubar.tpl	(revision 9744)
+++ extensions/ContestResults/template/cr_menubar.tpl	(revision 9745)
@@ -1,10 +1,12 @@
 {html_head}
-	<style type="text/css">
-		.CR_finished_menu {ldelim}
-			font-size:0.8em;
-			color:#a00;
-			letter-spacing:0px;
-		}
-	</style>
+{literal}
+<style type="text/css">
+	.CR_finished_menu {
+		font-size:0.8em;
+		color:#a00;
+		letter-spacing:0px;
+	}
+</style>
+{/literal}
 {/html_head}
 
@@ -13,14 +15,10 @@
 	<ul>
 		{foreach from=$block->data item=data}
-			<li>
-				<a href="{$data.URL}" title="{$data.DATE}">
-					{$data.LABEL}
-					{if $data.FINISHED}
-						<span class="CR_finished_menu">&times;</span>
-					{else}
-						<span class="CR_finished_menu">{$data.DAYS}</span>
-					{/if}
-				</a>
-			</li>
+		<li>
+			<a href="{$data.URL}" title="{$data.DATE}">
+				{$data.LABEL}
+				<span class="CR_finished_menu">{$data.DAYS}</span>
+			</a>
+		</li>
 		{/foreach}
 	</ul>
Index: extensions/ContestResults/template/cr_page.tpl
===================================================================
--- extensions/ContestResults/template/cr_page.tpl	(revision 9744)
+++ extensions/ContestResults/template/cr_page.tpl	(revision 9745)
@@ -1,7 +1,8 @@
-{combine_css id='cr_style' path=$CR_PATH|@cat:'template/style.css'}
+{combine_css path=$CR_PATH|@cat:'template/style.css'}
 
 {$MENUBAR}
 
 {if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if}
+
 <div class="content">
 	<div class="titrePage">
@@ -16,16 +17,12 @@
 		<h2>
 			<a href="index.php?/contests" name="top">{'Contests'|@translate}</a>{$SEPARATOR}<a href="{$URL}">{$NAME}</a>
-			{if $FINISHED}
-				<span class="CR_finished">({'CR_finished'|@translate})</span>
-			{else}
-				<span class="CR_finished">({$DAYS} {'CR_days'|@translate})</span>
-			{/if}
+			<span class="CR_finished">({$DAYS})</span>
 		</h2>
 	</div> <!-- titrePage -->
 
 	{if !$VISIBLE}
-		<div class="nopublic">
-			{'CR_nopublic'|@translate}
-		</div>
+	<div class="nopublic">
+		{'CR_nopublic'|@translate}
+	</div>
 	{/if}
 	
@@ -43,74 +40,74 @@
 	
 	{foreach from=$description item=desc name=desc_loop}
-		<div class="CR_text">
-			<h3>{$desc.NAME} :</h3>
-			{$desc.CONTENT}
-		</div>
+	<div class="CR_text">
+		<h3>{$desc.NAME} :</h3>
+		{$desc.CONTENT}
+	</div>
 	{/foreach}
 </div> <!-- content_contest -->
 
 {if !empty($RESULTS)}
-	<div class="content">
-		<div class="titrePage">
-			<ul class="categoryActions">  
-				{if isset($U_RESULTS) }
-				<li><a href="{$U_RESULTS}" title="{'CR_results'|@translate}" class="pwg-state-default pwg-button">
-					<span class="pwg-icon pwg-icon-category-edit"> </span><span class="pwg-button-text">{'CR_edit_tab'|@translate}</span>
-				</a></li>
-				{/if}
-			</ul>
-			<h2><a href="{$URL}">{$NAME}</a>{$SEPARATOR}<a href="#results" name="results">{'CR_results'|@translate}</a></h2>
+<div class="content">
+	<div class="titrePage">
+		<ul class="categoryActions">  
+			{if isset($U_RESULTS) }
+			<li><a href="{$U_RESULTS}" title="{'CR_results'|@translate}" class="pwg-state-default pwg-button">
+				<span class="pwg-icon pwg-icon-category-edit"> </span><span class="pwg-button-text">{'CR_edit_tab'|@translate}</span>
+			</a></li>
+			{/if}
+		</ul>
+		<h2><a href="#top">{$NAME}</a>{$SEPARATOR}<a href="#results" name="results">{'CR_results'|@translate}</a></h2>
+	</div>
+	
+	<div id="CR_podium">
+	{foreach from=$RESULTS item=result}
+		{if $result.RANK <= 3}
+		{if $result.RANK == 2}<div class="podium_23">{/if}
+		<div class="podium_{$result.RANK}">
+			<div class="illustration">
+				<div class="title">{'CR_order_'|cat:$result.RANK|@translate} {'CR_place'|@translate} - <u>{$result.AUTHOR}</u></div>
+				<a href="{$result.IMAGE_URL}" title="{$result.IMAGE_NAME}">
+					<img src="{$result.IMAGE_SRC}" alt="{$result.IMAGE_NAME}"/>
+				</a>
+			</div>
+			<p>
+				{$result.COMMENT}
+			</p>
 		</div>
-		
-		<div id="CR_podium">
-			{foreach from=$RESULTS item=result}
-				{if $result.RANK <= 3}
-					{if $result.RANK == 2}<div class="podium_23">{/if}
-					<div class="podium_{$result.RANK}">
-						<div class="illustration">
-							<div class="title">{'CR_order_'|cat:$result.RANK|@translate} {'CR_place'|@translate} - <u>{$result.AUTHOR}</u></div>
-							<a href="{$result.IMAGE_URL}" title="{$result.IMAGE_NAME}">
-								<img src="{$result.IMAGE_SRC}" alt="{$result.IMAGE_NAME}"/>
-							</a>
-						</div>
-						<p>
-							{$result.COMMENT}
-						</p>
-					</div>
-					{if $result.RANK == 3}</div>{/if}
-				{/if}
-			{/foreach}
-		</div>
-		
-		<ul class="thumbnails">
-			{foreach from=$RESULTS item=result}
-				{if $result.RANK > 3}
-					<li>
-						<span class="wrap1">
-							<span class="wrap2">
-								<a href="{$result.IMAGE_URL}" title="{$result.IMAGE_NAME}">
-									<img class="thumbnail" src="{$result.TN_SRC}" alt="{$result.IMAGE_NAME}"/>
-								</a>
-							</span>							
-							<span class="thumbLegend">
-								<span class="thumbnail-name">
-									{$result.AUTHOR}
-								</span>
-								<span class="nb-hits">
-									<br>{$result.RANK}{'CR_order_sup'|@translate} {'CR_place'|@translate}
-								</span>
-							</span>
-						</span>
-					</li>
-				{/if}
-			{/foreach}
-		</ul>
-		
-		{if !empty($LOGO)}
-			<div class="CR_banner">
-				<h1><a href="#top"><img src="{$LOGO}" alt="{$NAME}"/></a></h1>
-			</div>
+		{if $result.RANK == 3 OR ($result.RANK == 2 AND $NB_RESULTS == 2)}</div>{/if} <!-- au cas ou il n'y a que deux résultats -->
 		{/if}
-	</div> <!-- content_results -->
+	{/foreach}
+	</div>
+	
+	<ul class="thumbnails">
+	{foreach from=$RESULTS item=result}
+		{if $result.RANK > 3}
+		<li>
+			<span class="wrap1">
+				<span class="wrap2">
+					<a href="{$result.IMAGE_URL}" title="{$result.IMAGE_NAME}">
+						<img class="thumbnail" src="{$result.TN_SRC}" alt="{$result.IMAGE_NAME}"/>
+					</a>
+				</span>							
+				<span class="thumbLegend">
+					<span class="thumbnail-name">
+						{$result.AUTHOR}
+					</span>
+					<span class="nb-hits">
+						<br>{$result.RANK}{'CR_order_sup'|@translate} {'CR_place'|@translate}
+					</span>
+				</span>
+			</span>
+		</li>
+		{/if}
+	{/foreach}
+	</ul>
+	
+	{if !empty($LOGO)}
+	<div class="CR_banner">
+		<h1><a href="#top"><img src="{$LOGO}" alt="{$NAME}"/></a></h1>
+	</div>
+	{/if}
+</div> <!-- content_results -->
 {/if}
 
Index: extensions/ContestResults/template/style.css
===================================================================
--- extensions/ContestResults/template/style.css	(revision 9744)
+++ extensions/ContestResults/template/style.css	(revision 9745)
@@ -3,13 +3,13 @@
 	font-size:0.8em;
 	letter-spacing:0.2em;
-	padding-left:10px;
+	
 	color:#a00;
 }
 
-div.thumbnailCategory.novisible {
+.novisible {
 	opacity:0.4;
 }
 
-div.nopublic {
+.nopublic {
 	background:#aaa;
 	border:1px dotted #555;
@@ -39,5 +39,4 @@
 		font-size:1.3em;
 		border-bottom:1px dotted #999;
-		color:#ddd;
 	}
 	
@@ -48,5 +47,4 @@
 	font-style:italic;
 	font-family:"Consolas";
-	color:#ddd;
 	border-top:1px dotted #999;
 }
