Index: branches/2.1/picture.php
===================================================================
--- branches/2.1/picture.php	(revision 6592)
+++ branches/2.1/picture.php	(revision 6614)
@@ -313,5 +313,5 @@
     {
       check_pwg_token();
-  
+
       include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
 
@@ -319,5 +319,5 @@
 
       $author_id = get_comment_author_id($_GET['comment_to_edit']);
-      
+
       if (can_manage_comment('edit', $author_id))
       {
@@ -332,5 +332,5 @@
             $_POST['key']
             );
-          
+
           redirect($url_self);
         }
@@ -345,16 +345,16 @@
     {
       check_pwg_token();
-  
+
       include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
-      
+
       check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID);
 
       $author_id = get_comment_author_id($_GET['comment_to_delete']);
-      
+
       if (can_manage_comment('delete', $author_id))
       {
         delete_user_comment($_GET['comment_to_delete']);
       }
-      
+
       redirect($url_self);
     }
@@ -362,16 +362,16 @@
     {
       check_pwg_token();
-  
+
       include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
 
       check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID);
-      
+
       $author_id = get_comment_author_id($_GET['comment_to_validate']);
-      
+
       if (can_manage_comment('validate', $author_id))
       {
         validate_user_comment($_GET['comment_to_validate']);
       }
-      
+
       redirect($url_self);
     }
@@ -797,37 +797,20 @@
     AND user_id = '.$user['id'].'
 ;';
-  $result = pwg_query($query);
-  $row = pwg_db_fetch_assoc($result);
-
-  if ($row['nb_fav'] == 0)
-  {
-    $template->assign(
-      'favorite',
-      array(
-        'FAVORITE_IMG'  =>
-          get_root_url().get_themeconf('icon_dir').'/favorite.png',
-        'FAVORITE_HINT' => l10n('add this image to your favorites'),
-        'U_FAVORITE'    => add_url_params(
-          $url_self,
-          array('action'=>'add_to_favorites')
-          ),
-        )
-      );
-  }
-  else
-  {
-    $template->assign(
-      'favorite',
-      array(
-        'FAVORITE_IMG'  =>
-          get_root_url().get_themeconf('icon_dir').'/del_favorite.png',
-        'FAVORITE_HINT' => l10n('delete this image from your favorites'),
-        'U_FAVORITE'    => add_url_params(
-          $url_self,
-          array('action'=>'remove_from_favorites')
-          ),
-        )
-      );
-  }
+  $row = pwg_db_fetch_assoc( pwg_query($query) );
+	$is_favorite = $row['nb_fav'] != 0;
+
+  $template->assign(
+    'favorite',
+    array(
+			'IS_FAVORITE' => $is_favorite,
+      'FAVORITE_IMG'  =>
+        get_root_url().get_themeconf('icon_dir').(!$is_favorite ? '/favorite.png' : '/del_favorite.png' ),
+      'FAVORITE_HINT' => l10n( !$is_favorite ? 'add this image to your favorites' : 'delete this image from your favorites'),
+      'U_FAVORITE'    => add_url_params(
+        $url_self,
+        array('action'=> !$is_favorite ? 'add_to_favorites' : 'remove_from_favorites' )
+        ),
+      )
+    );
 }
 
