Index: /extensions/ConcoursPhoto/CHANGELOG
===================================================================
--- /extensions/ConcoursPhoto/CHANGELOG	(revision 8945)
+++ /extensions/ConcoursPhoto/CHANGELOG	(revision 8946)
@@ -1,4 +1,25 @@
 TODO for next versions : 
-- 
+- Finaliser la page "Audit" dans la partie adminsitration
+- Ajouter support ExtendedDescription (si nécessaire pour description du concours)
+- Ajouter aide (help) pour le paramétrage et l'utilisation du plugin
+- Fixer le pb pour masquer les données EXIFS/IPTC pour les photos d'un concours
+- Ajouter possibilité de voter pour les guests (pb identification dans bdd!)
+- Ajouter possibilité de sélectionner 1 ou plusieurs photos d'une catégorie pour participer à un concours.
+- Ajouter une page de consultation du concours en cours
+- Probleme lors que la date/heure de fin ou début est positionnée à 0h00 ou 24h00 --> erreur de date enregistrée dans la bdd. Mettre en place un contrôle de date_fin>date_debut
+- Possibilité d'ajouter en direct (après vote) le résultat (+ paramétre pour afficher/masque en fonction du paramétre : modification notes attribuées à la photo)
+- Ajouter la possibilité de consultation des résultats pour les "guests"
+
+- Modifier onglet 1 pour la consultation des concours. Ajouter 3 sous onglets
+- Problème d'affichage du menu concours dans le cas de non sélection de groupes...
+
+- OK Ajout update_method pour l'ajout de données dans table Concours (param guest).
+
+______________
+
+Version 2.0.x
+-------------
+2.0.0   - Add to guest the possibility to vote for a concours (BETA)
+        - Some correction (code and database structure)
 
 ______________
@@ -6,4 +27,9 @@
 Version 1.0.x
 -------------
+1.2.0   - Add exaequo checking for the result (beta)
+        - Add EN language
+        - Correct "concours not displayed" when no group is selected in admin page. Now, concours is available for all registered user (not depending on the group appartenance)
+        - Add option to allow author to vote for their photos (disable check based on username=authorname)
+        - Add option to allow user to change the score after a validation
 1.1.0	- Add datas "moyenne" and "nbvotant" in database concours_result. Export theses datas in csv.
 		- add method of rank calculation in a concours (in database).
Index: /extensions/ConcoursPhoto/admin/add_concours.php
===================================================================
--- /extensions/ConcoursPhoto/admin/add_concours.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/add_concours.php	(revision 8946)
@@ -115,4 +115,5 @@
 
 	$concours->concours_infos['groups'] = (!empty($_POST['groups']) ? '"' . implode(',', $_POST['groups']) . '"' : 'NULL');
+	$concours->concours_infos['guest'] = isset($_POST['guest']);
 	$concours->concours_infos['category'] = $_POST['cat_selection'];
 	
@@ -227,4 +228,5 @@
 		$concours->concours_infos['groups'] = explode(',', $concours->concours_infos['groups']);
 
+        
         $tBeginDate = explodeDateArray($concours->concours_infos['begin_date']);
         $tEndDate = explodeDateArray($concours->concours_infos['end_date']);
@@ -234,4 +236,5 @@
 				'NAME'	=> $concours->concours_infos['name'],
 				'DESCR'	=> $concours->concours_infos['descr'],
+                'GUEST' => ($concours->concours_infos['guest'] ? 'checked="checked"' : ''),
 //				'BEGIN_DATE'	=> $concours->concours_infos['begin_date'],
 //				'END_DATE'	=> NbJours($concours->concours_infos['begin_date'], $concours->concours_infos['end_date'])
@@ -266,4 +269,5 @@
 				'NAME'	=> $concours->concours_infos['name'],
 				'DESCR'	=> $concours->concours_infos['descr'],
+                'GUEST' => ($concours->concours_infos['guest'] ? 'checked="checked"' : ''),
 //				'BEGIN_DATE'	=> $concours->concours_infos['begin_date'],
 //				'END_DATE'	=> NbJours($concours->concours_infos['begin_date'], $concours->concours_infos['end_date'])
@@ -373,4 +377,5 @@
 }
 
+
 // Category selection
 $query = '
Index: /extensions/ConcoursPhoto/admin/admin.php
===================================================================
--- /extensions/ConcoursPhoto/admin/admin.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/admin.php	(revision 8946)
@@ -35,11 +35,10 @@
                $my_base_url.'&amp;tab=params');
 
-/*$tabsheet->add('audit',
+$tabsheet->add('audit',
                l10n('concours_audit'),
                $my_base_url.'&amp;tab=audit');
-*/
+
 $tabsheet->select($page['tab']);
 $tabsheet->assign();
-
 
 
Index: /extensions/ConcoursPhoto/admin/audit.php
===================================================================
--- /extensions/ConcoursPhoto/admin/audit.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/audit.php	(revision 8946)
@@ -17,5 +17,5 @@
     $user_id = 0;
     
-//echo "USER_ID=".$user_id;
+echo "USER_ID=".$user_id;
    
 // Get the concours id if present
@@ -29,7 +29,8 @@
     $users = array();     // contain {id;username} or each 
     $groups = $concours->concours_infos['groups'];
-    $query = 'SELECT user_id, username FROM ' . USER_GROUP_TABLE 
+    $query = 'SELECT distinct(user_id), username FROM ' . USER_GROUP_TABLE 
     .' INNER JOIN ' . USERS_TABLE .' ON id = user_id'
-    .($groups != NULL ? ' WHERE group_id = '.$groups : '')
+    .($groups != NULL ? ' WHERE group_id IN ('.$groups.')' : '')
+//    = '.$groups : '')
     .' ORDER BY username ASC'
     .';';
@@ -55,4 +56,16 @@
     }
 
+    // Add the guest list (if coucours OK for guest)
+    $ipguest = $concours->get_guest_list();
+    if ($concours->concours_infos['guest'])
+    {
+        foreach ( $ipguest as $i => $userid ) //on parcours le tableau 
+        {
+            $template->append('user_list',
+                array(	'ID' => 'G'.$i,     //$userid['user_id'],
+                        'NAME' => $userid,
+                        'SELECTED' => ($user_id == 'G'.$i ? 'selected' : '')));
+        }
+    }
     
     // Send concours info to template
@@ -70,23 +83,15 @@
 // Step 3 : Display theses informations
 	
-	
-	// nb of users who vote for each image (for a selected concours
-	$query = 'SELECT img_id, COUNT(DISTINCT user_id) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 
-	.' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id )
-	.' GROUP BY img_id '
-	.';';
-			
-	$result = pwg_query($query);
-	$nbvotes = array();
-	while ($row = mysql_fetch_assoc($result))
-	{
-		$nbvotes[$row['img_id']] = $row['NBVOTE'];
-	}
+    // Get the nb of vote for the concours
+    $nbvotes = $concours->nb_votes_by_img();
+
 
 	// Get all the users who have notes for the concours
-	$query = 'SELECT distinct(user_id), USER.username'
+	$query = 'SELECT distinct user_id, USER.username'
 	.' FROM ' .CONCOURS_DATA_TABLE
 	.' INNER JOIN ' . USERS_TABLE.' AS USER on USER.id = user_id'
 	.' WHERE id_concours = '.$concours_id
+        // Dont take the guest informations because 
+    .' AND user_id <> '.$conf['guest_id']
 	.' ORDER BY username ASC'
 	.';';
@@ -95,6 +100,7 @@
 	$user_list = array();
 	while ($row2 = mysql_fetch_assoc($result))
-		array_push($user_list, $row2);	
-
+        // Dont take the guest informations because 
+//        if ($row2['user_id'] != $conf['guest_id'])
+            array_push($user_list, $row2);	
 
 
@@ -185,14 +191,34 @@
 		$user_note = array();
 		$globalnote = 0;
-		if ($user_id != 0)	// for user 
+            echo "USER=".$user_id."\n";
+		if (!is_numeric($user_id) OR $user_id != 0)	// for user 
+		{   
+            echo "USERNON0=".$user_id."\n";
+            $pos = strpos($user_id, 'G');
+            if ($pos === false)
+            {
+                $globalnote = $concours->get_img_globalnote_user($row['id'], $concours_id, $user_id);
+                $user_note = $concours->get_img_note_user($row['id'], $concours_id, $user_id);
+            }
+            else
+            {
+                echo "G...".substr($user_id, $pos+1)." = ".substr($user_id, $pos+1)."\n";
+                echo "IPGUEST=".$ipguest[substr($user_id, $pos+1)]."\n";
+                $globalnote = $concours->get_img_globalnote_user($row['id'], $concours_id, $conf['guest_id'], $ipguest[substr($user_id, $pos+1)]);
+                $user_note = $concours->get_img_note_user($row['id'], $concours_id, $conf['guest_id'], $ipguest[substr($user_id, $pos+1)]);
+            }
+		}
+		elseif (is_numeric($user_id) AND $user_id == 0)	// for user 	// global
 		{
-			$globalnote = $concours->get_img_globalnote_user($row['id'], $concours_id, $user_id);
-			$user_note = $concours->get_img_note_user($row['id'], $concours_id, $user_id);
-		}
-		else	// global
-		{
-			foreach ($user_list as $userid)
-			$globalnote += $concours->get_img_globalnote_user($row['id'], null, $userid['user_id']);
-		}
+            echo "USER00=".$user_id."\n";
+        
+			foreach ($user_list as $i => $userid)
+               $globalnote += $concours->get_img_globalnote_user($row['id'], null, $userid['user_id']);
+            
+			foreach ($ipguest as $i => $ipguestt)
+            {
+                $globalnote += $concours->get_img_globalnote_user($row['id'], null, $conf['guest_id'], $ipguestt);
+            }
+        }
 
 		
@@ -233,8 +259,23 @@
     
 	$rang = 1;
