Index: /extensions/ContactForm/admin/config.php
===================================================================
--- /extensions/ContactForm/admin/config.php	(revision 17944)
+++ /extensions/ContactForm/admin/config.php	(revision 17945)
@@ -14,5 +14,4 @@
     'cf_mandatory_name' =>    isset($_POST['cf_mandatory_name']),
     'cf_mail_type' =>         $_POST['cf_mail_type'],
-    'cf_admin_mails' =>       $conf['ContactForm']['cf_admin_mails'],
     );
   $conf['ContactForm_before'] = $_POST['cf_before'];
@@ -34,5 +33,5 @@
   ));
 
-$template->set_filename('contact_form', dirname(__FILE__).'/template/config.tpl');
+$template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/config.tpl'));
 
 ?>
Index: /extensions/ContactForm/admin/emails.php
===================================================================
--- /extensions/ContactForm/admin/emails.php	(revision 17944)
+++ /extensions/ContactForm/admin/emails.php	(revision 17945)
@@ -5,4 +5,5 @@
 if (isset($_POST['save_emails']))
 {
+  var_dump($_POST);
   $emails = array();
   foreach ($_POST['emails'] as $entry)
@@ -16,14 +17,23 @@
     else
     {
+      if ($entry['group_name'] == -1) $entry['group_name'] = null;
+      
       array_push($emails, array(
         'name' => $entry['name'],
         'email' => $entry['email'],
-        'active' => isset($entry['active']),
+        'group_name' => $entry['group_name'],
+        'active' => boolean_to_string(isset($entry['active'])),
         ));
     }
   }
   
-  $conf['ContactForm']['cf_admin_mails'] = $emails;
-  conf_update_param('ContactForm', serialize($conf['ContactForm']));
+  pwg_query('TRUNCATE TABLE `'. CONTACT_FORM_TABLE. '`');
+  
+  mass_inserts(
+    CONTACT_FORM_TABLE,
+    array('name','email','group_name','active'),
+    $emails
+    );
+  
   array_push($page['infos'], l10n('Information data registered in database'));
 }
@@ -31,7 +41,30 @@
 
 // display emails
-$template->assign('EMAILS', $conf['ContactForm']['cf_admin_mails']);
+$query = '
+SELECT *
+  FROM '. CONTACT_FORM_TABLE .'
+  ORDER BY
+    group_name ASC,
+    name ASC
+';
+$result = pwg_query($query);
 
-$template->set_filename('contact_form', dirname(__FILE__).'/template/emails.tpl');
+$emails = $groups = array();
+while ($data = pwg_db_fetch_assoc($result))
+{
+  $data['active'] = get_boolean($data['active']);
+  array_push($emails, $data);
+  if (!empty($data['group_name']))
+  {
+    array_push($groups, $data['group_name']);
+  }
+}
+
+$template->assign(array(
+  'EMAILS' => $emails,
+  'GROUPS' => array_unique($groups),
+  ));
+
+$template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/emails.tpl'));
 
 ?>
Index: /extensions/ContactForm/admin/template/config.tpl
===================================================================
--- /extensions/ContactForm/admin/template/config.tpl	(revision 17944)
+++ /extensions/ContactForm/admin/template/config.tpl	(revision 17945)
@@ -53,5 +53,5 @@
         <label>
           <input type="text" name="cf_default_subject" value="{$cf_default_subject}" size="50">
-          {'Default e-mail subject'|@translate}
+          {'Default e-mail subject'|@translate} ({'can be translated with LocalFiles Editor plugin'|@translate})
         </label>
       </li>
@@ -59,5 +59,5 @@
         <label>
           <input type="text" name="cf_subject_prefix" value="{$cf_subject_prefix}" size="50">
-          {'Prefix of the sent e-mail subject (you can use "%gallery_title%")'|@translate}
+          {'Prefix of the sent e-mail subject'|@translate} ({'you can use "%gallery_title%"'|@translate})
         </label>
       </li>
Index: /extensions/ContactForm/admin/template/emails.tpl
===================================================================
--- /extensions/ContactForm/admin/template/emails.tpl	(revision 17944)
+++ /extensions/ContactForm/admin/template/emails.tpl	(revision 17945)
@@ -1,17 +1,9 @@
 {combine_css path=$CONTACT_FORM_PATH|@cat:"admin/template/style.css"}
 
-{footer_script}{literal}
-jQuery(document).on('change', '.delete', function() {
-  if ($(this).is(':checked')) {
-    $(this).parents('tr').addClass('delete');
-  } else {
-    $(this).parents('tr').removeClass('delete');
-  }
-});
-{/literal}{/footer_script}
 
 <div class="titrePage">
 	<h2>Contact Form</h2>
 </div>
+
 
 <form method="post" action="{$CONTACT_FORM_ADMIN}-emails" class="properties">
@@ -20,4 +12,5 @@
       <th>{'Name'|@translate}</th>
       <th>{'Email address'|@translate}</th>
+      <th>{'Category'|@translate}</th>
       <th>{'Active'|@translate}</th>
       <th>{'Delete'|@translate}</th>
@@ -27,8 +20,14 @@
     <tr class="{if $i is odd}row1{else}row2{/if}">
       <td>
