Index: tensions/Piwecard/CHANGELOG
===================================================================
--- /extensions/Piwecard/CHANGELOG	(revision 20009)
+++ 	(revision )
@@ -1,29 +1,0 @@
-TODO for next versions : 
-- ajout possibilité de diffuser à plusieurs destinataires 
-- Nettoyage code et class ecard
-
-______________
-
-Version 1.1.x
--------------
-1.1.0 -->   - Compatible with Piwigo 2.2.x
-			- Add SK language
-______________
-
-Version 1.0.x
--------------
-1.0.4 -->   - Correct warning when option "active on user cats" is active
-            - Add default mail for Guest eCard (in admin)
-1.0.3 -->   - Add RU, LV language
-            - Add load language into ecard function
-1.0.2 -->   - Correct format error (slash appears) on mail
-            - Open this function on special cats like "random" or "best rated" and compatible with PWG Stuffs modules
-            	(This is only available if the plugin is active on "all categories")
-1.0.1 -->   - Add EN, DE, ITlanguages
-            - Add fck editor integration (thanks to Pat)
-1.0.0 --> First public release
-_______________
-
-Version 0.0.x
--------------
-0.0.1 --> Initial version (for testing)
Index: /extensions/Piwecard/admin/admin_consult.php
===================================================================
--- /extensions/Piwecard/admin/admin_consult.php	(revision 20009)
+++ /extensions/Piwecard/admin/admin_consult.php	(revision 20010)
@@ -4,9 +4,9 @@
 global $template, $page;
 
-$ecard = get_plugin_data($plugin_id);
+$piwecard = get_plugin_data($plugin_id);
 
 $start =  (isset($_GET['start']) ? $_GET['start'] : 0);
 // Verify if the previous action is delete the last ecard on a page, go to first page
-if ($start != 0 and $ecard->get_nb_ecard() == $ecard->my_config['nb_ecard_page'])
+if ($start != 0 and $piwecard->get_nb_ecard() == $piwecard->my_config['nb_ecard_page'])
 	$start = 0;
 
@@ -15,9 +15,9 @@
 		case "delete" :
 			$ecard_id = $_GET['id'];
-			$ecard->delete_ecard($ecard_id);
+			$piwecard->delete_ecard($ecard_id);
 			redirect(ECARD_ADMIN . '-consult&amp;start='.$start);
 			break;
 		case "delall" :
-			$ecard->delete_allinvalid_ecard();
+			$piwecard->delete_allinvalid_ecard();
 			redirect(ECARD_ADMIN . '-consult');
 			break;
@@ -31,7 +31,7 @@
 $consult_url = ECARD_ADMIN.'-consult';
 $ecard_navbar = array();
-$ecard_navbar = create_navigation_bar($consult_url, $ecard->get_nb_ecard(), $start, $ecard->my_config['nb_ecard_page']);
+$ecard_navbar = create_navigation_bar($consult_url, $piwecard->get_nb_ecard(), $start, $piwecard->my_config['nb_ecard_page']);
 
-$query = 'SELECT * FROM '.ECARD_TABLE.' ORDER BY date_creation DESC LIMIT '.$start.','.$ecard->my_config['nb_ecard_page'].';';
+$query = 'SELECT * FROM '.ECARD_TABLE.' ORDER BY date_creation DESC LIMIT '.$start.','.$piwecard->my_config['nb_ecard_page'].';';
 $result = pwg_query($query);
 
@@ -40,5 +40,5 @@
 
 	// Check if the ecard is valid 
-	$valid = $ecard->is_valid($file['id']);
+	$valid = $piwecard->is_valid($file['id']);
 
 	$template->append('ecard_file',array(
@@ -58,6 +58,6 @@
 
 // Get the number of ecard (total & valid & invalid)
-$template->assign('nb_ecard_valid', $ecard->get_nb_valid_ecard());
-$template->assign('nb_ecard', $ecard->get_nb_ecard());
+$template->assign('nb_ecard_valid', $piwecard->get_nb_valid_ecard());
+$template->assign('nb_ecard', $piwecard->get_nb_ecard());
 
 $template->assign('ecard_del_all', $consult_url.'&amp;action=delall' );
Index: /extensions/Piwecard/admin/admin_manage.php
===================================================================
--- /extensions/Piwecard/admin/admin_manage.php	(revision 20009)
+++ /extensions/Piwecard/admin/admin_manage.php	(revision 20010)
@@ -14,5 +14,5 @@
 if (isset($_POST['falsify']) and isset($_POST['cat_true']) and count($_POST['cat_true']) > 0) {
 	foreach ($_POST['cat_true'] as $cat)
-		unset($piwecard->my_config['cats'][array_search($cat, $piwecard->my_config['cats'])]);
+		unset($piwecard->my_config['selected_cats'][array_search($cat, $piwecard->my_config['selected_cats'])]);
 	$piwecard->save_config();
 }
@@ -22,41 +22,26 @@
 	$query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id IN ("'.implode('","', $_POST['cat_false']).'");';
 	$result = pwg_query($query);
-	$categories = array();
 
 	if (!empty($result)) {
-		while ($row = pwg_db_fetch_assoc($result))
-			array_push($categories, $row);			
+		while ($cat = pwg_db_fetch_assoc($result))
+			array_push($piwecard->my_config['selected_cats'], $cat['id']);			
 	}
-	usort($categories, 'global_rank_compare');
+	usort($piwecard->my_config['selected_cats'], 'global_rank_compare');
 
-	if (!empty($result)) {
-		foreach ($categories as $cat) {
-			array_push($piwecard->my_config['cats'], $cat['id']);
-		}
-	}
 	$piwecard->save_config();
 }
 
 if (isset($_POST['submit'])) { 
-	$piwecard->my_config['allcats'] = isset($_POST['allcats']);
-	$piwecard->my_config['user_cat'] = isset($_POST['user_cat']);
-	$piwecard->my_config['recursive'] = isset($_POST['recursiv']);
-	if ($piwecard->my_config['groups'] = isset($_POST['groups']))
-		array_map("mysql_escape_string", $_POST['groups']);
+	$piwecard->my_config['authorizations'] = $_POST['ecard_authorizations'];
+	if (isset($_POST['ecard_selected_cats_recursive']) AND $_POST['ecard_selected_cats_recursive'] == '1')
+		$piwecard->my_config['recursive'] = true;
 	else
-		array(); 
+		$piwecard->my_config['recursive'] = false;
 	$piwecard->save_config();
 	array_push($page['infos'], l10n('ecard_admin_saveOK'));
 }
 
-// Groups selection
-$groups = get_all_groups();
-if (!empty($groups)) {
-  $template->assign('group_perm', array('GROUPSELECTION' => get_html_groups_selection($groups, 'groups', (isset($piwecard->my_config['groups']) ? $piwecard->my_config['groups'] : array()))));
-}
-	
-// Test double select wall categories 
-// Categories non prises en compte
-$query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id not IN ("'.implode('","', $piwecard->my_config['cats']).'");';
+//Populate double_select
+$query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id not IN ("'.implode('","', $piwecard->my_config['selected_cats']).'");';
 $result = pwg_query($query);
 $categories = array();
@@ -73,17 +58,16 @@
 	}
 }