+    $previousNote = $previousMoy = 0;
+
 	foreach ($concours_img  as $key => $value) 
 	{
+
+        // Check the exaequos
+        if ($concours->my_config['check_exaequo'])
+        {
+            if ( ($concours->concours_infos['method'] == 1	// total
+                   AND ($concours_img[$key]['note'] == $previousNote))
+                 OR  ($concours->concours_infos['method'] == 2	// moyenne
+                      AND ($concours_img[$key]['moyenne'] == $previousMoy)))
+            {
+                $rang --;
+                
+            }
+        }
+//        echo "RANG=".$rang."\n";
 	   $concours_img[$key]['rang'] = $rang;
-		$rang++;
 
 		$template->append( 'concours_note', array(
@@ -251,4 +292,8 @@
 
 			));
+        $rang++;
+
+        $previousNote = $concours_img[$key]['note'];
+        $previousMoy = $concours_img[$key]['moyenne'];
 	}
 
Index: /extensions/ConcoursPhoto/admin/config.php
===================================================================
--- /extensions/ConcoursPhoto/admin/config.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/config.php	(revision 8946)
Index: /extensions/ConcoursPhoto/admin/criteria.php
===================================================================
--- /extensions/ConcoursPhoto/admin/criteria.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/criteria.php	(revision 8946)
Index: /extensions/ConcoursPhoto/admin/functions.inc.php
===================================================================
--- /extensions/ConcoursPhoto/admin/functions.inc.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/functions.inc.php	(revision 8946)
Index: /extensions/ConcoursPhoto/admin/index.php
===================================================================
--- /extensions/ConcoursPhoto/admin/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/admin/manage.php
===================================================================
--- /extensions/ConcoursPhoto/admin/manage.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/manage.php	(revision 8946)
Index: /extensions/ConcoursPhoto/admin/params.php
===================================================================
--- /extensions/ConcoursPhoto/admin/params.php	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/params.php	(revision 8946)
@@ -15,5 +15,9 @@
   $concours->my_config['mask_author'] = isset($_POST['mask_author']);
   $concours->my_config['thumb_note'] = isset($_POST['thumb_note']);
-  $concours->my_config['mask_exif'] = isset($_POST['mask_exif']);
+
+  $concours->my_config['check_exaequo'] = isset($_POST['check_exaequo']);
+
+  $concours->my_config['author_vote_available'] = isset($_POST['author_vote_available']);
+  $concours->my_config['concours_change_score'] = isset($_POST['concours_change_score']);
 
   $concours->save_config();
@@ -31,6 +35,9 @@
     'MASK_AUTHOR' 			=> ($concours->my_config['mask_author'] ? 'checked="checked"' : ''),
     'THUMB_NOTE' 			=> ($concours->my_config['thumb_note'] ? 'checked="checked"' : ''),
-    'MASK_EXIF' 			=> ($concours->my_config['mask_exif'] ? 'checked="checked"' : ''),
-			));
+    'CHECK_EXAEQUO'         => ($concours->my_config['check_exaequo'] ? 'checked="checked"' : ''),
+    'AUTHOR_VOTE_AVAILABLE' => ($concours->my_config['author_vote_available'] ? 'checked="checked"' : ''),
+    'CHANGE_SCORE'          => ($concours->my_config['concours_change_score'] ? 'checked="checked"' : ''),
+
+        ));
 
 $result = array();
Index: /extensions/ConcoursPhoto/admin/template/add_concours.tpl
===================================================================
--- /extensions/ConcoursPhoto/admin/template/add_concours.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/template/add_concours.tpl	(revision 8946)
@@ -96,4 +96,11 @@
         </tr>
 		{/if}
+        <TR>
+            <TD colspan="4">
+                <input type="checkbox" name="guest" {$CONCOURS.GUEST}/> {'concours_allow_guest'|@translate} 
+                <br/>
+            </TD>
+        </TR>
+        
         <tr><td colspan="4"><br></td></tr>
 		<tr>
@@ -182,18 +189,18 @@
 <fieldset>
 	<legend>{'concours_criterias'|@translate}</legend>
-     <table class="table2 littlefont" id="criteria_list" border="1">
-        <tr class="throw">
-			<th><b>{'concours_id2'|@translate}</b></td>
-			<th><b>{'concours_name'|@translate}</b></td>
-			<th><b>{'concours_descr'|@translate}</b></td>
-			<th><b>{'concours_min_value'|@translate}</b></td>
-			<th><b>{'concours_max_value'|@translate}</b></td>
-			<th><b>{'concours_coef'|@translate}</b></td>
+	 <table border="1">
+		<tr>
+			<td><b>{'concours_id'|@translate}</b></td>
+			<td><b>{'concours_name'|@translate}</b></td>
+			<td width="50%"><b>{'concours_descr'|@translate}</b></td>
+			<td><b>{'concours_min_value'|@translate}</b></td>
+			<td><b>{'concours_max_value'|@translate}</b></td>
+			<td><b>{'concours_coef'|@translate}</b></td>
 			{if $action != 'edit'}
-			<th colspan="3"><b>{'concours_actions'|@translate}</b></td>
+			<td width="10%"><b>{'concours_actions'|@translate}</b></td>
 			{/if}
 		</tr>
 	 {foreach from=$concours_criteria item=concours_criteria}
-        <tr class="TableRow" style="cursor:pointer;">
+		<tr>
 			<td>{$concours_criteria.id}</td>		
 			<td>
@@ -214,17 +221,13 @@
 			{if $action != 'edit'}
 			<td>
-				{if $concours_criteria.level == 1}
-					<a href="{$concours_criteria.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" class="button" alt="{'subcriteria_add'|@translate}" /></a>
-				{/if}
-			</td>
-			<td>
 				{if isset($concours_criteria.U_EDIT)}
 					<a href="{$concours_criteria.U_EDIT}" title="{'criteria_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'criteria_edit'|@translate}"/></a>
 					&nbsp;
 				{/if}
-			</td>
-			<td>
 				{if isset($concours_criteria.U_DELETE)}
 					<a href="{$concours_criteria.U_DELETE}" title="{'criteria_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'criteria_delete'|@translate}" /></a>
+				{/if}
+				{if $concours_criteria.level == 1}
+					<a href="{$concours_criteria.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" class="button" alt="{'subcriteria_add'|@translate}" /></a>
 				{/if}
 			</td>
Index: /extensions/ConcoursPhoto/admin/template/audit.tpl
===================================================================
--- /extensions/ConcoursPhoto/admin/template/audit.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/template/audit.tpl	(revision 8946)
Index: /extensions/ConcoursPhoto/admin/template/config.tpl
===================================================================
--- /extensions/ConcoursPhoto/admin/template/config.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/template/config.tpl	(revision 8946)
@@ -9,16 +9,16 @@
 	<legend>{'default_criteria'|@translate}</legend>
 
-     <table class="table2 littlefont" id="criteria_default" border="1">
-        <tr class="throw">
-			<th><b>{'concours_id2'|@translate}</b></td>
-			<th><b>{'concours_name'|@translate}</b></td>
-			<th><b>{'concours_descr'|@translate}</b></td>
-			<th><b>{'concours_min_value'|@translate}</b></td>
-			<th><b>{'concours_max_value'|@translate}</b></td>
-			<th><b>{'concours_coef'|@translate}</b></td>
-			<th colspan="3"><b>{'concours_actions'|@translate}</b></td>
+	 <table border="1">
+		<tr>
+			<td><b>{'concours_id'|@translate}</b></td>
+			<td><b>{'concours_name'|@translate}</b></td>
+			<td width="50%"><b>{'concours_descr'|@translate}</b></td>
+			<td><b>{'concours_min_value'|@translate}</b></td>
+			<td><b>{'concours_max_value'|@translate}</b></td>
+			<td><b>{'concours_coef'|@translate}</b></td>
+			<td width="10%"><b>{'concours_actions'|@translate}</b></td>
 		</tr>
 	 {foreach from=$concours_criteria item=concours_criteria}
-        <tr class="TableRow" style="cursor:pointer;">
+		<tr>
 			<td>{$concours_criteria.id}</td>		
 			<td>
@@ -38,17 +38,13 @@
 			{/if}
 			<td>
-			{if $concours_criteria.level == 1}
-				<a href="{$concours_criteria.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" class="button" alt="{'subcriteria_add'|@translate}" /></a>
-			{/if}
-            </td>
-            <td>
 			{if isset($concours_criteria.U_EDIT)}
 				<a href="{$concours_criteria.U_EDIT}" title="{'criteria_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'criteria_edit'|@translate}"/></a>
 				&nbsp;
 			{/if}
-            </td>
-            <td>
 			{if isset($concours_criteria.U_DELETE)}
 				<a href="{$concours_criteria.U_DELETE}" title="{'criteria_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'criteria_delete'|@translate}" /></a>
+			{/if}
+			{if $concours_criteria.level == 1}
+				<a href="{$concours_criteria.U_ADD}" title="{'subcriteria_add'|@translate}" ><img src="{$IMG_URL}add.png" class="button" alt="{'subcriteria_add'|@translate}" /></a>
 			{/if}
 			</td>
Index: /extensions/ConcoursPhoto/admin/template/criteria.tpl
===================================================================
--- /extensions/ConcoursPhoto/admin/template/criteria.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/template/criteria.tpl	(revision 8946)
Index: /extensions/ConcoursPhoto/admin/template/manage.tpl
===================================================================
--- /extensions/ConcoursPhoto/admin/template/manage.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/template/manage.tpl	(revision 8946)
@@ -11,18 +11,16 @@
 	<fieldset>
 		<legend>{'prepared_concours'|@translate}</legend>
-        {if isset($prepared_concours)}
-		 <table class="table2 littlefont" id="pconcours_list" border="1">
-
-			<tr class="throw">
+		 <table border="1">
+			<tr>
 				<th><b>{'concours_id2'|@translate}</b></th>
 				<th><b>{'concours_name'|@translate}</b></th>
 				<th><b>{'concours_create_date'|@translate}</b></th>
