Index: extensions/Subscribe_to_comments/admin.php
===================================================================
--- extensions/Subscribe_to_comments/admin.php	(revision 15641)
+++ extensions/Subscribe_to_comments/admin.php	(revision 15641)
@@ -0,0 +1,31 @@
+<?php
+if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// +-----------------------------------------------------------------------+
+//                         Save configuration                              |
+// +-----------------------------------------------------------------------+
+if (isset($_POST['config_submit'])) 
+{
+  $conf['Subscribe_to_Comments'] = array(
+    'notify_admin_on_subscribe' => isset($_POST['notify_admin_on_subscribe']),
+    'allow_global_subscriptions' => isset($_POST['allow_global_subscriptions']),
+    );
+  
+  conf_update_param('Subscribe_to_Comments', serialize($conf['Subscribe_to_Comments']));
+  array_push($page['infos'], l10n('Information data registered in database'));
+}  
+
+
+// +-----------------------------------------------------------------------+
+//                               Template                                  |
+// +-----------------------------------------------------------------------+  
+$template->assign(array(
+  'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH,
+  'notify_admin_on_subscribe' => $conf['Subscribe_to_Comments']['notify_admin_on_subscribe'],
+  'allow_global_subscriptions' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'],
+  ));
+
+$template->set_filename('plugin_admin_content', dirname(__FILE__).'/template/admin.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: extensions/Subscribe_to_comments/include/functions.inc.php
===================================================================
--- extensions/Subscribe_to_comments/include/functions.inc.php	(revision 15376)
+++ extensions/Subscribe_to_comments/include/functions.inc.php	(revision 15641)
@@ -2,81 +2,131 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-include_once(PHPWG_ROOT_PATH .'include/functions_tag.inc.php');
+include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
 
 /**
  * Send comment to subscribers
- * @param array comm
+ * @param: array comment (author, content, image_id|category_id)
  */
 function send_comment_to_subscribers($comm)
 {
-  global $conf, $page, $user;
-  
   if ( empty($comm) or !is_array($comm) )
   {
-    trigger_error('send_comment_to_subscribers: undefinided comm', E_USER_WARNING);
-    return false;
-  }
-  
-  $type= isset($comm['category_id']) ? 'category' : 'image';
+    trigger_error('send_comment_to_subscribers: undefineded comm', E_USER_WARNING);
+    return false;
+  }
+  
+  global $conf, $page, $user, $template;
+  
+  // create search clauses
+  $where_clauses = array();
+  if (isset($comm['image_id']))
+  {
+    $element_id = $comm['image_id'];
+    $element_type = 'image';
+    
+    array_push($where_clauses, 'type = "image" AND element_id = '.$element_id.'');
+    if (!empty($page['category']['id'])) array_push($where_clauses, 'type = "album-images" AND element_id = '.$page['category']['id'].'');
+    array_push($where_clauses, 'type = "all-images"');
+  }
+  else if (isset($comm['category_id']))
+  {
+    $element_id = $comm['category_id'];
+    $element_type = 'category';
+    
+    array_push($where_clauses, 'type = "album" AND element_id = '.$element_id.'');
+    array_push($where_clauses, 'type = "all-albums"');
+  }
+  else
+  {
+    return;
+  }
   
   // exclude current user
   $exclude = null;
-  if (!empty($_POST['stc_mail'])) $exclude = pwg_db_real_escape_string($_POST['stc_mail']);
-  else if (!is_a_guest()) $exclude = $user['email'];
-  
-  // get subscribers emails
+  if (!empty($_POST['stc_mail']))
+  {
+    $exclude = pwg_db_real_escape_string($_POST['stc_mail']);
+  }
+  else if (!is_a_guest())
+  {
+    $exclude = $user['email'];
+  }
+  
+  // get subscribers datas
   $query = '
-SELECT 
-    email
+SELECT
+    id,
+    email,
+    language
   FROM '.SUBSCRIBE_TO_TABLE.'
-  WHERE
-    '.$type.'_id = '.$comm[$type.'_id'].'
+  WHERE (
+      ('.implode(")\n      OR (", $where_clauses).')
+    )
     AND validated = true
     AND email != "'.$exclude.'"
 ';
-  $emails = array_from_query($query, 'email');
+  $subscriptions = hash_from_query($query, 'email');
   
   set_make_full_url();
-  if ($type == 'image')
+  
+  // get element infos
+  if ($element_type == 'image')
   {
     $element = get_picture_infos($comm['image_id']);
   }
-  else if ($type == 'category')
+  else
   {
     $element = get_category_infos($comm['category_id']);
   }
   
-  // get author name
-  if ($comm['author'] == 'guest')
-  {
-    $comm['author'] = l10n('guest');
-  }
+  // format comment
+  if ($comm['author'] == 'guest') $comm['author'] = l10n('guest');
+  $comm['author'] = trigger_event('render_comment_author', $comm['author']);
+  $comm['content'] = trigger_event('render_comment_content', $comm['content']);
   
   // mail content
-  $mail_args = array(
-    'subject' => '['.strip_tags($conf['gallery_title']).'] Re:'.$element['name'],
-    'content_format' => 'text/html',
-    );
-    
-  $generic_content = '
-<a href="'.$element['url'].'"><img src="'.$element['thumbnail'].'" alt="'.$element['name'].'"></a>
-<br>
-<b>.'.trigger_event('render_comment_author', $comm['author']).'</b> wrote :
-
-<blockquote>'.trigger_event('render_comment_content', $comm['content']).'</blockquote>
-
-<a href="'.$element['url'].'#comment-'.$comm['id'].'">Link to comment</a>
-<br><br>
-================================
-<br><br>';
-
-  foreach ($emails as $email)
-  {
-    $mail_args['content'] = $generic_content.'
-<a href="'.make_stc_url('unsubscribe-'.$type, $email, $element['id']).'">Stop receiving notifications</a><br>
-<a href="'.make_stc_url('manage', $email).'">Manage my subscribtions</a>';
-    pwg_mail($email, $mail_args);
-  }
-  
+  $subject = '['.strip_tags($conf['gallery_title']).'] Re:'.$element['name'];
+    
+  $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/notification.tpl');
+
+  foreach ($subscriptions as $row)
+  {
+    // get subscriber id
+    if ( ($uid = get_userid_by_email($row['email'])) !== false )
+    {
+      $row['user_id'] = $uid;
+    }
+    else
+    {
+      $row['user_id'] = $conf['guest_id'];
+    }
+    
+    // check permissions
+    if (!user_can_view_element($row['user_id'], $element_id, $element_type))
+    {
+      continue;
+    }
+    
+    // send mail
+    switch_lang_to($row['language']);
+    load_language('plugin.lang', SUBSCRIBE_TO_PATH);
+    
+    $comm['caption'] = sprintf('<b>%s</b> wrote on <i>%s</i>', $comm['author'], format_date(date('Y-d-m H:i:s')));
+    
+    $template->assign('STC', array(
+      'element' => $element,
+      'comment' => $comm,
+      'UNSUB_URL' => make_stc_url('unsubscribe', $row['email'], $row['id']),
+      'MANAGE_URL' => make_stc_url('manage', $row['email']),
+      'GALLERY_TITLE' => $conf['gallery_title'],
+      ));
+    
+    $content = $template->parse('stc_mail', true);
+
+    stc_send_mail($row['email'], $content, $subject);
+    switch_lang_back();
+  }
+  
+  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
   unset_make_full_url();
 }
@@ -85,76 +135,138 @@
 /**
  * add an email to subscribers list
- * @param int (image|category)_id
- * @param string email
- * @param string type (image|category)
- */
-function subscribe_to_comments($element_id, $email, $type='image')
-{
+ * @param: string email
+ * @param: string type (image|album-images|all-images|album|all-albums)
+ * @param: int element_id
+ * @return: bool
+ */
+function subscribe_to_comments($email, $type, $element_id='NULL')
+{
+  if (empty($type))
+  {
+    trigger_error('subscribe_to_comment: missing type', E_USER_WARNING);
+    return false;
+  }
+  
+  if ( !in_array($type, array('all-images','all-albums')) and $element_id == 'NULL' )
+  {
+    trigger_error('subscribe_to_comment: missing element_id', E_USER_WARNING);
+    return false;
+  }
+  
   global $page, $conf, $user, $template, $picture;
-  
-  if ( empty($element_id) or empty($type) )
-  {
-    trigger_error('subscribe_to_comment: missing element_id and/or type', E_USER_WARNING);
-    return false;
-  }
   
   // check email
   if ( ( is_a_guest() or empty($user['email']) ) and empty($email) )
   {
-    return false;
-  }
-  else if (!is_a_guest())
+    array_push($page['errors'], l10n('Invalid email adress, your are not subscribed to comments.'));
+    return false;
+  }
+  else if ( !is_a_guest() and empty($email) )
   {
     $email = $user['email'];
   }
   
-  // don't care if already registered
+  // search if already registered (can use ODKU because we want to get the id of inserted OR updated row)
   $query = '
+SELECT id
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE
+    type = "'.$type.'"
+    AND element_id = '.$element_id.'
+    AND email = "'.pwg_db_real_escape_string($email).'"
+;';
+  $result = pwg_query($query);
+  
+  if (pwg_db_num_rows($result))
+  {
+    list($inserted_id) = pwg_db_fetch_row($result);
+  }
+  else
+  {
+    $query = '
 INSERT INTO '.SUBSCRIBE_TO_TABLE.'(
+    type,
+    element_id,
+    language,
     email,
-    '.$type.'_id,
     registration_date,
     validated
   )
   VALUES(
+    "'.$type.'",
+    '.$element_id.',
+    "'.$user['language'].'",
     "'.pwg_db_real_escape_string($email).'",
-    '.$element_id.',
     NOW(),
     "'.(is_a_guest() ? "false" : "true").'"
   )
-  ON DUPLICATE KEY UPDATE
-    registration_date = IF(validated="true", registration_date, NOW()),
-    validated = IF(validated="true", validated, "'.(is_a_guest() ? "false" : "true").'")
 ;';
-  pwg_query($query);
+    pwg_query($query);
+    
+    $inserted_id = pwg_db_insert_id();
+  }
+  
+  // notify admins
+  if ( pwg_db_changes(null) != 0 and $conf['Subscribe_to_Comments']['notify_admin_on_subscribe'] )
+  {
+    stc_mail_notification_admins($email, $type, $element_id, $inserted_id);
+  }
   
   // send validation mail
   if ( is_a_guest() and pwg_db_changes(null) != 0 )
   {
-    $element_name = ($type == 'image') ? $picture['current']['name'] : $page['category']['name'];
-    
-    $mail_args = array(
-      'subject' => '['.strip_tags($conf['gallery_title']).'] Please confirm your subscribtion to comments',
-      'content_format' => 'text/html',
-      );
+    set_make_full_url();
+    
+    $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/confirm.tpl');
+    
+    $subject = '['.strip_tags($conf['gallery_title']).'] '.l10n('Confirm your subscribtion to comments');
       
-    $mail_args['content'] = '
-You requested to subscribe by email to comments on <b>'.$element_name.'</b>.<br>
-<br>
-We care about your inbox, so we want to confirm this request. Please click the confirm link to activate the subscription.<br>
-<br>
-<a href="'.make_stc_url('validate-'.$type, $email, $element_id).'">Confirm subscription</a><br>
-<br>
-If you did not request this action please disregard this message.
-';
-
-    pwg_mail($email, $mail_args);
-    return 'confirm_mail';
+    switch ($type)
+    {
+      case 'image':
+        $element = get_picture_infos($element_id);
+        $element['on'] = sprintf(l10n('the picture <a href="%s">%s</a>'), $element['url'], $element['name']);
+        break;
+      case 'album-images':
+        $element = get_category_infos($element_id);
+        $element['on'] = sprintf(l10n('all pictures of the album <a href="%s">%s</a>'), $element['url'], $element['name']);
+        break;
+      case 'all-images':
+        $element['thumbnail'] = null;
+        $element['on'] = l10n('all pictures of the gallery');
+        break;
+      case 'album':
+        $element = get_category_infos($element_id);
+        $element['on'] = sprintf(l10n('the album <a href="%s">%s</a>'), $element['url'], $element['name']);
+        break;
+      case 'all-albums':
+        $element['thumbnail'] = null;
+        $element['on'] = l10n('all albums of the gallery');
+        break;
+    }
+    
+    $template->assign('STC', array(
+      'element' => $element,
+      'VALIDATE_URL' => make_stc_url('validate', $email, $inserted_id),
+      'MANAGE_URL' => make_stc_url('manage', $email),
+      'GALLERY_TITLE' => $conf['gallery_title'],
+      ));
+    
+    $content = $template->parse('stc_mail', true);
+
+    stc_send_mail($email, $content, $subject);
+    unset_make_full_url();
+    
+    array_push($page['infos'], l10n('Please check your email inbox to confirm your subscription.'));
+    return true;
   }
   // just display confirmation message
   else if (pwg_db_changes(null) != 0)
   {
+    array_push($page['infos'], l10n('You have been added to the list of subscribers.'));
     return true;
   }
+  
+  return false;
 }
 