-        <input type="text" name="emails[{$i}][name]" value="{$entry.name}" size="20">
+        <input type="text" name="emails[{$i}][name]" value="{$entry.name|escape:html}" size="20">
       </td>
       <td>
         <input type="text" name="emails[{$i}][email]" value="{$entry.email}" size="30">
+      </td>
+      <td>
+        <select name="emails[{$i}][group_name]" class="groups">
+          <option value="-1">------------</option>
+          {html_options values=$GROUPS output=$GROUPS selected=$entry.group_name}
+        </select>
       </td>
       <td style="text-align:center;">
@@ -42,20 +41,43 @@
   {/foreach}
     <tr class="{if $i is odd}row1{else}row2{/if}" id="addEntryContainer">
-      <td colspan="4">
+      <td colspan="2" style="text-align:center;">
         <a id="addEntry">{'+ Add an email'|@translate}</a>
+      </td>
+      <td>
+        <a id="addGroup">{'+ Add a category'|@translate}</a>
+      </td>
+      <td colspan="2"  style="text-align:center;">
+        <input type="submit" name="save_emails" value="{'Submit'|@translate}" class="submit">
       </td>
     </tr>
   </table>
   {footer_script}var entry = {$i};{/footer_script}
-
-  <p><input type="submit" name="save_emails" value="{'Submit'|@translate}" class="submit"></p>
 </form>
 
-{footer_script}{literal}
+
+
+{footer_script}
+var group_options = new Array;
+{foreach from=$GROUPS item=entry}
+group_options[group_options.length] = '<option value="{$entry|escape:javascript}">{$entry|escape:javascript}</option>';
+{/foreach}
+
+{literal}
+var doBlink = function(obj,start,finish) { jQuery(obj).fadeOut(300).fadeIn(300); if(start!=finish) { start=start+1; doBlink(obj,start,finish); } };
+jQuery.fn.blink = function(start,finish) { return this.each(function() { doBlink(this,start,finish) }); };
+
+jQuery(document).on('change', '.delete', function() {
+  if ($(this).is(':checked')) {
+    $(this).parents('tr').addClass('delete');
+  } else {
+    $(this).parents('tr').removeClass('delete');
+  }
+});
+
 jQuery('#addEntry').click(function() {
   entry++;
   i = entry;
   
-  $('#emails').append(
+  content =
     '<tr class="row'+ (i%2+1) +'">'+
       '<td>'+
@@ -64,4 +86,12 @@
       '<td>'+
         '<input type="text" name="emails['+ i +'][email]" size="30">'+
+      '</td>'+
+      '<td>'+
+        '<select name="emails['+ i +'][group_name]" class="groups">'+
+          '<option value="-1">------------</option>';
+          for (var j in group_options) {
+            content+= group_options[j];
+          }
+        content+= '</select>'+
       '</td>'+
       '<td style="text-align:center;">'+
@@ -72,5 +102,5 @@
       '</td>'+
     '</tr>'
-    );
+  $('#emails').append(content);
     
   $('#addEntryContainer')
@@ -79,3 +109,13 @@
     .appendTo($('#emails'));
 });
+
+jQuery('#addGroup').click(function() {
+  name = prompt("{/literal}{'Name'|@translate}{literal}:");
+  if (name != null && name != "") {
+    name = name.replace(new RegExp('"','g'),"'");
+    content = '<option value="'+ name +'">'+ name +'</option>';
+    group_options[group_options.length] = content;
+    $("select.groups").append(content).blink(1,2);
+  }
+});
 {/literal}{/footer_script}
Index: /extensions/ContactForm/admin/template/style.css
===================================================================
--- /extensions/ContactForm/admin/template/style.css	(revision 17944)
+++ /extensions/ContactForm/admin/template/style.css	(revision 17945)
@@ -1,7 +1,17 @@
-#emails input[type="text"] {
+#emails input[type="text"], select {
   margin:2px 10px !important;
 }
 
-tr.delete input {
+tr.delete input, tr.delete select {
   opacity:0.5;
 }
+
+#addEntry {
+  display:inline-block;
+  padding:2px 5px;
+  margin:4px;
+  border-width:1px;
+  border-style:solid;
+  border-radius:10px;
+  font-weight:bold;
+}
Index: /extensions/ContactForm/include/contact_form.inc.php
===================================================================
--- /extensions/ContactForm/include/contact_form.inc.php	(revision 17944)
+++ /extensions/ContactForm/include/contact_form.inc.php	(revision 17945)
@@ -15,8 +15,9 @@
 {
   $contact = array(
-    'author' => trim($_POST['author']),
-    'email' => trim($_POST['email']),
-    'subject' =>   trim($_POST['subject']),
-    'content' =>   $_POST['content'],
+    'author' =>  trim($_POST['author']),
+    'email' =>   trim($_POST['email']),
+    'group' =>   @$_POST['group'],
+    'subject' => trim($_POST['subject']),
+    'content' => $_POST['content'],
    );
   
@@ -47,4 +48,5 @@
       'author' => $user['username'],
       'email' => $user['email'],
+      'group' => null,
       'subject' => l10n($conf['ContactForm']['cf_default_subject']),
       'content' => null,
@@ -67,4 +69,22 @@
 }
 