-				<th><b>{'concours_descr'|@translate}</b></th>
+				<th width="50%"><b>{'concours_descr'|@translate}</b></th>
 				<th><b>{'concours_begin_date'|@translate}</b></th>
 				<th><b>{'concours_end_date'|@translate}</b></th>
-				<th colspan="4"><b>{'concours_actions'|@translate}</b></th>
+				<th width="10%"><b>{'concours_actions'|@translate}</b></th>
 			</tr>
 		 {foreach from=$prepared_concours item=prepared_concours}
-            <tr class="TableRow" style="cursor:pointer;">
+			<tr>
 				<td>{$prepared_concours.ID}</td>		
 				<td>{$prepared_concours.NAME}</td>		
@@ -31,30 +29,26 @@
 				<td>{$prepared_concours.BEGIN_DATE}</td>		
 				<td>{$prepared_concours.END_DATE}</td>		
-				<td><a href="{$prepared_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a></td>
-                <td><a href="{$prepared_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a></td>
-                <td colspan="2"></td>
+				<td><a href="{$prepared_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a>
+				&nbsp;<a href="{$prepared_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a>
+				</td>
 			</tr>
 		{/foreach}
 		</table>
-        {else}
-        <b>{'NO_concours'|@translate}</b>
-        {/if}
 	</fieldset>
 	
 	<fieldset>
 		<legend>{'active_concours'|@translate}</legend>
-        {if isset($active_concours)}
-		 <table class="table2 littlefont" id="aconcours_list" border="1">
-			<tr class="throw">
+		 <table border="1">
+			<tr>
 				<th><b>{'concours_id2'|@translate}</b></th>
 				<th><b>{'concours_name'|@translate}</b></th>
 				<th><b>{'concours_create_date'|@translate}</b></th>
-				<th><b>{'concours_descr'|@translate}</b></th>
+				<th width="50%"><b>{'concours_descr'|@translate}</b></th>
 				<th><b>{'concours_begin_date'|@translate}</b></th>
 				<th><b>{'concours_end_date'|@translate}</b></th>
-				<th colspan="4"><b>{'concours_actions'|@translate}</b></th>
+				<th width="10%"><b>{'concours_actions'|@translate}</b></th>
 			</tr>
 		 {foreach from=$active_concours item=active_concours}
-            <tr class="TableRow" style="cursor:pointer;">
+			<tr>
 				<td>{$active_concours.ID}</td>		
 				<td><a href="{$active_concours.U_AUDIT}" title="{'concours_audit1'|@translate}">{$active_concours.NAME}</a></td>		
@@ -63,29 +57,26 @@
 				<td>{$active_concours.BEGIN_DATE}</td>		
 				<td>{$active_concours.END_DATE}</td>		
-				<td><a href="{$active_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a></td>
-				<td><a href="{$active_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a></td>
+				<td><a href="{$active_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a>
+				&nbsp;<a href="{$active_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a>
+				</td>
 			</tr>
 		{/foreach}
 		</table>
-        {else}
-        <b>{'NO_concours'|@translate}</b>
-        {/if}
 	</fieldset>
 
 	<fieldset>
 		<legend>{'closed_concours'|@translate}</legend>
-        {if isset($closed_concours)}
-		 <table class="table2 littlefont" id="cconcours_list" border="1">
-			<tr class="throw">
+		 <table border="1">
+			<tr>
 				<th><b>{'concours_id2'|@translate}</b></th>
 				<th><b>{'concours_name'|@translate}</b></th>
 				<th><b>{'concours_create_date'|@translate}</b></th>
-				<th><b>{'concours_descr'|@translate}</b></th>
+				<th width="50%"><b>{'concours_descr'|@translate}</b></th>
 				<th><b>{'concours_begin_date'|@translate}</b></th>
 				<th><b>{'concours_end_date'|@translate}</b></th>
-				<th colspan="4"><b>{'concours_actions'|@translate}</b></th>
+				<th><b>{'concours_actions'|@translate}</b></th>
 			</tr>
 		 {foreach from=$closed_concours item=closed_concours}
-            <tr class="TableRow" style="cursor:pointer;">
+			<tr>
 				<td>{$closed_concours.ID}</td>		
 				<td><a href="{$closed_concours.U_AUDIT}" title="{'concours_audit1'|@translate}">{$closed_concours.NAME}</a></td>		
@@ -94,14 +85,13 @@
 				<td>{$closed_concours.BEGIN_DATE}</td>		
 				<td>{$closed_concours.END_DATE}</td>		
-				<td><a href="{$closed_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a></td>
-				<td><a href="{$closed_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a></td>
-				<td>{if $closed_concours.U_RESULT != ''}&nbsp;<a href="{$closed_concours.U_RESULT}" title="{'concours_result'|@translate}"><img src="{$IMG_URL}generate.png" class="button" alt="{'concours_result'|@translate}" /></a>{/if}</td>
-				<td>{if $closed_concours.U_FILE != ''}&nbsp;<a href="{$closed_concours.U_FILE}" title="{'concours_file'|@translate}"><img src="{$IMG_URL}file.png" class="button" alt="{'concours_file'|@translate}" /></a>{/if}</td>
+				<td><a href="{$closed_concours.U_EDIT}" title="{'concours_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'concours_edit'|@translate}"/></a>
+				&nbsp;<a href="{$closed_concours.U_DELETE}" title="{'concours_delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'concours_delete'|@translate}" /></a>
+				{if $closed_concours.U_RESULT != ''}&nbsp;<a href="{$closed_concours.U_RESULT}" title="{'concours_result'|@translate}"><img src="{$IMG_URL}generate.png" class="button" alt="{'concours_result'|@translate}" /></a>{/if}
+				{if $closed_concours.U_FILE != ''}&nbsp;<a href="{$closed_concours.U_FILE}" title="{'concours_file'|@translate}"><img src="{$IMG_URL}file.png" class="button" alt="{'concours_file'|@translate}" /></a>{/if}
+				
+				</td>
 			</tr>
 		{/foreach}
 		</table>
-        {else}
-        <b>{'NO_concours'|@translate}</b>
-        {/if}
 	</fieldset>
 	
Index: /extensions/ConcoursPhoto/admin/template/params.tpl
===================================================================
--- /extensions/ConcoursPhoto/admin/template/params.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/admin/template/params.tpl	(revision 8946)
@@ -35,5 +35,5 @@
 	<TR>
 		<TD colspan="2">
-		    <input type="checkbox" name="mask_exif" {$MASK_EXIF}/> {'concours_mask_exif'|@translate} 
+		    <input type="checkbox" name="thumb_note" {$THUMB_NOTE}/> {'concours_thumb_note'|@translate} 
 		    <br/>
 		</TD>
@@ -41,9 +41,20 @@
 	<TR>
 		<TD colspan="2">
-		    <input type="checkbox" name="thumb_note" {$THUMB_NOTE}/> {'concours_thumb_note'|@translate} 
+		    <input type="checkbox" name="check_exaequo" {$CHECK_EXAEQUO}/> {'concours_check_exaequo'|@translate} 
+		    <br/>
+		</TD>
+	<TR>
+		<TD colspan="2">
+		    <input type="checkbox" name="author_vote_available" {$AUTHOR_VOTE_AVAILABLE}/> {'concours_author_vote'|@translate} 
 		    <br/>
 		</TD>
 	</TR>
- </table>
+ 	<TR>
+		<TD colspan="2">
+		    <input type="checkbox" name="concours_change_score" {$CHANGE_SCORE}/> {'concours_change_score'|@translate} 
+		    <br/>
+		</TD>
+	</TR>
+</table>
 <br/>
 </fieldset>
Index: /extensions/ConcoursPhoto/img/index.php
===================================================================
--- /extensions/ConcoursPhoto/img/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/img/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/include/Concours.class.php
===================================================================
--- /extensions/ConcoursPhoto/include/Concours.class.php	(revision 8945)
+++ /extensions/ConcoursPhoto/include/Concours.class.php	(revision 8946)
@@ -5,5 +5,5 @@
  */
  
-global $user;
+global $user, $conf;
 
 class Concours
@@ -164,5 +164,7 @@
 						`category`, 
 						`groups`,
-						`method`
+						`method`,
+						`guest`
+                        
 						)
 					VALUES (".($concours_id !== NULL ? $concours_id : $this->concours_id).", now(), 
@@ -170,5 +172,5 @@
 							\"".$this->concours_infos['begin_date']."\", \"".$this->concours_infos['end_date']."\", 
 							".$this->concours_infos['category'].", ".$this->concours_infos['groups'].",
-							".$this->concours_infos['method']."
+							".$this->concours_infos['method'].", ".($this->concours_infos['guest'] ? "TRUE" : "FALSE")."
 							);";
 			if (pwg_query($query) != null)
@@ -196,5 +198,6 @@
 						category = ".$this->concours_infos['category'].", 
 						groups = ".$this->concours_infos['groups'].",
-						method = ".$this->concours_infos['method']."
+						method = ".$this->concours_infos['method'].",
+						guest = ".($this->concours_infos['guest'] ? "TRUE" : "FALSE")."
 						
 						WHERE id = ".($concours_id !== NULL ? $concours_id : $this->concours_id)."
@@ -458,5 +461,5 @@
 			$result = pwg_query($query);
 	if ($this->debug) echo $query."\n";