@@ -162,17 +274,17 @@
 /**
  * remove an email from subscribers list
- * @param int (image|category)_id
- * @param string email
- * @param string type (image|category)
- */
-function un_subscribe_to_comments($element_id, $email, $type='image')
-{
+ * @param: string email
+ * @param: int subscription id
+ * @return: bool
+ */
+function un_subscribe_to_comments($email, $id)
+{  
+  if (empty($id))
+  {
+    trigger_error('un_subscribe_to_comment: missing id', E_USER_WARNING);
+    return false;
+  }
+  
   global $template, $user;
-  
-  if ( empty($element_id) or empty($type) )
-  {
-    trigger_error('un_subscribe_to_comment: missing element_id and/or type', E_USER_WARNING);
-    return false;
-  }
   
   // check email
@@ -181,5 +293,5 @@
     return false;
   }
-  else if (!is_a_guest())
+  else if ( !is_a_guest() and empty($email) )
   {
     $email = $user['email'];
@@ -187,24 +299,13 @@
   
   // delete subscription
-  switch ($type)
-  {
-    case 'image' :
-    case 'category' :
-      $where_clause = $type.'_id = '.pwg_db_real_escape_string($element_id);
-    case 'all' :
-    {
-      $query = '
+  $query = '
 DELETE FROM '.SUBSCRIBE_TO_TABLE.'
   WHERE 
     email = "'.pwg_db_real_escape_string($email).'"
-    '.(!empty($where_clause) ? 'AND '.$where_clause : null).'
+    AND id = "'.pwg_db_real_escape_string($id).'"
 ;';
-      pwg_query($query);
+  pwg_query($query);
       
-      return true;
-      break;
-    }
-  }
-  
+  if (pwg_db_changes(null) != 0) return true;
   return false;
 }
@@ -213,38 +314,98 @@
 /**
  * validate a subscription
- * @param int (image|category)_id
- * @param string email
- * @param string type (image|category)
- */
-function validate_subscriptions($element_id, $email, $type='image')
-{
-  if ( empty($element_id) or empty($email) or empty($type) )
-  {
-    trigger_error('validate_subscriptions: missing element_id and/or email and/or type', E_USER_WARNING);
-    return false;
-  }
-  
-  switch ($type)
-  {
-    case 'image' :
-    case 'category':
-      $where_clause = $type.'_id = '.pwg_db_real_escape_string($element_id);
-    case 'all' :
-    {
-       $query = '
+ * @param: string email
+ * @param: int subscription id
+ * @return: bool
+ */
+function validate_subscriptions($email, $id)
+{
+  if (empty($email))
+  {
+    trigger_error('validate_subscriptions: missing email', E_USER_WARNING);
+    return false;
+  }
+  
+  if (empty($id))
+  {
+    trigger_error('validate_subscriptions: missing id', E_USER_WARNING);
+    return false;
+  }
+  
+  $query = '
 UPDATE '.SUBSCRIBE_TO_TABLE.'
   SET validated = "true"
   WHERE 
     email = "'.pwg_db_real_escape_string($email).'"
-    '.(!empty($where_clause) ? 'AND '.$where_clause : null).'
+    AND id = '.pwg_db_real_escape_string($id).'
 ;';
-      pwg_query($query);
+  pwg_query($query);
       
-      if (pwg_db_changes(null) != 0) return true;
+  if (pwg_db_changes(null) != 0) return true;
+  return false;
+}
+
+
+/**
+ * send notification to admins
+ * @param: string email
+ * @param: string type (image|album-images|all-images|album|all-albums)
+ * @param: int element_id
+ * @param: int subscription id
+ */
+function stc_mail_notification_admins($email, $type, $element_id, $inserted_id)
+{
+  global $user, $conf, $template;
+  
+  $admins = get_admins_email();
+  if (empty($admins)) return;
+  
+  set_make_full_url();
+  switch_lang_to(get_default_language());
+  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
+  
+  $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/admin.tpl');
+    
+  $subject = '['.strip_tags($conf['gallery_title']).'] '.sprintf(l10n('%s has subscribed to comments on'), is_a_guest()?$email:$user['username']);
+    
+  switch ($type)
+  {
+    case 'image':
+      $element = get_picture_infos($element_id, false);
+      $element['on'] = sprintf(l10n('the picture <a href="%s">%s</a>'), $element['url'], $element['name']);
       break;
-    }
-  }
-  
-  return false;
+    case 'album-images':
+      $element = get_category_infos($element_id, false);
+      $element['on'] = sprintf(l10n('all pictures of the album <a href="%s">%s</a>'), $element['url'], $element['name']);
+      break;
+    case 'all-images':
+      $element['on'] = l10n('all pictures of the gallery');
+      break;
+    case 'album':
+      $element = get_category_infos($element_id, false);
+      $element['on'] = sprintf(l10n('the album <a href="%s">%s</a>'), $element['url'], $element['name']);
+      break;
+    case 'all-albums':
+      $element['on'] = l10n('all albums of the gallery');
+      break;
+  }
+  
+  $technical_infos[] = sprintf(l10n('Connected user: %s'), stripslashes($user['username']));
+  $technical_infos[] = sprintf(l10n('IP: %s'), $_SERVER['REMOTE_ADDR']);
+  $technical_infos[] = sprintf(l10n('Browser: %s'), $_SERVER['HTTP_USER_AGENT']);
+  
+  $template->assign('STC', array(
+    'ELEMENT' => $element['on'],
+    'USER' => sprintf(l10n('%s has subscribed to comments on'), is_a_guest() ? '<b>'.$email.'</b>' : '<b>'.$user['username'].'</b> ('.$email.')'), 
+    'GALLERY_TITLE' => $conf['gallery_title'],
+    'TECHNICAL' => implode('<br>', $technical_infos),
+    ));
+  
+  $content = $template->parse('stc_mail', true);
+
+  stc_send_mail($admins, $content, $subject);
+  
+  unset_make_full_url();
+  switch_lang_back();
+  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
 }
 
@@ -252,9 +413,10 @@
 /**
  * create absolute url to subscriptions section
- * @param string action
- * @param string email
- * @return string
- */
-function make_stc_url($action, $email)
+ * @param: string action
+ * @param: string email
+ * @param: int optional
+ * @return: string
+ */
+function make_stc_url($action, $email, $id=null)
 {
   if ( empty($action) or empty($email) )
@@ -272,7 +434,7 @@
     );
   
-  if (func_num_args() > 2)
-  {
-    $url_params['id'] = func_get_arg(2);
+  if (!empty($id))
+  {
+    $url_params['id'] = $id;
   }
   
@@ -293,19 +455,96 @@
 
 /**
- * get name and url of a picture
- * @param int image_id
- * @return array
- */
-function get_picture_infos($image_id, $absolute=false)
-{
-  global $page;
-  
+ * send mail with STC style
+ * @param: string to
+ * @param: string content
+ * @param: string subject
+ * @return: bool
+ */
+function stc_send_mail($to, $content, $subject)
+{
+  global $conf, $conf_mail, $page, $template;
+  
+  // inputs
+  if (empty($to))
+  {
+    return false;
+  }
+
+  if (empty($content))
+  {
+    return false;
+  }
+  
+  if (empty($subject))
+  {
+    $subject = 'Piwigo';
+  }
+  else
+  {
+    $subject = trim(preg_replace('#[\n\r]+#s', '', $subject));
+    $subject = encode_mime_header($subject);
+  }
+  
+  if (!isset($conf_mail))
+  {
+    $conf_mail = get_mail_configuration();
+  }
+
+  $args['from'] = $conf_mail['formated_email_webmaster'];
+  
+  set_make_full_url();
+  
+  // hearders
+  $headers = 'From: '.$args['from']."\n";  
+  $headers.= 'Content-Type: text/html; charset="'.get_pwg_charset().'";'."\n";
+  $headers.= 'Content-Transfer-Encoding: 8bit'."\n";
+  $headers.= 'MIME-Version: 1.0'."\n";
+  $headers.= 'X-Mailer: Piwigo Mailer'."\n";
+  
+  // template
+  $template->set_filenames(array(
+    'stc_mail_header' => dirname(__FILE__).'/../template/mail/header.tpl',
+    'stc_mail_footer' => dirname(__FILE__).'/../template/mail/footer.tpl',
+    ));
+  $stc_mail_css = file_get_contents(dirname(__FILE__).'/../template/mail/style.css');
+    
+  $template->assign(array(
+    'GALLERY_URL' => get_gallery_home_url(),
+    'PHPWG_URL' => PHPWG_URL,
+    'STC_MAIL_CSS' => str_replace("\n", null, $stc_mail_css),
+    ));
+  
+  $content = $template->parse('stc_mail_header', true) . $content . $template->parse('stc_mail_footer', true);
+  $content = wordwrap($content, 70, "\n", true);
+
+  unset_make_full_url();
+  
+  // send mail
+  return
+    trigger_event('send_mail',
+      false, /* Result */
+      trigger_event('send_mail_to', get_strict_email_list($to)),
+      trigger_event('send_mail_subject', $subject),
+      trigger_event('send_mail_content', $content),
+      trigger_event('send_mail_headers', $headers),
+      $args
+    );
+}
+
+
+/**
+ * get name, url and thumbnail of a picture
+ * @param: int image_id
+ * @param: bool return thumbnail
+ * @return: array (id, name, url, thumbnail)
+ */
+function get_picture_infos($image_id, $with_thumb=true)
+{
   $query = '
 SELECT
     id,
+    file,
     name,
-    file,
-    path, 
-    tn_ext
+    path
   FROM '.IMAGES_TABLE.'
   WHERE id = '.$image_id.'
@@ -319,12 +558,10 @@
   
   $url_params = array('image_id' => $element['id']);
-  if ( !empty($page['category']) and !$absolute )
-  {
-    $url_params['section'] = 'categories';
-    $url_params['category'] = $page['category'];
-  }
   $element['url'] = make_picture_url($url_params);
   
-  $element['thumbnail'] = get_thumbnail_url($element);
+  if ($with_thumb)
+  {
+    $element['thumbnail'] = DerivativeImage::thumb_url($element);
+  }
   
   return $element;
@@ -332,9 +569,10 @@
 
 /**
- * get name and url of a category
- * @param int cat_id
- * @return array
- */
-function get_category_infos($cat_id)
+ * get name, url and thumbnail of a category
+ * @param: int cat_id
+ * @param: int return thumbnail
+ * @return: array (id, name, url, thumbnail)
+ */
+function get_category_infos($cat_id, $with_thumb=true)
 {
   global $conf;
@@ -346,6 +584,5 @@
     cat.permalink,
     img.id AS image_id,
-    img.path,
-    img.tn_ext
+    img.path
   FROM '.CATEGORIES_TABLE.' AS cat
     LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 
@@ -356,17 +593,86 @@
 ;';
   $element = pwg_db_fetch_assoc(pwg_query($query));
-  // we use guest_id for user_cache beacause we don't know the status of recipient
-  
-  $url_params['section'] = 'categories';
-  $url_params['category'] = $element;
-  $element['url'] = make_index_url($url_params);
-  
-  $element['thumbnail'] = get_thumbnail_url(array(
-    'id' => $element['image_id'],
-    'path' => $element['path'],
-    'tn_ext' => $element['tn_ext'],
+  // we use guest_id for user_cache because we don't know the status of recipient
+  
+  $element['url'] = make_index_url(array(
+    'section'=>'categories',
+    'category'=>$element,
     ));
   
+  if ($with_thumb)
+  {
+    $element['thumbnail'] = DerivativeImage::thumb_url(array(
+      'id'=>$element['image_id'],
+      'path'=>$element['path'],
+      ));
+  }
+  
   return $element;
+}
+
+/**
+ * get list of admins email
+ * @return: string
+ */
+function get_admins_email()
+{
+  global $conf, $user;
+  
+  $admins = array();
+  
+  $query = '
+SELECT
+    u.'.$conf['user_fields']['username'].' AS username,
+    u.'.$conf['user_fields']['email'].' AS email
+  FROM '.USERS_TABLE.' AS u
+    JOIN '.USER_INFOS_TABLE.' AS i 
+      ON i.user_id =  u.'.$conf['user_fields']['id'].'
+  WHERE i.status IN ("webmaster", "admin")
+    AND '.$conf['user_fields']['email'].' IS NOT NULL
+    AND i.user_id != '.$user['id'].'
+  ORDER BY username
+;';
+
+  $datas = pwg_query($query);
+  if (!empty($datas))
+  {
+    while ($admin = pwg_db_fetch_assoc($datas))
+    {
+      array_push($admins, format_email($admin['username'], $admin['email']));
+    }
+  }
+
+  return implode(',', $admins);
+}
+
+
+/**
+ * check if the given user can view the category/image
+ * @param: int user_id
+ * @param: int element_id
+ * @param: string type (image|category)
+ * @return: bool
+ */
+function user_can_view_element($user_id, $element_id, $type)
+{
+  global $conf;
+  
+  $old_conf = $conf['external_authentification'];
+  $conf['external_authentification'] = false;
+  $user = getuserdata($user_id, true);
+  $conf['external_authentification'] = $old_conf;
+  
+  if ($type == 'image')
+  {
+    return !in_array($element_id, explode(',', $user['image_access_list']));
+  }
+  else if ($type == 'category')
+  {
+    return !in_array($element_id, explode(',', $user['forbidden_categories']));
+  }
+  else
+  {
+    return false;
+  }
 }
 
@@ -375,7 +681,7 @@
  * crypt a string using mcrypt extension or
  * http://stackoverflow.com/questions/800922/how-to-encrypt-string-without-mcrypt-library-in-php/802957#802957
- * @param string value to crypt
- * @param string key
- * @return string
+ * @param: string value to crypt
+ * @param: string key
+ * @return: string
  */
 function crypt_value($value, $key)
@@ -405,7 +711,7 @@
 /**
  * decrypt a string crypted with previous function
- * @param string value to decrypt
- * @param string key
- * @return string
+ * @param: string value to decrypt
+ * @param: string key
+ * @return: string
  */
 function decrypt_value($value, $key)
@@ -436,5 +742,5 @@
 /**
  * variant of base64 functions usable into url
- * http://fr.php.net/manual/fr/function.base64-encode.php#103849
+ * http://php.net/manual/en/function.base64-encode.php#103849
  */
 function base64url_encode($data)
Index: extensions/Subscribe_to_comments/include/index.php
===================================================================
--- extensions/Subscribe_to_comments/include/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/include/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php
===================================================================
--- extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php	(revision 15376)
+++ extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php	(revision 15641)
@@ -3,5 +3,5 @@
 
 /**
- * detect 'subscriptions' section and load page
+ * detect 'subscriptions' section and load the page
  */
 function stc_detect_section()
@@ -12,4 +12,5 @@
   {
     $page['section'] = 'subscriptions';
+    $page['title'] = l10n('Comments notifications');
   }
 }
@@ -27,5 +28,6 @@
 
 /**
- * send notifications and/or add subscriber
+ * send notifications and/or add subscriber on comment insertion
+ * @param: array comment
  */
 function stc_comment_insertion($comm)
@@ -33,6 +35,4 @@
   global $page, $template;
   
-  $infos = $errors = array();
-  
   if ($comm['action'] == 'validate')
   {
@@ -40,46 +40,58 @@
   }
   
-  if ( !empty($_POST['stc_check']) and ( $comm['action'] == 'validate' or $comm['action'] == 'moderate' ) )
-  {
-    if (isset($comm['image_id']))
-    {
-      $return = subscribe_to_comments($comm['image_id'], @$_POST['stc_mail'], 'image');
-    }
-    else if (isset($comm['category_id']))
-    {
-      $return = subscribe_to_comments($comm['category_id'], @$_POST['stc_mail'], 'category');
-      
-    }
-    
-    if (isset($return))
-    {
-      if ($return === 'confirm_mail')
-      {
-        array_push($infos, l10n('Please check your email inbox to confirm your subscription.'));
-      }
-      else if ($return === true)
-      {
-        array_push($infos, l10n('You have been added to the list of subscribers for this '.(isset($comm['image_id'])?'picture':'album').'.'));
-      }
-      else
-      {
-        array_push($errors, l10n('Invalid email adress, your are not subscribed to comments.'));
-      }
-      
-      // messages management
-      stc_add_messages($errors, $infos, true);
-    }
-  }
-}
-
+  if ( !empty($_POST['stc_mode']) and $_POST['stc_mode'] != -1 )
+  {
+    if ($comm['action'] != 'reject')
+    {
+      if (isset($comm['image_id']))
+      {
+        switch ($_POST['stc_mode'])
+        {
+          case 'all-images':
+            subscribe_to_comments(@$_POST['stc_mail'], 'all-images');
+            break;
+          case 'album-images':
+            if (empty($page['category']['id'])) break;
+            subscribe_to_comments(@$_POST['stc_mail'], 'album-images', $page['category']['id']);
+            break;
+          case 'image':
+            subscribe_to_comments(@$_POST['stc_mail'], 'image', $comm['image_id']);
+            break;
+        }
+      }
+      else if (isset($comm['category_id']))
+      {
+        switch ($_POST['stc_mode'])
+        {
+          case 'all-albums':
+            subscribe_to_comments(@$_POST['stc_mail'], 'all-albums');
+            break;
+          case 'album':
+            subscribe_to_comments(@$_POST['stc_mail'], 'album', $comm['category_id']);
+            break;
+        }
+      }
+    }
+    else
+    {
+      $template->assign('STC_MODE', $_POST['stc_mode']);
+      $template->assign('STC_MAIL', @$_POST['stc_mail']);
+    }
+  }
+}
+
+
+/**
+ * send notifications on comment validation
+ * @param: array|int comment_id
+ * @param: string type (image|category)
+ */
 function stc_comment_validation($comm_ids, $type='image')
 {
   if (!is_array($comm_ids)) $comm_ids = array($comm_ids);
   
-  foreach($comm_ids as $comm_id)
-  {
-    if ($type == 'image')
-    {
-      $query = '
+  if ($type == 'image')
+  {
+    $query = '
 SELECT
     id,
@@ -88,10 +100,10 @@
     content
   FROM '.COMMENTS_TABLE.'
-  WHERE id = '.$comm_id.'
-;';
-    }
-    else if ($type == 'category')
-    {
-      $query = '
+  WHERE id IN('.implode(',', $comm_ids).')
+;';
+  }
+  else if ($type == 'category')
+  {
+    $query = '
 SELECT
     id,
@@ -100,9 +112,11 @@
     content
   FROM '.COA_TABLE.'
-  WHERE id = '.$comm_id.'
-;';
-    }
-    
-    $comm = pwg_db_fetch_assoc(pwg_query($query));
+  WHERE id IN('.implode(',', $comm_ids).')
+;';
+  }
+  
+  $comms = hash_from_query($query, 'id');
+  foreach ($comms as $comm)
+  {
     send_comment_to_subscribers($comm);
   }
@@ -115,73 +129,128 @@
 function stc_on_picture()
 {
-  global $template, $picture, $page, $user;
-  
-  $infos = $errors = array();
-  
+  global $template, $picture, $page, $user, $conf;
+  
+  // standalone subscription
   if (isset($_POST['stc_submit']))
   {
-    $return = subscribe_to_comments($picture['current']['id'], @$_POST['stc_mail_stdl'], 'image');
-    if ($return === 'confirm_mail')
-    {
-      array_push($infos, l10n('Please check your email inbox to confirm your subscription.'));
-    }
-    else if ($return === true)
-    {
-      array_push($infos, l10n('You have been added to the list of subscribers for this picture.'));
-    }
-    else
-    {
-      array_push($errors, l10n('Invalid email adress, your are not subscribed to comments.'));
+    switch ($_POST['stc_mode'])
+    {
+      case 'all-images':
+        subscribe_to_comments(@$_POST['stc_mail'], 'all-images');
+        break;
+      case 'album-images':
+        if (empty($page['category']['id'])) break;
+        subscribe_to_comments(@$_POST['stc_mail'], 'album-images', $page['category']['id']);
+        break;
+      case 'image':
+        subscribe_to_comments(@$_POST['stc_mail'], 'image', $picture['current']['id']);
+        break;
     }
   }
   else if (isset($_GET['stc_unsubscribe']))
-  {
-    if (un_subscribe_to_comments($picture['current']['id'], null, 'image'))
-    {
-      array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
-    }
-  }
-  
-  // messages management
-  stc_add_messages($errors, $infos);
+  {    
+    if (un_subscribe_to_comments(null, $_GET['stc_unsubscribe']))
+    {
+      array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
+    }
+  }
   
   // if registered user with mail we check if already subscribed
   if ( !is_a_guest() and !empty($user['email']) )
   {
-    $query = '
-SELECT id
-  FROM '.SUBSCRIBE_TO_TABLE.'
-  WHERE
-    email = "'.$user['email'].'"
-    AND image_id = '.$picture['current']['id'].'
-    AND validated = "true"
-;';
-    if (pwg_db_num_rows(pwg_query($query)))
-    {
-      $template->assign(array(
-        'SUBSCRIBED' => true,
-        'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>'1')),
-        ));
+    $subscribed = false;
+    
+    // registered to all pictures
+    if (!$subscribed)
+    {
+      $query = '
+SELECT id
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE
+    email = "'.$user['email'].'"
+    AND type = "all-images"
+    AND validated = "true"
+;';
+      $result = pwg_query($query);
+      
+      if (pwg_db_num_rows($result))
+      {
+        $template->assign(array(
+          'SUBSCRIBED_ALL_IMAGES' => true,
+          'MANAGE_LINK' => make_stc_url('manage', $user['email']),
+          ));
+        $subscribed = true;
+      }
+    }
+
+    // registered to pictures in this album
+    if ( !$subscribed and !empty($page['category']['id']) )
+    {
+      $query = '
+SELECT id
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE
+    email = "'.$user['email'].'"
+    AND element_id = '.$page['category']['id'].'
+    AND type = "album-images"
+    AND validated = "true"
+;';
+      $result = pwg_query($query);
+      
+      if (pwg_db_num_rows($result))
+      {
+        list($stc_id) = pwg_db_fetch_row($result);
+        $template->assign(array(
+          'SUBSCRIBED_ALBUM_IMAGES' => true,
+          'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)),
+          ));
+        $subscribed = true;
+      }
+    }
+    
+    // registered to this picture
+    if (!$subscribed)
+    {
+      $query = '
+SELECT id
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE
+    email = "'.$user['email'].'"
+    AND element_id = '.$picture['current']['id'].'
+    AND type = "image"
+    AND validated = "true"
+;';
+      $result = pwg_query($query);
+      
+      if (pwg_db_num_rows($result))
+      {
+        list($stc_id) = pwg_db_fetch_row($result);
+        $template->assign(array(
+          'SUBSCRIBED_IMAGE' => true,
+          'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)),
+          ));
+        $subscribed = true;
+      }
     }
   }
   else
   {
-    $template->assign('ASK_MAIL', true);
-  }
-  
-  if ( $is_simple = strstr($user['theme'], 'simple') !== false or strstr($user['theme'], 'stripped') !== false )
-    $template->set_prefilter('picture', 'stc_simple_prefilter');
-  else
-    $template->set_prefilter('picture', 'stc_main_prefilter');
-}
-
-/**
- * add field and on album page
+    $template->assign('STC_ASK_MAIL', true);
+  }
+  
+  $template->assign('STC_ON_PICTURE', true);
+  if ( !empty($page['category']['id']) ) $template->assign('STC_ALLOW_ALBUM_IMAGES', true);
+  if ( $conf['Subscribe_to_Comments']['allow_global_subscriptions'] or is_admin() ) $template->assign('STC_ALLOW_GLOBAL', true);
+  
+  $template->set_prefilter('picture', 'stc_main_prefilter');
+}
+
+
+/**
+ * add field and link on album page
  */
 function stc_on_album()
 {
-  global $page, $template, $pwg_loaded_plugins, $user;
-  
-  $infos = $errors = array();
+  global $page, $template, $pwg_loaded_plugins, $user, $conf;
   
   if (
@@ -196,173 +265,110 @@
   if (isset($_POST['stc_submit']))
   {
-    $return = subscribe_to_comments($page['category']['id'], @$_POST['stc_mail_stdl'], 'category');
-    if ($return === 'confirm_mail')
-    {
-      array_push($infos, l10n('Please check your email inbox to confirm your subscription.'));
-    }
-    else if ($return === true)
-    {
-      array_push($infos, l10n('You have been added to the list of subscribers for this album.'));
-    }
-    else
-    {
-      array_push($errors, l10n('Invalid email adress, your are not subscribed to comments.'));
+    switch ($_POST['stc_mode'])
+    {
+      case 'all-albums':
+        subscribe_to_comments(@$_POST['stc_mail'], 'all-albums');
+        break;
+      case 'album':
+        subscribe_to_comments(@$_POST['stc_mail'], 'album', $page['category']['id']);
+        break;
     }
   }
   else if (isset($_GET['stc_unsubscribe']))
   {
-    if (un_subscribe_to_comments($page['category']['id'], null, 'category'))
-    {
-      array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
-    }
-  }
-  
-  // messages management
-  stc_add_messages($errors, $infos, true);
+    if (un_subscribe_to_comments(null, $_GET['stc_unsubscribe']))
+    {
+      array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
+    }
+  }
   
   // if registered user we check if already subscribed
   if ( !is_a_guest() and !empty($user['email']) )
   {
-    $query = '
-SELECT id
-  FROM '.SUBSCRIBE_TO_TABLE.'
-  WHERE
-    email = "'.$user['email'].'"
-    AND category_id = '.$page['category']['id'].'
-    AND validated = "true"
-;';
-    if (pwg_db_num_rows(pwg_query($query)))
-    {
-      $url_params['section'] = 'categories';
-      $url_params['category'] = $page['category'];
-      $element_url = make_index_url($url_params);
-      
-      $template->assign(array(
-        'SUBSCRIBED' => true,
-        'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>'1')),
-        ));
+    $subscribed = false;
+    
+    // registered to all albums
+    if (!$subscribed)
+    {
+      $query = '
+SELECT id
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE
+    email = "'.$user['email'].'"
+    AND type = "all-albums"
+    AND validated = "true"
+;';
+      $result = pwg_query($query);
+      
+      if (pwg_db_num_rows($result))
+      {
+        $template->assign(array(
+          'SUBSCRIBED_ALL_ALBUMS' => true,
+          'MANAGE_LINK' => make_stc_url('manage', $user['email']),
+          ));
+        $subscribed = true;
+      }
+    }
+    
+    // registered to this album
+    if (!$subscribed)
+    {
+      $query = '
+SELECT id
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE
+    email = "'.$user['email'].'"
+    AND element_id = '.$page['category']['id'].'
+    AND type = "album"
+    AND validated = "true"
+;';
+      $result = pwg_query($query);
+      
+      if (pwg_db_num_rows($result))
+      {
+        list($stc_id) = pwg_db_fetch_row($result);
+        $element_url = make_index_url(array(
+          'section' => 'categories',
+          'category' => $page['category'],
+          ));
+        
+        $template->assign(array(
+          'SUBSCRIBED_ALBUM' => true,
+          'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)),
+          ));
+        $subscribed = true;
+      }
     }
   }
   else
   {
-    $template->assign('ASK_MAIL', true);
-  }
-  
-  if ( $is_simple = strstr($user['theme'], 'simple') !== false or strstr($user['theme'], 'stripped') !== false )
-    $template->set_prefilter('comments_on_albums', 'stc_simple_prefilter');
-  else
-    $template->set_prefilter('comments_on_albums', 'stc_main_prefilter');
-}
-
-
-/**
- * prefilter for common themes
+    $template->assign('STC_ASK_MAIL', true);
+  }
+  
+  $template->assign('STC_ON_ALBUM', true);
+  if ( $conf['Subscribe_to_Comments']['allow_global_subscriptions'] or is_admin() ) $template->assign('STC_ALLOW_GLOBAL', true);
+
+  $template->set_prefilter('comments_on_albums', 'stc_main_prefilter');
+}
+
+
+/**
+ * main prefilter
  */
 function stc_main_prefilter($content, &$smarty)
-{  
+{
   ## subscribe at any moment ##
-  $search = '#\<\/div\>(.{0,10})\{\/if\}(.{0,10})\{\*comments\*\}#is';
-  
-  $replace = '
-<form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
-  <fieldset>
-  {if $SUBSCRIBED}
-    {\'You are currently subscribed to comments of this picture.\'|@translate}
-    <a href="{$UNSUB_LINK}">{\'Unsubscribe\'|@translate}
-  {else}
-    <legend>{\'Subscribe without commenting\'|@translate}</legend>
-    {if $ASK_MAIL}
-      <label>{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label>
-      <label><input type="submit" name="stc_submit" value="{\'Submit\'|@translate}"></label>
-    {else}
-      <label><input type="submit" name="stc_submit" value="{\'Subscribe\'|@translate}"></label>
-    {/if}
-  {/if}
-  </fieldset>
-</form>
-</div>$1{/if}$2{*comments*}';
-
-  $content = preg_replace($search, $replace, $content);
+  $search = '{if isset($comments)}';
+  $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_standalone.tpl');
+  $content = str_replace($search, $replace.$search, $content);
   
   ## subscribe while add a comment ##
-  $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#';
-  
-  $replace = '
-<input type="hidden" name="key" value="{$comment_add.KEY}"$1>
-{if !$SUBSCRIBED}
-  <label>{\'Notify me of followup comments\'|@translate} <input type="checkbox" name="stc_check" value="1"></label><br>
-
-  {if $ASK_MAIL}
-    <label id="stc_mail" style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail"></label><br>
-    {footer_script require="jquery"}{literal}
-    jQuery(document).ready(function() {
-      $("input[name=stc_check]").change(function() {
-        if ($(this).is(":checked")) $("#stc_mail").css("display", "");
-        else $("#stc_mail").css("display", "none");
-      });
-    });
-    {/literal}{/footer_script}
-  {/if}
-{/if}';
-  
-  $content = preg_replace($search, $replace, $content);
+  $search = '<p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>';
+  $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_comment.tpl');
+  $content = str_replace($search, $search.$replace, $content);
   
   return $content;
 }
 
-/**
- * prefilter for simple/stripped themes
- */
-function stc_simple_prefilter($content, &$smarty)
-{  
-  ## subscribe at any moment ##
-  $search = '#\<\/div\>(.{0,10})\{\/if\}(.{0,10})\{if \!empty\(\$navbar\) \}\{include file\=\'navigation_bar.tpl\'\|\@get_extent:\'navbar\'\}\{\/if\}#is';
-  
-  $replace = '
-<form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
-  <fieldset>
-  {if $SUBSCRIBED}
-    {\'You are currently subscribed to comments of this album.\'|@translate}
-    <a href="{$UNSUB_LINK}">{\'Unsubscribe\'|@translate}
-  {else}
-    <legend>{\'Subscribe without commenting\'|@translate}</legend>
-    {if $ASK_MAIL}
-      <label>{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label>
-      <label><input type="submit" name="stc_submit" value="{\'Submit\'|@translate}"></label>
-    {else}
-      <label><input type="submit" name="stc_submit" value="{\'Subscribe\'|@translate}"></label>
-    {/if}
-  {/if}
-  </fieldset>
-</form>
-</div>$1{/if}$2{if !empty($navbar) }{include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'}{/if}';
-
-  $content = preg_replace($search, $replace, $content);
-  
-  ## subscribe while add a comment ##
-  $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#';
-  
-  $replace = '
-<input type="hidden" name="key" value="{$comment_add.KEY}"$1>
-{if !$SUBSCRIBED}
-  <label>{\'Notify me of followup comments\'|@translate} <input type="checkbox" name="stc_check" value="1"></label><br>
-
-  {if $ASK_MAIL}
-    <label id="stc_mail" style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail"></label><br>
-    {footer_script require="jquery"}{literal}
-    jQuery(document).ready(function() {
-      $("input[name=stc_check]").change(function() {
-        if ($(this).is(":checked")) $("#stc_mail").css("display", "");
-        else $("#stc_mail").css("display", "none");
-      });
-    });
-    {/literal}{/footer_script}
-  {/if}
-{/if}';
-  
-  $content = preg_replace($search, $replace, $content);
-  
-  return $content;
-}
 
 /**
@@ -375,39 +381,15 @@
   if (!empty($user['email']))
   {
+    $template->assign('MANAGE_LINK', make_stc_url('manage', $user['email']) );
     $template->set_prefilter('profile_content', 'stc_profile_link_prefilter');
   }
 }
-
 function stc_profile_link_prefilter($content, &$smarty)
 {
-  global $user;
-  
   $search = '<p class="bottomButtons">';
-  $replace = '<a href="'.make_stc_url('manage', $user['email']).'" title="{\'Manage my subscriptions to comments\'|@translate}" rel="nofollow">{\'Manage my subscriptions to comments\'|@translate}</a><br>';
-  
-  return str_replace($search, $search.$replace, $content);
-}
-
-/**
- * must overload messages because Piwigo is weird
- */
-function stc_add_messages($errors, $infos, $prefilter=false)
-{
-  global $template;
-  
-  if (!empty($errors))
-  {
-    $errors_bak = $template->get_template_vars('errors');
-    if (empty($errors_bak)) $errors_bak = array();
-    $template->assign('errors', array_merge($errors_bak, $errors));
-    if ($prefilter) $template->set_prefilter('index', 'coa_messages'); // here we use a prefilter existing in COA
-  }
-  if (!empty($infos))
-  {
-    $infos_bak = $template->get_template_vars('infos');
-    if (empty($infos_bak)) $infos_bak = array();
-    $template->assign('infos', array_merge($infos_bak, $infos));
-    if ($prefilter) $template->set_prefilter('index', 'coa_messages');
-  }
-}
+  $replace = '<p style="font-size:1.1em;text-decoration:underline;"><a href="{$MANAGE_LINK}" rel="nofollow">{\'Manage my subscriptions to comments\'|@translate}</a></p>';
+  
+  return str_replace($search, $replace.$search, $content);
+}
+
 ?>
Index: extensions/Subscribe_to_comments/include/subscribtions_page.inc.php
===================================================================
--- extensions/Subscribe_to_comments/include/subscribtions_page.inc.php	(revision 15376)
+++ extensions/Subscribe_to_comments/include/subscribtions_page.inc.php	(revision 15641)
@@ -2,10 +2,9 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-global $template, $conf;
-
-$infos = $errors = array();
+global $template, $conf, $page, $pwg_loaded_plugins;
 
 // check input parameters
 $_GET['verif_key'] = $_GET['action'].$_GET['email'].(isset($_GET['id'])?$_GET['id']:null);
+
 if ( 
   empty($_GET['action']) or empty($_GET['email']) or empty($_GET['key'])
@@ -13,43 +12,58 @@
   )
 {
-  $_GET['action'] = 'hacker';
+  $_GET['action'] = null;
 }
 else
 {
-  // sanitize inputs
-  if (isset($_GET['id'])) $_GET['id'] = pwg_db_real_escape_string($_GET['id']);
-  $_GET['email'] = pwg_db_real_escape_string($_GET['email']);
-
-  // unsubscribe
-  if (isset($_POST['unsubscribe']))
-  {
-    if (un_subscribe_to_comments(!empty($_GET['id'])?$_GET['id']:'N/A', $_GET['email'], $_POST['unsubscribe']))
-    {
-      array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
-    }
-    else
-    {
-      array_push($errors, l10n('Invalid email adress.'));
-    }
-    
-    $_GET['action'] = 'manage';
-  }
+  // unsubscribe all
+  if ( isset($_POST['unsubscribe_all']) and isset($_POST['unsubscribe_all_check']) )
+  {
+    $query = '
+DELETE FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE email = "'.$_GET['email'].'"
+;';
+    pwg_query($query);
+  }
+  
+  // bulk action
+  if (isset($_POST['apply_bulk']))
+  {
+    foreach ($_POST['selected'] as $id)
+    {
+      switch ($_POST['action'])
+      {
+        case 'unsubscribe':
+          un_subscribe_to_comments($_GET['email'], $id);
+          break;
+        case 'validate':
+          validate_subscriptions($_GET['email'], $id);
+          break;
+      }
+    }
+  }
+  
+  // unsubscribe from manage page
   if (isset($_GET['unsubscribe']))
   {
-    $query = '
-  DELETE FROM '.SUBSCRIBE_TO_TABLE.'
-    WHERE 
-      id = '.pwg_db_real_escape_string($_GET['unsubscribe']).'
-      AND email = "'.$_GET['email'].'"
-  ;';
-    pwg_query($query);
-    
-    if (pwg_db_changes(null) != 0)
-    {
-      array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
-    }
-    else
-    {
-      array_push($errors, l10n('Invalid email adress.'));
+    if (un_subscribe_to_comments($_GET['email'], $_GET['unsubscribe']))
+    {
+      array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
+    }
+    else
+    {
+     array_push($page['errors'], l10n('Not found.'));
+    }
+  }
+  
+  // validate from manage page
+  if (isset($_GET['validate']))
+  {
+    if (validate_subscriptions($_GET['email'], $_GET['validate']))
+    {
+      array_push($page['infos'], l10n('Your subscribtion has been validated, thanks you.'));
+    }
+    else
+    {
+      array_push($page['infos'], l10n('Already validated.'));
     }
   }
@@ -58,99 +72,147 @@
 }
 
+
 switch ($_GET['action'])
 {
   /* validate */
-  case 'validate-image' :
-  {
-    if (validate_subscriptions($_GET['id'], $_GET['email'], 'image'))
-    {
-      array_push($infos, l10n('Your subscribtion has been validated, thanks you.'));
-    }
-    else
-    {
-      array_push($errors, l10n('Nothing to validate.'));
-    }
-    
-    $element = get_picture_infos($_GET['id']);
-    
-    $template->assign(array(
-      'validate' => 'image',
-      'element' => $element,
-      ));
-      
-    break;
-  }
-  case 'validate-category':
-  {
-    if (validate_subscriptions($_GET['id'], $_GET['email'], 'category'))
-    {
-      array_push($infos, l10n('Your subscribtion has been validated, thanks you.'));
-    }
-    else
-    {
-      array_push($errors, l10n('Nothing to validate.'));
-    }
-    
-    $element = get_category_infos($_GET['id']);
-    
-    $template->assign(array(
-      'validate' => 'category',
-      'element' => $element,
-      ));
-    break;
-  }
-  
-  /* unsubscribe */
-  case 'unsubscribe-image' :
-  {  
-    $element = get_picture_infos($_GET['id']);
-    
-    $template->assign(array(
-      'unsubscribe_form' => 'image',
-      'element' => $element,
-      ));
-    
-    break;
-  }
-  case 'unsubscribe-category':
-  {  
-    $element = get_category_infos($_GET['id']);
-    
-    $template->assign(array(
-      'unsubscribe_form' => 'category',
-      'element' => $element,
-      ));
-    
-    break;
-  }
-  
-  /* manage */
-  case 'manage' :
-  {
-    $query = '
-SELECT *
+  case 'validate':
+  {
+    $query = '
+SELECT
+    type,
+    element_id
   FROM '.SUBSCRIBE_TO_TABLE.'
   WHERE 
     email = "'.$_GET['email'].'"
-    AND validated = "true"
+    AND id = '.$_GET['id'].'
+;';
+    $result = pwg_query($query);
+    
+    if (!pwg_db_num_rows($result))
+    {
+      array_push($page['errors'], l10n('Not found.'));
+    }
+    else
+    {
+      if (validate_subscriptions($_GET['email'], $_GET['id']))
+      {
+        array_push($page['infos'], l10n('Your subscribtion has been validated, thanks you.'));
+      }
+      else
+      {
+        array_push($page['infos'], l10n('Already validated.'));
+      }
+      
+      list($type, $element_id) = pwg_db_fetch_row($result);
+      
+      switch ($type)
+      {
+        case 'image':
+          $element = get_picture_infos($element_id, false);
+          break;
+        case 'album-images':
+        case 'album':
+          $element = get_category_infos($element_id, false);
+          break;
+        default:
+          $element = null;
+      }
+      
+      $template->assign(array(
+        'type' => $type,
+        'element' => $element,
+        ));
+    }
+    
+    $template->assign('IN_VALIDATE', true);
+    break;
+  }
+  
+  /* unsubscribe */
+  case 'unsubscribe':
+  {
+    $query = '
+SELECT
+    type,
+    element_id
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE 
+    email = "'.$_GET['email'].'"
+    AND id = '.$_GET['id'].'
+;';
+    $result = pwg_query($query);
+    
+    if (!pwg_db_num_rows($result))
+    {
+      array_push($page['errors'], l10n('Not found.'));
+    }
+    else
+    {
+      if (un_subscribe_to_comments($_GET['email'], $_GET['id']))
+      {
+        array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
+      }
+      else
+      {
+        array_push($page['errors'], l10n('Not found.'));
+      }
+      
+      list($type, $element_id) = pwg_db_fetch_row($result);
+      
+      switch ($type)
+      {
+        case 'image':
+          $element = get_picture_infos($element_id);
+          break;
+        case 'album-images':
+        case 'album':
+          $element = get_category_infos($element_id);
+          break;
+        default:
+          $element = null;
+      }
+      
+      $template->assign(array(
+        'type' => $type,
+        'element' => $element,
+        ));
+    }
+    
+    $template->assign('IN_UNSUBSCRIBE', true);
+    break;
+  }
+  
+  /* manage */
+  case 'manage':
+  {
+    $query = '
+SELECT *
+  FROM '.SUBSCRIBE_TO_TABLE.'
+  WHERE email = "'.$_GET['email'].'"
   ORDER BY registration_date DESC
 ;';
     $result = pwg_query($query);
     
-    if (pwg_db_num_rows($result) !== 0)
+    if (pwg_db_num_rows($result))
     {
       while ($subscription = pwg_db_fetch_assoc($result))
       {
-        if (!empty($subscription['image_id']))
+        $subscription['registration_date'] = format_date($subscription['registration_date'], true);
+        
+        switch ($subscription['type'])
         {
-          $subscription['infos'] = get_picture_infos($subscription['image_id']);
-          $subscription['type'] = 'image';
+          case 'image':
+            $subscription['infos'] = get_picture_infos($subscription['element_id']);
+            break;
+          case 'album-images':
+          case 'album':
+            $subscription['infos'] = get_category_infos($subscription['element_id']);
+            break;
+          default:
+            $subscription['infos'] = null;
+            $template->append('global_subscriptions', $subscription);
+            continue(2);
         }
-        else if (!empty($subscription['category_id']))
-        {
-          $subscription['infos'] = get_category_infos($subscription['category_id']);
-          $subscription['type'] = 'category';
-        }
-        $subscription['registration_date'] = format_date($subscription['registration_date'], true);
+        
         $template->append('subscriptions', $subscription);
       }
@@ -158,14 +220,19 @@
     else
     {
-      $template->assign('subscriptions', 'none');
+      array_push($page['infos'], l10n('You are not subscribed to any comment.'));
     }
     break;
   }
   
-  case 'hacker' :
+  default:
   {
     set_status_header(403);
-    array_push($errors, l10n('Bad query'));
-  }
+    array_push($page['errors'], l10n('Bad query'));
+  }
+}
+
+if (isset($pwg_loaded_plugins['Comments_on_Albums']))
+{
+  $template->assign('COA_ACTIVATED', true);
 }
 
@@ -175,9 +242,5 @@
   ));
 
-$template->assign(array(
-  'infos' => $infos,
-  'errors' => $errors,
-  ));
-
 $template->set_filenames(array('index'=> dirname(__FILE__).'/../template/subscribtions_page.tpl'));
+
 ?>
Index: extensions/Subscribe_to_comments/index.php
===================================================================
--- extensions/Subscribe_to_comments/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/ca_ES/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/ca_ES/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/ca_ES/plugin.lang.php	(revision 15641)
@@ -21,25 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
-$lang['Date'] = 'Data';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Adreça de correu electrònic no vàlida. No està inscrit als comentaris.';
-$lang['Invalid email adress.'] = 'Adreça de correu electrònic no vàlida';
-$lang['Item'] = 'Objecte';
-$lang['Manage my subscriptions to comments'] = 'Gestionar les meves inscripcions als comentaris';
-$lang['Nothing to validate.'] = 'No hi ha res per validar';
 $lang['Notify me of followup comments'] = 'Notificar-me en cas d\'haver-hi nous comentaris';
-$lang['Only unsubscribe notifications for comments from:'] = 'Només donar de baixa les notificacions per comentaris de:';
 $lang['Please check your email inbox to confirm your subscription.'] = 'Revisi el seu correu electrònic per confirmar la seva inscripció.';
 $lang['Return to item page'] = 'Tornar a la pàgina anterior';
-$lang['Subscribe without commenting'] = 'Instriure\'s sense comentar';
 $lang['Subscribe'] = 'Instriure\'s';
 $lang['Subscriptions of'] = 'Incripcions de';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'La seva adreça de correu electrònic ha estat donat de baixa correctament. No rebrà més notificacions.';
 $lang['Unsubscribe from all email notifications'] = 'Donar-se de baixa de totes les notificacions per correu electrònic';
-$lang['Unsubscribe from email notification'] = 'Donar-se de baixa de les notificacions per correu electrònic';
 $lang['Unsubscribe'] = 'Donar de baixa';
-$lang['You are currently subscribed to comments.'] = 'Actualment ja està inscrit als comentaris.';
 $lang['You are not subscribed to any comment.'] = 'No està inscrit a cap comentari';
-$lang['You have been added to the list of subscribers for this album.'] = 'Se l\'ha afegit a la llista d\'usuaris inscrits per a aquest àlbum.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Se l\'ha afegit a la llista d\'usuaris inscrits per a aquesta imatge.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'La seva inscripció ha estat validada. Gràcies.';
 ?>
Index: extensions/Subscribe_to_comments/language/cs_CZ/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/cs_CZ/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/cs_CZ/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/cs_CZ/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/cs_CZ/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/cs_CZ/plugin.lang.php	(revision 15641)
@@ -1,23 +1,12 @@
 <?php
 $lang['Please check your email inbox to confirm your subscription.'] = 'Prosím nyní zkontrolujte vaši email schránku a odsouhlaste vaše přihlášení k odběru.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Byl jste přidán do seznamu účastníků diskuze pro toto album.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Byl jste přidán do seznamu účastníků diskuze pro tento obrázek.';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Byla zadána neplatná email adresa, nebyl jste zařazen k odběru komentářů.';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Vaše email adresa byla úspěšně odstraněna ze seznamu odběratelů pro upozorňující zprávy.';
-$lang['You are currently subscribed to comments.'] = 'Nyní jste přihlášen k odběru komentářů.';
 $lang['Unsubscribe'] = 'Odhlásit';
 $lang['Subscribe'] = 'Přihlásit';
-$lang['Subscribe without commenting'] = 'Přihlášení bez zadání komentáře';
 $lang['Notify me of followup comments'] = 'Upozorni mě na následující komentáře';
-$lang['Invalid email adress.'] = 'Neplatný email.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Vaše přihlášení k odběru bylo potvrzeno, děkujeme vám.';
-$lang['Nothing to validate.'] = 'Nic k ověření.';
 $lang['Subscriptions of'] = 'Odběr z';
-$lang['Unsubscribe from email notification'] = 'Odhlásit se z odběru upozorňujících zpráv o nových komentářích';
-$lang['Only unsubscribe notifications for comments from:'] = 'Odhlásit se z odběru upozornění jen z těchto komentářů:';
 $lang['Unsubscribe from all email notifications'] = 'Odhlásit se z odběru upozornění ze všech komentářů';
-$lang['Manage my subscriptions to comments'] = 'Spravovat moje přihlášení k odběrům komentářů';
-$lang['Item'] = 'Zpráva';
-$lang['Date'] = 'Datum';
 $lang['You are not subscribed to any comment.'] = 'Nejste nyní přihlášen k oběru upozornění u žádného komentáře.';
 $lang['Return to item page'] = 'Zpět na stránku zprávy';
Index: extensions/Subscribe_to_comments/language/de_DE/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/de_DE/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/de_DE/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/de_DE/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/de_DE/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/de_DE/plugin.lang.php	(revision 15641)
@@ -2,23 +2,12 @@
 
 $lang['Please check your email inbox to confirm your subscription.'] = 'Bitte überprüfen Sie Ihren Posteingang, um Ihre Abonnementanfrage zu bestätigen.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Sie wurden zur Abonnentenliste dieses Albums hinzugefügt.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Sie wurden zur Abonnentenliste dieses Bildes hinzugefügt.';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Ungültige E-mailadresse, Sie haben Kommentare nicht abonniert.';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Ihr Abonnement wurde erfolgreich deaktiviert. Sie erhalten keine weiteren Benachrichtigungen.';
-$lang['You are currently subscribed to comments.'] = 'Sie werden derzeit bei neuen Kommentaren benachrichtigt.';
 $lang['Unsubscribe'] = 'Abmelden';
 $lang['Subscribe'] = 'Anmelden';
-$lang['Subscribe without commenting'] = 'Anmelden ohne zu Kommentieren';
 $lang['Notify me of followup comments'] = 'Bei weiteren Kommentaren benachrichtigen';
-$lang['Invalid email adress.'] = 'Ungültige E-mailadresse.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Danke, ihr Abonnement wurde bestätigt.';
-$lang['Nothing to validate.'] = 'Nichts zu Bestätigen.';
 $lang['Subscriptions of'] = 'Abonnements von';
-$lang['Unsubscribe from email notification'] = 'Von E-mailbenachrichtigungen abmelden';
-$lang['Only unsubscribe notifications for comments from:'] = 'Nur die folgenden Benachrichtigungen deaktivieren:';
 $lang['Unsubscribe from all email notifications'] = 'Alle E-mailbenachrichtigungen deaktivieren';
-$lang['Manage my subscriptions to comments'] = 'Meine Abonnements verwalten';
-$lang['Item'] = 'Eintrag';
-$lang['Date'] = 'Datum';
 $lang['You are not subscribed to any comment.'] = 'Sie haben im Moment keine Benachrichtigungen abonniert.';
 $lang['Return to item page'] = 'Zurück zur Übersichtsseite der Einträge';
Index: extensions/Subscribe_to_comments/language/en_UK/description.txt
===================================================================
--- extensions/Subscribe_to_comments/language/en_UK/description.txt	(revision 15376)
+++ extensions/Subscribe_to_comments/language/en_UK/description.txt	(revision 15641)
@@ -1,1 +1,1 @@
-This plugin allows you to subscribe to comments by email.
+This plugin allows to subscribe to comments by email.
Index: extensions/Subscribe_to_comments/language/en_UK/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/en_UK/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/en_UK/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/en_UK/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/en_UK/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/en_UK/plugin.lang.php	(revision 15641)
@@ -1,26 +1,64 @@
 <?php
 
+$lang['Comments notifications'] = 'Comments notifications';
+
+/* messages */
+$lang['Invalid email adress, your are not subscribed to comments.'] = 'Invalid email adress, your are not subscribed to comments.';
+$lang['Confirm your subscribtion to comments'] = 'Confirm your subscribtion to comments';
+$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Successfully unsubscribed your email address from receiving notifications.';
+$lang['Not found.'] = 'Not found.';
+$lang['Your subscribtion has been validated, thanks you.'] = 'Your subscribtion has been validated, thanks you.';
+$lang['Already validated.'] = 'Already validated.';
+$lang['You are not subscribed to any comment.'] = 'You are not subscribed to any comment.';
 $lang['Please check your email inbox to confirm your subscription.'] = 'Please check your email inbox to confirm your subscription.';
-$lang['You have been added to the list of subscribers for this album.'] = 'You have been added to the list of subscribers for this album.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'You have been added to the list of subscribers for this picture.';
-$lang['Invalid email adress, your are not subscribed to comments.'] = 'Invalid email adress, your are not subscribed to comments.';
-$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Successfully unsubscribed your email address from receiving notifications.';
-$lang['You are currently subscribed to comments.'] = 'You are currently subscribed to comments.';
+$lang['You have been added to the list of subscribers.'] = 'You have been added to the list of subscribers.';
+
+/* sprintf */
+$lang['the picture <a href="%s">%s</a>'] = 'the picture <a href="%s">%s</a>';
+$lang['all pictures of the album <a href="%s">%s</a>'] = 'all pictures of the album <a href="%s">%s</a>';
+$lang['all pictures of the gallery'] = 'all pictures of the gallery';
+$lang['the album <a href="%s">%s</a>'] = 'the album <a href="%s">%s</a>';
+$lang['all albums of the gallery'] = 'all albums of the gallery';
+$lang['%s has subscribed to comments on'] = '%s has subscribed to comments on';
+
+/* config */
+$lang['Notify administrators when a user take a new subscription'] = 'Notify administrators when a user take a new subscription';
+$lang['Allow users to subscribe to global notifications'] = 'Allow users to subscribe to global notifications';
+
+/* comment form */
+$lang['Subscribe to mail notifications'] = 'Subscribe to mail notifications';
+$lang['Notify me of followup comments'] = 'Notify me of followup comments';
+$lang['You are currently subscribed to comments on'] =  'You are currently subscribed to comments on';
+$lang['on this picture'] = 'on this picture';
+$lang['on all pictures of this album'] = 'on all pictures of this album';
+$lang['on all pictures of the gallery'] = 'on all pictures of the gallery';
+$lang['on this album'] = 'on this album';
+$lang['on all albums of the gallery'] = 'on all albums of the gallery';
+
+/* buttons */
+$lang['Manage my subscribtions'] = 'Manage my subscribtions';
+$lang['Subscribe'] = 'Subscribe';
 $lang['Unsubscribe'] = 'Unsubscribe';
-$lang['Subscribe'] = 'Subscribe';
-$lang['Subscribe without commenting'] = 'Subscribe without commenting';
-$lang['Notify me of followup comments'] = 'Notify me of followup comments';
-$lang['Invalid email adress.'] = 'Invalid email adress.';
-$lang['Your subscribtion has been validated, thanks you.'] = 'Your subscribtion has been validated, thanks you.';
-$lang['Nothing to validate.'] = 'Nothing to validate.';
+$lang['Validate'] = 'Validate';
+$lang['Confirm subscription'] = 'Confirm subscription';
+
+/* email */
+$lang['New subscription on'] = 'New subscription on';
+$lang['Subscribe to comments on'] = 'Subscribe to comments on';
+$lang['You requested to subscribe by email to comments on'] = 'You requested to subscribe by email to comments on';
+$lang['To activate, click the confirm button. If you believe this is an error, please just ignore this message.'] = 'To activate, click the confirm button. If you believe this is an error, please just ignore this message.';
+$lang['Want to edit your notifications options?'] = 'Want to edit your notifications options?';
+$lang['New comment on'] = 'New comment on';
+
+/* manage page */
 $lang['Subscriptions of'] = 'Subscriptions of';
-$lang['Unsubscribe from email notification'] = 'Unsubscribe from email notification';
-$lang['Only unsubscribe notifications for comments from:'] = 'Only unsubscribe notifications for comments from:';
+$lang['Return to item page'] = 'Return to item page';
+$lang['Manage my subscriptions to comments'] = 'Manage my subscriptions to comments';
+$lang['Subject'] = 'Subject';
+$lang['Followed on'] = 'Followed on';
 $lang['Unsubscribe from all email notifications'] = 'Unsubscribe from all email notifications';
-$lang['Manage my subscriptions to comments'] = 'Manage my subscriptions to comments';
-$lang['Item'] = 'Item';
-$lang['Date'] = 'Date';
-$lang['You are not subscribed to any comment.'] = 'You are not subscribed to any comment.';
-$lang['Return to item page'] = 'Return to item page';
+$lang['comments on a picture'] = 'comments on a picture';
+$lang['comments on all pictures of an album'] = 'comments on all pictures of an album';
+$lang['comments on an album'] = 'comments on an album';
 
 ?>
Index: extensions/Subscribe_to_comments/language/es_ES/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/es_ES/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/es_ES/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/es_ES/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/es_ES/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/es_ES/plugin.lang.php	(revision 15641)
@@ -21,25 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
-$lang['Date'] = 'Fecha';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Email incorrecto, no se ha suscrito a los comentarios.';
-$lang['Invalid email adress.'] = 'Dirección de email incorrecta.';
-$lang['Item'] = 'Objeto';
-$lang['Manage my subscriptions to comments'] = 'Administrar mis suscripciones de los comentarios.';
-$lang['Nothing to validate.'] = 'Nada que validar.';
 $lang['Notify me of followup comments'] = 'Notificarme de próximos comentarios.';
-$lang['Only unsubscribe notifications for comments from:'] = 'Cancelar suscripción de los comentarios de:';
 $lang['Please check your email inbox to confirm your subscription.'] = 'Por favor, revisa tu buzón de correo electrónico para confirmar la suscripción.';
 $lang['Return to item page'] = 'Volver a la página anterior';
 $lang['Subscribe'] = 'Suscribir';
-$lang['Subscribe without commenting'] = 'Suscribirse sin comentar.';
 $lang['Subscriptions of'] = 'Suscripciones de';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Suscripción cancelada correctamente.';
 $lang['Unsubscribe'] = 'Cancelar suscripción';
 $lang['Unsubscribe from all email notifications'] = 'Cancelar todas las suscripciones por email ';
-$lang['Unsubscribe from email notification'] = 'Cancelar suscripción de notificaciones por email';
-$lang['You are currently subscribed to comments.'] = 'Estas suscrito a los comentarios.';
 $lang['You are not subscribed to any comment.'] = 'No estas suscrito a ningún comentarios';
-$lang['You have been added to the list of subscribers for this album.'] = 'Se ha añadido tu dirección a la lista de suscriptores del álbum.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Se ha añadido tu dirección a la lista de suscriptores de la foto.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Tu suscripción se ha validado, gracias.';
 ?>
Index: extensions/Subscribe_to_comments/language/fr_FR/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/fr_FR/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/fr_FR/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/fr_FR/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/fr_FR/plugin.lang.php	(revision 15641)
@@ -2,25 +2,15 @@
 
 $lang['Please check your email inbox to confirm your subscription.'] = 'Veillez consulter votre boite mail pour confirmer votre inscription.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Vous avez été ajouté à la liste des abonnés pour cet album.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Vous avez été ajouté à la liste des abonnés pour cette photo.';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Addresse email invalide, vous n\'avez pas été inscrit.';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Inscription aux commentaires annulée avec succès.';
-$lang['You are currently subscribed to comments.'] = 'Vous êtes actuellement inscrit aux commentaires.';
 $lang['Unsubscribe'] = 'Se désinscrire';
 $lang['Subscribe'] = 'S\'inscrire';
-$lang['Subscribe without commenting'] = 'S\'inscrire sans commenter';
 $lang['Notify me of followup comments'] = 'Me notifier des nouveaux commentaires';
-$lang['Invalid email adress.'] = 'Adress email invalide.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Votre inscription a été validée, merci.';
-$lang['Nothing to validate.'] = 'Rien à valider.';
 $lang['Subscriptions of'] = 'Abonnements de';
-$lang['Unsubscribe from email notification'] = 'Se désinscrire de la notification par mail';
-$lang['Only unsubscribe notifications for comments from:'] = 'Uniquement se désinscrire de :';
 $lang['Unsubscribe from all email notifications'] = 'Ne plus recevoir aucune notification';
-$lang['Manage my subscriptions to comments'] = 'Gérer mes abonnements aux commentaires';
-$lang['Item'] = 'Objet';
-$lang['Date'] = 'Date';
 $lang['You are not subscribed to any comment.'] = 'Vous n\'êtes inscrit à aucun commentaire.';
 $lang['Return to item page'] = 'Retourner à la page de l\'élément';
+$lang['New comment on'] = 'Nouveau commentaire sur';
 
 ?>
Index: extensions/Subscribe_to_comments/language/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/it_IT/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/it_IT/index.php	(revision 15641)
+++ extensions/Subscribe_to_comments/language/it_IT/index.php	(revision 15641)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Subscribe_to_comments/language/it_IT/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/it_IT/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/it_IT/plugin.lang.php	(revision 15641)
@@ -21,25 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
-$lang['Date'] = 'Data';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Indirizzo mail errato, non sei sottoscritto ai commenti';
-$lang['Invalid email adress.'] = 'Indirizzo mail errato';
-$lang['Item'] = 'Oggetto';
-$lang['Manage my subscriptions to comments'] = 'Gestisci le mie sottoscrizioni ai commenti';
-$lang['Nothing to validate.'] = 'Niente da confermare.';
 $lang['Notify me of followup comments'] = 'Notificami sui commenti successivi';
-$lang['Only unsubscribe notifications for comments from:'] = 'Rimuovi la sottoscrizione delle notifiche solo per i commenti di:';
 $lang['Please check your email inbox to confirm your subscription.'] = 'Controlla la tua posta in arrivo per confermare la sottoscrizione';
 $lang['Return to item page'] = 'Ritorna alla pagina degli argomenti';
 $lang['Subscribe'] = 'Sottoscrivi';
-$lang['Subscribe without commenting'] = 'Sottoscrivi senza commentare';
 $lang['Subscriptions of'] = 'Sottoscrizione di';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'La sottoscrizione del tuo account email alle notifiche è stata disattivata con successo';
 $lang['Unsubscribe'] = 'Non sottoscrivere';
 $lang['Unsubscribe from all email notifications'] = 'Rimuovi la sottoscrizione da tutte le notifiche mail';
-$lang['Unsubscribe from email notification'] = 'Rimuovi la sottoscrizione delle notifiche mail';
-$lang['You are currently subscribed to comments.'] = 'La sottoscrizione ai commenti è attualmente attiva';
 $lang['You are not subscribed to any comment.'] = 'Non hai sottoscritto alcun commento';
-$lang['You have been added to the list of subscribers for this album.'] = 'Sei stato aggiunto alla lista delle sottoscrizioni per questo album';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Sei stato aggiunto alla lista delle sottoscrizioni per questa immagine';
 $lang['Your subscribtion has been validated, thanks you.'] = 'La tua sottoscrizione è stata confermata, grazie.';
 ?>
Index: extensions/Subscribe_to_comments/language/lv_LV/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/lv_LV/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/lv_LV/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/lv_LV/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/lv_LV/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/lv_LV/plugin.lang.php	(revision 15641)
@@ -22,23 +22,12 @@
 // +-----------------------------------------------------------------------+
 $lang['Please check your email inbox to confirm your subscription.'] = 'Lūdzu pārbaudiet savu e-pastu, lai apstiprinātu savu pierakstu.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Jūs esat pievienots šā albūma parakstītāju sarakstam.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Jūs esat pievienots šā foto parakstītāju sarakstam.';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Nekorekta e-pasta adrese, jūs neesat pierakstījies komentāriem.';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Jūsu e-pasta adrese sekmīgi izņemta no paziņojumu saņēmēju saraksta.';
-$lang['You are currently subscribed to comments.'] = 'Jūs patlaban esat pierakstījies komentāriem.';
 $lang['Unsubscribe'] = 'Atsacīties no pieraksta';
 $lang['Subscribe'] = 'Pierakstīties';
-$lang['Subscribe without commenting'] = 'Pierakstīties nekomentējot';
 $lang['Notify me of followup comments'] = 'Paziņot man par tekošajiem komentāriem';
-$lang['Invalid email adress.'] = 'Nekorekta e-pasta adrese.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Paldies. Jūsu pieraksts ir validēts.';
-$lang['Nothing to validate.'] = 'Nav ko validēt.';
 $lang['Subscriptions of'] = 'Pierakstīšanās';
-$lang['Unsubscribe from email notification'] = 'Atsacītiess no e-pasta paziņojumiem';
-$lang['Only unsubscribe notifications for comments from:'] = 'Atsacīties tikai no paziņojumiem par komentāriem no:';
 $lang['Unsubscribe from all email notifications'] = 'Atsacīties no visiem epasta paziņojumiem';
-$lang['Manage my subscriptions to comments'] = 'Pārvaldīt manus paziņojumus par komentāriem';
-$lang['Item'] = 'Vienums';
-$lang['Date'] = 'Datums';
 $lang['You are not subscribed to any comment.'] = 'Jūs neesat pierakstījies jebkādu komentāru veikšanai.';
 $lang['Return to item page'] = 'Atgriezties vienuma lapā';
Index: extensions/Subscribe_to_comments/language/nl_NL/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/nl_NL/index.php	(revision 15641)
+++ extensions/Subscribe_to_comments/language/nl_NL/index.php	(revision 15641)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Subscribe_to_comments/language/nl_NL/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/nl_NL/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/nl_NL/plugin.lang.php	(revision 15641)
@@ -21,25 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
-$lang['Date'] = 'datum';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Ongeldig emailadres, je bent niet ingeschreven op commentaar.';
-$lang['Invalid email adress.'] = 'Ongeldig emailadres.';
-$lang['Item'] = 'item';
-$lang['Manage my subscriptions to comments'] = 'Beheer mijn inschrijvingen voor commentaar';
-$lang['Nothing to validate.'] = 'Niets om goed te keuren.';
 $lang['Notify me of followup comments'] = 'Notificeer mij over opvolgend commentaar';
-$lang['Only unsubscribe notifications for comments from:'] = 'Schrijf alleen uit van commentaar van:';
 $lang['Please check your email inbox to confirm your subscription.'] = 'Bekijk je inbox om je inschrijving te bevestigen.';
 $lang['Return to item page'] = 'Keer terug naar de itempagina';
-$lang['Subscribe without commenting'] = 'Inschrijven zonder commentaar te schrijven';
 $lang['Subscribe'] = 'Inschrijven';
 $lang['Subscriptions of'] = 'Inschrijvingen van';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Je emailadres is uitgeschreven van het ontvangen van notificaties.';
 $lang['Unsubscribe from all email notifications'] = 'Schrijf uit van alle emailnotificaties';
-$lang['Unsubscribe from email notification'] = 'Schrijf uit van emailnotificatie';
 $lang['Unsubscribe'] = 'Uitschrijven';
-$lang['You are currently subscribed to comments.'] = 'Je bent nu ingeschreven op het commentaar.';
 $lang['You are not subscribed to any comment.'] = 'Je bent niet ingeschreven voor enig commentaar.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Je bent toegevoegd aan de lijst van mensen die zich op dit album hebben ingeschreven.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Je bent toegevoegd aan de lijst van mensen die zich op deze afbeelding hebben ingescreven.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Je inschrijving is goedgekeurd, dank je.';
 ?>
Index: extensions/Subscribe_to_comments/language/pl_PL/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/pl_PL/index.php	(revision 15641)
+++ extensions/Subscribe_to_comments/language/pl_PL/index.php	(revision 15641)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Subscribe_to_comments/language/pl_PL/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/pl_PL/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/pl_PL/plugin.lang.php	(revision 15641)
@@ -21,25 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
- $lang['Please check your email inbox to confirm your subscription.'] = 'Sprawdź skrzynką pocztową aby potwierdzić subskrypcje.';
- $lang['You have been added to the list of subscribers for this album.'] = 'Zostałeś dodany do listy subskrybentów tego albumu.';
- $lang['You have been added to the list of subscribers for this picture.'] = 'Zostałeś dodany do listy subskrybentów tego zdjęcia.';
- $lang['Invalid email adress, your are not subscribed to comments.'] = 'Niewłaściwy adres e-mail, nie zostałeś subskrybowany.';
- $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Usunąłeś ten adres e-mail z listy subskrybentów.';
- $lang['You are currently subscribed to comments.'] = 'Jesteś obecnie zasubskrybowany do komentarzy.';
- $lang['Unsubscribe'] = 'Nie subskrybuj';
- $lang['Subscribe'] = 'Subskrybuj';
- $lang['Subscribe without commenting'] = 'Subskrybuj bez komentowania.';
- $lang['Notify me of followup comments'] = 'Powiadamiaj o odpowiedziach.';
- $lang['Invalid email adress.'] = 'Nieprawidłowy adres e-mail.';
- $lang['Your subscribtion has been validated, thanks you.'] = 'Twoja subskrypcja została potwierdzona, dziękujemy.';
- $lang['Nothing to validate.'] = 'Nie ma czego potwierdzać.';
- $lang['Subscriptions of'] = 'Subskrypcje';
- $lang['Unsubscribe from email notification'] = 'Zakończ subskrypcję powiadomień e-mail';
- $lang['Only unsubscribe notifications for comments from:'] = 'Zakończ tylko subskrypcję powiadomień komentarzy od:';
- $lang['Unsubscribe from all email notifications'] = 'Zakończ subskrypcję wszystkich powiadomień';
- $lang['Manage my subscriptions to comments'] = 'Zarządzaj moimi subskrypcjami komentarzy';
- $lang['Item'] = 'Element';
- $lang['Date'] = 'Data';
- $lang['You are not subscribed to any comment.'] = 'Nie subskrybowałeś żadnych komentarzy.';
- $lang['Return to item page'] = 'Powróć do listy elementów'; 
+$lang['Please check your email inbox to confirm your subscription.'] = 'Sprawdź skrzynką pocztową aby potwierdzić subskrypcje.';
+$lang['Invalid email adress, your are not subscribed to comments.'] = 'Niewłaściwy adres e-mail, nie zostałeś subskrybowany.';
+$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Usunąłeś ten adres e-mail z listy subskrybentów.';
+$lang['Unsubscribe'] = 'Nie subskrybuj';
+$lang['Subscribe'] = 'Subskrybuj';
+$lang['Notify me of followup comments'] = 'Powiadamiaj o odpowiedziach.';
+$lang['Your subscribtion has been validated, thanks you.'] = 'Twoja subskrypcja została potwierdzona, dziękujemy.';
+$lang['Subscriptions of'] = 'Subskrypcje';
+$lang['Unsubscribe from all email notifications'] = 'Zakończ subskrypcję wszystkich powiadomień';
+$lang['You are not subscribed to any comment.'] = 'Nie subskrybowałeś żadnych komentarzy.';
+$lang['Return to item page'] = 'Powróć do listy elementów'; 
 ?>
Index: extensions/Subscribe_to_comments/language/pt_PT/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/pt_PT/index.php	(revision 15641)
+++ extensions/Subscribe_to_comments/language/pt_PT/index.php	(revision 15641)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Subscribe_to_comments/language/pt_PT/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/pt_PT/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/pt_PT/plugin.lang.php	(revision 15641)
@@ -21,25 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
-$lang['Date'] = 'Data';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Endereço de correio electrónico inválido, não foi subscrito aos comentários.';
-$lang['Invalid email adress.'] = 'Endereço de correio electrónico inválido.';
-$lang['Item'] = 'Item';
-$lang['Manage my subscriptions to comments'] = 'Gerir as minhas subscrições de comentários';
-$lang['Nothing to validate.'] = 'Nada para validar.';
 $lang['Notify me of followup comments'] = 'Notifique-me de futuros comentários';
-$lang['Only unsubscribe notifications for comments from:'] = 'Apenas cancelar subscrição de comentários de:';
 $lang['Please check your email inbox to confirm your subscription.'] = 'Por favor consulte a sua caixa de correio electrónico para confirmar a sua subscrição.';
 $lang['Return to item page'] = 'Regressar à página do item';
-$lang['Subscribe without commenting'] = 'Subscrever sem comentar';
 $lang['Subscribe'] = 'Subscrever';
 $lang['Subscriptions of'] = 'Subscrições de';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Cancelou a subscrição para receber notificações por correio electrónico.';
 $lang['Unsubscribe from all email notifications'] = 'Cancelar todas as notificações por correio electrónico';
-$lang['Unsubscribe from email notification'] = 'Cancelar subscrição de notificação por correio electrónico';
 $lang['Unsubscribe'] = 'Cancelar subscrição';
-$lang['You are currently subscribed to comments.'] = 'Está subscrito aos comentários.';
 $lang['You are not subscribed to any comment.'] = 'Não está subscrito a nenhum comentário.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Foi adicionado à lista de subscritores deste álbum.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Foi adicionado à lista de subscritores desta foto.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'A sua subscrição foi validada, obrigado.';
 ?>
Index: extensions/Subscribe_to_comments/language/ru_RU/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/ru_RU/index.php	(revision 15641)
+++ extensions/Subscribe_to_comments/language/ru_RU/index.php	(revision 15641)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Subscribe_to_comments/language/ru_RU/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/ru_RU/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/ru_RU/plugin.lang.php	(revision 15641)
@@ -22,24 +22,13 @@
 // +-----------------------------------------------------------------------+
 $lang['Please check your email inbox to confirm your subscription.'] = 'Пожалуйста, проверьте ваш электронный почтовый ящик, чтобы подтвердить подписку.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Вы были добавлены в список абонентов для этого альбома.';
-$lang['Date'] = 'Дата';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Неправильный электронный адрес, вы не подписаны на комментарии.';
-$lang['Invalid email adress.'] = 'Неправильный электронный адрес.';
-$lang['Item'] = 'Элемент';
-$lang['Manage my subscriptions to comments'] = 'Управление подпиской на комментарии';
-$lang['Nothing to validate.'] = 'Ничего нет для проверки.';
 $lang['Notify me of followup comments'] = 'Сообщите мне о новых комментариях';
-$lang['Only unsubscribe notifications for comments from:'] = 'Отказаться только от уведомлений о комментариях:';
 $lang['Return to item page'] = 'Вернуться к списку';
-$lang['Subscribe without commenting'] = 'Подписаться без комментариев';
 $lang['Subscribe'] = 'Подписаться';
 $lang['Subscriptions of'] = 'Подписки на';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Вы успешно отписали Ваш адрес электронной почты и не получите больше уведомлений.';
 $lang['Unsubscribe from all email notifications'] = 'Отказаться от всех уведомлений по электронной почте';
-$lang['Unsubscribe from email notification'] = 'Отказаться от уведомлений по электронной почте';
 $lang['Unsubscribe'] = 'Отказаться от подписки';
-$lang['You are currently subscribed to comments.'] = 'Сейчас Вы подписаны на комментарии.';
 $lang['You are not subscribed to any comment.'] = 'Вы не подписаны на комментарии.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Вы были добавлены в список абонентов для этой фотографии.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Ваша подписка была подтверждена, спасибо.';
 ?>
Index: extensions/Subscribe_to_comments/language/sk_SK/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/sk_SK/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/sk_SK/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery                                  |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/language/sk_SK/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/sk_SK/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/sk_SK/plugin.lang.php	(revision 15641)
@@ -21,25 +21,13 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
-
 $lang['Please check your email inbox to confirm your subscription.'] = 'Prosím skontrolujte si svoj mail na potvrdenie odberu.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Boli ste pridaný do zoznamu odberov tohto albumu.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Boli ste pridaný do zoznamu odberov tejto fotky.';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Neplatná emailová adresa, neboli ste zapísaný do odberu komentárov.';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Úspešné odhlásenie Vašej emailovej adresy z prijímania upozornení.';
-$lang['You are currently subscribed to comments.'] = 'Práve ste zapísaný do odberu komentárov.';
 $lang['Unsubscribe'] = 'Odhlásiť';
 $lang['Subscribe'] = 'Prihlásiť';
-$lang['Subscribe without commenting'] = 'Prihlásiť bez komentovania';
 $lang['Notify me of followup comments'] = 'Upozorniť ma na nasledovné komentáre';
-$lang['Invalid email adress.'] = 'Neplatná emailová adresa.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Vaše prihlásenie bolo potvrdené, ďakujeme.';
-$lang['Nothing to validate.'] = 'Nepotvrdené.';
 $lang['Subscriptions of'] = 'Prihlásený';
-$lang['Unsubscribe from email notification'] = 'Odhlásiť z emailovej notifikácie';
-$lang['Only unsubscribe notifications for comments from:'] = 'Len odhlásenie notifikácií pre komentére z:';
 $lang['Unsubscribe from all email notifications'] = 'Odhlásenie zo všetkých emailových notofikácií';
-$lang['Manage my subscriptions to comments'] = 'Ovládanie mojich prihlásení na odber komentárov';
-$lang['Item'] = 'Položka';
-$lang['Date'] = 'Dátum';
 $lang['You are not subscribed to any comment.'] = 'Nie ste prihlásený na odber žiadneho komentára.';
 $lang['Return to item page'] = 'Návrat na stránku položiek';
Index: extensions/Subscribe_to_comments/language/uk_UA/index.php
===================================================================
--- extensions/Subscribe_to_comments/language/uk_UA/index.php	(revision 15641)
+++ extensions/Subscribe_to_comments/language/uk_UA/index.php	(revision 15641)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Subscribe_to_comments/language/uk_UA/plugin.lang.php
===================================================================
--- extensions/Subscribe_to_comments/language/uk_UA/plugin.lang.php	(revision 15376)
+++ extensions/Subscribe_to_comments/language/uk_UA/plugin.lang.php	(revision 15641)
@@ -21,25 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
-$lang['Date'] = 'Дата';
 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Невірна електронна адреса, Ви не підписані на коментарі.';
-$lang['Invalid email adress.'] = 'Недійсна адреса електронної пошти.';
-$lang['Item'] = 'Елемент';
-$lang['Manage my subscriptions to comments'] = 'Управління моєю підпискою на коментарі';
-$lang['Nothing to validate.'] = 'Нічого для підтвердження.';
 $lang['Notify me of followup comments'] = 'Повідомити мене про нові коментарі';
-$lang['Only unsubscribe notifications for comments from:'] = 'Лише відписатись від сповіщення про коментарі від:';
 $lang['Please check your email inbox to confirm your subscription.'] = 'Будь ласка, перевірте вашу поштову скриньку, щоб підтвердити підписку.';
 $lang['Return to item page'] = 'Повернутися на сторінку елемента';
 $lang['Subscribe'] = 'Підписатися';
-$lang['Subscribe without commenting'] = 'Підписатися не коментуючи';
 $lang['Subscriptions of'] = 'Підписка на';
 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Ви успішно відписалися від отримання сповіщень.';
 $lang['Unsubscribe'] = 'Відписатися від підписки';
 $lang['Unsubscribe from all email notifications'] = 'Відписатись від усіх повідомлень по електронній пошті';
-$lang['Unsubscribe from email notification'] = 'Відписатись від повідомлень по електронній пошті';
-$lang['You are currently subscribed to comments.'] = 'Ви підписані на коментарі.';
 $lang['You are not subscribed to any comment.'] = 'Ви не підписані на жоден коментар.';
-$lang['You have been added to the list of subscribers for this album.'] = 'Ви були додані до списку передплатників для цього альбому.';
-$lang['You have been added to the list of subscribers for this picture.'] = 'Ви були додані до списку передплатників для цього зображення.';
 $lang['Your subscribtion has been validated, thanks you.'] = 'Ваша підписка була підтверджена, спасибі вам.';
 ?>
Index: extensions/Subscribe_to_comments/main.inc.php
===================================================================
--- extensions/Subscribe_to_comments/main.inc.php	(revision 15376)
+++ extensions/Subscribe_to_comments/main.inc.php	(revision 15641)
@@ -3,5 +3,5 @@
 Plugin Name: Subscribe To Comments
 Version: auto
-Description: This plugin allows you to subscribe to comments by email.
+Description: This plugin allows to subscribe to comments by email.
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=587
 Author: Mistic
@@ -13,6 +13,5 @@
 global $prefixeTable;
 
-define('SUBSCRIBE_TO_DIR' , basename(dirname(__FILE__)));
-define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_DIR . '/');
+define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
 define('SUBSCRIBE_TO_TABLE', $prefixeTable . 'subscribe_to_comments');
 
@@ -21,8 +20,14 @@
 function stc_init()
 {
+  global $conf, $user;
+  
+  // no comments on luciano
+  if ($user['theme'] == 'luciano') return;
+  
+  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
+  $conf['Subscribe_to_Comments'] = unserialize($conf['Subscribe_to_Comments']);
+  
   include_once(SUBSCRIBE_TO_PATH.'include/functions.inc.php');
   include_once(SUBSCRIBE_TO_PATH.'include/subscribe_to_comments.inc.php');
-
-  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
 
   // send mails
@@ -32,12 +37,24 @@
   // subscribe
   add_event_handler('loc_end_picture', 'stc_on_picture');
-  add_event_handler('loc_begin_index', 'stc_on_album');
+  add_event_handler('loc_begin_coa', 'stc_on_album');
 
   // management
   add_event_handler('loc_end_section_init', 'stc_detect_section');
-  add_event_handler('loc_end_index', 'stc_load_section');
+  add_event_handler('loc_begin_page_header', 'stc_load_section');
 
   // profile link
   add_event_handler('loc_begin_profile', 'stc_profile_link');
+  
+  // config page
+  add_event_handler('get_admin_plugin_menu_links', 'stc_admin_menu');
+}
+
+function stc_admin_menu($menu) 
+{
+  array_push($menu, array(
+    'NAME' => 'Subscribe to Comments',
+    'URL' => get_root_url().'admin.php?page=plugin-' . basename(dirname(__FILE__))
+  ));
+  return $menu;
 }
 ?>
Index: extensions/Subscribe_to_comments/maintain.inc.php
===================================================================
--- extensions/Subscribe_to_comments/maintain.inc.php	(revision 15376)
+++ extensions/Subscribe_to_comments/maintain.inc.php	(revision 15641)
@@ -2,40 +2,111 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
+global $prefixeTable;
+
+define('STC_TABLE', $prefixeTable . 'subscribe_to_comments');
+
+define(
+  'stc_default_config', 
+  serialize(array(
+    'notify_admin_on_subscribe' => false,
+    'allow_global_subscriptions' => true,
+    ))
+  );
+  
+
 function plugin_install() 
 {
-	global $prefixeTable;
-
   /* create table to store subscribtions */
 	pwg_query('
-CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'subscribe_to_comments` (
-  `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-  `email` VARCHAR( 255 ) NOT NULL ,
-  `image_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT "0",
-  `category_id` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT "0",
-  `registration_date` DATETIME NOT NULL,
-  `validated` ENUM( "true", "false" ) NOT NULL DEFAULT "false",
-  UNIQUE KEY `UNIQUE` (`email`, `image_id`, `category_id`)
+CREATE TABLE IF NOT EXISTS '.STC_TABLE.' (
+  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `type` enum("image","album-images","album","all-images","all-albums") NOT NULL DEFAULT "image",
+  `element_id` mediumint(8) DEFAULT NULL,
+  `language` varchar(64) NOT NULL,
+  `email` varchar(255) NOT NULL,
+  `registration_date` datetime NOT NULL,
+  `validated` enum("true","false") NOT NULL DEFAULT "false",
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `UNIQUE` (`email` , `type` , `element_id`)
 ) DEFAULT CHARSET=utf8
 ;');
+
+  /* config parameter */
+  conf_update_param('Subscribe_to_Comments', stc_default_config);
+
+}
+
+function plugin_activate()
+{
+  global $conf;
+  
+  // new config in 1.1
+  if (empty($conf['Subscribe_to_Comments']))
+  {
+    conf_update_param('Subscribe_to_Comments', stc_default_config);
+  }
+  
+  // table structure upgrade in 1.1
+  $result = pwg_query('SHOW COLUMNS FROM '.STC_TABLE.' LIKE "element_id";');
+  if (!pwg_db_num_rows($result))
+  {
+    // backup subscriptions
+    $query = 'SELECT * FROM '.STC_TABLE.' ORDER BY registration_date;';
+    $subscriptions = hash_from_query($query, 'id');
+    
+    // upgrade the table
+    pwg_query('TRUNCATE TABLE '.STC_TABLE.';');
+    pwg_query('ALTER TABLE '.STC_TABLE.' DROP `image_id`, DROP `category_id`;');
+    pwg_query('ALTER TABLE '.STC_TABLE.' AUTO_INCREMENT = 1;');
+    
+    $query = '
+ALTER TABLE '.STC_TABLE.' 
+  ADD `type` ENUM( "image", "album-images", "album", "all-images", "all-albums" ) NOT NULL DEFAULT "image" AFTER `id`,
+  ADD `element_id` MEDIUMINT( 8 ) NULL AFTER `type`,
+  ADD `language` VARCHAR( 64 ) NOT NULL AFTER `element_id` 
+;';
+    pwg_query($query);
+    
+    pwg_query('ALTER TABLE '.STC_TABLE.'  DROP INDEX `UNIQUE`, ADD UNIQUE `UNIQUE` ( `email` , `type` , `element_id` );');
+    
+    // convert datas and fill the table
+    $inserts = array();
+    
+    foreach ($subscriptions as $row)
+    {
+      if (!empty($row['category_id']))
+      {
+        $row['type'] = 'album';
+        $row['element_id'] = $row['category_id'];
+      }
+      else if (!empty($row['image_id']))
+      {
+        $row['type'] = 'image';
+        $row['element_id'] = $row['image_id'];
+      }
+      else
+      {
+        continue;
+      }
       
-  /* config parameter */
-  // pwg_query('
-// INSERT INTO `' . CONFIG_TABLE . '`
-  // VALUES (
-    // "Subscribe_to_Comments", 
-    // "'.serialize(array()).'",
-    // "Configuration for Subscribe_to_Comments plugin"
-  // )
-// ;');
-
+      unset($row['id'], $row['image_id'], $row['category_id']);
+      $row['language'] = 'en_UK';
+      
+      array_push($inserts, $row);
+    }
+    
+    if (count($inserts) > 0)
+    {
+      $dbfields = array('type', 'element_id', 'language', 'email', 'registration_date', 'validated');
+      mass_inserts(STC_TABLE, $dbfields, $inserts);
+    }
+  }
 }
 
 function plugin_uninstall() 
 {
-	global $prefixeTable;
-  
   /* delete table and config */
-  pwg_query('DROP TABLE `' . $prefixeTable . 'subscribe_to_comments`;');
-  // pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = "Subscribe_to_Comments";');
+  pwg_query('DROP TABLE '.STC_TABLE.';');
+  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "Subscribe_to_Comments" LIMIT 1;');
 }
 ?>
Index: extensions/Subscribe_to_comments/template/admin.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/admin.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/admin.tpl	(revision 15641)
@@ -0,0 +1,25 @@
+<div class="titrePage" style="clear:right;">
+  <h2>Subscribe to Comments</h2>
+</div>
+
+<form method="post" action="" class="properties">
+  <fieldset>
+    <legend>{'Configuration'|@translate}</legend>
+    <ul>
+      <li>
+        <label>
+          <span class="property">{'Notify administrators when a user take a new subscription'|@translate}</span>
+          <input type="checkbox" name="notify_admin_on_subscribe" value="1" {if $notify_admin_on_subscribe}checked="checked"{/if}>
+        </label>
+      </li>
+      <li>
+        <label>
+          <span class="property">{'Allow users to subscribe to global notifications'|@translate}</span>
+          <input type="checkbox" name="allow_global_subscriptions" value="1" {if $allow_global_subscriptions}checked="checked"{/if}>
+        </label>
+      </li>  
+    </ul>
+  </fieldset>
+
+  <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="config_submit"/></p>
+</form>
Index: extensions/Subscribe_to_comments/template/form_comment.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/form_comment.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/form_comment.tpl	(revision 15641)
@@ -0,0 +1,36 @@
+{if !$SUBSCRIBED_ALL_IMAGES && !$SUBSCRIBED_ALL_ALBUMS && !$SUBSCRIBED_ALBUM && !$SUBSCRIBED_ALBUM_IMAGES && !$SUBSCRIBED_IMAGE}
+<p>
+  {'Notify me of followup comments'|@translate} :<br>
+  <label><input type="radio" name="stc_mode" value="-1" {if !$STC_MODE}checked="checked"{/if}> {'no'|@translate}</label>
+  {if $STC_ON_PICTURE}
+    {if $STC_ALLOW_GLOBAL} 
+      <label><input type="radio" name="stc_mode" value="image" {if $STC_MODE == "image"}checked="checked"{/if}> {'this picture'|@translate}</label>
+      {if $STC_ALLOW_ALBUM_IMAGES}<label><input type="radio" name="stc_mode" value="album-images" {if $STC_MODE == "album-images"}checked="checked"{/if}> {'all pictures of this album'|@translate}</label>{/if}
+      <label><input type="radio" name="stc_mode" value="all-images" {if $STC_MODE == "all-images"}checked="checked"{/if}> {'all pictures of the gallery'|@translate}</label>
+    {else}
+      <label><input type="radio" name="stc_mode" value="image" {if $STC_MODE == "image"}checked="checked"{/if}> {'yes'|@translate}</label>
+    {/if}
+  {elseif $STC_ON_ALBUM}
+    {if $STC_ALLOW_GLOBAL}
+      <label><input type="radio" name="stc_mode" value="album" {if $STC_MODE == "album"}checked="checked"{/if}> {'this album'|@translate}</label>
+      <label><input type="radio" name="stc_mode" value="all-albums" {if $STC_MODE == "all-albums"}checked="checked"{/if}> {'all albums of the gallery'|@translate}</label>
+    {else}
+      <label><input type="radio" name="stc_mode" value="album" {if $STC_MODE == "album"}checked="checked"{/if}> {'yes'|@translate}</label>
+    {/if}
+  {/if}
+</p>
+
+{if $STC_ASK_MAIL}
+  <p><label id="stc_mail" {if !$STC_MODE}style="display:none;"{/if}>{'Email address'|@translate} : <input type="text" name="stc_mail" value="{$STC_MAIL}"></label></p>
+  {footer_script require="jquery"}{literal}
+  jQuery(document).ready(function() {
+    $("#addComment input[name='stc_mode']").change(function() {
+      if ($(this).val() != "-1")
+        $("#stc_mail").css("display", "");
+      else
+        $("#stc_mail").css("display", "none");
+    });
+  });
+  {/literal}{/footer_script}
+{/if}
+{/if}
Index: extensions/Subscribe_to_comments/template/form_standalone.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/form_standalone.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/form_standalone.tpl	(revision 15641)
@@ -0,0 +1,52 @@
+{if isset($comment_add)}
+<div id="pictureCommentList">
+<form method="post" action="{$comment_add.F_ACTION}" id="stc_standalone">
+  <fieldset>
+  {if $SUBSCRIBED_ALL_IMAGES}
+    {'You are currently subscribed to comments on'|@translate} {'all pictures of the gallery'|@translate}.
+    <a href="{$MANAGE_LINK}">{'Manage my subscribtions'|@translate}</a> 
+    
+  {elseif $SUBSCRIBED_ALBUM_IMAGES}
+    {'You are currently subscribed to comments on'|@translate} {'all pictures of this album'|@translate}.
+    <a href="{$UNSUB_LINK}">{'Unsubscribe'|@translate}</a>
+    
+  {elseif $SUBSCRIBED_IMAGE}
+    {'You are currently subscribed to comments on'|@translate} {'this picture'|@translate}.
+    <a href="{$UNSUB_LINK}">{'Unsubscribe'|@translate}</a>
+    
+  {elseif $SUBSCRIBED_ALL_ALBUMS}
+    {'You are currently subscribed to comments on'|@translate} {'all albums of the gallery'|@translate}.
+    <a href="{$MANAGE_LINK}">{'Manage my subscribtions'|@translate}</a>
+    
+  {elseif $SUBSCRIBED_ALBUM}
+    {'You are currently subscribed to comments on'|@translate} {'this album'|@translate}.
+    <a href="{$UNSUB_LINK}">{'Unsubscribe'|@translate}</a>
+    
+  {else}
+    <legend>{'Subscribe to mail notifications'|@translate}</legend>
+    {if $STC_ON_PICTURE}
+      {if $STC_ALLOW_GLOBAL}
+        <label><input type="radio" name="stc_mode" value="image"> {'this picture'|@translate}</label>
+        {if $STC_ALLOW_ALBUM_IMAGES}<label><input type="radio" name="stc_mode" value="album-images"> {'all pictures of this album'|@translate}</label>{/if}
+        <label><input type="radio" name="stc_mode" value="all-images"> {'all pictures of the gallery'|@translate}</label>
+      {else}
+        <input type="hidden" name="stc_mode" value="image">
+      {/if}
+    {elseif $STC_ON_ALBUM}
+      {if $STC_ALLOW_GLOBAL}
+        <label><input type="radio" name="stc_mode" value="album"> {'this album'|@translate}</label>
+        <label><input type="radio" name="stc_mode" value="all-albums"> {'all albums of the gallery'|@translate}</label>
+      {else}
+        <input type="hidden" name="stc_mode" value="album">
+      {/if}
+    {/if}
+    {if $STC_ALLOW_GLOBAL and $STC_ASK_MAIL}<br>{/if}
+    {if $STC_ASK_MAIL}
+      <label>{'Email address'|@translate} <input type="text" name="stc_mail" size="30"></label>
+    {/if}
+    <label><input type="submit" name="stc_submit" value="{'Subscribe'|@translate}"></label>
+  {/if}
+  </fieldset>
+</form>
+</div>
+{/if}
Index: extensions/Subscribe_to_comments/template/index.php
===================================================================
--- extensions/Subscribe_to_comments/template/index.php	(revision 15376)
+++ extensions/Subscribe_to_comments/template/index.php	(revision 15641)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify  |
-// | it under the terms of the GNU General Public License as published by  |
-// | the Free Software Foundation                                          |
-// |                                                                       |
-// | This program is distributed in the hope that it will be useful, but   |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
-// | General Public License for more details.                              |
-// |                                                                       |
-// | You should have received a copy of the GNU General Public License     |
-// | along with this program; if not, write to the Free Software           |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA.                                                                  |
-// +-----------------------------------------------------------------------+
-
-// Recursive call
 $url = '../';
 header( 'Request-URI: '.$url );
Index: extensions/Subscribe_to_comments/template/mail/admin.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/mail/admin.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/mail/admin.tpl	(revision 15641)
@@ -0,0 +1,14 @@
+<div id="the_header">
+{'New subscription on'|@translate} <b>{$STC.GALLERY_TITLE}</b>
+</div>
+
+<div id="the_content">
+
+<p>
+  {'Hi administrators,'|@translate}<br>
+  {$STC.USER} {$STC.ELEMENT}.
+</p>
+
+<p>{$STC.TECHNICAL}</p>
+
+</div>
Index: extensions/Subscribe_to_comments/template/mail/confirm.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/mail/confirm.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/mail/confirm.tpl	(revision 15641)
@@ -0,0 +1,19 @@
+<div id="the_header">
+{'Subscribe to comments on'|@translate} <b>{$STC.GALLERY_TITLE}</b>
+</div>
+
+<div id="the_content">
+
+<p>{'You requested to subscribe by email to comments on'|@translate} {$STC.element.on}.</p>
+
+{if not empty($STC.element.thumbnail)}
+<p id="the_image"><img src="{$STC.element.thumbnail}" alt="{$STC.element.name}"></p>
+{/if}
+
+<p>{'To activate, click the confirm button. If you believe this is an error, please just ignore this message.'|@translate}</p>
+
+<p><a href="{$STC.VALIDATE_URL}" class="button">{'Confirm subscription'|@translate}</a></p>
+
+<p>{'Want to edit your notifications options?'|@translate} <a href="{$STC.MANAGE_URL}">{'Manage my subscribtions'|@translate}</a>.</p>
+
+</div>
Index: extensions/Subscribe_to_comments/template/mail/footer.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/mail/footer.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/mail/footer.tpl	(revision 15641)
@@ -0,0 +1,8 @@
+<div id="the_footer">
+  {'Sent by'|@translate} <a href="{$GALLERY_URL}">{$GALLERY_TITLE}</a>
+  - {'Powered by'|@translate} <a href="{$PHPWG_URL}" class="Piwigo">Piwigo</a> {$VERSION}
+</div>
+
+</div>
+</body>
+</html>
Index: extensions/Subscribe_to_comments/template/mail/header.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/mail/header.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/mail/header.tpl	(revision 15641)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+  <title>Piwigo Mail</title>
+  <meta http-equiv="Content-Type" content="text/html; charset={$CONTENT_ENCODING}">
+  
+  <style type="text/css">{strip}<!--
+  {$STC_MAIL_CSS}
+  -->{/strip}</style>
+</head>
+
+<body>
+<div id="the_page">
Index: extensions/Subscribe_to_comments/template/mail/index.php
===================================================================
--- extensions/Subscribe_to_comments/template/mail/index.php	(revision 15641)
+++ extensions/Subscribe_to_comments/template/mail/index.php	(revision 15641)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Subscribe_to_comments/template/mail/notification.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/mail/notification.tpl	(revision 15641)
+++ extensions/Subscribe_to_comments/template/mail/notification.tpl	(revision 15641)
@@ -0,0 +1,22 @@
+<div id="the_header">
+{'New comment on'|@translate} <b>{$STC.GALLERY_TITLE}</b>
+</div>
+
+<div id="the_content">
+
+<p id="the_image">
+  <a href="{$STC.element.url}">{$STC.element.name}<br>
+  <img src="{$STC.element.thumbnail}" alt="{$STC.element.name}"></a>
+</p>
+
+<p>
+  {$STC.comment.caption}:
+  <blockquote>{$STC.comment.content}</blockquote>
+</p>
+
+<p>
+  <a href="{$STC.UNSUB_URL}">{'Stop receiving notifications'|@translate}</a><br>
+  <a href="{$STC.MANAGE_URL}">{'Manage my subscribtions'|@translate}</a>
+</p>
+
+</div>
Index: extensions/Subscribe_to_comments/template/mail/style.css
===================================================================
--- extensions/Subscribe_to_comments/template/mail/style.css	(revision 15641)
+++ extensions/Subscribe_to_comments/template/mail/style.css	(revision 15641)
@@ -0,0 +1,56 @@
+body {
+  margin:0px; 
+  padding:0px;
+  font-family: Univers, Helvetica, Optima; 
+  font-size:12px;
+  text-align:left;
+  background:#111;
+  color:#aaa;
+}
+
+a {
+  color:#CE2E5A;
+}
+ 
+#the_page {
+  width:600px;
+  margin:10px auto; 
+  padding:0px; 
+}
+
+#the_header {
+  background:#222;
+  border-top:5px solid #CE2E5A;
+  border-bottom:1px solid #111;
+  font-size:16px;
+  padding:10px;
+}
+
+#the_content {
+  background:#333;
+  border-top:1px solid #555;
+  border-bottom:1px solid #111;
+  padding:10px;
+}
+
+#the_footer {
+  background:#222;
+  border-top:1px solid #555;
+  border-bottom:3px solid #CE2E5A;
+  font-size:10px;
+  padding:5px;
+}
+
+#the_image img {
+  border:10px solid #444;
+}
+
+.button {
+  padding:8px 15px;
+  background:#A80D24;
+  color:#bbb;
+  border:1px solid #CE2E5A;
+  text-decoration:none;
+  font-size:14px;
+  font-weight:bold;
+}
Index: extensions/Subscribe_to_comments/template/style.css
===================================================================
--- extensions/Subscribe_to_comments/template/style.css	(revision 15376)
+++ extensions/Subscribe_to_comments/template/style.css	(revision 15641)
@@ -1,22 +1,71 @@
 .subscriptions_list {
-  width:600px;
-	border: 1px solid #111;
+  width:700px;
+	border-left: 1px solid #444;
+	border-right: 1px solid #444;
 	margin: 1em auto;
 	padding: 0;
   background-color:#222;
-  border-collapse:collapse;
+  border-spacing:0;
+  text-align: left;
 }
 
-.subscriptions_list TD {
+.subscriptions_list td, .subscriptions_list th {
 	padding:5px 5px 2px 5px;
   vertical-align:center;
+  border-top: 1px solid #444;
+  border-bottom: 1px solid #111;
+}
+  .subscriptions_list .chkb {
+    text-align:center;
+  }
+  .subscriptions_list td.info {
+    width:200px;
+    padding-top:2em;
+    vertical-align:top;
+  }
+    .subscriptions_list tr .actions {
+      display:none;
+    }
+    .subscriptions_list tr:hover .actions {
+      display:block;
+    }
+  .subscriptions_list td.date {
+    width:250px;
+    padding-top:2em;
+    vertical-align:top;
+  }
+  
+.subscriptions_list tr.row2 { background-color:#222; }
+.subscriptions_list tr.row1 { background-color:#333; }
+
+.subscriptions_list tr.not-validated { background-color:#433; }
+
+.subscriptions_list tr.header th, .subscriptions_list tr.footer td
+{
+  height:30px;
+}
+.subscriptions_list tr.header th, .subscriptions_list tr.footer.row1 td {
+  
+  background: #333333;
+  background: -moz-linear-gradient(top,  #333333 0%, #222222 100%);
+  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#333333), color-stop(100%,#222222));
+  background: -webkit-linear-gradient(top,  #333333 0%,#222222 100%);
+  background: -o-linear-gradient(top,  #333333 0%,#222222 100%);
+  background: -ms-linear-gradient(top,  #333333 0%,#222222 100%);
+  background: linear-gradient(top,  #333333 0%,#222222 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#333333', endColorstr='#222222',GradientType=0 );
+}
+.subscriptions_list tr.footer.row2 td {
+  background: #222222;
+  background: -moz-linear-gradient(top,  #222222 0%, #333333 100%);
+  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#222222), color-stop(100%,#333333));
+  background: -webkit-linear-gradient(top,  #222222 0%,#333333 100%);
+  background: -o-linear-gradient(top,  #222222 0%,#333333 100%);
+  background: -ms-linear-gradient(top,  #222222 0%,#333333 100%);
+  background: linear-gradient(top,  #222222 0%,#333333 100%);
+  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222222', endColorstr='#333333',GradientType=0 );
 }
 
-.subscriptions_list TR {
-	text-align: left;
-}
 
-.row2 { background-color:#222; }
-.row1 { background-color:#333; }
 
 .stc p {
@@ -32,2 +81,3 @@
   max-height:90px;
 }
+
Index: extensions/Subscribe_to_comments/template/subscribtions_page.tpl
===================================================================
--- extensions/Subscribe_to_comments/template/subscribtions_page.tpl	(revision 15376)
+++ extensions/Subscribe_to_comments/template/subscribtions_page.tpl	(revision 15641)
@@ -1,92 +1,115 @@
 {combine_css path=$SUBSCRIBE_TO_PATH|@cat:'template/style.css'}
 
-{$MENUBAR}
+{if $themeconf.name != "stripped" and $themeconf.parent != "stripped" and $themeconf.name != "simple-grey" and $themeconf.parent != "simple"}
+  {$MENUBAR}
+{else}
+  {assign var="intern_menu" value="true"}
+{/if}
+<div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">
+{if $intern_menu}{$MENUBAR}{/if}
 
-{if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if}
+<div class="titrePage">
+  <h2>{'Subscriptions of'|@translate} <i>{$EMAIL}</i></h2>
+</div>
 
-<div id="content" class="content stc">
-  <div class="titrePage">
-    <ul class="categoryActions">
-      {if !empty($PLUGIN_INDEX_ACTIONS)}{$PLUGIN_INDEX_ACTIONS}{/if}
-    </ul>
-    <h2>{'Subscriptions of'|@translate} <i>{$EMAIL}</i></h2>
-  </div> <!-- titrePage -->
+{include file='infos_errors.tpl'}
+ 
+{if $IN_VALIDATE or $IN_UNSUBSCRIBE}
+<p>
+  {if !empty($element)}<a href="{$element.url}" title="{$element.name}">{'Return to item page'|@translate}</a><br>{/if}
+  <a href="{$MANAGE_LINK}">{'Manage my subscriptions to comments'|@translate}</a>
+</p>
+{/if}
   
-  {if !empty($errors)}
-  <div class="errors">
-    <ul>
-      {foreach from=$errors item=error}
-      <li>{$error}</li>
+<form action="{$MANAGE_LINK}" method="post">
+  {if !empty($global_subscriptions)}
+  <fieldset>
+    <legend>{'Global subscriptions'|@translate}</legend>
+    <table class="subscriptions_list">
+      {foreach from=$global_subscriptions item=sub name=subs_loop}
+      <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}">
+        <td>
+          {if $sub.type == 'all-images'}
+            <img src="{$SUBSCRIBE_TO_PATH}template/image.png"> {'You are currently subscribed to comments on all pictures of the gallery.'|@translate}
+          {else $sub.type == 'all-albums'}
+            <img src="{$SUBSCRIBE_TO_PATH}template/album.png"> {'You are currently subscribed to comments on all albums of the gallery.'|@translate}
+          {/if}
+        </td>
+        <td style="white-space:nowrap;">
+          <a href="{$MANAGE_LINK}&amp;unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a>
+          {if $sub.validated == 'false'}<br> <a href="{$MANAGE_LINK}&amp;validate={$sub.id}">{'Validate'|@translate}</a>{/if}
+        </td>
+        <td style="white-space:nowrap;">
+          <i>{$sub.registration_date}</i>
+        </td>
+      </tr>
       {/foreach}
-    </ul>
-  </div>
-  {/if}
-  {if !empty($infos)}
-  <div class="infos">
-    <ul>
-      {foreach from=$infos item=info}
-      <li>{$info}</li>
-      {/foreach}
-    </ul>
-  </div>
+    </table>
+  </fieldset>
   {/if}
   
-  {if !empty($unsubscribe_form)}
-  <form action="" method="post">
-  <fieldset>
-    <legend>{'Unsubscribe from email notification'|@translate}</legend>
-    
-    <p>
-      <label><input type="radio" name="unsubscribe" value="{$unsubscribe_form}" checked="checked"> {'Only unsubscribe notifications for comments from:'|@translate} <a href="{$element.url}" target="_blank">{$element.name}</a></label>
-      <label><input type="radio" name="unsubscribe" value="all"> {'Unsubscribe from all email notifications'|@translate}</label>
-      <br>
-      <label><input type="submit" value="Unsubscribe notifications for {$EMAIL}"></label>
-      <a href="{$MANAGE_LINK}">{'Manage my subscriptions'|@translate}</a>
-    </p>
-  </fieldset>
-  </form>
-  {/if}
-  
-  {if !empty($validate)}
-  <p>
-    {if empty($errors)}<a href="{$element.url}">{'Return to item page'|@translate}</a><br>{/if}
-    <a href="{$MANAGE_LINK}">{'Manage my subscriptions'|@translate}</a>
-  </p>
-  {/if}
-  
-  {if !empty($subscriptions) and $subscriptions != 'none'}
-  <form action="{$MANAGE_LINK}" method="post">
+  {if !empty($subscriptions)}
   <fieldset>
     <legend>{'Manage my subscriptions to comments'|@translate}</legend>
     <table class="subscriptions_list">
+      <tr class="header">
+        <th class="chkb"><input type="checkbox" id="check_all"></th>
+        <th colspan="2" class="info">{'Subject'|@translate}</th>
+        <th class="date">{'Followed on'|@translate}</th>
+      </tr>
+      
       {foreach from=$subscriptions item=sub name=subs_loop}
-      <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}">
-        <td><img src="{$sub.infos.thumbnail}" alt="{$sub.infos.name}" class="thumbnail"></td>
-        <td>
-          {if $sub.type == 'image'}
-          <img src="{$SUBSCRIBE_TO_PATH}template/picture.png" alt="(P)">
-          {else}
-          <img src="{$SUBSCRIBE_TO_PATH}template/folder_picture.png" alt="(A)">
-          {/if} 
+      <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if} {if $sub.validated == 'false'}not-validated{/if}">
+        <td class="chkb"><input type="checkbox" name="selected[]" value="{$sub.id}"></td>
+        <td class="thumb"><img src="{$sub.infos.thumbnail}" alt="{$sub.infos.name}" class="thumbnail"></td>
+        <td class="info">
+          <img src="{$SUBSCRIBE_TO_PATH}template/{$sub.type}.png">
           <a href="{$sub.infos.url}">{$sub.infos.name}</a>
-          <br>{$sub.registration_date}
+
+          <div class="actions">
+            <a href="{$MANAGE_LINK}&amp;unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a>
+            {if $sub.validated == 'false'}| <a href="{$MANAGE_LINK}&amp;validate={$sub.id}">{'Validate'|@translate}</a>{/if}
+          </div>
         </td>
-        <td><a href="{$MANAGE_LINK}&amp;unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a></td>
+        <td class="date">
+          <i>{$sub.registration_date}</i>
+        </td>
       </tr>
       {/foreach}
+      
+      <tr class="footer {if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}"><td colspan="4">
+        <select name="action">
+          <option value="-1">{'Choose an action'|@translate}</option>
+          <option value="unsubscribe">{'Unsubscribe'|@translate}</option>
+          <option value="validate">{'Validate'|@translate}</option>
+        </select>
+        <input type="submit" name="apply_bulk" value="{'Apply action'|@translate}">
+      </td></tr>
     </table>
     
     <p>
-      <input type="hidden" name="unsubscribe" value="all">
-      <input type="submit" value="{'Unsubscribe from all email notifications'|@translate}">
+      <b>Legend :</b> 
+      <img src="{$SUBSCRIBE_TO_PATH}template/image.png"> {'comments on a picture'|@translate}. 
+      <img src="{$SUBSCRIBE_TO_PATH}template/album-images.png"> {'comments on all pictures of an album'|@translate}.
+      {if $COA_ACTIVATED}<img src="{$SUBSCRIBE_TO_PATH}template/album.png"> {'comments on an album'|@translate}.{/if}
     </p>
   </fieldset>
-  {elseif !empty($subscriptions) and $subscriptions == 'none'}
-  <p>
-    {'You are not subscribed to any comment.'|@translate}
-  </p>
   {/if}
+  
+  {if !empty($global_subscriptions) or !empty($subscriptions)}
+    <p>
+      <label><input type="checkbox" name="unsubscribe_all_check" value="1"> {'Unsubscribe from all email notifications'|@translate}</label>
+      <input type="submit" name="unsubscribe_all" value="{'Submit'|@translate}">
+  {/if}
+</form>
+
+{footer_script require="jquery"}{literal}
+jQuery("#check_all").change(function() {
+  if ($(this).is(":checked"))
+    $("input[name^='selected']").attr('checked', 'checked');
+  else
+    $("input[name^='selected']").removeAttr('checked');
+});
+{/literal}{/footer_script}
 
 </div> <!-- content -->
-
-{if !empty($PLUGIN_INDEX_CONTENT_AFTER)}{$PLUGIN_INDEX_CONTENT_AFTER}{/if}