+$query = '
+SELECT DISTINCT group_name
+  FROM '. CONTACT_FORM_TABLE .'
+  ORDER BY group_name
+;';
+$result = pwg_query($query);
+
+$groups = array();
+while ($data = pwg_db_fetch_assoc($result))
+{
+  $groups[ $data['group_name'] ] = !empty($data['group_name']) ? l10n($data['group_name']) : l10n('Default');
+}
+
+if (count($groups) > 1)
+{
+  $template->assign('GROUPS', $groups);
+}
+
 $template->assign(array(
   'contact' => $contact,
@@ -77,5 +97,5 @@
   ));
 
-$template->set_filename('index', dirname(__FILE__).'/../template/contact_form.tpl');
+$template->set_filename('index', realpath(CONTACT_FORM_PATH . 'template/contact_form.tpl'));
 
 ?>
Index: /extensions/ContactForm/include/functions.inc.php
===================================================================
--- /extensions/ContactForm/include/functions.inc.php	(revision 17944)
+++ /extensions/ContactForm/include/functions.inc.php	(revision 17945)
@@ -86,9 +86,14 @@
       'name' => $row['username'],
       'email' => $row['email'],
-      'active' => true,
+      'active' => 'true',
       ));
   }
   
-  $conf['ContactForm']['cf_admin_mails'] = $emails;
+  mass_inserts(
+    CONTACT_FORM_TABLE,
+    array('name','email','active'),
+    $email
+    );
+  
   $conf['ContactForm']['cf_must_initialize'] = false;
   conf_update_param('ContactForm', serialize($conf['ContactForm']));
@@ -107,4 +112,11 @@
     $conf_mail = get_mail_configuration();
   }
+  
+  $query = '
+SELECT DISTINCT group_name
+  FROM '. CONTACT_FORM_TABLE .'
+  ORDER BY group_name
+;';
+  $groups = array_from_query($query, 'group_name');
   
   $comm = array_merge($comm,
@@ -159,4 +171,12 @@
   }
   
+  // check group
+  if ( count($groups) > 1 and $comm['group'] == -1 )
+  {
+    $comm['group'] = true;
+    array_push($page['errors'], l10n('Please choose a category'));
+    $comment_action='reject';
+  }
+  
   // check content
   if (empty($comm['content']))
@@ -186,5 +206,5 @@
   
   // get admin emails