-	$criteria = mysql_fetch_assoc($result);
+            $criteria = mysql_fetch_assoc($result);
 	/*		while ($row = mysql_fetch_assoc($result))
 			{
@@ -619,4 +622,5 @@
 		$query = 'SELECT img_id, COUNT(DISTINCT user_id) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 
 		.' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id )
+        .' AND ipguest IS NULL'
 		.' GROUP BY img_id '
 		.';';
@@ -628,11 +632,59 @@
 			$nbvotes[$row['img_id']] = $row['NBVOTE'];
 		}
+        
+        // Add guest infos
+        $query = 'SELECT img_id, COUNT(DISTINCT user_id, ipguest) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 
+        .' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id )
+        .' AND ipguest IS NOT NULL'
+        .' GROUP BY img_id '
+        .';';
+                
+        $result = pwg_query($query);
+    if ($this->debug)		echo "NBVOTE = ".$query."\n";
+        while ($row = mysql_fetch_assoc($result))
+            if (!isset($nbvotes[$row['img_id']]))
+                $nbvotes[$row['img_id']] = $row['NBVOTE'];
+            else
+                $nbvotes[$row['img_id']] += $row['NBVOTE'];
+        
 		return $nbvotes;
 	}
-		
+
+	// Get All iaddr for guest who have vote (IP Stores in db) in a concours
+	function get_guest_list($concours_id = NULL)
+	{
+        $ipguest = array();
+		if ($concours_id!== null or $this->concours_id !== null)
+		{
+			$query = '
+				SELECT distinct(ipguest)
+				FROM ' . CONCOURS_DATA_TABLE .' 
+				WHERE id_concours =' . ($concours_id !== null ? $concours_id : $this->concours_id ) . '
+                AND ipguest IS NOT NULL
+				ORDER BY ipguest
+				';
+			$result = pwg_query($query);
+if ($this->debug) echo $query."\n";
+			while ($row = mysql_fetch_assoc($result))
+			{
+				array_push($ipguest, $row['ipguest']);
+			}
+            if ($this->debug)
+            {
+                foreach ($ipguest as $ip)
+                    echo "IP=".$ip."\n";
+            }
+
+			return $ipguest;
+		}
+		else
+			return $ipguest;
+	}
+    
 	
 	// After concours is completed (closed date is passed), generate the result and store it to DB
 	function create_result($concours_id = NULL)
 	{
+        global $conf;
 		// var which contains id=img_id and val =global note
 		$global_note = array();
@@ -655,7 +707,8 @@
 	echo "CAT=".$category;
 				// Get all user_id from a concours
-				$query = 'SELECT DISTINCT(user_id)'
+				$query = 'SELECT DISTINCT user_id'
 				.' FROM ' .CONCOURS_DATA_TABLE
 				.' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id )
+                .' AND user_id <> '.$conf['guest_id']
 				.';';
 				$result = pwg_query($query);
@@ -663,12 +716,17 @@
 echo $query;
 				while ($row = mysql_fetch_assoc($result))
-				{
 					array_push($user_id, $row['user_id']);
-				}
+
+                // Add guest info is present
+                $ipguest = array();
+                if ($concours_id!== null)
+                    $ipguest = $this->get_guest_list(($concours_id !== null ? $concours_id : $this->concours_id ));
 
 if ($this->debug)
+{
 	foreach ($user_id as $userid)
 			echo "USER = ".$userid;
-				
+}	foreach ($ipguest as $userid)
+			echo "IPGUEST = ".$userid;
 				
 				
@@ -687,5 +745,12 @@
 						if (!isset($global_note[$row['image_id']]))
 							$global_note[$row['image_id']] = 0;
-						$global_note[$row['image_id']] +=  $this->get_img_globalnote_user($row['image_id'], null, $userid );			
+						$global_note[$row['image_id']] +=  $this->get_img_globalnote_user($row['image_id'], null, $userid);			
+					}
+                    // Add guest scores if present
+					foreach ($ipguest as $i => $ipguestt)
+					{
+						if (!isset($global_note[$row['image_id']]))
+							$global_note[$row['image_id']] = 0;
+						$global_note[$row['image_id']] +=  $this->get_img_globalnote_user($row['image_id'], null, null, $ipguestt);			
 					}
 				}
@@ -717,4 +782,5 @@
 					
 				}
+            
 				
 
@@ -755,61 +821,8 @@
 	
 
-	// Disable exif if a concours is open or prepared
-	function concours_disable_exifs()
-	{
-		global $page, $conf;
-
-		// Get user group.
-		$this->get_user_groups();
-
-		$concours = array();
-
-	// disable exifs  on image which are present in a concours.
-	// check the categories where the current image is present and disable the exifs
-		if (isset($page['image_id']) && isset($this->my_config['mask_exifs']) && $this->my_config['mask_exifs'] == true)
-		{
-			// Get all categories where the current image is present
-			$query = '
-			SELECT category_id,uppercats,commentable,global_rank
-			  FROM '.IMAGE_CATEGORY_TABLE.'
-				INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
-			  WHERE image_id = '.$page['image_id'].'
-			  ;';
-//	               echo $query;
-			$result = pwg_query($query);
-			$related_categories = array();
-			while ($row = mysql_fetch_array($result))
-			{
-			  array_push($related_categories, $row['category_id']);
-			}
-			//
-            //echo related_categories;
-            if (count($related_categories))
-            {
-                // Request for all concours prepared & actived on each categories
-                $query = '
-                    SELECT *
-                    FROM ' . CONCOURS_TABLE .' 
-                    WHERE category IN ('.implode(',', $related_categories).')
-                    AND time_to_sec(TIMEDIFF(now(), end_date)) < 0
-                ';
-        //                echo $query;
-                $result = pwg_query($query);
-                // If one or more concours are found, the exifs are masked 
-                if ($result && mysql_fetch_assoc($result))
-                {
-                    $conf['show_exif'] = false;
-                }
-            }
-		}
-
-	// End disable author name
-    
-    }
-
-    
 	// Add tpl to picture.php page to display concours informations and vote
 	function display_concours_to_picture()
 	{
+		// Step0 : if user = guest, check the concours param and store ip address to user name.
 		// Step1 : concours is defined to this category AND concours is open AND user is authorized to access to this category (thru group)
 		// Step1 bis : dont show concours if img_author = user_id
@@ -825,5 +838,45 @@
 		$concours = array();
 
-		
+        // STEP 0 
+if ($this->debug)	echo "STEP0\n";
+
+    $user['ipguest'] = null;
+
+    echo "user id=".$user['id'];
+    // Check if the user is a guest only
+    if (is_a_guest())
+    {
+        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
+            $IP = $_SERVER['HTTP_X_FORWARDED_FOR']; 
+        elseif(isset($_SERVER['HTTP_CLIENT_IP']))   
+            $IP = $_SERVER['HTTP_CLIENT_IP'];   
+        else
+            $IP = $_SERVER['REMOTE_ADDR'];  
+             
+        // store ip
+        $user['ipguest'] = $IP;
+if ($this->debug)	    
+    echo "user ip guest=".$user['ipguest'];
+
+}
+
+
+		
+// DEBUG
+if ($this->debug)
+{
+    foreach ($user as $id=>$val)
+    {
+        if (is_array($val))
+            foreach ($val as $id2=>$val2)
+                echo "user[".$id."][".$id2."]=".$val2."\n";
+        else
+            echo "user[".$id."]=".$val."\n";
+    }
+}
+
+//  END DEBUG
+        
+        
 // DEBUG
 if ($this->debug)
@@ -916,5 +969,4 @@
 			while ($row = mysql_fetch_assoc($result))
 			{
-				
 				if (!empty($row['groups']))
 				{
@@ -926,6 +978,10 @@
 						continue;
 					}
+                    // If no group is parameter for that concours  ==> available for all registered users
 					$concours = $row;
 				}
+                else
+   					$concours = $row;
+
 
 			}
@@ -935,5 +991,6 @@
 			// Step 1 bis
 			// Actual user is  the author of the picture ==>end
-			if ($this->check_img_user($page['current_item']))
+			if ( !$this->my_config['author_vote_available']
+                AND $this->check_img_user($page['current_item']))
 				return;
 			
@@ -989,7 +1046,7 @@
 				
 //				$datas = "0=0";
-					$this->store_img_note_user($page['current_item'], $user_note, $concours['id']);
+					$this->store_img_note_user($page['current_item'], $user_note, $concours['id'], $user['ipguest']);
 if ($this->debug)	echo "COMMENT=".$_POST['CONCOURS_COMMENT'];
-					$this->store_img_comment_user($page['current_item'], $_POST['concours_comment'], $concours['id']);
+					$this->store_img_comment_user($page['current_item'], $_POST['concours_comment'], $concours['id'], $user['ipguest']);
 				}
 
@@ -998,14 +1055,14 @@
 				{
 if ($this->debug)			echo "RAZ";				
-					$this->RAZ_img_note_user($page['current_item'], $concours['id']);
+					$this->RAZ_img_note_user($page['current_item'], $concours['id'], $user['ipguest']);
 				}
 				else
 				{
 					// Recover previous note in DB (if exists)
-					$user_notes = $this->get_img_note_user($page['current_item'], $concours['id']);
+					$user_notes = $this->get_img_note_user($page['current_item'], $concours['id'], $user['id'], $user['ipguest']);
 				}
 				
 				// Comment is not RAZ, always restore				
-				$comment = $this->get_img_comment_user($page['current_item'], $concours['id']);
+				$comment = $this->get_img_comment_user($page['current_item'], $concours['id'], $user['id'], $user['ipguest']);
 
 if ($this->debug)	echo "STEP3\n";
@@ -1061,4 +1118,13 @@
 				// Add the comment
 				$template->assign( 'CONCOURS_COMMENT', $comment);
+
+				// if a user has already vote for this photo, check if the score change is allowed
+
+if ($this->debug)           echo "change=".($this->my_config['concours_change_score'] ? "OK" : "KO");
+                if ($user_notes == array() OR $this->my_config['concours_change_score'])  // Allow user to change his vote after a validation
+                    $template->assign( 'CONCOURS_CHANGE_SCORE', true);
+                else
+                    $template->assign( 'CONCOURS_CHANGE_SCORE', false);
+                
 				
 				// Add concours informations on template
@@ -1066,5 +1132,5 @@
 							'name'	=> $concours['name'],
 							'descr'	=> $concours['descr'],
-                            'note'  => $this->get_img_globalnote_user($page['current_item'], $concours['id'])
+                            'note'  => $this->get_img_globalnote_user($page['current_item'], $concours['id'], null, $user['ipguest'])
 								));
 				
@@ -1083,5 +1149,5 @@
 	// fill criterias notes to 0 in DB
 	// return false if error
-	function RAZ_img_note_user($img_id, $concours_id = NULL)
+	function RAZ_img_note_user($img_id, $concours_id = NULL, $ipguest = null)
 	{
 		$user_note = "";
@@ -1114,5 +1180,5 @@
 		if (strlen($user_note) != 0)
 		{
-			$this->store_img_note_user($img_id, $user_note, $concours_id);
+			$this->store_img_note_user($img_id, $user_note, $concours_id, $ipguest);
 			return true;
 		}
@@ -1125,8 +1191,8 @@
 	// Store notation from user to db
 	// save with format "criteria_id=note;criteria_id=note..." for data	
-	function store_img_note_user($img_id, $datas, $concours_id = NULL)
+	function store_img_note_user($img_id, $datas, $concours_id = NULL, $ipguest = null)
 	{
 		global $user;
-		if ($this->get_img_note_user( $img_id, $concours_id) == array())
+		if ($this->get_img_note_user( $img_id, $concours_id, $user['id'], $ipguest) == array() )
 		{
 			$query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id  FROM ' . CONCOURS_DATA_TABLE . ' ;';
@@ -1140,8 +1206,13 @@
 				`create_date` ,
 				`img_id` ,
-				`datas` )
+				`datas`'.
+                ($ipguest ? ',`ipguest` ' : '')
+
+                .')
 			VALUES ( '.$next_element_id.','
 			.($concours_id !== null ? $concours_id : $this->concours_id ) .'
-			, '. $user['id'] .', now(), '.$img_id.', "'.$datas.'");';
+			, '. $user['id'] .', now(), '.$img_id.', "'.$datas.'"'
+            .($ipguest ? ',"'.$user['ipguest'].'"' : '')
+            .');';
 		}
 		else
@@ -1152,5 +1223,7 @@
 			WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ).'
 			AND user_id = '.$user['id'].' 
-			AND img_id = '.$img_id.';';
+			AND img_id = '.$img_id.
+            ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '')            
+            .';';
 		}
 if ($this->debug) 			echo $query."\n";
@@ -1163,5 +1236,5 @@
 	// Criteria_id ==> value
 	// Note : criterias with subcriterias are not saved and not restored. They are calculated for global result
-	function get_img_note_user($img_id, $concours_id = NULL, $user_id = null)
+	function get_img_note_user($img_id, $concours_id = NULL, $user_id = null, $ipguest = null)
 	{
 		global $user;
@@ -1174,6 +1247,7 @@
 			WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) . '
 			AND user_id = '. ($user_id !== null ? $user_id : $user['id']).'
-			AND img_id = '. $img_id .'
-			';
+			AND img_id = '. $img_id .
+            ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '')
+			.';';
 if ($this->debug) 			echo $query."\n";
 			$result = pwg_query($query);
@@ -1212,5 +1286,5 @@
 	// get notation's user from db
 	// Return the global note for a picture id from a user
-	function get_img_globalnote_user($img_id, $concours_id = NULL, $user_id = null)
+	function get_img_globalnote_user($img_id, $concours_id = NULL, $user_id = null, $ipguest = null)
 	{
 		global $user;
@@ -1224,6 +1298,7 @@
 			WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) . '
 			AND user_id = '. ($user_id !== null ? $user_id : $user['id']).'
-			AND img_id = '. $img_id .'
-			';
+			AND img_id = '. $img_id .
+            ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '')
+			.';';
 			$result = pwg_query($query);
 			
@@ -1271,8 +1346,8 @@
 
 	// Store comment from user to db
-	function store_img_comment_user($img_id, $datas, $concours_id = NULL)
+	function store_img_comment_user($img_id, $datas, $concours_id = NULL, $ipguest = null)
 	{
 		global $user;
-		if (($comment = $this->get_img_note_user( $img_id, $concours_id)) == false)
+		if (($comment = $this->get_img_note_user( $img_id, $concours_id, null, $ipguest)) == false)
 		{
 			$query = 'SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id  FROM ' . CONCOURS_DATA_TABLE . ' ;';
@@ -1286,5 +1361,7 @@
 				`create_date` ,
 				`img_id` ,
-				`comment`)
+				`comment`'
+                .($ipguest ? ' `ipguest`' : '').
+                ')
 			VALUES ( '.$next_element_id.','
 			.($concours_id !== null ? $concours_id : $this->concours_id ) .'
@@ -1298,5 +1375,7 @@
 			WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id ).'
 			AND user_id = '.$user['id'].' 
-			AND img_id = '.$img_id.';';
+			AND img_id = '.$img_id.
+            ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '')
+            .';';
 		}
 if ($this->debug) 			echo $query."\n";
@@ -1307,5 +1386,5 @@
 	
 	// Get comment on an image for a user
-	function get_img_comment_user($img_id, $concours_id = NULL, $user_id = null)
+	function get_img_comment_user($img_id, $concours_id = NULL, $user_id = null, $ipguest = null)
 	{
 		global $user;
@@ -1318,6 +1397,7 @@
 			WHERE id_concours =' . ($concours_id !== NULL ? $concours_id : $this->concours_id) . '
 			AND user_id = '. ($user_id !== null ? $user_id : $user['id']).'
-			AND img_id = '. $img_id .'
-			';
+			AND img_id = '. $img_id .
+            ($ipguest ? ' AND ipguest = "'.$ipguest.'"' : '')
+			.';';
 if ($this->debug) 			echo $query."\n";
 			$result = pwg_query($query);
@@ -1336,4 +1416,5 @@
 	function generate_csv($concours_id = NULL)
 	{
+        global $conf;
 		$file = "rang, id_concours,method, img_id, img_name, img_file, date, note, moyenne, nbvotant, datas\r\n";
 
@@ -1344,5 +1425,5 @@
 		$query = 'SELECT id_concours,method, img_id, IMG.name, IMG.file, date, note, moyenne, nbvotant, datas'
 		.' FROM ' .CONCOURS_RESULT_TABLE
-		.' INNER JOIN ' . CONCOURS.' AS CONC on CONC.id = id_concours'
+		.' INNER JOIN ' . CONCOURS_TABLE.' AS CONC on CONC.id = id_concours'
 		.' INNER JOIN ' . IMAGES_TABLE.' AS IMG on IMG.id = img_id'
 		.' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id );
@@ -1383,4 +1464,5 @@
 	function generate_detail_csv($concours_id = NULL)
 	{
+        global $conf;
 		if ($concours_id === null)
 			$concours_id = $this->concours_id;
@@ -1414,4 +1496,6 @@
 		$user_list = array();
 		$users_criteria = "";
+        
+        
 		// Get all the users who have notes for the concours
 		$query = 'SELECT distinct(user_id), USER.username'
@@ -1419,5 +1503,7 @@
 		.' INNER JOIN ' . USERS_TABLE.' AS USER on USER.id = user_id'
 		.' WHERE id_concours = '.($concours_id !== null ? $concours_id : $this->concours_id )
-		.' ORDER BY username ASC'
+        // Dont take the guest informations because 
+        .' AND user_id <> '.$conf['guest_id']
+        .' ORDER BY username ASC'
 		.';';
 		$result = pwg_query($query);
@@ -1429,4 +1515,16 @@
 			
 		}
+        
+        $ipguest = array();
+        // Get guest info (if available)
+        if ($this->concours_infos['guest'])
+        {
+            $ipguest = $this->get_guest_list();
+            // For each guest
+            foreach ( $ipguest as $i => $userid ) //on parcours le tableau 
+            {
+                $users_criteria .= (strlen($users_criteria) ? "," : "")."user, user_global_note, comment, ".$criteria_list;                
+            }        
+        }
 
 if ($this->debug)	echo "users_criteria=".$users_criteria."\n";	
@@ -1443,22 +1541,4 @@
 
 		
-		/*		$query = 'SELECT img_id, COUNT(DISTINCT user_id) AS NBVOTE FROM ' . CONCOURS_DATA_TABLE 
-		.' GROUP BY img_id '
-		.';';
-				
-		$result = pwg_query($query);
-//		echo $query;
-		$nbvotes = array();
-		while ($row = mysql_fetch_assoc($result))
-		{
-			$nbvotes[$row['img_id']] = $row['NBVOTE'];
-		}
-*/		
-/*		
-		foreach ($nbvotes as $id=>$val)
-		{
-			echo "Vote img(".$id.")=".$val."\n";
-		}
-*/		
 		// recover all img_id from the category
 		if (!(isset($this->concours_infos['method'])))