-$template->assign( 'category_option_false', $tpl);
-$template->assign( 'category_option_false_selected', array());
+$template->assign('category_option_false', $tpl);
+$template->assign('category_option_false_selected', array());
 
-// Categories prises en compte
-$query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id IN ("'.implode('","', $piwecard->my_config['cats']).'");';
+$query = 'SELECT id, name, uppercats, global_rank FROM '.CATEGORIES_TABLE.' WHERE id IN ("'.implode('","', $piwecard->my_config['selected_cats']).'");';
 $result = pwg_query($query);
 $categories = array();
-if (!empty($result))
-{
+if (!empty($result)) {
 	while ($row = pwg_db_fetch_assoc($result))
 		array_push($categories, $row);
 }
 usort($categories, 'global_rank_compare');
+
 $tpl2 = array();
 if (!empty($result)) {
@@ -92,55 +76,23 @@
 	}
 }
-$template->assign( 'category_option_true', $tpl2);
-$template->assign( 'category_option_true_selected', array());
+$template->assign('category_option_true', $tpl2);
+$template->assign('category_option_true_selected', array());
 
-$template->assign('ECARD_ALLCATS', ($piwecard->my_config['allcats'] ? 'checked="checked"' : ''));
-$template->assign('ECARD_USERCAT', ($piwecard->my_config['user_cat'] ? 'checked="checked"' : ''));
-$template->assign('ECARD_RECURSIV', ($piwecard->my_config['recursive'] ? 'checked="checked"' : ''));
+$template->assign('ecard', array(
+								'all_cats_checked' => (($piwecard->my_config['authorizations'] == 'all_cats') ? 'checked="checked"' : ''),
+								'selected_cats_checked' => (($piwecard->my_config['authorizations'] == 'selected_cats') ? 'checked="checked"' : ''),
+								'selected_cats_recursive_checked' => (($piwecard->my_config['recursive']) ? 'checked="checked"' : ''),
+								'user_cats_checked' => (($piwecard->my_config['authorizations'] == 'user_cats') ? 'checked="checked"' : ''),
+							)
+);
 
-$template->assign(Array(
-	'F_ACTION' => '',
-	'L_CAT_OPTIONS_TRUE' => l10n('To Translate!'),
-	'L_CAT_OPTIONS_FALSE' => l10n('To Translate!'),
-));
+$template->assign(array(
+						'F_ACTION' => '',
+						'L_CAT_OPTIONS_TRUE' => l10n('selected_cats'),
+						'L_CAT_OPTIONS_FALSE' => l10n('non_selected_cats'),
+					)
+);
 
 $template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
-$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
-
-function get_html_groups_selection($groups, $fieldname, $selecteds = array()) {
-	global $conf;
-	
-	if (count ($groups) == 0) {
-		return '';
-	}
-	
-	$output = '<div id="'.$fieldname.'">';
-	$id = 1;
-	
-	foreach ($groups as $group) {
-		$output.= '<input type="checkbox" name="'.$fieldname.'[]" id="group_'.$id++.'" value="'.$group['id'].'"';
-
-		if (in_array($group['id'], $selecteds)) {
-		  $output.= ' checked="checked"';
-		}
-
-		$output.= '><label>&nbsp;'. $group['name'].'</label>\n';
-	}
-	$output.= '</div>';
-
-	return $output;
-}
-
-function get_all_groups() {
-	$query = 'SELECT id, name FROM '.GROUPS_TABLE.'	ORDER BY name ASC;';
-	$result = pwg_query($query);
-
-	$groups = array();
-	while ($row = pwg_db_fetch_assoc($result)) {
-		array_push($groups, $row);
-	}
-	uasort($groups, 'name_compare');
-
-	return $groups;
-}
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 ?>
Index: /extensions/Piwecard/admin/admin_params.php
===================================================================
--- /extensions/Piwecard/admin/admin_params.php	(revision 20009)
+++ /extensions/Piwecard/admin/admin_params.php	(revision 20010)
@@ -4,48 +4,50 @@
 global $template, $page;
  
-$me = get_plugin_data($plugin_id);
+$piwecard = get_plugin_data($plugin_id);
 
 
 if (isset($_POST['submit'])) { 
 
-    $me->my_config['activ'] = $_POST['ecard_activ'];
-    $me->my_config['send_copy'] = isset($_POST['ecard_sendcopy']);
-    $me->my_config['expmail_change'] = isset($_POST['ecard_modifexpmail']);
-    $me->my_config['send_HTML'] = isset($_POST['ecard_sendhtml']);
-    $me->my_config['ecard_showinfos'] = isset($_POST['ecard_showinfos']);
-    $me->my_config['nb_ecard_page'] = $_POST['ecard_nb_page'];
+    $piwecard->my_config['validity_default'] = $_POST['ecard_activ'];
+    $piwecard->my_config['sender_copy'] = isset($_POST['ecard_sender_copy']);
+    $piwecard->my_config['sender_email_change'] = isset($_POST['ecard_modifexpmail']);
+    $piwecard->my_config['email_format'] = isset($_POST['ecard_sendhtml']);
+    $piwecard->my_config['show_image_infos'] = isset($_POST['ecard_showinfos']);
+    $piwecard->my_config['nb_ecard_page'] = $_POST['ecard_nb_page'];
 
-    $me->my_config['defaultmail'] = $_POST['defaultmail'];
+    $piwecard->my_config['default_guest_email'] = $_POST['defaultmail'];
 
 	
-	$me->my_config['subject_link'] = htmlspecialchars($_POST['ecard_subject_link']);
-	$me->my_config['message_link'] = htmlspecialchars($_POST['ecard_message_link']);
-	$me->my_config['message_HTML'] = stripslashes($_POST['ecard_message_html']);
-	$me->save_config();
+	$piwecard->my_config['email_subject'] = htmlspecialchars($_POST['ecard_subject_link']);
+	$piwecard->my_config['email_text'] = htmlspecialchars($_POST['ecard_message_link']);
+	$piwecard->my_config['email_html'] = stripslashes($_POST['ecard_message_html']);
+	$piwecard->save_config();
 	array_push($page['infos'], l10n('ecard_admin_saveOK'));
 	
 }
 