-  $emails = get_contact_emails();
+  $emails = get_contact_emails($comm['group']);
   if (!count($emails))
   {
@@ -281,6 +301,10 @@
 /**
  * get contact emails
- */
-function get_contact_emails()
+ * @param mixed group:
+ *    - bool true:    all emails
+ *    - empty string: emails without group
+ *    - string:       emails with the specified group
+ */
+function get_contact_emails($group=true)
 {
   global $conf;
@@ -288,11 +312,31 @@
   include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
   
+  $where = '1=1';
+  if ($group!==true)
+  {
+    if (empty($group))
+    {
+      $where = 'group_name IS NULL';
+    }
+    else
+    {
+      $where = 'group_name="'.$group.'"';
+    }
+  }
+  
+  $query = '
+SELECT *
+  FROM '. CONTACT_FORM_TABLE .'
+  WHERE 
+    '.$where.'
+    AND active = "true"
+  ORDER BY name ASC
+';
+  $result = pwg_query($query);
+  
   $emails = array();
-  foreach ($conf['ContactForm']['cf_admin_mails'] as $data)
-  {
-    if ($data['active'])
-    {
-      array_push($emails, format_email($data['name'], $data['email']));
-    }
+  while ($data = pwg_db_fetch_assoc($result))
+  {
+    array_push($emails, format_email($data['name'], $data['email']));
   }
   
Index: /extensions/ContactForm/include/install.inc.php
===================================================================
--- /extensions/ContactForm/include/install.inc.php	(revision 17944)
+++ /extensions/ContactForm/include/install.inc.php	(revision 17945)
@@ -4,5 +4,18 @@
 function contact_form_install()
 {
-  global $conf;
+  global $conf, $prefixeTable;
+  
+  // email table
+  $query = '
+CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'contact_form` (
+  `id` smallint(5) NOT NULL AUTO_INCREMENT,
+  `name` varchar(128) NOT NULL,
+  `email` varchar(128) NOT NULL,
+  `active` enum("true","false") NOT NULL DEFAULT "true",
+  `group_name` varchar(128) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `UNIQUE` (`email`,`group_name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;';
+  pwg_query($query);
 
   // configuration
@@ -19,5 +32,4 @@
       'cf_redirect_delay' => 5,
       'cf_mail_type' => 'text/html',
-      'cf_admin_mails' => array(),
       ));
     
@@ -37,19 +49,34 @@
     if (!isset($new_conf['cf_must_initialize']))
     {
+      // new params
       $new_conf['cf_must_initialize'] = false;
       $new_conf['cf_default_subject'] = 'A comment on your site';
       $new_conf['cf_mail_type'] = 'text/html';
-      unset($new_conf['comment'], $new_conf['cf_redirect_delay'], $new_conf['cf_separator'], $new_conf['cf_separator_length']);
       
+      // move emails to database
+      $email = array();
       foreach ($new_conf['cf_admin_mails'] as $email => $data)
       {
-        $new_conf['cf_admin_mails'][] = array(
+        array_push($emails, array(
           'email' => $email,
           'name' => $data['NAME'],
-          'active' => $data['ACTIVE'],
-          );
-        unset($new_conf['cf_admin_mails'][ $email ]);
+          'active' => boolean_to_string($data['ACTIVE']),
+          ));
       }
       
+      mass_inserts(
+        $prefixeTable .'contact_form',
+        array('name','email','active'),
+        $emails
+        );
+      
+      // old params
+      unset(
+        $new_conf['comment'], $new_conf['cf_redirect_delay'], 
+        $new_conf['cf_separator'], $new_conf['cf_separator_length'], 
+        $new_conf['cf_admin_mails']
+        );
+      
+      // save config
       $conf['ContactForm'] = serialize($new_conf);
       $conf['ContactForm_before'] = stripslashes($conf['persoformtop']);
Index: /extensions/ContactForm/language/bg_BG/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/bg_BG/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/bg_BG/plugin.lang.php	(revision 17945)
@@ -39,6 +39,6 @@
 $lang['Please enter a message'] = 'Моля въведете съобщение';
 $lang['Error while sending e-mail'] = 'Грешка при изпращане на e-mail';
-
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Префикс на изпращания имейл обект (Може да използвате "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Префикс на изпращания имейл обект';
+$lang['you can use "%gallery_title%"'] = 'Може да използвате "%gallery_title%"';
 $lang['Plain text'] = 'Свободен текст';
 $lang['No active email address'] = 'Неактивет имейл адрес';
Index: /extensions/ContactForm/language/cs_CZ/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/cs_CZ/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/cs_CZ/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a message'] = 'Prosím zadejte zprávu';
 $lang['Error while sending e-mail'] = 'Nastala chyba při odeslání zprávy';
-
 $lang['%s must not be more than %d characters long'] = '%s nesmí být delší než %d znaků';
 $lang['+ Add an email'] = '+ Přidat email';
@@ -48,5 +47,6 @@
 $lang['Plain text'] = 'Prostý text';
 $lang['Please enter an e-mail'] = 'Prosím, vložte e-mail';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Předpona poslaného e-mail předmětu (můžete použít "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Předpona poslaného e-mail předmětu';
+$lang['you can use "%gallery_title%"'] = 'můžete použít "%gallery_title%"';
 $lang['%s must not be less than %d characters long'] = '%s nesmí být kratší než %d znaků';
 ?>
Index: /extensions/ContactForm/language/da_DK/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/da_DK/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/da_DK/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a message'] = 'Angiv en beskred';
 $lang['Error while sending e-mail'] = 'Fejl ved afsendelse af e-mail';
-
 $lang['%s must not be less than %d characters long'] = '%s må ikke være kortere end %d karakterer';
 $lang['%s must not be more than %d characters long'] = '%s må ikke være længere end %d karakterer';
@@ -49,4 +48,5 @@
 $lang['Plain text'] = 'Ren tekst';
 $lang['Please enter an e-mail'] = 'Angiv en email adresse';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Præfix for email emne (du kan anvende "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Præfix for email emne';
+$lang['you can use "%gallery_title%"'] = 'du kan anvende "%gallery_title%"';
 ?>
Index: /extensions/ContactForm/language/de_DE/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/de_DE/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/de_DE/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a message'] = 'Bitte fügen Sie eine Mitteilung hinzu';
 $lang['Error while sending e-mail'] = 'Es ist ein Fehler beim Versand der E-Mail aufgetreten'; 
-
 $lang['+ Add an email'] = '+ Eine Mail hinzufügen';
 $lang['E-mail format :'] = 'E-Mail Format:';
@@ -49,4 +48,5 @@
 $lang['%s must not be more than %d characters long'] = '%s darf nicht mehr als %d Zeichen lang sein';
 $lang['Default e-mail subject'] = 'Standard E-mail-Betreff';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Präfix des gesendeten e-Mail-Betreffs (Sie können "% Gallery_title" benutzen)';
+$lang['Prefix of the sent e-mail subject'] = 'Präfix des gesendeten e-Mail-Betreffs';
+$lang['you can use "%gallery_title%"'] = 'Sie können "%gallery_title%" benutzen';
 ?>
Index: /extensions/ContactForm/language/el_GR/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/el_GR/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/el_GR/plugin.lang.php	(revision 17945)
@@ -33,6 +33,6 @@
 $lang['Please enter a message'] = 'Παρακαλώ εισάγετε ένα μήνυμα';
 $lang['Error while sending e-mail'] = 'Λάθος κατά την απόστολή e-mail';
-
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Πρόθεμα για το θέμα του e-mail που στέλνετε (μπορείτε να χρησιμοποιήσετε το " "%gallery_title%"")';
+$lang['Prefix of the sent e-mail subject'] = 'Πρόθεμα για το θέμα του e-mail που στέλνετε';
+$lang['you can use "%gallery_title%"'] = 'μπορείτε να χρησιμοποιήσετε το "%gallery_title%"';
 $lang['Please enter an e-mail'] = 'Παρακαλώ εισάγετε ένα e-mail';
 $lang['Plain text'] = 'Απλό κείμενο';
Index: /extensions/ContactForm/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/en_UK/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/en_UK/plugin.lang.php	(revision 17945)
@@ -26,4 +26,5 @@
 $lang['Subject'] = 'Subject';
 $lang['Message'] = 'Message';
+$lang['Category'] = 'Category';
 $lang['General configuration'] = 'General configuration';
 $lang['Add link in menu'] = 'Add link in menu';
@@ -35,9 +36,12 @@
 $lang['Plain text'] = 'Plain text';
 $lang['Default e-mail subject'] = 'Default e-mail subject';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefix of the sent e-mail subject (you can use "%gallery_title%")';
+$lang['can be translated with LocalFiles Editor plugin'] = 'can be translated with LocalFiles Editor plugin';
+$lang['Prefix of the sent e-mail subject'] = 'Prefix of the sent e-mail subject';
+$lang['you can use "%gallery_title%"'] = 'you can use "%gallery_title%"';
 $lang['Text before the contact form'] = 'Text before the contact form';
 $lang['Text after the contact form'] = 'Text after the contact form';
 $lang['Active'] = 'Active';
 $lang['+ Add an email'] = '+ Add an email';
+$lang['+ Add a category'] = '+ Add a category';
 $lang['No active email address'] = 'No active email address';
 $lang['E-mail sent successfully'] = 'E-mail sent successfully';
@@ -46,4 +50,5 @@
 $lang['Please enter a subject'] = 'Please enter a subject';
 $lang['Please enter a message'] = 'Please enter a message';
+$lang['Please choose a category'] = 'Please choose a category';
 $lang['%s must not be less than %d characters long'] = '%s must not be less than %d characters long';
 $lang['%s must not be more than %d characters long'] = '%s must not be more than %d characters long';
Index: /extensions/ContactForm/language/es_ES/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/es_ES/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/es_ES/plugin.lang.php	(revision 17945)
@@ -38,5 +38,4 @@
 $lang['Please enter a message'] = 'Por favor, entre un mensaje';
 $lang['Error while sending e-mail'] = 'Error en el momento del envío del e-mail';
-
 $lang['%s must not be less than %d characters long'] = '%s no debe ser menor que %d caracteres';
 $lang['%s must not be more than %d characters long'] = '%s no debe ser mayor que %d caracteres';
@@ -49,4 +48,5 @@
 $lang['Plain text'] = 'Texto sin formato';
 $lang['Please enter an e-mail'] = 'Por favor, introduzca un e-mail';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefijo del asunto del correo electrónico de envío (se puede utilizar "%galería de title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Prefijo del asunto del correo electrónico de envío';
+$lang['you can use "%gallery_title%"'] = 'se puede utilizar "%gallery_title%"';
 ?>
Index: /extensions/ContactForm/language/fa_IR/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/fa_IR/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/fa_IR/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a subject'] = 'موضوع را وارد کنید';
 $lang['Please enter an e-mail'] = 'ایمیل خود را وارد کنید';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'پیشوند موضوع ایمیل (می توانید از "%gallery_title%" استفاده کنید)';
 $lang['Text after the contact form'] = 'متنِ پس از فرمِ تماس';
 $lang['Text before the contact form'] = 'متنِ پیش از فرمِ تماس';
Index: /extensions/ContactForm/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/fr_FR/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/fr_FR/plugin.lang.php	(revision 17945)
@@ -26,4 +26,5 @@
 $lang['Subject'] = 'Sujet';
 $lang['Message'] = 'Message';
+$lang['Category'] = 'Catégorie';
 $lang['General configuration'] = 'Configuration générale';
 $lang['Add link in menu'] = 'Ajouter le lien dans le menu';
@@ -35,10 +36,13 @@
 $lang['Plain text'] = 'Texte brut';
 $lang['Default e-mail subject'] = 'Sujet par défaut';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Préfixe du sujet de l\'e-mail envoyé (vous pouvez utiliser "%gallery_title%")';
+$lang['can be translated with LocalFiles Editor plugin'] = 'peut être traduit avec le plugin LocalFiles Editor';
+$lang['Prefix of the sent e-mail subject'] = 'Préfixe du sujet de l\'e-mail envoyé';
+$lang['you can use "%gallery_title%"'] = 'vous pouvez utiliser "%gallery_title%"';
 $lang['Text before the contact form'] = 'Texte au-dessus du formulaire de contact';
 $lang['Text after the contact form'] = 'Texte au-dessous du formulaire de contact';
 $lang['E-mails'] = 'E-mails';
 $lang['Active'] = 'Actif';
-$lang['+ Add an email'] = '+ Ajouter un email';
+$lang['+ Add an email'] = '+ Ajouter une email';
+$lang['+ Add a category'] = '+ Ajouter une categorie';
 $lang['No active email address'] = 'Aucune adresse email active';
 $lang['E-mail sent successfully'] = 'E-mail envoyé avec succès';
@@ -47,4 +51,5 @@
 $lang['Please enter a subject'] = 'Veuillez entrer un sujet';
 $lang['Please enter a message'] = 'Veuillez entrer un message';
+$lang['Please choose a category'] = 'Veuillez choisir une categorie';
 $lang['%s must not be less than %d characters long'] = '%s ne doit pas faire moins de %d caractères';
 $lang['%s must not be more than %d characters long'] = '%s ne doit pas faire plus de %d caractères';
Index: /extensions/ContactForm/language/hu_HU/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/hu_HU/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/hu_HU/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a message'] = 'Írja be az üzenetét';
 $lang['Error while sending e-mail'] = 'Hiba történt a levél küldése közben';
-
 $lang['%s must not be less than %d characters long'] = '%s nem lehet kevesebb %d karakternél';
 $lang['%s must not be more than %d characters long'] = '%s nem lehet több %d karakternél';
@@ -49,4 +48,5 @@
 $lang['Plain text'] = 'Egyszerű szöveg';
 $lang['Please enter an e-mail'] = 'Kérek egy e-mail címet';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Küldött e-mail tárgy előtag (a "%gallery_title%" használható)';
+$lang['Prefix of the sent e-mail subject'] = 'Küldött e-mail tárgy előtag';
+$lang['you can use "%gallery_title%"'] = 'a "%gallery_title%" használható';
 ?>
Index: /extensions/ContactForm/language/it_IT/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/it_IT/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/it_IT/plugin.lang.php	(revision 17945)
@@ -39,7 +39,6 @@
 $lang['Please enter a message'] = 'Entrare un messaggio';
 $lang['Error while sending e-mail'] = 'Errore durante l\'invio dell\'E-mail';
-
-$lang['%s must not be less than %d characters long'] = '% deve essere lungo non meno di % caratteri';
-$lang['%s must not be more than %d characters long'] = '% la lunghezza non deve essere maggiore di % caratteri';
+$lang['%s must not be less than %d characters long'] = '%s deve essere lungo non meno di %d caratteri';
+$lang['%s must not be more than %d characters long'] = '%s la lunghezza non deve essere maggiore di %d caratteri';
 $lang['Default e-mail subject'] = 'Oggetto email predefinito';
 $lang['E-mail format :'] = 'Formato email';
@@ -47,5 +46,5 @@
 $lang['Plain text'] = 'Testo non formattato';
 $lang['Please enter an e-mail'] = 'Aggiungi la tua email';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Presisso per le email gia inviate';
+$lang['Prefix of the sent e-mail subject'] = 'Presisso per le email gia inviate';
 $lang['Active'] = 'Attivo';
 $lang['+ Add an email'] = 'Aggiungi la tua email';
Index: /extensions/ContactForm/language/lv_LV/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/lv_LV/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/lv_LV/plugin.lang.php	(revision 17945)
@@ -39,6 +39,6 @@
 $lang['Please enter a message'] = 'Lūdzu ievadiet ziņojumu';
 $lang['Error while sending e-mail'] = 'Kļūda sūtot e-pastu';
-
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Nosūtītā e-pasta tēmas prefikss (varat lietot "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Nosūtītā e-pasta tēmas prefikss';
+$lang['you can use "%gallery_title%"'] = 'varat lietot "%gallery_title%"';
 $lang['%s must not be more than %d characters long'] = '%s jābūt ne vairāk kā %d rakstzīmju garam';
 $lang['%s must not be less than %d characters long'] = '%s jābūt ne māzāk kā %d rakstzīmju garam';
Index: /extensions/ContactForm/language/nl_NL/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/nl_NL/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/nl_NL/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a message'] = 'Vul een berichttekst in';
 $lang['Error while sending e-mail'] = 'Fout tijdens versturen van e-mail';
-
 $lang['%s must not be less than %d characters long'] = '%s mag niet kleiner zijn dan %d tekens';
 $lang['%s must not be more than %d characters long'] = '%s mag niet groter zijn dan %d tekens';
@@ -49,4 +48,5 @@
 $lang['Plain text'] = 'Platte tekst';
 $lang['Please enter an e-mail'] = 'Voer een email adres in';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Voorvoegsel voor het email onderwerp (je kan \'%gallery_title%\') gebruiken';
+$lang['Prefix of the sent e-mail subject'] = 'Voorvoegsel voor het email onderwerp';
+$lang['you can use "%gallery_title%"'] = 'je kan "%gallery_title%" gebruiken';
 ?>
Index: /extensions/ContactForm/language/pl_PL/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/pl_PL/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/pl_PL/plugin.lang.php	(revision 17945)
@@ -49,4 +49,5 @@
 $lang['Plain text'] = 'Sam tekst';
 $lang['Please enter an e-mail'] = 'Wprowadź proszę e-mail';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefix tematu wysyłanego maila (możesz wykorzystać tytuł galerii: "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Prefix tematu wysyłanego maila';
+$lang['you can use "%gallery_title%"'] = 'możesz wykorzystać tytuł galerii: "%gallery_title%"';
 ?>
Index: /extensions/ContactForm/language/pt_PT/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/pt_PT/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/pt_PT/plugin.lang.php	(revision 17945)
@@ -49,4 +49,5 @@
 $lang['Plain text'] = 'Texto normal';
 $lang['Please enter an e-mail'] = 'Indique um Email por favor';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Prefixo do assunto Enviar e-mail (Pode usar "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Prefixo do assunto Enviar e-mail';
+$lang['you can use "%gallery_title%"'] = 'Pode usar "%gallery_title%"';
 ?>
Index: /extensions/ContactForm/language/ru_RU/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/ru_RU/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/ru_RU/plugin.lang.php	(revision 17945)
@@ -40,5 +40,6 @@
 $lang['Error while sending e-mail'] = 'Ошибка при отправке сообщения';
 
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Префикс темы отправляемых e-mail (можно использовать "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Префикс темы отправляемых e-mail';
+$lang['you can use "%gallery_title%"'] = 'можно использовать "%gallery_title%"';
 $lang['Please enter an e-mail'] = 'Пожалуйста, введите e-mail';
 $lang['Active'] = 'Активный';
Index: /extensions/ContactForm/language/sk_SK/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/sk_SK/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/sk_SK/plugin.lang.php	(revision 17945)
@@ -40,5 +40,6 @@
 $lang['Error while sending e-mail'] = 'Chyba počas posielania e-mailu';
 
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Predpona predmetu posielaného emailu (môžete použiť "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Predpona predmetu posielaného emailu';
+$lang['you can use "%gallery_title%"'] = 'môžete použiť "%gallery_title%"';
 $lang['Please enter an e-mail'] = 'Prosím vložte email';
 $lang['Plain text'] = 'Obyčajný text';
Index: /extensions/ContactForm/language/tr_TR/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/tr_TR/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/tr_TR/plugin.lang.php	(revision 17945)
@@ -42,5 +42,6 @@
 $lang['%s must not be less than %d characters long'] = '%s, %d karakter uzunluğundan küçük olmamalıdır';
 $lang['%s must not be more than %d characters long'] = '%s, %d karakter uzunluğundan büyük olmamalıdır';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Gönderilen e-posta konusu başına bir ön takı ekle ("%gallery_title%" kullanabilirsiniz.)';
+$lang['Prefix of the sent e-mail subject'] = 'Gönderilen e-posta konusu başına bir ön takı ekle';
+$lang['you can use "%gallery_title%"'] = '"%gallery_title%" kullanabilirsiniz';
 $lang['+ Add an email'] = '+ Bir e-posta adresi ekle';
 $lang['Active'] = 'Etkin';
Index: /extensions/ContactForm/language/uk_UA/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/uk_UA/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/uk_UA/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a message'] = 'Будь ласка, введіть повідомлення';
 $lang['Error while sending e-mail'] = 'Помилка при відправленні по електронній пошті';
-
 $lang['%s must not be less than %d characters long'] = '%s повинно бути не коротше %d символів';
 $lang['%s must not be more than %d characters long'] = '%s повинно бути не довше %d символів';
@@ -49,4 +48,5 @@
 $lang['Plain text'] = 'Простий текст';
 $lang['Please enter an e-mail'] = 'Будь ласка, введіть e-mail';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Префікс теми відправлених e-mail (можна використовувати "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Префікс теми відправлених e-mail';
+$lang['you can use "%gallery_title%"'] = 'можна використовувати "%gallery_title%"';
 ?>
Index: /extensions/ContactForm/language/vi_VN/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/vi_VN/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/vi_VN/plugin.lang.php	(revision 17945)
@@ -39,5 +39,4 @@
 $lang['Please enter a message'] = 'Vui lòng nhập nội dung';
 $lang['Error while sending e-mail'] = 'Có lỗi trong quá trình gởi email';
-
 $lang['%s must not be less than %d characters long'] = '%s phải có ít nhất %d ký tự';
 $lang['%s must not be more than %d characters long'] = '%s phải có ít hơn %d ký tự';
@@ -49,4 +48,5 @@
 $lang['Plain text'] = 'Thô (không có định dạng gì)';
 $lang['Please enter an e-mail'] = 'Hãy nhập địa chỉ thư';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'Chủ đề gắn vào trước chủ đề thư (ví dụ "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'Chủ đề gắn vào trước chủ đề thư';
+$lang['you can use "%gallery_title%"'] = 'ví dụ "%gallery_title%"';
 ?>
Index: /extensions/ContactForm/language/zh_CN/plugin.lang.php
===================================================================
--- /extensions/ContactForm/language/zh_CN/plugin.lang.php	(revision 17944)
+++ /extensions/ContactForm/language/zh_CN/plugin.lang.php	(revision 17945)
@@ -22,5 +22,6 @@
 // +-----------------------------------------------------------------------+
 $lang['Please enter an e-mail'] = '请输入email地址';
-$lang['Prefix of the sent e-mail subject (you can use "%gallery_title%")'] = 'email标题的前缀 (您可以使用 "%gallery_title%")';
+$lang['Prefix of the sent e-mail subject'] = 'email标题的前缀';
+$lang['you can use "%gallery_title%"'] = '您可以使用 "%gallery_title%"';
 $lang['Subject'] = '标题';
 $lang['Text after the contact form'] = '联络表单之后的文字';
Index: /extensions/ContactForm/main.inc.php
===================================================================
--- /extensions/ContactForm/main.inc.php	(revision 17944)
+++ /extensions/ContactForm/main.inc.php	(revision 17945)
@@ -11,19 +11,25 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-define('CONTACT_FORM_PATH',   PHPWG_PLUGINS_PATH . 'ContactForm/');
-define('CONTACT_FORM_ADMIN',  get_root_url() . 'admin.php?page=plugin-ContactForm');
-define('CONTACT_FORM_PUBLIC', get_absolute_root_url() . make_index_url(array('section' => 'contact')) . '/');
-define('CONTACT_FORM_VERSION', '2.4.d');
+global $prefixeTable;
+
+defined('CONTACT_FORM_ID') or define('CONTACT_FORM_ID', basename(dirname(__FILE__)));
+define('CONTACT_FORM_PATH',    PHPWG_PLUGINS_PATH . CONTACT_FORM_ID . '/');
+define('CONTACT_FORM_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . CONTACT_FORM_ID);
+define('CONTACT_FORM_PUBLIC',  get_absolute_root_url() . make_index_url(array('section' => 'contact')) . '/');
+define('CONTACT_FORM_TABLE',   $prefixeTable .'contact_form');
+define('CONTACT_FORM_VERSION', '2.5.0');
 
 
 add_event_handler('init', 'contact_form_init');
 
-add_event_handler('loc_end_section_init', 'contact_form_section_init');
-add_event_handler('loc_end_index', 'contact_form_page');
-add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
-
 if (defined('IN_ADMIN'))
 {
   add_event_handler('get_admin_plugin_menu_links', 'contact_form_admin_menu');
+}
+else
+{
+  add_event_handler('loc_end_section_init', 'contact_form_section_init');
+  add_event_handler('loc_end_index', 'contact_form_page');
+  add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
 }
 
@@ -39,6 +45,6 @@
   
   if (
-    $pwg_loaded_plugins['ContactForm']['version'] == 'auto' or
-    version_compare($pwg_loaded_plugins['ContactForm']['version'], CONTACT_FORM_VERSION, '<')
+    $pwg_loaded_plugins[CONTACT_FORM_ID]['version'] == 'auto' or
+    version_compare($pwg_loaded_plugins[CONTACT_FORM_ID]['version'], CONTACT_FORM_VERSION, '<')
   )
   {
@@ -46,13 +52,13 @@
     contact_form_install();
     
-    if ($pwg_loaded_plugins['ContactForm']['version'] != 'auto')
+    if ($pwg_loaded_plugins[CONTACT_FORM_ID]['version'] != 'auto')
     {
       $query = '
 UPDATE '. PLUGINS_TABLE .'
 SET version = "'. CONTACT_FORM_VERSION .'"
-WHERE id = "ContactForm"';
+WHERE id = "'. CONTACT_FORM_ID .'"';
       pwg_query($query);
       
-      $pwg_loaded_plugins['ContactForm']['version'] = CONTACT_FORM_VERSION;
+      $pwg_loaded_plugins[CONTACT_FORM_ID]['version'] = CONTACT_FORM_VERSION;
       
       if (defined('IN_ADMIN'))
Index: /extensions/ContactForm/maintain.inc.php
===================================================================
--- /extensions/ContactForm/maintain.inc.php	(revision 17944)
+++ /extensions/ContactForm/maintain.inc.php	(revision 17945)
@@ -2,5 +2,6 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-include_once(PHPWG_PLUGINS_PATH . 'ContactForm/include/install.inc.php');
+defined('CONTACT_FORM_ID') or define('CONTACT_FORM_ID', basename(dirname(__FILE__)));
+include_once(PHPWG_PLUGINS_PATH . CONTACT_FORM_ID . '/include/install.inc.php');
 
 function plugin_install() 
Index: /extensions/ContactForm/template/contact_form.tpl
===================================================================
--- /extensions/ContactForm/template/contact_form.tpl	(revision 17944)
+++ /extensions/ContactForm/template/contact_form.tpl	(revision 17945)
@@ -12,4 +12,9 @@
 email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an e-mail'|@translate}" });
 email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|@translate}" });
+{/if}
+
+{if $GROUPS}
+var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true })
+group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|@translate}" });
 {/if}
 
@@ -75,4 +80,15 @@
         </td>
       </tr>
+      {if $GROUPS}
+      <tr>
+        <td class="title"><label for="group">{'Category'|@translate}</label></td>
+        <td>
+          <select name="group" id="group">
+            <option value="-1">------------</option>
+            {html_options options=$GROUPS selected=$contact.group}
+          </select>
+        </td>
+      </tr>
+      {/if}
       <tr>
         <td class="title"><label for="subject">{'Subject'|@translate}</label></td>
Index: /extensions/ContactForm/template/style.css
===================================================================
--- /extensions/ContactForm/template/style.css	(revision 17944)
+++ /extensions/ContactForm/template/style.css	(revision 17945)
@@ -18,7 +18,10 @@
     margin-right:3px;
   }
-  .contact input[type="text"], .contact textarea {
+  .contact input[type="text"], .contact textarea, .contact select {
     border-radius:2px;
     padding:3px;
+  }
+  .content select {
+    padding:2px;
   }
 