@@ -1481,6 +1561,21 @@
 		// For each images
 		$rang = 1;
+        $previousNote = $previousMoy = 0;
+
 		while ($row = mysql_fetch_assoc($result))
 		{
+            // Check and verify for exaequo
+            if ($this->my_config['check_exaequo'])
+            {
+                if ( ($this->concours_infos['method'] == 1	// total
+                       AND ($row['note'] == $previousNote))
+                     OR  ($this->concours_infos['method'] == 2	// moyenne
+                          AND ($row['moyenne'] == $previousMoy)))
+                {
+                    $rang --;
+                    
+                }
+            }
+            
 			$file .= ($row['nbvotant'] != 0 ? $rang : 'N/A').', '
 					.$row['id_concours'].', '
@@ -1542,6 +1637,51 @@
 			}
 
+            // Add guest infos (if present)
+			foreach ($ipguest as $ipguestt)
+			{
+//                echo "IP=".$ipguestt."\n";
+				$comment = $this->get_img_comment_user($row['img_id'], $concours_id, $conf['guest_id'], $ipguestt);
+			
+				$user_note = $this->get_img_note_user($row['img_id'], $concours_id, $conf['guest_id'], $ipguestt);
+				
+				$file .= ', Guest('.$ipguestt.'), '.$this->get_img_globalnote_user($row['img_id'], $concours_id, $conf['guest_id'], $ipguestt)
+//						.', '.($row['comment'] != null ? str_replace(",", "",$row['comment']) : '')
+						.', '.($comment != false ? str_replace(array(",","\r\n", "\n", "\r"), " ",$comment) : '')
+						.', '
+						;
+
+				$user_note_by_crit = "";
+				foreach ($firstcriterias as $criteria)
+				{
+					// First without sub criterias
+					if (!$this->is_criterias_contains_sub($criteria['criteria_id'],$concours_id ))
+					{
+						$user_note_by_crit .= (strlen($user_note_by_crit) ? "," : "").(isset($user_note[$criteria['criteria_id']]) ? $user_note[$criteria['criteria_id']] : ' ');
+					}
+					else
+					{
+						$user_note_by_subcrit = "";
+						$subcrit_note = 0;
+						$user_has_vote = false;
+						$secondcriterias = $this->get_subcriterias($criteria['criteria_id'], $concours_id );
+						foreach ($secondcriterias as $subcriteria)
+						{
+							if (isset($user_note[$subcriteria['criteria_id']]))		$user_has_vote = true;
+							$user_note_by_subcrit .= (strlen($user_note_by_subcrit) ? "," : "").(isset($user_note[$subcriteria['criteria_id']]) ? $user_note[$subcriteria['criteria_id']] : ' ');
+							$subcrit_note += (int)$subcriteria['ponderation'] * (float)(isset($user_note[$subcriteria['criteria_id']]) ? $user_note[$subcriteria['criteria_id']] : 0);
+
+						}
+						$user_note_by_crit .= (strlen($user_note_by_crit) ? "," : "").($user_has_vote ? $subcrit_note : ' ').",".$user_note_by_subcrit;
+					}
+				}
+				$file .= $user_note_by_crit;
+
+			}
+            
 			$file .="\r\n";
 			$rang ++;