-$template->append('ECARD_ACTIV',array('ID' => 0,'NAME' => l10n('ecard_nolimit'),'SELECTED' => ($me->my_config['activ'] == 0 ? 'selected' : '')));
-
-for($jj=5; $jj < 30; $jj+=5)
-{
-	$template->append('ECARD_ACTIV',array('ID' => $jj,'NAME' => $jj.' '.l10n('ecard_days'),'SELECTED' => ($me->my_config['activ'] == $jj ? 'selected' : '')));
+foreach($piwecard->my_config['validity'] as $validity) {
+	$template->append('ECARD_ACTIV', array(
+											'ID' => $validity,
+											'NAME' => ($validity == 0) ? l10n('ecard_nolimit') : $validity.' '.l10n('ecard_days'),
+											'SELECTED' => ($piwecard->my_config['validity_default'] == $validity ? 'selected' : '')
+										)
+	);
 }
 
 for($jj=1; $jj < 20; $jj++)
-	$template->append('ECARD_NB_PAGE',array('ID' => $jj,'NAME' => $jj,'SELECTED' => ($me->my_config['nb_ecard_page'] == $jj ? 'selected' : '')));
+	$template->append('ECARD_NB_PAGE',array('ID' => $jj,'NAME' => $jj,'SELECTED' => ($piwecard->my_config['nb_ecard_page'] == $jj ? 'selected' : '')));
 
 
-$template->assign('ECARD_SENDCOPY', $me->my_config['send_copy'] ? 'checked="checked"' : '');
-$template->assign('ECARD_MODIFEXPMAIL', $me->my_config['expmail_change'] ? 'checked="checked"' : '');
-$template->assign('ECARD_SENDHTML', $me->my_config['send_HTML'] ? 'checked="checked"' : '');
-$template->assign('ECARD_SHOWINFOS', $me->my_config['ecard_showinfos'] ? 'checked="checked"' : '');
+$template->assign('ECARD_SENDCOPY', $piwecard->my_config['sender_copy'] ? 'checked="checked"' : '');
+$template->assign('ECARD_MODIFEXPMAIL', $piwecard->my_config['sender_email_change'] ? 'checked="checked"' : '');
+$template->assign('ECARD_SENDHTML', ($piwecard->my_config['email_format'] == 'html') ? 'checked="checked"' : '');
+$template->assign('ECARD_SHOWINFOS', $piwecard->my_config['show_image_infos'] ? 'checked="checked"' : '');
 
-$template->assign('ECARD_DEFAULT_MAIL', $me->my_config['defaultmail']);
+$template->assign('ECARD_DEFAULT_MAIL', $piwecard->my_config['default_guest_email']);
 
-$template->assign('ECARD_SUBJECT_LINK', htmlspecialchars_decode($me->my_config['subject_link']));
-$template->assign('ECARD_MESSAGE_LINK', htmlspecialchars_decode($me->my_config['message_link']));
-$template->assign('ECARD_MESSAGE_HTML', htmlspecialchars_decode($me->my_config['message_HTML']));
+$template->assign('ECARD_SUBJECT_LINK', htmlspecialchars_decode($piwecard->my_config['email_subject']));
+$template->assign('ECARD_MESSAGE_LINK', htmlspecialchars_decode($piwecard->my_config['email_text']));
+$template->assign('ECARD_MESSAGE_HTML', htmlspecialchars_decode($piwecard->my_config['email_html']));
 	
 // Use FCK Editor
Index: /extensions/Piwecard/admin/template/admin_consult.tpl
===================================================================
--- /extensions/Piwecard/admin/template/admin_consult.tpl	(revision 20009)
+++ /extensions/Piwecard/admin/template/admin_consult.tpl	(revision 20010)
@@ -5,12 +5,12 @@
 	<legend>{'ecard_list'|@translate}</legend>
 	<div id="ECardAdminConsult">
-		<div class="ecard_first_line">
-			{'ecard_list'|@translate} [{$nb_ecard_valid} {'valid'|@translate} / {$nb_ecard} {'total'|@translate}]
-			<a href="{$ecard_del_all}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'ecard_delete_all'|@translate}">
-				{'ecard_delete_all'|@translate}
-				<img src="{$themeconf.admin_icon_dir}/delete.png" alt="{'ecard_delete_all'|@translate}"/>
-			</a>
-		</div>
 		{if count($ecard_file)}
+			<div class="ecard_first_line">
+				{'ecard_list'|@translate} [{$nb_ecard_valid} {'valid'|@translate} / {$nb_ecard} {'total'|@translate}]
+				<a href="{$ecard_del_all}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'ecard_delete_all'|@translate}">
+					{'ecard_delete_all'|@translate}
+					<img src="{$themeconf.admin_icon_dir}/delete.png" alt="{'ecard_delete_all'|@translate}"/>
+				</a>
+			</div>
 			<table class="table2" width="97%">
 				<thead>
Index: /extensions/Piwecard/admin/template/admin_manage.tpl
===================================================================
--- /extensions/Piwecard/admin/template/admin_manage.tpl	(revision 20009)
+++ /extensions/Piwecard/admin/template/admin_manage.tpl	(revision 20010)
@@ -22,18 +22,15 @@
 	<h2>{'ecard'|@translate}</h2>
 </div>
-<form method="post" action="" class="properties"  ENCTYPE="multipart/form-data">
-	<fieldset>
-		<legend>{'ecard_manage'|@translate}</legend>
-		<div id="ECardAdminManage">
-			<div>
-				<input type="radio" name="ecard_manage" id="ecard_user_cats" value="ecard_user_cats" {$ecard.user_cats} /><label for="ecard_user_cats">{'ecard_active_user_cat'|@translate}</label><br />
+<form method="post" action="" class="properties">
+	<div id="ECardAdminManage">
+		<fieldset>
+			<legend>{'ecard_manage'|@translate}</legend>
+			<div class="ecard_radio">
+				<input type="radio" name="ecard_authorizations" id="ecard_all_cats" value="all_cats" {$ecard.all_cats_checked} /><label for="ecard_all_cats"> {'ecard_active_all_cats'|@translate}</label>
 			</div>
-			<div>
-				<input type="radio" name="ecard_manage" id="ecard_all_cats" value="ecard_all_cats" {$ecard.all_cats} /><label for="ecard_all_cats">{'ecard_active_all_cats'|@translate}</label><br />
-			</div>
-			<div>
-				<input type="radio" name="ecard_manage" id="ecard_selected_cats" value="ecard_selected_cats" {$ecard.selected_cats}><label for="ecard_selected_cats">{'ecard_active_spec_cats'|@translate}</label><br />
+			<div class="ecard_radio">
+				<input type="radio" name="ecard_authorizations" id="ecard_selected_cats" value="selected_cats" {$ecard.selected_cats_checked}><label for="ecard_selected_cats"> {'ecard_active_spec_cats'|@translate}</label>
 				<div id="ecard_selected_cats_options">
-					<input type="checkbox" name="ecard_selected_cats_recursive" id="ecard_selected_cats_recursive" {$ecard.selected_cats_recursive} /><label for="ecard_selected_cats_recursive">{'ecard_recursive'|@translate}</label><br />
+					<input type="checkbox" name="ecard_selected_cats_recursive" id="ecard_selected_cats_recursive" value="1" {$ecard.selected_cats_recursive_checked} /><label for="ecard_selected_cats_recursive"> {'ecard_recursive'|@translate}</label><br />
 					<div id="ecard_cat_select">
 						{$DOUBLE_SELECT}
@@ -41,8 +38,11 @@
 				</div>
 			</div>
-			<div>
-				<input type="submit" name="submit" value="{'Submit'|@translate}" />
+			<div class="ecard_radio">
+				<input type="radio" name="ecard_authorizations" id="ecard_user_cats" value="user_cats" {$ecard.user_cats_checked} /><label for="ecard_user_cats"> {'ecard_active_user_cat'|@translate}</label>
 			</div>
+		</fieldset>
+		<div id="ecard_submit">
+			<input type="submit" name="submit" value="{'Submit'|@translate}" />
 		</div>
-	</fieldset>
+	</div>
 </form>
Index: /extensions/Piwecard/admin/template/admin_params.tpl
===================================================================
--- /extensions/Piwecard/admin/template/admin_params.tpl	(revision 20009)
+++ /extensions/Piwecard/admin/template/admin_params.tpl	(revision 20010)
@@ -15,17 +15,17 @@
 			</div>
 			<div>
-				<input type="checkbox" name="ecard_sendcopy" {$ECARD_SENDCOPY}/> {'ecard_send_copy'|@translate}
+				<input type="checkbox" name="ecard_sendcopy" id="ecard_sendcopy" {$ECARD_SENDCOPY}/> <label for="ecard_sendcopy">{'ecard_send_copy'|@translate}</label>
 			</div>
 			<div>
-				<input type="checkbox" name="ecard_modifexpmail" {$ECARD_MODIFEXPMAIL}/> {'ecard_nomodif_expmail'|@translate}
+				<input type="checkbox" name="ecard_modifexpmail" id="ecard_modifexpmail" {$ECARD_MODIFEXPMAIL}/> <label for="ecard_modifexpmail">{'ecard_nomodif_expmail'|@translate}</label>
 			</div>
 			<div>
-				<input type="checkbox" name="ecard_sendhtml" {$ECARD_SENDHTML}/> {'ecard_send_HTML'|@translate}
+				<input type="checkbox" name="ecard_sendhtml" id="ecard_sendhtml" {$ECARD_SENDHTML}/> <label for="ecard_sendhtml">{'ecard_send_HTML'|@translate}</label>
 			</div>
 			<div>
-				<input type="checkbox" name="ecard_showinfos" {$ECARD_SHOWINFOS}/> {'ecard_show_infos'|@translate} 
+				<input type="checkbox" name="ecard_showinfos" id="ecard_showinfos" {$ECARD_SHOWINFOS}/> <label for="ecard_showinfos">{'ecard_show_infos'|@translate}</label>
 			</div>
 			<div>
-				{'ecard_admin_nb_page'|@translate}
+				{'ecard_admin_nb_page'|@translate}</label>
 				<select id="ecard_nb_page" name="ecard_nb_page">
 					{foreach from=$ECARD_NB_PAGE item=ECARD_NB_PAGE}
@@ -35,5 +35,5 @@
 			</div>
 			<div>
-				{'ecard_default_mail'|@translate}
+				<label for="defaultmail">{'ecard_default_mail'|@translate}
 				<input type="text" maxlength="50" size="50" name="defaultmail" id="defaultmail" value="{$ECARD_DEFAULT_MAIL}" />
 			</div>
@@ -42,31 +42,34 @@
 		<fieldset>
 			<legend>{'ecard_mail_config'|@translate}</legend>
-		</br>
-		  <ul>
-			<li>
-			  <span class="property">
+			<div>
 				<label for="ecard_subject_link">{'ecard_subject_link'|@translate}</label>
-			  </span>
-			  <input type="text" maxlength="255" size="50" name="ecard_subject_link" id="ecard_subject_link" value="{$ECARD_SUBJECT_LINK}" />
-			</li>
-			<li>
-
-			  <span class="property">
-				<label for="page_banner">{'ecard_message_link'|@translate}</label>
-			  </span>
-			  <textarea name="ecard_message_link" id="ecard_message_link"  rows="10" cols="50" style="width:100%; height: 150px;">{$ECARD_MESSAGE_LINK}</textarea>
-			</li>
-			<li>
-
-			  <span class="property">
-				<label for="page_banner">{'ecard_message_html'|@translate}</label>
-			  </span>
-			  <textarea name="ecard_message_html" id="ecard_message_html" rows="10" cols="50" style="width:100%; height: 200px;">{$ECARD_MESSAGE_HTML}</textarea>
-			</li>
-			<p><div align="left">
-			<small>{'ecard_parameters'|@translate}<small>
-			</div></p>
-		  </ul>
-			  
+				<input type="text" maxlength="255" size="50" name="ecard_subject_link" id="ecard_subject_link" value="{$ECARD_SUBJECT_LINK}" />
+			</div>
+			<div>
+				<label for="ecard_message_link">{'ecard_message_link'|@translate}</label>
+				<textarea name="ecard_message_link" id="ecard_message_link"  rows="10" cols="50" style="width:100%; height: 150px;">{$ECARD_MESSAGE_LINK}</textarea>
+			</div>
+			<div>
+				<label for="ecard_message_html">{'ecard_message_html'|@translate}</label>
+				<textarea name="ecard_message_html" id="ecard_message_html" rows="10" cols="50" style="width:100%; height: 200px;">{$ECARD_MESSAGE_HTML}</textarea>
+			</div>
+			<div id="ecard_parameters_description">
+				<div id="ecard_parameters_description_label">
+					{'ecard_parameters'|@translate}<br />
+				</div>
+				<div id="ecard_parameters_description_text">
+					<span class="ecard_parameters_description_parameter">%yourname% : </span><span class="ecard_parameters_description_parameter">{'piwecard_sender_name'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%youremail% : </span><span class="ecard_parameters_description_parameter">{'piwecard_sender_email'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%recipientname% : </span><span class="ecard_parameters_description_parameter">{'piwecard_recipient_name'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%recipientemail% : </span><span class="ecard_parameters_description_parameter">{'piwecard_recipient_email'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%website% : </span><span class="ecard_parameters_description_parameter">{'piwecard_website'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%websiteurl% : </span><span class="ecard_parameters_description_parameter">{'piwecard_website_url'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%ecardurl% : </span><span class="ecard_parameters_description_parameter">{'piwecard_ecard_url'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%ecardsubject% : </span><span class="ecard_parameters_description_parameter">{'piwecard_ecard_email_subject'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%ecardmessage% : </span><span class="ecard_parameters_description_parameter">{'piwecard_ecard_email_message'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%pictureurl% : </span><span class="ecard_parameters_description_parameter">{'piwecard_ecard_image_url'|@translate}</span><br />
+					<span class="ecard_parameters_description_parameter">%pictureinfos% : </span><span class="ecard_parameters_description_parameter">{'piwecard_ecard_image_infos'|@translate}</span>
+				</div>
+			</div>
 		</fieldset>
 		<div>
Index: /extensions/Piwecard/css/admin.css
===================================================================
--- /extensions/Piwecard/css/admin.css	(revision 20009)
+++ /extensions/Piwecard/css/admin.css	(revision 20010)
@@ -1,2 +1,22 @@
+#ECardAdminManage .ecard_radio {
+	margin-top: 0.5em;
+}
+
+#ECardAdminManage .ecard_radio #ecard_selected_cats_options {
+	margin-left: 5%;
+	margin-right: 5%;
+	margin-top: 1em;
+}
+
+#ECardAdminManage h3 {
+	font-size: 1.17em !important;
+}
+
+#ECardAdminManage #ecard_submit {
+	text-align: center;
+	margin-bottom: 2em;
+}
+
+
 #ECardAdminConsult .ecard_first_line {
 	text-align: left;
Index: /extensions/Piwecard/include/piwecard.class.php
===================================================================
--- /extensions/Piwecard/include/piwecard.class.php	(revision 20009)
+++ /extensions/Piwecard/include/piwecard.class.php	(revision 20010)
@@ -27,5 +27,5 @@
 	// Initialize default values of params
 	private function load_default_config() {
-	    require_once(ECARD_INSTALL_PATH.'default_values.inc.php');
+	    require(ECARD_INSTALL_PATH.'default_values.inc.php');
 	    foreach ($ecard_default_values as $key => $value) {
 		    if (!isset($this->my_config[$key]))
@@ -36,27 +36,7 @@
 	// Save  general configuration to config_database
 	function save_config() {
-		$query = 'UPDATE '.CONFIG_TABLE.' SET value="'.pwg_db_real_escape_string(serialize($this->my_config)).'" WHERE param="piwecard";';
-		$result = pwg_query($query);
-
-		if($result) 
-		  return true;
-		else
-		  return false;
-	}
-	
-
-	// Retrieve user groups 
-	function get_user_groups() {
-		global $user;
-		
-		$query = 'SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id=' . $user['id'] . ';';
-
-		$result = pwg_query($query);
-		while ($row = pwg_db_fetch_assoc($result)) {
-			array_push($this->user_groups, $row['group_id']);
-		}
-	}
-
-
+		conf_update_param('piwecard', pwg_db_real_escape_string(serialize($this->my_config)));
+	}
+	
 	function section_init_ecard() {
 		global $tokens, $page;
@@ -179,7 +159,4 @@
 	function display_ecard_to_picture() {
 		global $page, $user, $template;
-		
-		// Init user groups
-		$this->get_user_groups();
 
 		// Only on category page!
@@ -191,8 +168,5 @@
 				//	- if the parameter for "recursive" is OK
 				//	- if the upper category is activated for this function
-				$query = 'SELECT *
-							FROM '.CATEGORIES_TABLE.'
-							WHERE id = '.pwg_db_real_escape_string($page['category']['id']).'
-							;';
+				$query = 'SELECT * FROM '.CATEGORIES_TABLE.' WHERE id = '.pwg_db_real_escape_string($page['category']['id']).';';
 				$cat = pwg_db_fetch_assoc(pwg_query($query));
 				
@@ -211,10 +185,10 @@
 			}
 			
-			if ($this->my_config['user_cat']) {	// !Function only allowed on user image 
+			if ($this->my_config['authorizations'] == 'user_cats') {	// !Function only allowed on user image 
 				// Check the category name, user name et img author
 				// Get all name for upper categories and current category
 				if (isset($cat) and !empty($cat)) {
 					$catname[0] = $cat['name'];
-					if (isset($upper_ids) and $upper_ids != null) {
+					if (isset($upper_ids)) {
 						$nb=1;
 						foreach ($upper_ids as $upper_cat) {
@@ -235,160 +209,148 @@
 					$authorname = $img_infos['author'];
 				}
-			}		
-		
+			}
+			
 			// Only on available cats
-			if ($this->my_config['allcats']		// Available on all cats
-				OR (!empty($page['category']) AND in_array($page['category']['id'], $this->my_config['cats']))	// Available on specific cats
-				OR ($this->my_config['recursive'] AND isset($upper_ids) AND 				// Available on upper cats this recursiv mode
-						(array_intersect($upper_ids, $this->my_config['cats']) != array()))
-				OR	// Available based on usename
-					($this->my_config['user_cat']
-						AND (in_array($username, $catname)	// Available user categories
-								OR $username == $authorname)
-
-					) 
-				)
-			{
-			// And only available groups
-				if (empty($this->my_config['groups']) 
-					OR (!empty($this->my_config['groups'])
-						AND (array_intersect($this->user_groups, $this->my_config['groups']) != array())) 
-					)
-				{
-				
-					// Check if user is guest. 
-					// In this case, force mail to default mail (in params)
-					if (is_a_guest()) {
-						if (!empty($this->my_config['defaultmail']))
-							$user['email'] = $this->my_config['defaultmail'];
-					}
-				
-					// Template informations
-					$template->assign('ecard', array(
-							'subject'			=> l10n('ecard_send_title'),
-							'message' 			=> l10n('ecard_send_message'),
-							'sender_name' 		=> $user['username'],
-							'sender_email' 		=> $user['email'],
-							'recipient_name'	=> l10n('ecard_send_dest_name'),
-							'recipient_email' 	=> l10n('ecard_send_dest_mail'),
-							'copy'				=> $this->my_config['send_copy'] ? 'checked="checked"' : '',
-							'changemail' 		=> ($this->my_config['expmail_change'] ? '' : 'disabled="disabled"')
-							));
-
-					// Template add for the active parameter choice by the user
-					if ($this->my_config['active_parameter']) {	// Allowed for the user
-						$template->append('ecard_validity',array('id' => 0, 'name' => l10n('ecard_nolimit'), 'selected' => ($this->my_config['activ'] == 0 ? 'checked' : '')));
-						for($jj=5; $jj < 30; $jj+=5)
-							$template->append('ecard_validity',array('id' => $jj, 'name' => $jj , 'selected' => ($this->my_config['activ'] == $jj ? 'checked' : '')));
-					}
-								
-					// Template add for the send method to be chose, by the user
-					// default : text
-					$template->append('ecard_send_method',array('id' => 0, 'name' => l10n('ecard_maillink'), 'selected' => ($this->my_config['send_HTML'] ?  '' : 'checked')));
-					if ($this->my_config['send_HTML']) {	// Allowed for the user
-						$template->append('ecard_send_method',array('id' => 1, 'name' => l10n('ecard_mailhtml'), 'selected' => ($this->my_config['send_HTML'] ? 'checked' : '')));
-					}
-
-					// Send the card
-					if (isset($_POST['ecard_submit'])) {
-						$send_method = $_POST['ecard_send_method'];
-						
-						// If conf doesn't allow to modify the %votremail param, force it to user mail
-						if (!isset($_POST['ecard_sender_email']))
-							$_POST['ecard_sender_email'] = $user['email'];
-						
-						// Initialize the array for image element
-						$image_element = array();
-
-						// Get all image informations
-						$query = 'SELECT * FROM '.IMAGES_TABLE.' WHERE id='.$page['image_id'].' LIMIT 1;';
-						$result = pwg_query($query);
-						if (isset($result))
-							$image_element = mysql_fetch_array($result);
-						
-						// Generate random number
-						$image_element['next_element_id']  = $this->random(64);
-
-						// Image infos
-						if ($this->my_config['ecard_showinfos']) {
-							if (isset($image_element['name'])) {
-								$image_element['picture_infos'] = $image_element['name'];
-								if (isset($image_element['author']))
-									$image_element['picture_infos'] .= ' ('.$image_element['author'].')';
-							}
+			if (($this->my_config['authorizations'] == 'all_cats')		//Parameter : all_cats
+				OR ($this->my_config['authorizations'] == 'selected_cats' AND !empty($page['category']) AND in_array($page['category']['id'], $this->my_config['selected_cats']))	//Parameter : selected_cats but not recursive
+				OR ($this->my_config['authorizations'] == 'selected_cats' AND $this->my_config['recursive'] AND isset($upper_ids) AND (array_intersect($upper_ids, $this->my_config['selected_cats']) != array())) //Parameter : selected_cats and recursive
+				OR	($this->my_config['authorizations'] == 'user_cats' AND (in_array($username, $catname) OR $username == $authorname)) //Parameter : selected_cats and recursive
+			) {
+				// Check if user is guest. 
+				// In this case, force mail to default mail (in params)
+				if (is_a_guest()) {
+					if (!empty($this->my_config['default_guest_email']))
+						$user['email'] = $this->my_config['default_guest_email'];
+				}
+			
+				// Template informations
+				$template->assign('ecard', array(
+						'subject'			=> l10n('ecard_send_title'),
+						'message' 			=> l10n('ecard_send_message'),
+						'sender_name' 		=> $user['username'],
+						'sender_email' 		=> $user['email'],
+						'recipient_name'	=> l10n('ecard_send_dest_name'),
+						'recipient_email' 	=> l10n('ecard_send_dest_mail'),
+						'copy'				=> $this->my_config['sender_copy'] ? 'checked="checked"' : '',
+						'changemail' 		=> (!isset($user['email']) OR $this->my_config['sender_email_change']) ? '' : 'disabled="disabled"')
+						));
+
+				// Template add for the active parameter choice by the user
+				if ($this->my_config['validity_choice']) {
+					foreach($this->my_config['validity'] as $validity) {
+						$template->append('ecard_validity', array(
+																	'id' => $validity,
+																	'name' => ($validity == 0) ? l10n('ecard_nolimit') : $validity.' '.l10n('ecard_days'),
+																	'selected' => ($this->my_config['validity_default'] == $validity ? 'checked' : '')
+																)
+						);
+					}
+				}
+				
+				foreach ($this->my_config['email_format'] as $email_format) {
+					$template->append('ecard_send_method', array(
+																'id' => $email_format,
+																'name' => l10n('ecard_mail_format_'.$email_format),
+																'selected' => (($this->my_config['email_format_default'] == $email_format) ?  '' : 'checked')
+															)
+					);
+				}
+
+				// Send the card
+				if (isset($_POST['ecard_submit'])) {
+					$send_method = $_POST['ecard_send_method'];
+					
+					// If conf doesn't allow to modify the %votremail param, force it to user mail
+					if (!$this->my_config['sender_email_change'])
+						$_POST['ecard_sender_email'] = $user['email'];
+					
+					// Initialize the array for image element
+					$image_element = array();
+
+					// Get all image informations
+					$query = 'SELECT * FROM '.IMAGES_TABLE.' WHERE id='.$page['image_id'].' LIMIT 1;';
+					$result = pwg_query($query);
+					if (isset($result))
+						$image_element = mysql_fetch_array($result);
+					
+					// Generate random number
+					$image_element['next_element_id']  = $this->random(64);
+
+					// Image infos
+					if ($this->my_config['show_image_infos']) {
+						if (isset($image_element['name'])) {
+							$image_element['picture_infos'] = $image_element['name'];
+							if (isset($image_element['author']))
+								$image_element['picture_infos'] .= ' ('.$image_element['author'].')';
 						}
-
-						$insert = array(
-									'id' 				=> $image_element['next_element_id'],
-									'sender_name' 		=> $_POST['ecard_sender_name'],
-									'recipient_name' 	=> $_POST['ecard_recipient_name'],
-									'sender_email' 		=> $_POST['ecard_sender_email'],
-									'recipient_email' 	=> $_POST['ecard_recipient_email'],
-									'subject' 			=> $_POST['ecard_subject'],
-									'message' 			=> $_POST['ecard_message'],
-									'image' 			=> $image_element['id'],
-									'date_creation' 	=> date("Y-m-d H:i:s"),
-						);
-						if ($_POST['ecard_validity'] != '0') {
-							$date = new DateTime();
-							$date->modify("+".$_POST['ecard_validity']." day");
-							$insert['date_validity'] = $date->format('Y-m-d H:i:s');
-						}
-						single_insert(ECARD_TABLE, $insert);
-						
-						// Complete the image_element array with Link for the ecard url to be added in the mail
-						set_make_full_url();
-						$ecard_url = embellish_url(get_absolute_root_url() . './index.php?/ecard/'.$image_element['next_element_id']);
-						$image_element['ecard_url'] = $ecard_url;
-						unset_make_full_url();
-						
-						// Complete the image_element with the url to point to the image url
-						set_make_full_url();
-						$image_element['picture_url'] = duplicate_picture_url(
-							array(
-								'image_id' => $image_element['id'],
-								'image_file' => $image_element['file']
-							),
-							array('start')
-						);
-						unset_make_full_url();
-
-						$mail_subject = htmlspecialchars_decode($this->parse( $this->my_config['subject_link'], $_POST));
-						
-						switch($send_method) {
-							case 0 : // text
-								// Get the standard message (in admin param) and parse it with the informations
-								$mail_message =  stripslashes(htmlspecialchars_decode($this->parse($this->my_config['message_link'], $_POST, $image_element)));
-								$mail_arg=array('from' 				=> $_POST['ecard_sender_email'],
-												'subject'	 		=> $mail_subject,
-												'content' 			=> $mail_message,
-												'content_format' 	=> "text/plain",
-												'email_format' 		=> "text/html"
-												);
-								break;
-							case 1 : // html
-								$mail_message_HTML =  stripslashes(htmlspecialchars_decode($this->parse($this->my_config['message_HTML'], $_POST, $image_element)));
-								$mail_arg=array('from' => $_POST['ecard_sender_email'],
-												'subject' => $mail_subject,
-												'content' => $mail_message_HTML,
-												'content_format' => "text/html",
+					}
+
+					$insert = array(
+								'id' 				=> $image_element['next_element_id'],
+								'sender_name' 		=> $_POST['ecard_sender_name'],
+								'recipient_name' 	=> $_POST['ecard_recipient_name'],
+								'sender_email' 		=> $_POST['ecard_sender_email'],
+								'recipient_email' 	=> $_POST['ecard_recipient_email'],
+								'subject' 			=> $_POST['ecard_subject'],
+								'message' 			=> $_POST['ecard_message'],
+								'image' 			=> $image_element['id'],
+								'date_creation' 	=> date("Y-m-d H:i:s"),
+					);
+					if ($_POST['ecard_validity'] != '0') {
+						$date = new DateTime();
+						$date->modify("+".$_POST['ecard_validity']." day");
+						$insert['date_validity'] = $date->format('Y-m-d H:i:s');
+					}
+					single_insert(ECARD_TABLE, $insert);
+					
+					// Complete the image_element array with Link for the ecard url to be added in the mail
+					set_make_full_url();
+					$ecard_url = embellish_url(get_absolute_root_url() . './index.php?/ecard/'.$image_element['next_element_id']);
+					$image_element['ecard_url'] = $ecard_url;
+					unset_make_full_url();
+					
+					// Complete the image_element with the url to point to the image url
+					set_make_full_url();
+					$image_element['picture_url'] = duplicate_picture_url(
+						array(
+							'image_id' => $image_element['id'],
+							'image_file' => $image_element['file']
+						),
+						array('start')
+					);
+					unset_make_full_url();
+
+					$email_subject = htmlspecialchars_decode($this->parse( $this->my_config['email_subject'], $_POST));
+					$email_message = htmlspecialchars_decode($this->parse($this->my_config['email_'.$this->my_config['email_format']], $_POST, $image_element));
+					$email_arg=array(	'from' => $_POST['ecard_sender_email'],
+										'subject'	 		=> $email_subject,
+										'content' 			=> $email_message,
+									);
+									
+					switch($send_method) {
+						case 'text': // text
+							$email_arg=array(	'content_format' 	=> "text/plain",
+												'email_format' 		=> "text/plain"
+											);
+							break;
+						case 'html': // html
+							$email_arg=array(	'content_format' => "text/html",
 												'email_format' => "text/html"
-												);
-								break;
-							default:
-								break;
-						}
-						
-						// Add the copy to expe if param.
-						if (isset($_POST['ecard_copy']))	// send copy to sender
-							$mail_arg['Bcc'] = array((isset($_POST['ecard_sender_email']) ? $_POST['ecard_sender_email'] : $user['email']));
-						
-						// Send the mail
-						pwg_mail($_POST['ecard_recipient_email'], $mail_arg);
-					}
-					
-					$template->set_filenames(array('ecard_template' =>  ECARD_ROOT.'/template/ecard.tpl'));
-					$template->concat('COMMENT_IMG', $template->parse('ecard_template', true));
-				}
+											);
+							break;
+						default:
+							break;
+					}
+					
+					// Add the copy to expe if param.
+					if (isset($_POST['ecard_copy']))	// send copy to sender
+						$email_arg['Bcc'] = array((isset($_POST['ecard_sender_email']) ? $_POST['ecard_sender_email'] : $user['email']));
+					
+					// Send the mail
+					pwg_mail($_POST['ecard_recipient_email'], $email_arg);
+				}
+				
+				$template->set_filenames(array('ecard_template' =>  ECARD_ROOT.'/template/ecard.tpl'));
+				$template->concat('COMMENT_IMG', $template->parse('ecard_template', true));
 			}
 		}
Index: /extensions/Piwecard/install/default_values.inc.php
===================================================================
--- /extensions/Piwecard/install/default_values.inc.php	(revision 20009)
+++ /extensions/Piwecard/install/default_values.inc.php	(revision 20010)
@@ -1,11 +1,20 @@
 <?php
-$ecard_default_values['site_name'] = ""; // Site Name
-$ecard_default_values['allcats'] = false;;	// active plugin on all categories
-$ecard_default_values['cats'] = array();;	// List of all categories where the plugin is active
-$ecard_default_values['send_copy'] = false; // Send a copy to sender
-$ecard_default_values['only_link'] = true; // Send only a link to the ecard in the mail
+//Manage parameters
+$ecard_default_values['authorizations'] = 'selected_cats';			//Determine the page from which the user can send ecard : 'all_cats' (all categories the user can access), 'selected_cats' (only the categories defined in the parameter 'selected_cats') or 'user_cats' (only the categories which are named like the user)
+$ecard_default_values['selected_cats'] = array();					//List of categories where the plugin is active
+$ecard_default_values['recursive'] = true;							//Active recursivity to activate plugin on top categories ==> all the subcats are active
 
-// message for the mail when only a link is sent
-$ecard_default_values['message_link'] = 
+//Params parameters
+$ecard_default_values['validity'] = array(0, 5, 10, 15);		 	//Number of days a card is available
+$ecard_default_values['validity_default'] = 10; 					//Default number of days a card is available
+$ecard_default_values['validity_choice'] = true;					//Add function for a user to choose the valid duration of an ecard
+$ecard_default_values['sender_copy'] = false;						//Send a copy to sender
+$ecard_default_values['sender_email_change'] = false;				//Possibility for the user to change the sender email
+$ecard_default_values['email_format'] = array('text', 'html');		//Type of mail sent : 'text' or 'html' or both
+$ecard_default_values['email_format_default'] = array('text', 'html');		//Type of mail sent : 'text' or 'html' or both
+$ecard_default_values['show_image_infos'] = true;					//Default : show infos under the image in ecard
+$ecard_default_values['default_guest_email'] = '';	    			//Default email used for guest user
+$ecard_default_values['email_subject'] = "Une eCard vous a ete envoyee par %yourname%"; //Subject of the email for plain text emails
+$ecard_default_values['email_text'] = 
 "Bonjour %recipientname% ! 
 %yourname% vous a envoy&eacute; une eCard depuis le site %website%. 
@@ -13,18 +22,5 @@
 A bientot sur %website% (%websiteurl% ) !
 Le Webmaster";
-
-$ecard_default_values['subject_link'] = "Une eCard vous a ete envoyee par %yourname%"; // subject of the mail when only a link is sent
-
-$ecard_default_values['groups'] = array(); // Groups
-$ecard_default_values['activ'] = 10; // nb of days a card is available
-
-$ecard_default_values['user_cat'] = false; 	// active plugin only on user categories (categorie name = user name; for ex. cat = toto.abc and username = toto.abc)
-$ecard_default_values['expmail_change'] = false; 	// possibility for the user to change the exp mail
-$ecard_default_values['recursive'] = false; 	// Active recursivity to only activate plugin on top categories ==> all the subcats are active
-$ecard_default_values['send_HTML'] = false; 	// Send a complete HTML mail with image attachement
-$ecard_default_values['nb_ecard_page'] = 10; // nb of ecard per page listed in the admin page
-
-$ecard_default_values['active_parameter'] = true;	// Add function for a user to choice the valid duration for an ecard
-$ecard_default_values['message_HTML'] =
+$ecard_default_values['email_html'] =
 'Bonjour %recipientname% ! 
 <b>%yourname%</b> vous a envoy&eacute; une eCard depuis le site <a href="%websiteurl%">%website%</a> :
@@ -37,5 +33,5 @@
 Le Webmaster';
 
-$ecard_default_values['ecard_showinfos']	= true;	// Default : show infos under image in ecard
-$ecard_default_values['defaultmail']	    = '';	    // Default mail used for guest user
+//Consult parameters
+$ecard_default_values['nb_ecard_page'] = '10';						//Number of ecard per page listed in the admin page
 ?>
Index: /extensions/Piwecard/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/Piwecard/language/en_UK/plugin.lang.php	(revision 20009)
+++ /extensions/Piwecard/language/en_UK/plugin.lang.php	(revision 20010)
@@ -1,8 +1,3 @@
 <?php
-/*
- * Plugin Name: Piwecard
- * File :  plugin.lang.php
-* Lang : EN
- */
 
 
@@ -51,6 +46,10 @@
 $lang['ecard_publish_bottom']			= 'This eCard was sent by ';
 
-// Admin
-$lang['ecard_admin_saveOK']				= 'Config saved';
+//Admin
+$lang['ecard_admin_saveOK']				= 'Configuration saved';
+
+//admin_manage.php
+$lang['selected_cats']					= 'Selected categories';
+$lang['non_selected_cats']				= 'Non selected categories';
 
 $lang['ecard_management']				= 'Piwecard Management';
@@ -80,16 +79,5 @@
 $lang['ecard_message_link']				= 'Message sent (mail for link mode only)';
 $lang['ecard_message_html']				= 'Message sent (mail HTML with photo)';
-$lang['ecard_parameters'] = '<b><u>Parameters</u></b>:<br> 
-<b>%yourname%</b>    ==> Sender name<br>
-<b>%youremail%</b>   ==> Sender mail<br>
-<b>%recipientname%</b>      ==> Receiver name<br>
-<b>%recipientemail%</b>     ==> Receiver mail<br>
-<b>%website%</b>        ==> Site name (Piwigo standard config)<br>
-<b>%websiteurl%</b>    ==> Site link (Piwigo standard config)<br>
-<b>%ecardurl%</b>      ==> Link to eCard page<br>
-<b>%ecardsubject%</b>       ==> eCard subject (write by user)<br>
-<b>%ecardmessage%</b>     ==> eCard message (write by user)<br>
-<b>%pictureurl%</b>      ==> Link to photo<br>
-<b>%pictureinfos%</b>    ==> Photo information (name and author)';
+$lang['ecard_parameters'] 				= 'Parameters';
 
 $lang['ecard_admin_consult']					= 'List';
Index: /extensions/Piwecard/language/es_ES/plugin.lang.php
===================================================================
--- /extensions/Piwecard/language/es_ES/plugin.lang.php	(revision 20009)
+++ /extensions/Piwecard/language/es_ES/plugin.lang.php	(revision 20010)
Index: /extensions/Piwecard/language/sk_SK/description.txt
===================================================================
--- /extensions/Piwecard/language/sk_SK/description.txt	(revision 20009)
+++ /extensions/Piwecard/language/sk_SK/description.txt	(revision 20010)
Index: /extensions/Piwecard/language/sk_SK/index.php
===================================================================
--- /extensions/Piwecard/language/sk_SK/index.php	(revision 20009)
+++ /extensions/Piwecard/language/sk_SK/index.php	(revision 20010)
Index: /extensions/Piwecard/language/sk_SK/plugin.lang.php
===================================================================
--- /extensions/Piwecard/language/sk_SK/plugin.lang.php	(revision 20009)
+++ /extensions/Piwecard/language/sk_SK/plugin.lang.php	(revision 20010)
Index: /extensions/Piwecard/language/sv_SE/index.php
===================================================================
--- /extensions/Piwecard/language/sv_SE/index.php	(revision 20009)
+++ /extensions/Piwecard/language/sv_SE/index.php	(revision 20010)
Index: /extensions/Piwecard/language/sv_SE/plugin.lang.php
===================================================================
--- /extensions/Piwecard/language/sv_SE/plugin.lang.php	(revision 20009)
+++ /extensions/Piwecard/language/sv_SE/plugin.lang.php	(revision 20010)
Index: /extensions/Piwecard/main.inc.php
===================================================================
--- /extensions/Piwecard/main.inc.php	(revision 20009)
+++ /extensions/Piwecard/main.inc.php	(revision 20010)
@@ -32,15 +32,15 @@
 load_language('plugin.lang', ECARD_PATH);	
 
-$ecard = new Piwecard();
+$piwecard = new Piwecard();
 
 // Add ecard to picture page
-add_event_handler('loc_end_picture', array(&$ecard, 'display_ecard_to_picture')); 
+add_event_handler('loc_end_picture', array(&$piwecard, 'display_ecard_to_picture')); 
 
-add_event_handler('loc_end_section_init', array(&$ecard, 'section_init_ecard'));
-add_event_handler('loc_end_index', array(&$ecard, 'index_ecard'));
+add_event_handler('loc_end_section_init', array(&$piwecard, 'section_init_ecard'));
+add_event_handler('loc_end_index', array(&$piwecard, 'index_ecard'));
 
 add_event_handler('loc_end_page_header', 'css_js_ecard');
 
-set_plugin_data($plugin['id'], $ecard);
+set_plugin_data($plugin['id'], $piwecard);
 
 /* +-----------------------------------------------------------------------+
Index: /extensions/Piwecard/publish.php
===================================================================
--- /extensions/Piwecard/publish.php	(revision 20009)
+++ /extensions/Piwecard/publish.php	(revision 20010)
@@ -10,9 +10,9 @@
 
 if (isset($ecard_id) and $ecard_id != '' and $ecard->is_valid($ecard_id)) {
-	$query = 'SELECT * FROM '.ECARD_TABLE.' WHERE numero = "'.$ecard_id.'";';
+	$query = 'SELECT * FROM '.ECARD_TABLE.' WHERE id = "'.$ecard_id.'";';
 	$result = pwg_query($query);
 	$result_array = pwg_db_fetch_assoc($result);
 
-	if (isset($result_array['numero'])) {
+	if (isset($result_array['id'])) {
 		//Recover img infos.
 		$query = 'SELECT DISTINCT * FROM '.IMAGES_TABLE.' AS img WHERE img.id = '.$result_array['image'].';';
@@ -32,5 +32,5 @@
 		//Assign variables to template
 		$template->assign('ecard', array(
-				'subject' 		=> $result_array['sujet'],
+				'subject' 		=> $result_array['subject'],
 				'image' 		=> $result_array['image'],
 				'message' 		=> $result_array['message'],
@@ -38,8 +38,8 @@
 				'name' 			=> $row['name'],
 				'image' 		=> DerivativeImage::url(IMG_LARGE, $row),
-				'sender_email' 	=> $result_array['adrexp'],
-				'sender_name' 	=> $result_array['nomexp'],
-				'image_title'	=> $ecard->my_config['ecard_showinfos'] ? $row['name'] : null,
-				'image_author' 	=> $ecard->my_config['ecard_showinfos'] ? $row['author'] : null
+				'sender_email' 	=> $result_array['sender_email'],
+				'sender_name' 	=> $result_array['sender_name'],
+				'image_title'	=> $ecard->my_config['show_image_infos'] ? $row['name'] : null,
+				'image_author' 	=> $ecard->my_config['show_image_infos'] ? $row['author'] : null
 				));
 		
Index: /extensions/Piwecard/template/ecard.tpl
===================================================================
--- /extensions/Piwecard/template/ecard.tpl	(revision 20009)
+++ /extensions/Piwecard/template/ecard.tpl	(revision 20010)
@@ -97,5 +97,5 @@
 					<span class="ecard_label">{'ecard_send_exp'|@translate}<span class="ecard_mandatory_fields">*</span> :</span>
 					<span class="ecard_name"><input name="ecard_sender_name" type="text" id="ecard_sender_name" maxlength="100" value="{$ecard.sender_name}"></span>
-					<span class="ecard_email"><input name="ecard_sender_email" type="text" id="ecard_sender_email" maxlength="100" {$ecard.changemail}  value="{$ecard.sender_email}" onfocus="ecard_clearDefaultText(this, '{$ecard.sender_email}');" onblur="ecard_checkField(this, 1);"></span>
+					<span class="ecard_email"><input name="ecard_sender_email" type="text" id="ecard_sender_email" maxlength="100" {$ecard.changemail} value="{$ecard.sender_email}" onfocus="ecard_clearDefaultText(this, '{$ecard.sender_email}');" onblur="ecard_checkField(this, 1);"></span>
 				</div>
 				<div class="ecard_field">