+            $previousNote = $row['note'];
+            $previousMoy = $row['moyenne'];
+
 		}
 if ($this->debug)		echo $file;
@@ -1756,4 +1896,18 @@
 	$this->get_user_groups();
 
+    $user['ipguest'] = null;
+    if (is_a_guest())
+    {
+        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
+            $IP = $_SERVER['HTTP_X_FORWARDED_FOR']; 
+        elseif(isset($_SERVER['HTTP_CLIENT_IP']))   
+            $IP = $_SERVER['HTTP_CLIENT_IP'];   
+        else
+            $IP = $_SERVER['REMOTE_ADDR'];  
+             
+        // store ip
+        $user['ipguest'] = $IP;
+    }
+        
     if ($this->my_config['thumb_note'] && $this->my_config['thumb_note'] == true)
     {
@@ -1785,15 +1939,26 @@
                     $concours = $row;
                 }
+                
+                // If no group is parameter for that concours  ==> available for all registered users
+                else
+                    $concours = $row;
+                
             }
             if (count($concours))
             {
-
-                foreach($tpl_var as $cle=>$valeur) 
-				{
-					// show only if the author is not the active user
-					if ($tpl_var[$cle]['FILE_AUTHOR'] != $user['username'])
-					{
-						$tpl_var[$cle]['NAME'] = $tpl_var[$cle]['NAME'].'<br>&nbsp;'.l10n('thumbnail_global_note').' : '.$this->get_img_globalnote_user($tpl_var[$cle]['ID'], $concours['id']);
-					}
+                // Check if user is guest and if guest is allowed
+                if ((is_a_guest() AND $concours['guest'])
+                    OR !is_a_guest())
+                {
+                    foreach($tpl_var as $cle=>$valeur) 
+                    {
+                        // show only if the author is not the active user
+                        if ($tpl_var[$cle]['FILE_AUTHOR'] != $user['username']
+                            OR $this->my_config['author_vote_available']    // Allow author to vote (and also show his score)
+                            )
+                        {
+                            $tpl_var[$cle]['NAME'] = $tpl_var[$cle]['NAME'].'<br>&nbsp;'.l10n('thumbnail_global_note').' : '.$this->get_img_globalnote_user($tpl_var[$cle]['ID'], $concours['id'], $user['id'], $user['ipguest']);
+                        }
+                    }
                 }
             }
Index: /extensions/ConcoursPhoto/include/default_values.inc.php
===================================================================
--- /extensions/ConcoursPhoto/include/default_values.inc.php	(revision 8945)
+++ /extensions/ConcoursPhoto/include/default_values.inc.php	(revision 8946)
@@ -9,4 +9,7 @@
 $concours_default_values['mask_author'] =   true; // Mask author for prepared concours
 $concours_default_values['thumb_note'] = true; // Display global note (for user) under thumbnail
-$concours_default_values['mask_exif'] = true; // Mask exif/iptc datas during concours
+$concours_default_values['check_exaequo'] = false; // Check exaequo and display the same rank
+$concours_default_values['author_vote_available'] = false; // Dont allow author to vote for his own photo
+$concours_default_values['concours_change_score']   = true; // Allow a user to change his score afer a validation
+
 ?>
Index: /extensions/ConcoursPhoto/include/index.php
===================================================================
--- /extensions/ConcoursPhoto/include/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/include/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/index.php
===================================================================
--- /extensions/ConcoursPhoto/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/language/en_UK/description.txt
===================================================================
--- /extensions/ConcoursPhoto/language/en_UK/description.txt	(revision 8945)
+++ /extensions/ConcoursPhoto/language/en_UK/description.txt	(revision 8946)
@@ -1,1 +1,1 @@
-Create photo competition with specifics criterias on Piwigo gallery
+Create photo contest with specifics criterias on Piwigo gallery
Index: /extensions/ConcoursPhoto/language/en_UK/index.php
===================================================================
--- /extensions/ConcoursPhoto/language/en_UK/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/language/en_UK/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/ConcoursPhoto/language/en_UK/plugin.lang.php	(revision 8945)
+++ /extensions/ConcoursPhoto/language/en_UK/plugin.lang.php	(revision 8946)
@@ -6,6 +6,94 @@
  */
 
-// Piclenslite button
-//$lang['']	 				= '';
 
+$lang['concours_save']	 				= 'Save';
+$lang['concours_RAZ']	 				= 'Reset';
+$lang['concours_admin_edit']	 		= 'Edit';
+$lang['concours_result']	 			= 'Contest Result';
+$lang['concours_add']	 				= 'Add a Contest';
+$lang['concours_id']	 				= 'Id';
+$lang['concours_id2']	 				= 'Id.';
+$lang['concours_name']	 				= 'Name';
+$lang['concours_descr']	 				= 'Description';
+$lang['concours_activation_date']					= 'Contest Period';
+$lang['concours_nb_jours']	 			= 'During';
+$lang['jours']	 				        = 'Days';
+$lang['concours_category_select']		= 'Selected category';
+$lang['concours_authorized_group']		= 'Authorized Groups';
+$lang['concours_begin_date']	 		= 'Stard Date';
+$lang['concours_end_date']	 			= 'End Date';
+$lang['concours_criterias']	 			= 'Contest criteria';
+$lang['concours_min_value']	 			= 'Min.';
+$lang['concours_max_value']	 			= 'Max.';
+$lang['concours_coef']	 				= 'Coef.';
+$lang['criteria_edit']	 				= 'Edit the criteria';
+$lang['criteria_delete']	 			= 'Delete the criteria';
+$lang['criteria_add']	 				= 'Add a criteria';
+$lang['subcriteria_add']	 			= 'Add a sub-criteria';
+$lang['concours_actions']	 			= 'Actions';
+$lang['concours_admin_title']	 	    = '"Concours Photo" plugin administration';
+$lang['default_criteria']	 			= 'Default criteria management';
+$lang['concours_add_criteria']	 		= 'Add a sub-criteria';
+$lang['concours_criteria_submit']	 	= 'Valid the criteria';
+$lang['manage_concours']	 			= 'Contest Management';
+$lang['prepared_concours']	 			= 'Prepared contest inactive';
+$lang['active_concours']	 			= 'Active contest';
+$lang['closed_concours']	 			= 'Contest closed';
+$lang['concours_result']	 			= 'Generate the result';
+$lang['concours_file']	 				= 'Download the result file';
+$lang['concours_create_date']	 		= 'Create date';
+$lang['concours_management']	 		= 'Contest Management';
+$lang['concours_edit']	 				= 'Edit the contest';
+$lang['concours_delete']	 			= 'Delete the contest';
+$lang['concours_add']	 				= 'Add a contest';
+$lang['concours_config']	 			= 'Default Criteria';
+$lang['concours_admin_add']             = $lang['concours_add'];
+$lang['concours_comment']		    	= 'Comments/Notes about the photo';
+$lang['concours_result_page']	    	= 'Contest Result';
+$lang['concours_img_author']	    	= 'Masked for the contest';
+$lang['concours_1st']			    	= 'st';
+$lang['concours_2nd']			    	= 'nd';
+$lang['concours_3rd']			    	= 'rd';
+$lang['concours_4th']			    	= 'th';
+$lang['concours_submit']		    	= 'Validate';
+$lang['concours_params']		    	= 'General parameters';
+$lang['concours_show_menubar']	    	= 'Show the menu "Contest Result"';
+$lang['concours_nb_concours_menubar']	= 'Number of results to display';
+$lang['concours_result_files']			= 'Contest result files generates';
+$lang['concours_result_file_list']		= 'List of contest result files that can be downloaded (even though if the contest has been deleted)';
+$lang['concours_no_result_file']		= 'No Result files';
+
+$lang['concours_date_from']             = 'Begin date';
+$lang['concours_date_end']              = 'End date';
+$lang['concours_hour_from']             = 'Begin hour';
+$lang['concours_hour_to']               = 'End hour';
+
+$lang['concours_mask_author']           =  'Mask author for prepared inactive contest';
+$lang['concours_mask_exif']             =  'Mask EXIF/IPTC datas for prepared inactive contest';
+
+$lang['thumbnail_global_note']          = 'Contest score';
+$lang['concours_thumb_note']            = 'Add the global note under thumbnails';
+$lang['concours_global_user_note']      = 'Total registered';
+
+
+$lang['concours_activ_from']            = 'Contest active from ';
+$lang['concours_activ_to']              = ' To ';
+$lang['concours_method']                = 'Rank calculating method';
+$lang['concours_method1']               = 'Sum of scored';
+$lang['concours_method2']               = 'Average of scores';
+
+$lang['concours_note']                  = 'Global score';
+$lang['concours_moyenne']               = 'Average';
+$lang['concours_nbvotant']              = 'Number of voting';
+$lang['concours_usernote']              = 'Your score';
+$lang['concours_infos']                 = 'Contest information';
+$lang['concours_audit']                 = 'Audit';
+$lang['concours_audit1']                = 'Audit the contest';
+$lang['concours_author']                = 'Author';
+$lang['NO_concours']                    = 'No contest';
+$lang['concours_username_selection']    = 'Select a user';
+$lang['all_users']                      = '-- All --';
+$lang['concours_check_exaequo']         = 'Manage exaequos';
+$lang['concours_author_vote']           = 'Allow author of a photo to vote (disable the check based on username/author)';
+$lang['concours_change_score']          = 'Allow user to change his score after a validation';
 ?>
Index: /extensions/ConcoursPhoto/language/fr_FR/description.txt
===================================================================
--- /extensions/ConcoursPhoto/language/fr_FR/description.txt	(revision 8945)
+++ /extensions/ConcoursPhoto/language/fr_FR/description.txt	(revision 8946)
@@ -1,1 +1,1 @@
-Création de concours photos avec critères sur les catégories de la galerie Piwigo
+Création de concours photos avec multi-critères sur les catégories de la galerie Piwigo
Index: /extensions/ConcoursPhoto/language/fr_FR/index.php
===================================================================
--- /extensions/ConcoursPhoto/language/fr_FR/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/language/fr_FR/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/ConcoursPhoto/language/fr_FR/plugin.lang.php	(revision 8945)
+++ /extensions/ConcoursPhoto/language/fr_FR/plugin.lang.php	(revision 8946)
@@ -9,6 +9,6 @@
 $lang['concours_save']	 				= 'Sauvegarder';
 $lang['concours_RAZ']	 				= 'Réinitialiser';
-$lang['concours_admin_edit']	 				= 'Edit';
-$lang['concours_result']	 				= 'Résultat du concours';
+$lang['concours_admin_edit']	 		= 'Edit';
+$lang['concours_result']	 			= 'Résultat du concours';
 $lang['concours_add']	 				= 'Ajouter un concours';
 $lang['concours_id']	 				= 'Identifiant';
@@ -16,81 +16,84 @@
 $lang['concours_name']	 				= 'Nom';
 $lang['concours_descr']	 				= 'Description';
-$lang['concours_activation_date']	 				= 'Période du concours';
-$lang['concours_nb_jours']	 				= 'Pendant';
-$lang['jours']	 				= 'Jours';
-$lang['concours_category_select']	 				= 'Catégorie sélectionnée';
-$lang['concours_authorized_group']	 				= 'Groupes authorisés';
-$lang['concours_begin_date']	 				= 'Date de début';
-$lang['concours_end_date']	 				= 'Date de fin';
-$lang['concours_criterias']	 				= 'Critères du concours';
-$lang['concours_min_value']	 				= 'Min.';
-$lang['concours_max_value']	 				= 'Max.';
+$lang['concours_activation_date']		= 'Période du concours';
+$lang['concours_nb_jours']	 			= 'Pendant';
+$lang['jours']	 				        = 'Jours';
+$lang['concours_category_select']	 	= 'Catégorie sélectionnée';
+$lang['concours_authorized_group']	 	= 'Groupes authorisés';
+$lang['concours_begin_date']	 		= 'Date de début';
+$lang['concours_end_date']	 			= 'Date de fin';
+$lang['concours_criterias']	 			= 'Critères du concours';
+$lang['concours_min_value']	 			= 'Min.';
+$lang['concours_max_value']	 			= 'Max.';
 $lang['concours_coef']	 				= 'Coef.';
 $lang['criteria_edit']	 				= 'Editer le critère';
-$lang['criteria_delete']	 				= 'Supprimer le critère';
+$lang['criteria_delete']	 			= 'Supprimer le critère';
 $lang['criteria_add']	 				= 'Ajouter un critère';
-$lang['subcriteria_add']	 				= 'Ajouter un sous-critère';
-$lang['concours_actions']	 				= 'Actions';
-$lang['concours_admin_title']	 				= 'Administration du plugin Concours Photo';
-$lang['default_criteria']	 				= 'Gestion des critères par défaut';
-$lang['concours_add_criteria']	 				= 'Ajouter un nouveau critère';
-$lang['concours_criteria_submit']	 				= 'Valider le critère';
-$lang['manage_concours']	 				= 'Gestion des concours';
-$lang['prepared_concours']	 				= 'Concours préparés non actifs';
-$lang['active_concours']	 				= 'Concours actifs en cours';
-$lang['closed_concours']	 				= 'Concours terminés';
-$lang['concours_result']	 				= 'Générer le résultat';
+$lang['subcriteria_add']	 			= 'Ajouter un sous-critère';
+$lang['concours_actions']	 			= 'Actions';
+$lang['concours_admin_title']	 		= 'Administration du plugin Concours Photo';
+$lang['default_criteria']	 		    = 'Gestion des critères par défaut';
+$lang['concours_add_criteria']	 		= 'Ajouter un nouveau critère';
+$lang['concours_criteria_submit']	 	= 'Valider le critère';
+$lang['manage_concours']	 			= 'Gestion des concours';
+$lang['prepared_concours']	 			= 'Concours préparés non actifs';
+$lang['active_concours']	 			= 'Concours actifs en cours';
+$lang['closed_concours']	 			= 'Concours terminés';
+$lang['concours_result']	 			= 'Générer le résultat';
 $lang['concours_file']	 				= 'Télécharger le fichier résultat';
-$lang['concours_create_date']	 				= 'Date de création';
-$lang['concours_management']	 				= 'Gérer les concours';
+$lang['concours_create_date']	 		= 'Date de création';
+$lang['concours_management']	 		= 'Gérer les concours';
 $lang['concours_edit']	 				= 'Editer le concours';
-$lang['concours_delete']	 				= 'Supprimer le concours';
+$lang['concours_delete']	 			= 'Supprimer le concours';
 $lang['concours_add']	 				= 'Ajouter un  concours';
-$lang['concours_config']	 				= 'Critères par défaut';
-$lang['concours_admin_add'] = $lang['concours_add'];
-$lang['concours_comment']			= 'Appréciation/Commentaire/Remarque sur la photo';
-$lang['concours_result_page']		= 'Résultat du concours';
-$lang['concours_img_author']		= 'Masqué pour le concours';
-$lang['concours_1st']				= 'er';
-$lang['concours_2nd']				= 'ème';
-$lang['concours_3rd']				= 'ème';
-$lang['concours_4th']				= 'ème';
-$lang['concours_submit']			= 'Valider';
-$lang['concours_params']			= 'Paramètres généraux';
+$lang['concours_config']	 			= 'Critères par défaut';
+$lang['concours_admin_add']             = $lang['concours_add'];
+$lang['concours_comment']		    	= 'Appréciation/Commentaire/Remarque sur la photo';
+$lang['concours_result_page']		    = 'Résultat du concours';
+$lang['concours_img_author']    		= 'Masqué pour le concours';
+$lang['concours_1st']			    	= 'er';
+$lang['concours_2nd']			    	= 'ème';
+$lang['concours_3rd']			    	= 'ème';
+$lang['concours_4th']			    	= 'ème';
+$lang['concours_submit']		    	= 'Valider';
+$lang['concours_params']		    	= 'Paramètres généraux';
 $lang['concours_show_menubar']			= 'Affichage du menu "Résultat des concours"';
-$lang['concours_nb_concours_menubar']			= 'Nombre de résultats à afficher';
+$lang['concours_nb_concours_menubar']	= 'Nombre de résultats à afficher';
 $lang['concours_result_files']			= 'Fichiers générés de résultat';
-$lang['concours_result_file_list']			= 'Liste des fichiers de résultat pouvant être téléchargés (même si le concours a été supprimé)';
-$lang['concours_no_result_file']			= 'Aucun fichier généré présent';
+$lang['concours_result_file_list']		= 'Liste des fichiers de résultat pouvant être téléchargés (même si le concours a été supprimé)';
+$lang['concours_no_result_file']		= 'Aucun fichier généré présent';
 
-$lang['concours_date_from']     = 'Date de Début';
-$lang['concours_date_end']     = 'Date de Fin';
-$lang['concours_hour_from']     = 'Heure de Début';
-$lang['concours_hour_to']     = 'Heure de Fin';
+$lang['concours_date_from']             = 'Date de Début';
+$lang['concours_date_end']              = 'Date de Fin';
+$lang['concours_hour_from']             = 'Heure de Début';
+$lang['concours_hour_to']               = 'Heure de Fin';
 
-$lang['concours_mask_author']   =  'Masquer l\'auteur pour les concours préparés non actifs';
-$lang['concours_mask_exif']   =  'Masquer les données EXIF/IPTC pour les concours préparés non actifs';
+$lang['concours_mask_author']           =  'Masquer l\'auteur pour les concours préparés non actifs';
+$lang['concours_mask_exif']             =  'Masquer les données EXIF/IPTC pour les concours préparés non actifs';
 
-$lang['thumbnail_global_note'] = 'Note concours';
-$lang['concours_thumb_note'] = 'Ajouter la note globale sous les miniatures';
-$lang['concours_global_user_note']  =   'Total enregistré';
+$lang['thumbnail_global_note']          = 'Note concours';
+$lang['concours_thumb_note']            = 'Ajouter la note globale sous les miniatures';
+$lang['concours_global_user_note']      = 'Total enregistré';
 
 
-$lang['concours_activ_from'] = 'Concours actif de ';
-$lang['concours_activ_to'] = ' à ';
-$lang['concours_method'] = 'Méthode de calcul du classement';
-$lang['concours_method1'] = 'Somme des notes';
-$lang['concours_method2'] = 'Moyenne des notes';
+$lang['concours_activ_from']            = 'Concours actif de ';
+$lang['concours_activ_to']              = ' à ';
+$lang['concours_method']                = 'Méthode de calcul du classement';
+$lang['concours_method1']               = 'Somme des notes';
+$lang['concours_method2']               = 'Moyenne des notes';
 
-$lang['concours_note'] = 'Note globale';
-$lang['concours_moyenne'] = 'Moyenne';
-$lang['concours_nbvotant'] = 'Nombre de votant';
-$lang['concours_usernote'] = 'Votre note';
-$lang['concours_infos'] = 'Information sur le concours';
-$lang['concours_audit'] = 'Audit';
-$lang['concours_audit1'] = 'Auditer le concours';
-$lang['concours_author'] = 'Auteur';
-$lang['NO_concours'] = 'Aucun concours';
+$lang['concours_note']                  = 'Note globale';
+$lang['concours_moyenne']               = 'Moyenne';
+$lang['concours_nbvotant']              = 'Nombre de votant';
+$lang['concours_usernote']              = 'Votre note';
+$lang['concours_infos']                 = 'Information sur le concours';
+$lang['concours_audit']                 = 'Audit';
+$lang['concours_audit1']                = 'Auditer le concours';
+$lang['concours_author']                = 'Auteur';
+$lang['NO_concours']                    = 'Aucun concours';
 $lang['concours_username_selection']    = 'Sélection d\'un utilisateur';
-$lang['all_users'] = '-- Tous --';
+$lang['all_users']                      = '-- Tous --';
+$lang['concours_check_exaequo']         = 'Gérer les exaequos';
+$lang['concours_author_vote']           = 'Autoriser les auteurs à voter pour leur propres photos (désactive le contrôle username=auteur)';
+$lang['concours_change_score']          = 'Autoriser les votants à modifier les notes après validation';
 ?>
Index: /extensions/ConcoursPhoto/language/index.php
===================================================================
--- /extensions/ConcoursPhoto/language/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/language/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/main.inc.php
===================================================================
--- /extensions/ConcoursPhoto/main.inc.php	(revision 8945)
+++ /extensions/ConcoursPhoto/main.inc.php	(revision 8946)
@@ -2,5 +2,5 @@
 /*
  * Plugin Name: ConcoursPhoto
- * Version: 1.1.0
+ * Version: 1.2.0
  * Description: Concours de photo paramétrable
  * Plugin URI: http://piwigo.org/ext/extension_view.php?eid=323
@@ -46,5 +46,4 @@
 
 // Add concours to picture page
-add_event_handler('loc_begin_picture', array(&$concours, 'concours_disable_exifs')); 
 add_event_handler('loc_end_picture', array(&$concours, 'display_concours_to_picture')); 
 // Add admin page
Index: /extensions/ConcoursPhoto/maintain.inc.php
===================================================================
--- /extensions/ConcoursPhoto/maintain.inc.php	(revision 8945)
+++ /extensions/ConcoursPhoto/maintain.inc.php	(revision 8946)
@@ -27,4 +27,5 @@
 				`groups` varchar(255) default NULL,
 				`method` smallint(5) default 1 NOT NULL,
+				`guest` Boolean default FALSE,
 				
 				PRIMARY KEY  (`id`)
@@ -59,4 +60,5 @@
 				`datas` longtext default NULL,
 				`comment` longtext default NULL,				
+				`ipguest` longtext default NULL,
 				PRIMARY KEY  (`id`)
 				) DEFAULT CHARSET=utf8;';
@@ -74,5 +76,5 @@
 				`nbvotant` smallint(5) default 0,
 				
-				PRIMARY KEY  (`img_id`),
+				PRIMARY KEY  (`img_id`, `id_concours`),
 				FOREIGN KEY (`id_concours`) REFERENCES ' . $prefixeTable . 'concours(id)				
 				) DEFAULT CHARSET=utf8;';
@@ -188,9 +190,16 @@
   global $prefixeTable;
 
-  // Check if upgrade is needed
+  // Check if upgrade is needed (from 1.0.0)
   $query = 'SHOW FULL COLUMNS FROM ' . $prefixeTable . 'concours_result;';
   $result = array_from_query($query, 'Field');
   if (count($result) < 7)	// only 6 datas on previous database
   {
+    upgrade_concoursresult_from_100();
+  }
+  // Check if upgrade is needed (from 1.0.0)
+  $query = 'SHOW FULL COLUMNS FROM ' . $prefixeTable . 'concours;';
+  $result = array_from_query($query, 'Field');
+  if (count($result) < 10)	// only 6 datas on previous database
+  {
     upgrade_concours_from_100();
   }
@@ -216,9 +225,9 @@
 }
 
-// Add new parameter in database in version 2.0.0:
+// Add new parameter in database in version 1.0.1:
 // - moy : moyenne of global note with all participant
 // - nbvotant : nb of vote for an image
 // - method = type of rank calculation (1-> total; 2-> moyenne)
-function upgrade_concours_from_100()
+function upgrade_concoursresult_from_100()
 {
 	global $prefixeTable;
@@ -241,3 +250,23 @@
 }
 
+// Add new parameter in database in version 2.0.0:
+// - guest : boolean to allow guest to use this function (concours)
+function upgrade_concours_from_100()
+{
+	global $prefixeTable;
+	// Add new parameters
+	$query = 'ALTER TABLE ' . $prefixeTable . 'concours
+	ADD `guest` boolean default FALSE AFTER `method`
+	;';
+
+	pwg_query($query);
+ 	// Add new parameters
+	$query = 'ALTER TABLE ' . $prefixeTable . 'concours_data
+	ADD `ipguest` longtext default NULL AFTER `comment`
+	;';
+
+	pwg_query($query);
+ 
+}
+
 ?>
Index: /extensions/ConcoursPhoto/publish.php
===================================================================
--- /extensions/ConcoursPhoto/publish.php	(revision 8945)
+++ /extensions/ConcoursPhoto/publish.php	(revision 8946)
@@ -10,4 +10,20 @@
 $ap_id = explode('concours/' , $_SERVER['REQUEST_URI']);
 $id_concours = $ap_id[1];
+
+$user['ipguest'] = null;
+if (is_a_guest())
+{
+    if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
+        $IP = $_SERVER['HTTP_X_FORWARDED_FOR']; 
+    elseif(isset($_SERVER['HTTP_CLIENT_IP']))   
+        $IP = $_SERVER['HTTP_CLIENT_IP'];   
+    else
+        $IP = $_SERVER['REMOTE_ADDR'];  
+         
+    // store ip
+    $user['ipguest'] = $IP;
+}
+        
+
 
 $concours = new Concours($id_concours);
@@ -34,5 +50,7 @@
 		.' INNER JOIN '.CATEGORIES_TABLE.' AS cat ON ic.category_id = cat.id'
 		.' INNER JOIN '.CONCOURS_RESULT_TABLE.' AS conc ON conc.img_id = img.id'
-		.' WHERE ic.category_id = '.$concours->concours_infos['category'];
+		.' WHERE ic.category_id = '.$concours->concours_infos['category']
+		.' AND conc.id_concours = '.$concours->concours_infos['id']
+        ;
 
 if ($concours->concours_infos['method'] == 1)	// total
@@ -45,4 +63,5 @@
 $result = pwg_query($query);
 $rang = 1;
+$previousNote = $previousMoy = 0;
 while ($row = mysql_fetch_assoc($result))
 {
@@ -76,4 +95,18 @@
 	unset_make_full_url();
 
+    // Check the exaequos
+    if ($concours->my_config['check_exaequo'])
+    {
+        if ( ($concours->concours_infos['method'] == 1	// total
+               AND ($row['note'] == $previousNote))
+             OR  ($concours->concours_infos['method'] == 2	// moyenne
+                  AND ($row['moyenne'] == $previousMoy)))
+        {
+//            echo "Rang=".$rang."\n";
+            $rang --;
+            
+        }
+    }
+
 	$template->append( 'concours_note', array(
 			'img_id' => $row['id'],
@@ -87,8 +120,12 @@
 			'moyenne' 	=> ($row['moyenne'] == 0 ? 'N/A' :$row['moyenne']),
 			'nbvotant' 	=> $row['nbvotant'],
-			'usernote'	=> $concours->get_img_globalnote_user($row['id'])
+			'usernote'	=> $concours->get_img_globalnote_user($row['id'], null, null, $user['ipguest'])
 			
 		));
-	$rang ++;
+    $rang ++;
+    
+//    echo "Rang=".$rang."\n";
+    $previousNote = $row['note'];
+    $previousMoy = $row['moyenne'];
 
 }
Index: /extensions/ConcoursPhoto/template/concours.tpl
===================================================================
--- /extensions/ConcoursPhoto/template/concours.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/template/concours.tpl	(revision 8946)
@@ -47,6 +47,8 @@
 	</table>
 	<p>
+    {if $CONCOURS_CHANGE_SCORE}
 	<input type="submit" name="concours_submit" value="{'concours_save'|@translate}" />
 	<input type="submit" name="concours_raz" value="{'concours_RAZ'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">
+    {/if}
 	</p>	
 	</fieldset> 
Index: /extensions/ConcoursPhoto/template/concours_menu.tpl
===================================================================
--- /extensions/ConcoursPhoto/template/concours_menu.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/template/concours_menu.tpl	(revision 8946)
Index: /extensions/ConcoursPhoto/template/index.php
===================================================================
--- /extensions/ConcoursPhoto/template/index.php	(revision 8945)
+++ /extensions/ConcoursPhoto/template/index.php	(revision 8946)
Index: /extensions/ConcoursPhoto/template/result.tpl
===================================================================
--- /extensions/ConcoursPhoto/template/result.tpl	(revision 8945)
+++ /extensions/ConcoursPhoto/template/result.tpl	(revision 8946)
