Index: /extensions/UserCollections/admin.php
===================================================================
--- /extensions/UserCollections/admin.php	(revision 25677)
+++ /extensions/UserCollections/admin.php	(revision 25678)
@@ -8,5 +8,5 @@
 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
 $page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : 'sets';
-  
+
 $tabsheet = new tabsheet();
 $tabsheet->add('sets', l10n('Collections'), USER_COLLEC_ADMIN . '-sets');
@@ -34,6 +34,4 @@
   'USER_COLLEC_ADMIN' => USER_COLLEC_ADMIN,
   ));
-  
+
 $template->assign_var_from_handle('ADMIN_CONTENT', 'user_collections');
-
-?>
Index: /extensions/UserCollections/admin/config.php
===================================================================
--- /extensions/UserCollections/admin/config.php	(revision 25677)
+++ /extensions/UserCollections/admin/config.php	(revision 25678)
@@ -8,5 +8,5 @@
     'allow_mails'     => isset($_POST['allow_mails']) && isset($_POST['allow_public']),
     );
-  
+
   conf_update_param('user_collections', serialize($conf['user_collections']));
 }
@@ -18,4 +18,2 @@
 
 $template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/config.tpl'));
-
-?>
Index: /extensions/UserCollections/admin/export.php
===================================================================
--- /extensions/UserCollections/admin/export.php	(revision 25677)
+++ /extensions/UserCollections/admin/export.php	(revision 25678)
@@ -4,5 +4,5 @@
 try {
   $collection = new UserCollection($_GET['col_id']);
-  
+
   $template->assign('COL_ID', $_GET['col_id']);
 }
@@ -19,8 +19,8 @@
   pwg_set_session_var('uc_export_active_fields', $_POST['active']);
   pwg_set_session_var('uc_export_inactive_fields', $_POST['inactive']);
-  
+
   $content = $collection->serialize($_POST['active']);
   $filename = 'collection_'.$_GET['col_id'].'_'.date('Ymd-Hi').'.csv';
-  
+
   header('Content-Type: application/force-download; name="'.$filename.'"');
   header('Content-Disposition: attachment; filename="'.$filename.'"');
@@ -32,5 +32,5 @@
   header('Pragma: no-cache');
   header('Expires: 0');
-  
+
   echo $content;
   exit;
@@ -55,5 +55,4 @@
 $template->assign('inactive_fields', pwg_get_session_var('uc_export_inactive_fields', $default_inactive_fields));
 
+
 $template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/export.tpl'));
-
-?>
Index: /extensions/UserCollections/admin/index.php
===================================================================
--- /extensions/UserCollections/admin/index.php	(revision 25677)
+++ /extensions/UserCollections/admin/index.php	(revision 25678)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2012 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 );
@@ -28,3 +5,2 @@
 header( 'Location: '.$url );
 exit();
-?>
Index: /extensions/UserCollections/admin/sets.php
===================================================================
--- /extensions/UserCollections/admin/sets.php	(revision 25677)
+++ /extensions/UserCollections/admin/sets.php	(revision 25678)
@@ -19,10 +19,10 @@
     array_push($where_clauses, 'username LIKE "%'.$_POST['username'].'%"');
   }
-  
+
   if (!empty($_POST['name']))
   {
     array_push($where_clauses, 'name LIKE "%'.$_POST['name'].'%"');
   }
-  
+
   $order_by = $_POST['order_by'].' '.$_POST['direction'];
 }
@@ -31,5 +31,5 @@
 // get sets
 $query = '
-SELECT 
+SELECT
     c.*,
     u.'.$conf['user_fields']['username'].' AS username
@@ -46,5 +46,5 @@
 {
   $template->append('sets', array(
-    'NAME' => trigger_event('render_category_name', $row['name']),
+    'NAME' => trigger_change('render_category_name', $row['name']),
     'NB_IMAGES' => $row['nb_images'],
     'DATE_CREATION' => format_date($row['date_creation'], true),
@@ -74,5 +74,5 @@
   'direction_options' => $page['direction_items'],
   'direction_selected' => isset($_POST['direction']) ? $_POST['direction'] : '',
-  
+
   'F_USERNAME' => @htmlentities($_POST['username'], ENT_COMPAT, 'UTF-8'),
   'F_NAME' => @htmlentities($_POST['name'], ENT_COMPAT, 'UTF-8'),
@@ -82,4 +82,2 @@
 
 $template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/sets.tpl'));
-
-?>
Index: /extensions/UserCollections/admin/template/config.tpl
===================================================================
--- /extensions/UserCollections/admin/template/config.tpl	(revision 25677)
+++ /extensions/UserCollections/admin/template/config.tpl	(revision 25678)
@@ -1,9 +1,9 @@
-{combine_css path=$USER_COLLEC_PATH|@cat:"admin/template/style.css"}
+{combine_css path=$USER_COLLEC_PATH|cat:'admin/template/style.css'}
 
-{footer_script}{literal}
-$("input[name='allow_public']").on("change", function() {
-    $("#allow_mails").toggle($(this).is(":checked"));
+{footer_script}
+$('input[name="allow_public"]').on('change', function() {
+    $('#allow_mails').toggle($(this).is(':checked'));
 });
-{/literal}{/footer_script}
+{/footer_script}
 
 <div class="titrePage">
@@ -17,5 +17,5 @@
       <label>
         <input type="checkbox" name="allow_public" {if $user_collections.allow_public}checked="checked"{/if}>
-        <b>{'Allow users to set their collections as public'|@translate}</b>
+        <b>{'Allow users to set their collections as public'|translate}</b>
       </label>
     </li>
@@ -23,5 +23,5 @@
       <label>
         <input type="checkbox" name="allow_mails" {if $user_collections.allow_mails}checked="checked"{/if}>
-        <b>{'Allow users to send their public collections by mail'|@translate}</b>
+        <b>{'Allow users to send their public collections by mail'|translate}</b>
       </label>
     </li>
@@ -29,4 +29,4 @@
 </fieldset>
 
-  <p class="formButtons"><input type="submit" name="save_config" value="{'Save Settings'|@translate}"></p>    
+  <p class="formButtons"><input type="submit" name="save_config" value="{'Save Settings'|translate}"></p>
 </form>
Index: /extensions/UserCollections/admin/template/export.tpl
===================================================================
--- /extensions/UserCollections/admin/template/export.tpl	(revision 25677)
+++ /extensions/UserCollections/admin/template/export.tpl	(revision 25678)
@@ -1,36 +1,36 @@
-{combine_css path=$USER_COLLEC_PATH|@cat:"admin/template/style.css"}
+{combine_css path=$USER_COLLEC_PATH|cat:'admin/template/style.css'}
 
-{footer_script require='jquery.ui.sortable'}{literal}
-$( "#fields_active, #fields_inactive" ).sortable({
-  connectWith: ".connectedSortable",
-  items: "> li",
-  placeholder: "sortable-moving"
+{footer_script require='jquery.ui.sortable'}
+$('#fields_active, #fields_inactive').sortable({
+  connectWith: '.connectedSortable',
+  items: '> li',
+  placeholder: 'sortable-moving'
 }).disableSelection();
 
-$("input[name='generate']").click(function() {
-  query = "ws.php?format=rest&method=pwg.collections.getSerialized&col_id={/literal}{$COL_ID}{literal}";
-  $("#fields_active li").each(function() {
+$('input[name="generate"]').click(function() {
+  query = 'ws.php?format=rest&method=pwg.collections.getSerialized&col_id={$COL_ID}';
+  $('#fields_active li').each(function() {
     query+= '&content[]='+ $(this).data('name');
   });
-  
-  $("#iframeWrapper").show();
-  $("#invokeFrame").attr('src', query);
-  
+
+  $('#iframeWrapper').show();
+  $('#invokeFrame').attr('src', query);
+
   return false;
 });
 
-$("#invokeFrame").load(function() {
+$('#invokeFrame').load(function() {
   $(this).css('height', $(this).contents().find('body').outerHeight(true)+10);
 });
 
-$("input[name='download']").click(function() {
-  $("#fields_active li").each(function() {
-    $("#export_form").append('<input type="hidden" name="active[]" value="'+ $(this).data('name') +'"/>');
+$('input[name="download"]').click(function() {
+  $('#fields_active li').each(function() {
+    $('#export_form').append('<input type="hidden" name="active[]" value="'+ $(this).data('name') +'"/>');
   });
-  $("#fields_inactive li").each(function() {
-    $("#export_form").append('<input type="hidden" name="inactive[]" value="'+ $(this).data('name') +'"/>');
+  $('#fields_inactive li').each(function() {
+    $('#export_form').append('<input type="hidden" name="inactive[]" value="'+ $(this).data('name') +'"/>');
   });
 });
-{/literal}{/footer_script}
+{/footer_script}
 
 <div class="titrePage">
@@ -41,7 +41,7 @@
 <form method="post" action="" class="properties" id="export_form">
 <fieldset>
-  <legend>{'Fields'|@translate}</legend>
+  <legend>{'Fields'|translate}</legend>
   <ul id="fields_active" class="connectedSortable">
-    <h4>{'Active'|@translate}</h4>
+    <h4>{'Active'|translate}</h4>
   {foreach from=$active_fields item=field}
     <li data-name="{$field}"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> {$field}</li>
@@ -49,18 +49,18 @@
   </ul>
   <ul id="fields_inactive" class="connectedSortable">
-    <h4>{'Inactive'|@translate}</h4>
+    <h4>{'Inactive'|translate}</h4>
   {foreach from=$inactive_fields item=field}
     <li data-name="{$field}"><img src="{$themeconf.admin_icon_dir}/cat_move.png"> {$field}</li>
   {/foreach}
   </ul>
-  
+
   <p class="formButtons">
-    <input type="submit" name="generate" value="{'Preview'|@translate}">
-    <input type="submit" name="download" value="{'Download CSV file'|@translate}">
-  </p>    
+    <input type="submit" name="generate" value="{'Preview'|translate}">
+    <input type="submit" name="download" value="{'Download CSV file'|translate}">
+  </p>
 </fieldset>
 
 <fieldset id="iframeWrapper" style="display:none;">
-  <legend>{'Preview'|@translate}</legend>
+  <legend>{'Preview'|translate}</legend>
   <iframe src="" id="invokeFrame" name="invokeFrame"></iframe>
 </fieldset>
Index: /extensions/UserCollections/admin/template/index.php
===================================================================
--- /extensions/UserCollections/admin/template/index.php	(revision 25677)
+++ /extensions/UserCollections/admin/template/index.php	(revision 25678)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2012 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 );
@@ -28,3 +5,2 @@
 header( 'Location: '.$url );
 exit();
-?>
Index: /extensions/UserCollections/admin/template/sets.tpl
===================================================================
--- /extensions/UserCollections/admin/template/sets.tpl	(revision 25677)
+++ /extensions/UserCollections/admin/template/sets.tpl	(revision 25678)
@@ -1,3 +1,3 @@
-{combine_css path=$USER_COLLEC_PATH|@cat:"admin/template/style.css"}
+{combine_css path=$USER_COLLEC_PATH|cat:'admin/template/style.css'}
 
 <div class="titrePage">
@@ -7,18 +7,18 @@
 <form class="filter" method="post" name="filter" action="{$F_FILTER_ACTION}">
 <fieldset>
-  <legend>{'Filter'|@translate}</legend>
+  <legend>{'Filter'|translate}</legend>
   <input type="hidden" name="page" value="user_list">
 
-  <label>{'Name'|@translate} <input type="text" name="name" value="{$F_NAME}"></label>
-  
-  <label>{'Username'|@translate} <input type="text" name="username" value="{$F_USERNAME}"></label>
+  <label>{'Name'|translate} <input type="text" name="name" value="{$F_NAME}"></label>
+
+  <label>{'Username'|translate} <input type="text" name="username" value="{$F_USERNAME}"></label>
 
   <label>
-  {'Sort by'|@translate}
+  {'Sort by'|translate}
   {html_options name=order_by options=$order_options selected=$order_selected}
   </label>
 
   <label>
-  {'Sort order'|@translate}
+  {'Sort order'|translate}
   {html_options name=direction options=$direction_options selected=$direction_selected}
   </label>
@@ -26,5 +26,5 @@
   <label>
   &nbsp;
-  <span><input class="submit" type="submit" name="filter" value="{'Submit'|@translate}"> <a href="{$F_FILTER_ACTION}">{'Reset'|@translate}</a></span>
+  <span><input class="submit" type="submit" name="filter" value="{'Submit'|translate}"> <a href="{$F_FILTER_ACTION}">{'Reset'|translate}</a></span>
   </label>
 
@@ -36,9 +36,9 @@
   <thead>
     <tr class="throw">
-      <td class="name">{'Name'|@translate}</td>
-      <td class="user">{'Username'|@translate}</td>
-      <td class="date">{'Creation date'|@translate}</td>
-      <td class="images">{'Number of images'|@translate}</td>
-      <td class="action">{'Actions'|@translate}</td>
+      <td class="name">{'Name'|translate}</td>
+      <td class="user">{'Username'|translate}</td>
+      <td class="date">{'Creation date'|translate}</td>
+      <td class="images">{'Number of images'|translate}</td>
+      <td class="action">{'Actions'|translate}</td>
     </tr>
   </thead>
@@ -53,14 +53,14 @@
     <td>{$set.NB_IMAGES}</td>
     <td style="padding-left:25px;">
-      <a href="{$set.U_EDIT}" title="{'Edit this collection'|@translate}"><img src="{$themeconf.admin_icon_dir}/edit_s.png"></a>
-      <a href="{$set.U_EXPORT}" title="{'Export image list'|@translate}"><img src="{$themeconf.admin_icon_dir}/plug_install.png"><span class="icon-upload"></span></a> <!-- temp 2.5/2.6 -->
-      <a href="{$set.U_DELETE}" title="{'Delete this collection'|@translate}" onClick="return confirm('{'Are you sure?'|@translate}');"><img src="{$themeconf.admin_icon_dir}/delete.png"></a>
+      <a href="{$set.U_EDIT}" title="{'Edit this collection'|translate}"><img src="{$themeconf.admin_icon_dir}/edit_s.png"></a>
+      <a href="{$set.U_EXPORT}" title="{'Export image list'|translate}"><img src="{$themeconf.admin_icon_dir}/plug_install.png"><span class="icon-upload"></span></a> <!-- temp 2.5/2.6 -->
+      <a href="{$set.U_DELETE}" title="{'Delete this collection'|translate}" onClick="return confirm('{'Are you sure?'|translate}');"><img src="{$themeconf.admin_icon_dir}/delete.png"></a>
     </td>
   </tr>
   {/foreach}
-  
+
   {if not $sets}
   <tr class="row2">
-    <td colspan="8" style="text-align:center;font-style:italic;">{'No results'|@translate}</td>
+    <td colspan="8" style="text-align:center;font-style:italic;">{'No results'|translate}</td>
   </tr>
   {/if}
Index: /extensions/UserCollections/admin/template/style.css
===================================================================
--- /extensions/UserCollections/admin/template/style.css	(revision 25677)
+++ /extensions/UserCollections/admin/template/style.css	(revision 25678)
@@ -93,5 +93,5 @@
     opacity:0.5;
   }
-  
+
 #invokeFrame {
   width:100%;
Index: /extensions/UserCollections/include/UserCollection.class.php
===================================================================
--- /extensions/UserCollections/include/UserCollection.class.php	(revision 25677)
+++ /extensions/UserCollections/include/UserCollection.class.php	(revision 25678)
@@ -6,19 +6,23 @@
   private $data;
   private $images;
-  
+
   /**
    * __construct
-   * @param: mixed col id (##|'new')
-   * @param: array images
+   * @throws Exception
+   *
+   * @param int|string $col_id or 'new'
+   * @param string $name
+   * @param string $comment
+   * @param int $user_id
    */
   function __construct($col_id, $name=null, $comment=null, $user_id=null)
   {
     global $user;
-    
+
     if (empty($user_id))
     {
       $user_id = $user['id'];
     }
-    
+
     $this->data = array(
       'id' => 0,
@@ -30,5 +34,5 @@
       );
     $this->images = array();
-    
+
     // load specific collection
     if (preg_match('#^[0-9]+$#', $col_id))
@@ -40,5 +44,5 @@
 ;';
       $result = pwg_query($query);
-      
+
       if (pwg_db_num_rows($result))
       {
@@ -47,5 +51,5 @@
           pwg_db_fetch_assoc($result)
           );
-        
+
         // make sure all pictures of the collection exist
         $query = '
@@ -56,5 +60,5 @@
 ;';
         pwg_query($query);
-      
+
         // select images of the collection
         $query = '
@@ -64,5 +68,5 @@
 ;';
         $this->images = array_from_query($query, 'image_id');
-        
+
         $this->updateParam('nb_images', count($this->images));
       }
@@ -77,5 +81,5 @@
       $this->data['name'] = $name;
       $this->data['comment'] = $comment;
-      
+
       $query = '
 INSERT INTO '.COLLECTIONS_TABLE.'(
@@ -84,5 +88,5 @@
     date_creation,
     comment
-  ) 
+  )
   VALUES(
     '.$this->data['user_id'].',
@@ -94,5 +98,5 @@
       pwg_query($query);
       $this->data['id'] = pwg_db_insert_id();
-      
+
       $date = pwg_query('SELECT NOW();');
       list($this->data['date_creation']) = pwg_db_fetch_row($date);
@@ -103,12 +107,13 @@
     }
   }
-  
-  /**
-   * check if current user is owner of the collection or admin
+
+  /**
+   * Check if current user is owner of the collection or admin
+   * @throws Exception
    */
   function checkUser()
   {
     global $user;
-    
+
     if (!is_admin() && $user['id'] != $this->data['user_id'])
     {
@@ -116,9 +121,10 @@
     }
   }
-  
+
   /**
    * updateParam
-   * @param: string param name
-   * @param: mixed param value
+   *
+   * @param string $name
+   * @param mixed $value
    */
   function updateParam($name, $value)
@@ -130,9 +136,10 @@
     }
   }
-  
+
   /**
    * getParam
-   * @param: string param name
-   * @return: mixed param value
+   *
+   * @param string $name
+   * @return mixed
    */
   function getParam($name)
@@ -140,8 +147,9 @@
     return $this->data[$name];
   }
-  
+
   /**
    * getImages
-   * @return: array
+   *
+   * @return int[]
    */
   function getImages()
@@ -149,9 +157,10 @@
     return $this->images;
   }
-  
-  /**
-   * isInSet
-   * @param: int image id
-   * @return: bool
+
+  /**
+   * Check if an image is in the collection.
+   *
+   * @param int $image_id
+   * @return bool
    */
   function isInSet($image_id)
@@ -159,41 +168,45 @@
     return in_array($image_id, $this->images);
   }
-  
+
   /**
    * removeImages
-   * @param: array image ids
+   *
+   * @param int|int[] $image_ids
    */
   function removeImages($image_ids)
   {
-    if (empty($image_ids) or !is_array($image_ids)) return;
-    
+    if (empty($image_ids)) return;
+    if (!is_array($image_ids)) $image_ids = array($image_ids);
+
     $this->images = array_diff($this->images, $image_ids);
-    
+
     $query = '
 DELETE FROM '.COLLECTION_IMAGES_TABLE.'
-  WHERE 
+  WHERE
     col_id = '.$this->data['id'].'
     AND image_id IN('.implode(',', $image_ids).')
 ;';
     pwg_query($query);
-    
+
     $this->updateParam('nb_images', count($this->images));
   }
-  
+
   /**
    * addImages
-   * @param: array image ids
+   *
+   * @param int|int[] $image_ids
    */
   function addImages($image_ids)
   {
-    if (empty($image_ids) or !is_array($image_ids)) return;
-    
+    if (empty($image_ids)) return;
+    if (!is_array($image_ids)) $image_ids = array($image_ids);
+
     $image_ids = array_unique($image_ids);
     $inserts = array();
-    
+
     foreach ($image_ids as $image_id)
     {
       if ($this->isInSet($image_id)) continue;
-      
+
       $this->images[] = $image_id;
       $inserts[] = array(
@@ -202,5 +215,5 @@
         );
     }
-    
+
     mass_inserts(
       COLLECTION_IMAGES_TABLE,
@@ -208,5 +221,5 @@
       $inserts
       );
-      
+
     $query = '
 UPDATE '.COLLECTION_IMAGES_TABLE.'
@@ -218,11 +231,12 @@
 ';
     pwg_query($query);
-      
+
     $this->updateParam('nb_images', count($this->images));
   }
-  
+
   /**
    * toggleImage
-   * @param: int image id
+   *
+   * @param int $image_id
    */
   function toggleImage($image_id)
@@ -237,5 +251,5 @@
     }
   }
-  
+
   /**
    * clearImages
@@ -245,5 +259,5 @@
     $this->images = array();
     $this->updateParam('nb_images', 0);
-    
+
     $query = '
 DELETE FROM '.COLLECTION_IMAGES_TABLE.'
@@ -252,8 +266,9 @@
     pwg_query($query);
   }
-  
+
   /**
    * getCollectionInfo
-   * @return: array
+   *
+   * @return array
    */
   function getCollectionInfo()
@@ -266,10 +281,12 @@
       'DATE_CREATION' => $this->data['date_creation'],
       );
-    
+
     return $set;
   }
-  
-  /**
-   * get share links
+
+  /**
+   * Returns share links
+   *
+   * @return array
    */
   function getShares()
@@ -281,10 +298,10 @@
 ;';
     $result = pwg_query($query);
-    
+
     $shares = array();
     while ($row = pwg_db_fetch_assoc($result))
     {
       $row['expired'] = false;
-      
+
       $row['params'] = unserialize($row['params']);
       if (!empty($row['params']['deadline']))
@@ -293,17 +310,20 @@
         $row['params']['deadline_readable'] = format_date($row['params']['deadline'], true, false);
       }
-      
+
       $row['url'] = USER_COLLEC_PUBLIC . 'view/' . $row['share_key'];
       $row['u_delete'] = USER_COLLEC_PUBLIC . 'edit/' . $this->data['id'] . '&amp;delete_share=' . $row['id'];
       $row['add_date_readable'] = format_date($row['add_date'], true, false);
-      
+
       $shares[] = $row;
     }
-    
+
     return $shares;
   }
-  
-  /**
-   * delete a share
+
+  /**
+   * Delete a share
+   *
+   * @param int $id
+   * @return bool
    */
   function deleteShare($id)
@@ -315,24 +335,26 @@
 ;';
     pwg_query($query);
-    
+
     return pwg_db_changes() != 0;
   }
-  
-  /**
-   * Add a share URL
-   * @param: array
-   *          - share_key
-   *          - password
-   *          - deadline
-   * @return: array errors
+
+  /**
+   * Add a share link
+   *
+   * @param array &$share
+   *          - share_key (will be slugified)
+   *          - password (optional)
+   *          - deadline (optional)
+   * @param bool $abord_on_duplicate
+   * @return array|string errors or full share link
    */
   function addShare(&$share, $abord_on_duplicate=true)
   {
     global $conf, $page;
-    
+
     $errors = array();
-    
+
     $share = array_map('stripslashes', $share);
-    
+
     // check key
     if (empty($share['share_key']) || strlen($share['share_key']) < 8)
@@ -344,5 +366,5 @@
       $share['share_key'] = str2url($share['share_key']);
       $share_key = $this->data['id'].'-'.$share['share_key'];
-      
+
       $query = '
 SELECT id FROM '.COLLECTION_SHARES_TABLE.'
@@ -363,12 +385,11 @@
       }
     }
-    
+
     // filter date
     if (!empty($share['deadline']))
     {
-      $date = DateTime::createFromFormat('Y-m-d H:i', $share['deadline']);
-      $share['deadline'] = $date->format('Y-m-d H:i');
-    }
-    
+      $share['deadline'] = transform_date($share['deadline'], 'Y-m-d H:i', 'Y-m-d H:i');
+    }
+
     // hash password
     if (!empty($share['password']))
@@ -376,5 +397,5 @@
       $share['password'] = sha1($conf['secret_key'].$share['password'].$share_key);
     }
-    
+
     if (empty($errors))
     {
@@ -383,5 +404,5 @@
         'deadline' => @$share['deadline'],
         ));
-      
+
       $query = '
 INSERT INTO '.COLLECTION_SHARES_TABLE.'(
@@ -399,14 +420,15 @@
 ;';
       pwg_query($query);
-      
+
       return USER_COLLEC_PUBLIC . 'view/' . $share_key;
     }
-    
+
     return $errors;
   }
-  
+
   /**
    * Send the collection by email
-   * @param: array
+   *
+   * @param array $comm
    *          - sender_name
    *          - sender_email
@@ -415,50 +437,50 @@
    *          - nb_images
    *          - message
-   * @return: array errors
+   * @return array|true array errors or true
    */
   function sendEmail($comm)
   {
-    global $conf;
-    
+    global $conf, $user;
+
     $errors = array();
-    
+
     $comm = array_map('stripslashes', $comm);
 
-    $comment_action='validate';
+    $comment_action = 'validate';
 
     // check author
     if (empty($comm['sender_name']))
     {
-      array_push($errors, l10n('Please enter your name'));
-      $comment_action='reject';
-    }      
+      $errors[] = l10n('Please enter your name');
+      $comment_action = 'reject';
+    }
     if (empty($comm['recipient_name']))
     {
-      array_push($errors, l10n('Please enter the recipient name'));
-      $comment_action='reject';
-    }
-    
+      $errors[] = l10n('Please enter the recipient name');
+      $comment_action = 'reject';
+    }
+
     // check email
     if (empty($comm['sender_email']))
     {
-      array_push($errors, l10n('Please enter your e-mail'));
-      $comment_action='reject';
-    }
-    else if ( !empty($comm['sender_email']) and !uc_check_email_validity($comm['sender_email']) )
-    {
-      array_push($errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'));
-      $comment_action='reject';
+      $errors[] = l10n('Please enter your e-mail');
+      $comment_action = 'reject';
+    }
+    else if (!empty($comm['sender_email']) and !email_check_format($comm['sender_email']))
+    {
+      $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
+      $comment_action = 'reject';
     }
     if (empty($comm['recipient_email']))
     {
-      array_push($errors, l10n('Please enter the recipient e-mail'));
-      $comment_action='reject';
-    }
-    else if ( !empty($comm['recipient_email']) and !uc_check_email_validity($comm['recipient_email']) )
-    {
-      array_push($errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'));
-      $comment_action='reject';
-    }
-     
+      $errors[] = l10n('Please enter the recipient e-mail');
+      $comment_action = 'reject';
+    }
+    else if (!empty($comm['recipient_email']) and !email_check_format($comm['recipient_email']))
+    {
+      $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
+      $comment_action = 'reject';
+    }
+
     // check content
     if (!empty($comm['message']))
@@ -466,137 +488,109 @@
       $comm['message'] = nl2br($comm['message']);
     }
-    
+
     include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
-    
+
     if ($comment_action == 'validate')
     {
-      // format subject
-      $subject = '['.$conf['gallery_title'].'] '.sprintf(l10n('A photo collection by %s'), $comm['sender_name']);
-      $subject = encode_mime_header($subject);
-            
-      // format expeditor
-      $args['from'] = format_email($comm['sender_name'], $comm['sender_email']);
-      $args['to'] = format_email($comm['recipient_name'], $comm['recipient_email']);
-      
-      // hearders
-      $headers = 'From: '.$args['from']."\n";  
-      $headers.= 'MIME-Version: 1.0'."\n";
-      $headers.= 'X-Mailer: Piwigo Mailer'."\n";
-      $headers.= 'Content-Transfer-Encoding: 8bit'."\n";
-      $headers.= 'Content-Type: text/html; charset="'.get_pwg_charset().'";'."\n";
-            
-      // mail content
-      $content = $this->getMailContent($comm);
-      $content = wordwrap($content, 70, "\n", true);
-      
-      // send mail
-      $result =
-        trigger_event('send_mail',
-          false, /* Result */
-          trigger_event('send_mail_to', $args['to']),
-          trigger_event('send_mail_subject', $subject),
-          trigger_event('send_mail_content', $content),
-          trigger_event('send_mail_headers', $headers),
-          $args
-        );
-      
-      if ($result == false)
-      {
-        array_push($errors, l10n('Error while sending e-mail'));
-      }
-      else
-      {
-        return true;
-      }
-    }
-    
-    return $errors;
-  }
-  
-  /**
-   * get mail content for sendMail()
-   */
-  function getMailContent($params)
-  {
-    global $user, $conf, $template;
-    
-    // switch to guest user
-    $user_save = $user;
-    $user = build_user($conf['guest_id'], true);
-    
-    // get pictures
-    $query = '
+      // switch to guest user for get_sql_condition_FandF
+      $user_save = $user;
+      $user = build_user($conf['guest_id'], true);
+
+      // get pictures
+      $query = '
 SELECT
-    id,
-    file,
-    name,
-    path
+    id, file, name, path
   FROM '.IMAGES_TABLE.' AS i
     JOIN '.IMAGE_CATEGORY_TABLE.' AS ci ON ci.image_id = i.id
-  WHERE id IN ('.implode(',', $this->images).')
-    '.get_sql_condition_FandF(array(
-                'forbidden_categories' => 'category_id',
-                'forbidden_images' => 'id'
-                ),
-              'AND'
-              ).'
+  WHERE id IN ('. implode(',', $this->images) .')
+    '.get_sql_condition_FandF(
+        array(
+          'forbidden_categories' => 'category_id',
+          'forbidden_images' => 'id'
+          ),
+        'AND'
+        ).'
   GROUP BY i.id
-  ORDER BY '.DB_RANDOM_FUNCTION.'()
-  LIMIT '.$params['nb_images'].'
-;';
-    $pictures = hash_from_query($query, 'id');
-    
-    // switch back to current user
-    $user = $user_save;
-    unset($user_save);
-  
-    // picture sinfos
-    set_make_full_url();
-    $tpl_vars = array();
-    foreach ($pictures as $row)
-    {
-      $name = render_element_name($row);
-      
-      $tpl_vars[] = array(
-        'TN_ALT' => htmlspecialchars(strip_tags($name)),
-        'NAME' => $name,
-        'URL' => make_picture_url(array('image_id' => $row['id'])),
-        'THUMB' => DerivativeImage::url(IMG_SQUARE, $row),
+  ORDER BY '. DB_RANDOM_FUNCTION .'()
+  LIMIT '. $comm['nb_images'] .'
+;';
+      $pictures = hash_from_query($query, 'id');
+
+      // switch back to current user
+      $user = $user_save;
+      unset($user_save);
+
+      $share_key = array('share_key'=>'mail-' . substr(sha1($this->data['id'].$conf['secret_key']), 0, 11));
+
+      $tpl_vars = array(
+        'COL_URL' => $this->addShare($share_key, false),
+        'PARAMS' => $comm,
+        'derivative_params' => ImageStdParams::get_by_type(IMG_SQUARE),
         );
-    }
-    
-    // template
-    $mail_css = file_get_contents(dirname(__FILE__).'/../template/mail.css');
-    
-    $share_key = array('share_key'=>'mail-' . substr(sha1($this->data['id'].$conf['secret_key']), 0, 11));
-    
-    $template->assign(array(
-      'GALLERY_URL' => get_gallery_home_url(),
-      'PHPWG_URL' => PHPWG_URL,
-      'UC_MAIL_CSS' => str_replace("\n", null, $mail_css),
-      'MAIL_TITLE' => $this->getParam('name').' ('.sprintf(l10n('by %s'), $params['sender_name']).')',
-      'COL_URL' => $this->addShare($share_key, false),
-      'PARAMS' => $params,
-      'derivative_params' => ImageStdParams::get_by_type(IMG_SQUARE),
-      'thumbnails' => $tpl_vars,
-      ));
-      
-    $template->set_filename('uc_mail', dirname(__FILE__).'/../template/mail.tpl');
-    $content = $template->parse('uc_mail', true);
-  
-    unset_make_full_url();
-    
-    return $content;
-  }
-
-  /**
-   * generate a listing of the collection
+
+      // pictures infos
+      set_make_full_url();
+
+      foreach ($pictures as $row)
+      {
+        $name = render_element_name($row);
+
+        $tpl_vars['THUMBNAILS'][] = array(
+          'TN_ALT' => htmlspecialchars(strip_tags($name)),
+          'NAME' =>   $name,
+          'URL' =>    make_picture_url(array('image_id' => $row['id'])),
+          'THUMB' =>  DerivativeImage::url(IMG_SQUARE, $row),
+          );
+      }
+
+      unset_make_full_url();
+
+      $result = pwg_mail(
+        array(
+          'name' => $comm['recipient_name'],
+          'email' => $comm['recipient_email'],
+          ),
+        array(
+          'subject' => '['.$conf['gallery_title'].'] '.l10n('A photo collection by %s', $comm['sender_name']),
+          'mail_title' => $this->getParam('name'),
+          'mail_subtitle' => l10n('by %s', $comm['sender_name']),
+          'content_format' => 'text/html',
+          'from' => array(
+            'name' => $comm['sender_name'],
+            'email' => $comm['sender_email'],
+            )
+          ),
+        array(
+          'filename' => 'mail',
+          'dirname' => realpath(USER_COLLEC_PATH . 'template'),
+          'assign' => $tpl_vars,
+          )
+        );
+
+      if ($result == false)
+      {
+        $errors[] = l10n('Error while sending e-mail');
+      }
+      else
+      {
+        return true;
+      }
+    }
+
+    return $errors;
+  }
+
+  /**
+   * Generate a listing of the collection
+   *
+   * @param string[] $fields
+   * @return string
    */
   function serialize($params)
   {
-    $params = array_intersect($params, array('id','file','name','url','path','date_creation','collection_add_date','filesize','width','height'));
-    
+    $fields = array_intersect($fields, array('id','file','name','url','path','date_creation','collection_add_date','filesize','width','height'));
+
     $content = null;
-     
+
     // get images infos
     $query = '
@@ -617,5 +611,5 @@
 ;';
     $pictures = hash_from_query($query, 'id');
-    
+
     if (count($pictures))
     {
@@ -623,12 +617,12 @@
       set_make_full_url();
       $root_url = get_root_url();
-      
+
       $fp = fopen('php://temp', 'r+');
-      fputcsv($fp, $params);
-        
+      fputcsv($fp, $fields);
+
       foreach ($pictures as $row)
       {
         $element = array();
-        foreach ($params as $field)
+        foreach ($fields as $field)
         {
           switch ($field)
@@ -653,17 +647,17 @@
         }
       }
-      
+
       rewind($fp);
       $content = stream_get_contents($fp);
       fclose($fp);
-      
+
       unset_make_full_url();
     }
-    
+
     return $content;
   }
-  
-  /**
-   * delete
+
+  /**
+   * Delete the collection
    */
   function delete()
@@ -673,4 +667,2 @@
   }
 }
-
-?>
Index: /extensions/UserCollections/include/collections.inc.php
===================================================================
--- /extensions/UserCollections/include/collections.inc.php	(revision 25677)
+++ /extensions/UserCollections/include/collections.inc.php	(revision 25678)
@@ -21,9 +21,9 @@
     access_denied();
   }
-  
-  $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/collections_list.tpl'));
-  
+
+  $template->set_filename('uc_page', realpath(USER_COLLEC_PATH.'template/collections_list.tpl'));
+
   // actions
-  if ( isset($_GET['action']) and preg_match('#^([0-9]+)$#', $_GET['col_id']) )
+  if (isset($_GET['action']) and preg_match('#^([0-9]+)$#', $_GET['col_id']))
   {
     switch ($_GET['action'])
@@ -39,5 +39,5 @@
         {
           $collection = new UserCollection('new', $_GET['name']);
-          
+
           if (isset($_GET['redirect']))
           {
@@ -52,5 +52,5 @@
         break;
       }
-        
+
       ## delete collection ##
       case 'delete':
@@ -69,13 +69,13 @@
     }
   }
-  
+
   $template->assign('U_CREATE',
     add_url_params(USER_COLLEC_PUBLIC, array('action'=>'new','col_id'=>'0'))
     );
-  
+
   $template->set_prefilter('index_category_thumbnails', 'user_collections_categories_list');
-  
+
   include(USER_COLLEC_PATH . '/include/display_collections.inc.php');
-  
+
   break;
 }
@@ -92,9 +92,9 @@
     redirect(USER_COLLEC_PUBLIC);
   }
-  
-  $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/collection_edit.tpl'));
-  
+
+  $template->set_filename('uc_page', realpath(USER_COLLEC_PATH.'template/collection_edit.tpl'));
+
   $self_url = USER_COLLEC_PUBLIC . 'edit/' . $page['col_id'];
-  
+
   $template->assign(array(
     'F_ACTION' => $self_url,
@@ -102,9 +102,9 @@
     'UC_IN_EDIT' => true,
     ));
-  
+
   try {
     $collection = new UserCollection($page['col_id']);
     $collection->checkUser();
-    
+
     // save properties
     if (isset($_POST['save_col']))
@@ -118,7 +118,7 @@
         $collection->updateParam('name', stripslashes($_POST['name']));
       }
-      $collection->updateParam('comment', stripslashes($_POST['comment']));
-    }
-    
+      $collection->updateParam('comment', stripslashes(@$_POST['comment']));
+    }
+
     // add key
     if ($conf['user_collections']['allow_public'])
@@ -127,9 +127,9 @@
       {
         $share = array(
-          'share_key' =>  trim($_POST['share_key']),
-          'password' =>   isset($_POST['use_share_password']) ? trim($_POST['share_password']) : '',
-          'deadline' =>   isset($_POST['use_share_deadline']) ? trim($_POST['share_deadline']) : '',
+          'share_key' => trim($_POST['share_key']),
+          'password' =>  isset($_POST['use_share_password']) ? trim($_POST['share_password']) : '',
+          'deadline' =>  isset($_POST['use_share_deadline']) ? trim($_POST['share_deadline']) : '',
           );
-          
+
         if (!verify_ephemeral_key(@$_POST['key']))
         {
@@ -147,5 +147,5 @@
         {
           $share = array();
-          $share['infos'][] = sprintf(l10n('New share added: <a href="%s">%s</a>'), $result, $result);
+          $share['infos'][] = l10n('New share added: <a href="%s">%s</a>', $result, $result);
         }
         $share['open'] = true;
@@ -163,23 +163,14 @@
       {
         $share['share_key'] = get_random_key(16);
-        $share['password'] = null;
-        $share['deadline'] = null;
+        $share['password'] =  null;
+        $share['deadline'] =  null;
       }
 
       $template->assign('share', $share);
     }
-    
+
     // send mail
-    if ( $conf['user_collections']['allow_mails'] && $conf['user_collections']['allow_public'] )
-    {
-      $contact = array(
-        'sender_name' =>      $user['username'],
-        'sender_email' =>     $user['email'],
-        'recipient_name' =>   null,
-        'recipient_email' =>  null,
-        'nb_images' =>        4,
-        'message' =>          null,
-        );
-          
+    if ($conf['user_collections']['allow_mails'] && $conf['user_collections']['allow_public'])
+    {
       if (isset($_POST['send_mail']))
       {
@@ -192,5 +183,5 @@
           'message' =>          $_POST['message'],
           );
-        
+
         if (!verify_ephemeral_key(@$_POST['key']))
         {
@@ -212,58 +203,74 @@
         }
       }
-      
+
+      if (!isset($contact['sender_email']))
+      {
+        $contact['sender_name'] =     $user['username'];
+        $contact['sender_email'] =    $user['email'];
+        $contact['recipient_name'] =  null;
+        $contact['recipient_email'] = null;
+        $contact['nb_images'] =       4;
+        $contact['message'] =         null;
+      }
+
       $template->assign('contact', $contact);
     }
-    
+
     // clear
-    if ( isset($_GET['action']) and $_GET['action'] == 'clear' )
+    if (isset($_GET['action']) && $_GET['action'] == 'clear')
     {
       $collection->clearImages();
     }
-    
-    
+
+
     // add remove item links
     $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_button');
     $template->set_prefilter('index_thumbnails', 'user_collections_add_colorbox');
-    
+
     // thumbnails
     include(USER_COLLEC_PATH . '/include/display_thumbnails.inc.php');
-    
-    
+
+
     // collection properties
     $infos = $collection->getCollectionInfo();
     $infos['DATE_CREATION'] = format_date($infos['DATE_CREATION'], true);
     $infos['SHARES'] = $collection->getShares();
-    $template->assign('collection', $infos); 
-    
+    $template->assign('collection', $infos);
+
+
     // toolbar buttons
     if (!empty($page['items']))
     {
-      $template->assign('U_CLEAR',
+      if ($conf['user_collections']['allow_public'])
+      {
+        user_collections_add_button('share', 'U_SHARE',
+          USER_COLLEC_PUBLIC . 'view/' . $page['col_id'] .'-'
+          );
+
+        if ($conf['user_collections']['allow_mails'])
+        {
+          user_collections_add_button('mail', 'U_MAIL', true);
+        }
+      }
+
+      user_collections_add_button('clear', 'U_CLEAR',
         add_url_params($self_url, array('action'=>'clear'))
         );
     }
-    $template->assign('U_DELETE',
+
+    user_collections_add_button('delete', 'U_DELETE',
       add_url_params(USER_COLLEC_PUBLIC, array('action'=>'delete','col_id'=>$page['col_id']))
       );
-      
-    if ( $conf['user_collections']['allow_public'] && !empty($page['items']) )
-    {
-      $template->assign('U_SHARE', USER_COLLEC_PUBLIC . 'view/' . $page['col_id'] .'-');
-    }
-    if ( $conf['user_collections']['allow_mails'] && $conf['user_collections']['allow_public'] && !empty($page['items']) )
-    {
-      $template->assign('U_MAIL', true);
-    }
+
     $template->assign('UC_TKEY', get_ephemeral_key(3));
-    
+
     // modify page title
-    $template->concat('TITLE', 
-      $conf['level_separator'] . trigger_event('render_category_name', $infos['NAME'])
+    $template->concat('TITLE',
+      $conf['level_separator'] . trigger_change('render_category_name', $infos['NAME'])
       );
-    
+
     // render description
     $template->assign('CONTENT_DESCRIPTION',
-      trigger_event('render_category_description', nl2br($infos['COMMENT']))
+      trigger_change('render_category_description', nl2br($infos['COMMENT']))
       );
   }
@@ -272,5 +279,5 @@
     $page['errors'][] = $e->getMessage();
   }
-  
+
   break;
 }
@@ -282,5 +289,5 @@
 {
   $page['col_key'] = $page['col_id'];
-  
+
   if (!$conf['user_collections']['allow_public'])
   {
@@ -291,5 +298,5 @@
     bad_request('');
   }
-  
+
   $query = '
 SELECT col_id, params
@@ -298,28 +305,29 @@
 ;';
   $result = pwg_query($query);
+
   if (!pwg_db_num_rows($result))
   {
     page_not_found(l10n('Collection not found'));
   }
-  
+
   list($page['col_id'], $share_params) = pwg_db_fetch_row($result);
   $share_params = unserialize($share_params);
-  
+
   // deadline check
-  if ( !empty($share_params['deadline']) && strtotime($share_params['deadline'])<time() )
+  if (!empty($share_params['deadline']) && strtotime($share_params['deadline'])<time())
   {
     page_not_found(l10n('This link expired'));
   }
-  
+
   $self_url = USER_COLLEC_PUBLIC . 'view/' . $page['col_key'];
-  
-  $template->set_filename('index', realpath(USER_COLLEC_PATH.'template/collection_view.tpl'));
-  
+
+  $template->set_filename('uc_page', realpath(USER_COLLEC_PATH.'template/collection_view.tpl'));
+
   try {
     $collection = new UserCollection($page['col_id']);
     $col = $collection->getCollectionInfo();
-    
+
     $mode = 'view';
-    
+
     // password check
     if (!empty($share_params['password']))
@@ -351,25 +359,26 @@
       }
     }
-    
+
     if ($mode == 'view')
     {
       $template->set_prefilter('index_thumbnails', 'user_collections_add_colorbox');
-      
+
       // thumbnails
       include(USER_COLLEC_PATH . '/include/display_thumbnails.inc.php');
-      
+
       // render description
       $template->assign('CONTENT_DESCRIPTION',
-        trigger_event('render_category_description', nl2br($col['COMMENT']))
+        trigger_change('render_category_description', nl2br($col['COMMENT']))
         );
     }
-    
+
     // add username in title
     include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-    $template->concat('TITLE', 
-      $conf['level_separator'] . trigger_event('render_category_name', $col['NAME']) .
-      ' (' . sprintf(l10n('by %s'), get_username($collection->getParam('user_id'))) . ')'
+
+    $template->concat('TITLE',
+      $conf['level_separator'] . trigger_change('render_category_name', $col['NAME']) .
+      ' (' . l10n('by %s', get_username($collection->getParam('user_id'))) . ')'
       );
-      
+
     $template->assign('UC_MODE', $mode);
   }
@@ -378,8 +387,10 @@
     access_denied();
   }
-  
+
   break;
 }
 }
+
+$template->assign_var_from_handle('CONTENT', 'uc_page');
 
 
@@ -393,5 +404,5 @@
     | <a href="{$cat.U_DELETE}" onClick="return confirm(\'{"Are you sure?"|@translate}\');" rel="nofollow">{"Delete"|@translate}</a>
   </div>';
-  
+
   return str_replace($search, $replace, $content);
 }
@@ -402,7 +413,15 @@
   $search = '<a href="{$thumbnail.URL}"';
   $replace = $search.' class="preview-box" data-src="{$thumbnail.FILE_SRC}" data-id="{$thumbnail.id}"';
-  
+
   return str_replace($search, $replace, $content);
 }
 
-?>
+// add special buttons
+function user_collections_add_button($tpl_file, $tpl_var, $value)
+{
+  global $template;
+
+  $template->assign($tpl_var, $value);
+  $template->set_filename('uc_button_'.$tpl_file, realpath(USER_COLLEC_PATH.'template/buttons/'. $tpl_file .'.tpl'));
+  $template->add_index_button($template->parse('uc_button_'.$tpl_file, true));
+}
Index: /extensions/UserCollections/include/display_collections.inc.php
===================================================================
--- /extensions/UserCollections/include/display_collections.inc.php	(revision 25677)
+++ /extensions/UserCollections/include/display_collections.inc.php	(revision 25678)
@@ -1,5 +1,4 @@
 <?php
 defined('USER_COLLEC_PATH') or die('Hacking attempt!');
-
 
 // collections orders
@@ -20,7 +19,8 @@
 $orders = get_collections_preferred_orders();
 
+
 // get sorted collections
 $query = '
-SELECT * 
+SELECT *
   FROM '.COLLECTIONS_TABLE.'
   WHERE user_id = '.$user['id'].'
@@ -31,9 +31,10 @@
 $template->assign('COLLECTIONS_COUNT', count($categories));
 
+
 // order menu
 if (count($categories))
 {
   $url = add_url_params(USER_COLLEC_PUBLIC, array('uc_collection_order' => ''));
-  
+
   foreach ($orders as $order_id => $order)
   {
@@ -53,4 +54,5 @@
 
 
+// collections details
 if (count($categories))
 {
@@ -69,5 +71,5 @@
 ;';
   $thumbnails = hash_from_query($query, 'col_id');
-  
+
   $thumbnails[0] = array(
     'id' => 0,
@@ -78,5 +80,5 @@
     'rotation' => 0,
     );
-  
+
   foreach ($thumbnails as &$info)
   {
@@ -84,5 +86,5 @@
   }
   unset($info);
-  
+
   $tpl_thumbnails_var = array();
 
@@ -91,29 +93,27 @@
     $thumb = empty($thumbnails[ $category['id'] ]) ? $thumbnails[0] : $thumbnails[ $category['id'] ];
     $counter = get_display_images_count($category['nb_images'], $category['nb_images'], 0);
-    
-    $tpl_var = array_merge( $category, array(
-      'representative'   => $thumb,
-      'TN_ALT'   => strip_tags($category['name']),
-      'URL'   => USER_COLLEC_PUBLIC.'edit/'.$category['id'],
-      'CAPTION_NB_IMAGES' => empty($counter) ? sprintf(l10n('%d photo'), 0) : $counter,
-      'NAME'  => trigger_event('render_category_name', $category['name']),
-      'DESCRIPTION'  => trigger_event('render_category_description', $category['comment'], 'subcatify_category_description'),
-      'INFO_DATES' => format_date($category['date_creation'], true),
-      'U_DELETE' => add_url_params(USER_COLLEC_PUBLIC, array('action'=>'delete','col_id'=>$category['id'])),
+
+    $tpl_var = array_merge($category, array(
+      'representative' =>     $thumb,
+      'TN_ALT' =>             strip_tags($category['name']),
+      'URL' =>                USER_COLLEC_PUBLIC.'edit/'.$category['id'],
+      'CAPTION_NB_IMAGES' =>  empty($counter) ? l10n('%d photo', 0) : $counter,
+      'NAME' =>               trigger_change('render_category_name', $category['name']),
+      'DESCRIPTION' =>        trigger_change('render_category_description', $category['comment'], 'subcatify_category_description'),
+      'INFO_DATES' =>         format_date($category['date_creation'], true),
+      'U_DELETE' =>           add_url_params(USER_COLLEC_PUBLIC, array('action'=>'delete','col_id'=>$category['id'])),
       ));
 
     $tpl_thumbnails_var[] = $tpl_var;
   }
-  
-  $derivative_params = trigger_event('get_index_album_derivative_params', ImageStdParams::get_by_type(IMG_THUMB) );
+
+  $derivative_params = trigger_change('get_index_album_derivative_params', ImageStdParams::get_by_type(IMG_THUMB) );
   $template->assign(array(
-    'maxRequests' =>$conf['max_requests'],
+    'maxRequests' => $conf['max_requests'],
     'category_thumbnails' => $tpl_thumbnails_var,
     'derivative_params' => $derivative_params,
     ));
-  
+
   $template->set_filename('index_category_thumbnails', 'mainpage_categories.tpl');
   $template->assign_var_from_handle('CATEGORIES', 'index_category_thumbnails');
 }
-
-?>
Index: /extensions/UserCollections/include/display_thumbnails.inc.php
===================================================================
--- /extensions/UserCollections/include/display_thumbnails.inc.php	(revision 25677)
+++ /extensions/UserCollections/include/display_thumbnails.inc.php	(revision 25678)
@@ -1,5 +1,4 @@
 <?php
 defined('USER_COLLEC_PATH') or die('Hacking attempt!');
-
 
 // image order
@@ -17,8 +16,9 @@
 }
 
-// get sorted elements
 $image_order_id = pwg_get_session_var('uc_image_order', 0);
 $orders = get_collection_preferred_image_orders();
 
+
+// get sorted elements
 $query = '
 SELECT i.id
@@ -31,4 +31,5 @@
 $page['items'] = array_from_query($query, 'id');
 
+
 // caddie
 if (isset($_GET['uc_caddie']))
@@ -38,4 +39,5 @@
 }
 
+
 // image order menu
 if ( $conf['index_sort_order_input']
@@ -43,5 +45,5 @@
 {
   $url = add_url_params($self_url, array('uc_image_order' => ''));
-  
+
   foreach ($orders as $order_id => $order)
   {
@@ -75,7 +77,9 @@
 }
 
+
 // add links for colorbox
 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
 
+// photos details
 global $selection, $pictures;
 include(PHPWG_ROOT_PATH . 'include/category_default.inc.php');
@@ -83,10 +87,10 @@
 
 // multisize menu
-if ( !empty($page['items']) )
+if (!empty($page['items']))
 {
   $url = add_url_params($self_url, array('display' => ''));
-    
+
   $selected_type = $template->get_template_vars('derivative_params')->type;
-  $template->clear_assign( 'derivative_params' );
+  $template->clear_assign('derivative_params');
   $type_map = ImageStdParams::get_defined_type_map();
   unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]);
@@ -118,11 +122,11 @@
 {
   global $template, $page;
-  
+
   $url = USER_COLLEC_PUBLIC . 'edit/'.$page['col_id'];
-  
+
   foreach ($tpl_thumbnails_var as &$thumbnail)
   {
     $src_image = new SrcImage($thumbnail);
-    
+
     $thumbnail['FILE_SRC'] = DerivativeImage::url(IMG_LARGE, $src_image);
     $thumbnail['URL'] = duplicate_picture_url(
@@ -135,7 +139,5 @@
       );
   }
-  
+
   return $tpl_thumbnails_var;
 }
-  
-?>
Index: /extensions/UserCollections/include/events.inc.php
===================================================================
--- /extensions/UserCollections/include/events.inc.php	(revision 25677)
+++ /extensions/UserCollections/include/events.inc.php	(revision 25678)
@@ -12,26 +12,31 @@
   if ($tokens[0] == 'collections')
   {
-    add_event_handler('loc_begin_page_header', 'user_collections_page_header');
-    
     $page['section'] = 'collections';
     $page['title'] = l10n('Collections');
-    
+    $page['body_id'] = 'theCollectionPage';
+    $page['is_external'] = true;
+    $page['is_homepage'] = false;
+
     $page['section_title'] = '<a href="'.get_absolute_root_url().'">'.l10n('Home').'</a>'.$conf['level_separator'];
-    if (is_a_guest()) $page['section_title'].= l10n('Collections');
-    else $page['section_title'].= '<a href="'.USER_COLLEC_PUBLIC.'">'.l10n('Collections').'</a>';
-    
+    if (is_a_guest())
+    {
+      $page['section_title'].= l10n('Collections');
+    }
+    else
+    {
+      $page['section_title'].= '<a href="'.USER_COLLEC_PUBLIC.'">'.l10n('Collections').'</a>';
+    }
+
+    $page['sub_section'] = 'list';
     if (in_array(@$tokens[1], array('edit','view','list')))
     {
       $page['sub_section'] = $tokens[1];
-      if ($tokens[1]=='edit' && isset($conf['GThumb']) && is_array($conf['GThumb']))
-      {
-        $conf['GThumb']['big_thumb'] = false; // big thumb is buggy with removes
-      }
-    }
-    else
-    {
-      $page['sub_section'] = 'list';
-    }
-    
+    }
+
+    if ($page['sub_section']=='edit' && isset($conf['GThumb']) && is_array($conf['GThumb']))
+    {
+      $conf['GThumb']['big_thumb'] = false; // big thumb is buggy with removes
+    }
+
     if (!empty($tokens[2]))
     {
@@ -39,29 +44,4 @@
     }
   }
-}
-
-function user_collections_page_header()
-{
-  global $page;
-  $page['body_id'] = 'theCollectionPage';
-}
-
-function uc_anti_lightbox($tpl_thumbnails_var)
-{
-  global $template, $page;
-  
-  if ($page['section'] == 'collections' && !empty($template->css_by_priority[0]))
-  {
-    foreach ($template->css_by_priority[0] as $file)
-    {
-      if (strpos($file[0], 'colorbox.css') !== false)
-      {
-        $template->assign('UC_NO_LIGHTBOX', true);
-        break;
-      }
-    }
-  }
-  
-  return $tpl_thumbnails_var;
 }
 
@@ -73,7 +53,7 @@
   if (isset($page['section']) and $page['section'] == 'collections')
   {
-    include(USER_COLLEC_PATH . '/include/collections.inc.php');
-  }
-  
+    include(USER_COLLEC_PATH . 'include/collections.inc.php');
+  }
+
   if (!is_a_guest() && count($page['items']))
   {
@@ -91,15 +71,15 @@
 {
   if (is_a_guest()) return $tpl_thumbnails_var;
-  
+
   global $page, $template, $user;
-  
+
   // the content is different on collection edition page and no button on batch downloader set edition page
-  if ( empty($pictures) or (@$page['section'] == 'collections' and @$page['sub_section']=='edit') or @$page['section'] == 'download')
+  if (empty($pictures) or (@$page['section'] == 'collections' and @$page['sub_section']=='edit') or @$page['section'] == 'download')
   {
     return $tpl_thumbnails_var;
   }
-  
+
   $image_ids = array_map(create_function('$i', 'return $i["id"];'), $pictures);
-  
+
   // get collections for each picture
   $query = '
@@ -117,5 +97,5 @@
 ;';
   $image_collections = simple_hash_from_query($query, 'image_id', 'col_ids');
-  
+
   foreach ($tpl_thumbnails_var as &$thumbnail)
   {
@@ -123,5 +103,5 @@
   }
   unset($thumbnail);
-  
+
   // get all collections
   $query = '
@@ -132,19 +112,19 @@
 ;';
   $collections = hash_from_query($query, 'id');
-  
+
   foreach ($collections as &$col)
   {
-    $col["name"] = trigger_event("render_category_name", $col["name"]);
+    $col["name"] = trigger_change('render_category_name', $col["name"]);
   }
   unset($col);
-  
+
   $template->assign(array(
     'COLLECTIONS' => $collections,
     'USER_COLLEC_PATH' => USER_COLLEC_PATH,
     ));
-  
+
   // thumbnails buttons
   $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_button');
-  
+
   return $tpl_thumbnails_var;
 }
@@ -162,5 +142,5 @@
 {/if}
 </a>{/strip}';
-  
+
   return preg_replace($search, $replace, $content);
 }
@@ -173,8 +153,11 @@
 function user_collections_picture_page()
 {
-  if (is_a_guest()) return;
-  
+  if (is_a_guest())
+  {
+    return;
+  }
+
   global $template, $picture, $user;
-  
+
   // get collections for this picture
   $query = '
@@ -190,5 +173,5 @@
 ;';
   list($image_collections) = pwg_db_fetch_row(pwg_query($query));
-  
+
   // get all collections
   $query = '
@@ -199,11 +182,11 @@
 ;';
   $collections = hash_from_query($query, 'id');
-  
+
   foreach ($collections as &$col)
   {
-    $col["name"] = trigger_event("render_category_name", $col["name"]);
+    $col["name"] = trigger_change('render_category_name', $col["name"]);
   }
   unset($col);
-  
+
   $template->assign(array(
     'CURRENT_COLLECTIONS' => $image_collections,
@@ -213,5 +196,5 @@
     'IN_PICTURE' => true,
     ));
-  
+
   // toolbar button
   $template->set_filename('usercol_button', realpath(USER_COLLEC_PATH.'template/picture_button.tpl'));
@@ -227,9 +210,10 @@
 function user_collections_add_menublock($menu_ref_arr)
 {
-  if (is_a_guest()) return;
-  
   $menu = &$menu_ref_arr[0];
-  if ($menu->get_id() != 'menubar') return;
-    
+  if (is_a_guest() || $menu->get_id() != 'menubar')
+  {
+    return;
+  }
+
   $menu->register_block(new RegisteredBlock('mbUserCollection', l10n('Collections'), 'UserCollection'));
 }
@@ -239,8 +223,8 @@
 {
   $max = 6;
-  
+
   global $template, $page, $conf, $user;
   $menu = &$menu_ref_arr[0];
-  
+
   if (($block = $menu->get_block('mbUserCollection')) != null)
   {
@@ -252,13 +236,13 @@
 ;';
     $collections = array_values(hash_from_query($query, 'id'));
-    
+
     $data['collections'] = array();
     for ($i=0; $i<$max && $i<count($collections); $i++)
     {
-      $collections[$i]['name'] = trigger_event('render_category_name', $collections[$i]['name']);
+      $collections[$i]['name'] = trigger_change('render_category_name', $collections[$i]['name']);
       $collections[$i]['u_edit'] = USER_COLLEC_PUBLIC.'edit/'.$collections[$i]['id'];
       $data['collections'][] = $collections[$i];
     }
-    
+
     $data['NB_COL'] = count($collections);
     if ($data['NB_COL'] > $max)
@@ -266,7 +250,7 @@
       $data['MORE'] = count($collections)-$max;
     }
-    
+
     $data['U_LIST'] = USER_COLLEC_PUBLIC;
-    
+
     $block->set_title('<a href="'.USER_COLLEC_PUBLIC.'">'.l10n('Collections').'</a>');
     $block->template = realpath(USER_COLLEC_PATH . 'template/menublock.tpl');
@@ -274,4 +258,2 @@
   }
 }
-
-?>
Index: /extensions/UserCollections/include/functions.inc.php
===================================================================
--- /extensions/UserCollections/include/functions.inc.php	(revision 25677)
+++ /extensions/UserCollections/include/functions.inc.php	(revision 25678)
@@ -1,24 +1,4 @@
 <?php
 defined('USER_COLLEC_PATH') or die('Hacking attempt!');
-
-function uc_check_email_validity($mail_address)
-{
-  if (function_exists('email_check_format'))
-  {
-    return email_check_format($mail_address); // Piwigo 2.5
-  }
-  else if (version_compare(PHP_VERSION, '5.2.0') >= 0)
-  {
-    return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false;
-  }
-  else
-  {
-    $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
-    $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
-    $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
-
-    return (bool)preg_match($regex, $mail_address);
-  }
-}
 
 function get_random_key($length=32)
@@ -35,6 +15,6 @@
 {
   global $conf;
-    
-  return trigger_event('get_category_preferred_image_orders', array(
+
+  return trigger_change('get_category_preferred_image_orders', array(
     array(l10n('Date added to collection, new &rarr; old'), 'add_date DESC', true),
     array(l10n('Date added to collection, old &rarr; new'), 'add_date ASC',  true),
@@ -42,5 +22,5 @@
     array(l10n('Photo title, Z &rarr; A'),        'name DESC',            true),
     array(l10n('Date created, new &rarr; old'),   'date_creation DESC',   true),
-    array(l10n('Date created, old &rarr; new'),   'date_creation ASC',    true), 
+    array(l10n('Date created, old &rarr; new'),   'date_creation ASC',    true),
     array(l10n('Date posted, new &rarr; old'),    'date_available DESC',  true),
     array(l10n('Date posted, old &rarr; new'),    'date_available ASC',   true),
@@ -58,9 +38,7 @@
     array(l10n('Name, Z &rarr; A'),               'name DESC',          true),
     array(l10n('Date created, new &rarr; old'),   'date_creation DESC', true),
-    array(l10n('Date created, old &rarr; new'),   'date_creation ASC',  true), 
+    array(l10n('Date created, old &rarr; new'),   'date_creation ASC',  true),
     array(l10n('Photos number, high &rarr; low'), 'nb_images DESC',     true),
     array(l10n('Photos number, low &rarr; high'), 'nb_images ASC',      true),
     );
 }
-
-?>
Index: /extensions/UserCollections/include/index.php
===================================================================
--- /extensions/UserCollections/include/index.php	(revision 25677)
+++ /extensions/UserCollections/include/index.php	(revision 25678)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2012 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 );
@@ -28,3 +5,2 @@
 header( 'Location: '.$url );
 exit();
-?>
Index: tensions/UserCollections/include/install.inc.php
===================================================================
--- /extensions/UserCollections/include/install.inc.php	(revision 25677)
+++ 	(revision )
@@ -1,103 +1,0 @@
-<?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-function user_collections_install() 
-{
-  global $conf, $prefixeTable;
-  
-  if (empty($conf['user_collections']))
-  {
-    $default_config = serialize(array(
-      'allow_mails' => true,
-      'allow_public' => true,
-      ));
-      
-    conf_update_param('user_collections', $default_config);
-    $conf['user_collections'] = $default_config;
-  }
-  
-  // create tables
-  $query = '
-CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collections` (
-  `id` mediumint(8) NOT NULL AUTO_INCREMENT,
-  `user_id` smallint(5) DEFAULT NULL,
-  `name` varchar(255) NOT NULL,
-  `date_creation` datetime NOT NULL,
-  `comment` text NULL,
-  `nb_images` mediumint(8) NOT NULL DEFAULT 0,
-  PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
-;';
-  pwg_query($query);
-  
-  $query = '
-CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collection_images` (
-  `col_id` mediumint(8) NOT NULL,
-  `image_id` mediumint(8) NOT NULL,
-  `add_date` datetime NULL,
-  UNIQUE KEY `UNIQUE` (`col_id`,`image_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8
-;';
-  pwg_query($query);
-  
-  // version 2.0.0
-  $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'collection_images` LIKE "add_date";');
-  if (!pwg_db_num_rows($result))
-  {
-    pwg_query('ALTER TABLE `'.$prefixeTable.'collection_images` ADD `add_date` datetime NULL;');
-  }
-  
-  $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'collections` LIKE "comment";');
-  if (!pwg_db_num_rows($result))
-  {
-    pwg_query('ALTER TABLE `'.$prefixeTable.'collections` ADD `comment` text NULL;');
-    pwg_query('ALTER TABLE `'.$prefixeTable.'collections` DROP `active`;');
-  }
-  
-  // version 2.1.0
-  $query = '
-CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collection_shares` (
-  `id` mediumint(8) NOT NULL AUTO_INCREMENT,
-  `col_id` mediumint(8) NOT NULL,
-  `share_key` varchar(64) NOT NULL,
-  `params` text NULL,
-  `add_date` datetime NOT NULL,
-  PRIMARY KEY (`id`),
-  UNIQUE KEY `share_key` (`share_key`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
-;';
-  pwg_query($query);
-  
-  $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'collections` LIKE "public";');
-  if (pwg_db_num_rows($result))
-  {
-    $now = date('Y-m-d H:i:s');
-    
-    $query = '
-SELECT id, public_id
-  FROM `'.$prefixeTable.'collections`
-  WHERE public = 1
-;';
-    $result = pwg_query($query);
-    
-    $inserts = array();
-    while ($row = pwg_db_fetch_assoc($result))
-    {
-      $inserts[] = array(
-        'col_id' => $row['id'],
-        'share_key' => $row['public_id'],
-        'params' => serialize(array('password'=>'','deadline'=>'')),
-        'add_date' => $now,
-        );
-    }
-    
-    mass_inserts($prefixeTable.'collection_shares',
-      array('col_id','share_key','params','add_date'),
-      $inserts
-      );
-    
-    pwg_query('ALTER TABLE `'.$prefixeTable.'collections` DROP `public`, DROP `public_id`;');
-  }
-}
-
-?>
Index: /extensions/UserCollections/include/plain_encoder.php
===================================================================
--- /extensions/UserCollections/include/plain_encoder.php	(revision 25677)
+++ /extensions/UserCollections/include/plain_encoder.php	(revision 25678)
@@ -40,4 +40,2 @@
   }
 }
-
-?>
Index: /extensions/UserCollections/include/ws_functions.inc.php
===================================================================
--- /extensions/UserCollections/include/ws_functions.inc.php	(revision 25677)
+++ /extensions/UserCollections/include/ws_functions.inc.php	(revision 25678)
@@ -6,5 +6,5 @@
   $service = &$arr[0];
   global $conf;
-  
+
   $service->addMethod(
     'pwg.collections.create',
@@ -17,5 +17,5 @@
     'Create a new User Collection.'
     );
-    
+
   $service->addMethod(
     'pwg.collections.delete',
@@ -26,5 +26,5 @@
     'Delete a User Collection.'
     );
-    
+
   $service->addMethod(
     'pwg.collections.getList',
@@ -42,5 +42,5 @@
     'Returns a list of collections.'
     );
-    
+
   $service->addMethod(
     'pwg.collections.addImages',
@@ -52,5 +52,5 @@
     'Add images to a collection.'
     );
-    
+
   $service->addMethod(
     'pwg.collections.removeImages',
@@ -62,5 +62,5 @@
     'Remove images from a collection.'
     );
-    
+
   $service->addMethod(
     'pwg.collections.getImages',
@@ -74,5 +74,5 @@
     'Returns elements for the corresponding  collection.'
     );
-    
+
   $service->addMethod(
     'pwg.collections.getSerialized',
@@ -88,5 +88,5 @@
     'Returns a serialized version of the collection in CSV.<br>The return type is plain/text whatever you select as response format.'
     );
-    
+
   $service->addMethod(
     'pwg.collections.getInfo',
@@ -105,11 +105,11 @@
 {
   global $conf, $user;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-  
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
   // check name
   if (empty($params['name']))
@@ -117,5 +117,5 @@
     return new PwgError(WS_ERR_MISSING_PARAM, 'Empty collection name');
   }
-  
+
   // check user id
   if (!empty($params['user_id']))
@@ -135,7 +135,7 @@
     $params['user_id'] = $user['id'];
   }
-  
+
   $collection = new UserCollection('new', $params['name'], $params['comment'], $params['user_id']);
-  
+
   return array_change_key_case($collection->getCollectionInfo(), CASE_LOWER);
 }
@@ -147,15 +147,15 @@
 {
   global $user;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-  
-  try {
-    $collection = new UserCollection($params['col_id']);
-    $collection->checkUser();
-    
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
+  try {
+    $collection = new UserCollection($params['col_id']);
+    $collection->checkUser();
+
     $collection->delete();
   }
@@ -172,11 +172,11 @@
 {
   global $user, $conf;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-  
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
   // check user_id
   if (!empty($params['user_id']))
@@ -196,5 +196,5 @@
     $params['user_id'] = $user['id'];
   }
-  
+
   // search
   $where_clauses = array('1=1');
@@ -207,9 +207,9 @@
     $where_clauses[] = 'name LIKE("%'.pwg_db_real_escape_string($params['name']).'%")';
   }
-  
+
   $order_by = !empty($params['order']) ? $params['order'] : 'username ASC, name ASC';
-  
+
   $query = '
-SELECT 
+SELECT
     c.*,
     u.'.$conf['user_fields']['username'].' AS username
@@ -223,5 +223,5 @@
 ;';
   $sets = hash_from_query($query, 'id');
-  
+
   $data = array();
   foreach ($sets as $row)
@@ -238,5 +238,5 @@
       );
   }
-  
+
   return array(
     'paging' => new PwgNamedStruct(array(
@@ -250,5 +250,5 @@
       )
     );
-  
+
   return $ret;
 }
@@ -260,17 +260,17 @@
 {
   global $conf, $user;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-
-  try {
-    $collection = new UserCollection($params['col_id']);
-    $collection->checkUser();
-    
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
+  try {
+    $collection = new UserCollection($params['col_id']);
+    $collection->checkUser();
+
     $collection->addImages($params['image_ids']);
-    
+
     return array('nb_images' => $collection->getParam('nb_images'));
   }
@@ -287,17 +287,17 @@
 {
   global $conf, $user;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-  
-  try {
-    $collection = new UserCollection($params['col_id']);
-    $collection->checkUser();
-    
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
+  try {
+    $collection = new UserCollection($params['col_id']);
+    $collection->checkUser();
+
     $collection->removeImages($params['image_ids']);
-    
+
     return array('nb_images' => $collection->getParam('nb_images'));
   }
@@ -314,18 +314,18 @@
 {
   global $conf, $user;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-
-  try {
-    $collection = new UserCollection($params['col_id']);
-    $collection->checkUser();
-    
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
+  try {
+    $collection = new UserCollection($params['col_id']);
+    $collection->checkUser();
+
     $image_ids = $collection->getImages();
     $images = array();
-    
+
     if (!empty($image_ids))
     {
@@ -343,5 +343,5 @@
 SELECT i.*
   FROM '.IMAGES_TABLE.' i
-  WHERE 
+  WHERE
     '. implode("\n AND ", $where_clauses).'
   GROUP BY i.id
@@ -366,9 +366,9 @@
         }
         $image = array_merge($image, ws_std_get_urls($row));
-        
+
         array_push($images, $image);
       }
     }
-    
+
     return array(
       'paging' => new PwgNamedStruct(array(
@@ -396,20 +396,20 @@
 {
   global $conf, $user;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-
-  try {
-    $collection = new UserCollection($params['col_id']);
-    $collection->checkUser();
-    
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
+  try {
+    $collection = new UserCollection($params['col_id']);
+    $collection->checkUser();
+
     // change encoder to plain text
     include_once(USER_COLLEC_PATH.'include/plain_encoder.php');
     $encoder = new PwgPlainEncoder();
     $service->setEncoder('plain', $encoder);
-  
+
     return $collection->serialize($params['content']);
   }
@@ -426,15 +426,15 @@
 {
   global $conf, $user;
-  
-  // check status
-  if (is_a_guest())
-  {
-    return new PwgError(403, 'Forbidden');
-  }
-
-  try {
-    $collection = new UserCollection($params['col_id']);
-    $collection->checkUser();
-  
+
+  // check status
+  if (is_a_guest())
+  {
+    return new PwgError(403, 'Forbidden');
+  }
+
+  try {
+    $collection = new UserCollection($params['col_id']);
+    $collection->checkUser();
+
     return array_change_key_case($collection->getCollectionInfo(), CASE_LOWER);
   }
@@ -444,4 +444,2 @@
   }
 }
-
-?>
Index: /extensions/UserCollections/index.php
===================================================================
--- /extensions/UserCollections/index.php	(revision 25677)
+++ /extensions/UserCollections/index.php	(revision 25678)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2012 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 );
@@ -28,3 +5,2 @@
 header( 'Location: '.$url );
 exit();
-?>
Index: /extensions/UserCollections/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/UserCollections/language/en_UK/plugin.lang.php	(revision 25677)
+++ /extensions/UserCollections/language/en_UK/plugin.lang.php	(revision 25678)
@@ -55,4 +55,5 @@
 $lang['Message (optional)'] = 'Message (optional)';
 $lang['Hello <b>%s</b>, %s sent you a photos collection from <a href="%s">%s</a>'] = 'Hello <b>%s</b>, %s sent you a photo collection from <a href="%s">%s</a>';
+$lang['Hello %s, %s sent you a photos collection from "%s"'] = 'Hello %s, %s sent you a photos collection from "%s"';
 $lang['Click here to view the complete collection'] = 'Click here to view the complete collection';
 $lang['Date added to collection, new &rarr; old'] = 'Date added to collection, new &rarr; old';
@@ -62,4 +63,10 @@
 $lang['Photos number, high &rarr; low'] = 'Photos number, high &rarr; low';
 $lang['Photos number, low &rarr; high'] = 'Photos number, low &rarr; high';
+$lang['Add'] = 'Add';
+$lang['Cancel'] = 'Cancel';
+$lang['Description'] = 'Description';
+$lang['jump to photo'] = 'jump to photo';
+$lang['Name'] = 'Name';
+$lang['Send'] = 'Send';
 
 ?>
Index: /extensions/UserCollections/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/UserCollections/language/fr_FR/plugin.lang.php	(revision 25677)
+++ /extensions/UserCollections/language/fr_FR/plugin.lang.php	(revision 25678)
@@ -55,4 +55,5 @@
 $lang['Message (optional)'] = 'Message (optionel)';
 $lang['Hello <b>%s</b>, %s sent you a photos collection from <a href="%s">%s</a>'] = 'Bonjour <b>%s</b>, %s vous a envoyé une collection de photos depuis <a href="%s">%s</a>';
+$lang['Hello %s, %s sent you a photos collection from "%s"'] = 'Bonjour %s, %s vous a envoyé une collection de photos depuis "%s"';
 $lang['Click here to view the complete collection'] = 'Cliquez ici pour voir la collection complète';
 $lang['Date added to collection, new &rarr; old'] = 'Date d\'ajout à la collection, récent &rarr; ancien';
@@ -62,4 +63,10 @@
 $lang['Photos number, high &rarr; low'] = 'Nombre de photos, élévé &rarr; faible';
 $lang['Photos number, low &rarr; high'] = 'Nombre de photos, faible &rarr; élévé';
+$lang['Add'] = 'Ajouter';
+$lang['Cancel'] = 'Annuler';
+$lang['Description'] = 'Description';
+$lang['jump to photo'] = 'Voir la photo';
+$lang['Name'] = 'Nom';
+$lang['Send'] = 'Envoyer';
 
 ?>
Index: /extensions/UserCollections/main.inc.php
===================================================================
--- /extensions/UserCollections/main.inc.php	(revision 25677)
+++ /extensions/UserCollections/main.inc.php	(revision 25678)
@@ -1,3 +1,3 @@
-<?php 
+<?php
 /*
 Plugin Name: User Collections
@@ -18,5 +18,5 @@
 global $conf, $prefixeTable;
 
-defined('USER_COLLEC_ID') or define('USER_COLLEC_ID', basename(dirname(__FILE__)));
+define('USER_COLLEC_ID',          basename(dirname(__FILE__)));
 define('USER_COLLEC_PATH',        PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/');
 define('COLLECTIONS_TABLE',       $prefixeTable.'collections');
@@ -43,5 +43,4 @@
   // thumbnails actions
   add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL-10, 2);
-  add_event_handler('loc_end_index_thumbnails', 'uc_anti_lightbox', 41);
 
   // picture action
@@ -64,34 +63,12 @@
 function user_collections_init()
 {
-  global $pwg_loaded_plugins, $conf;
-  
-  if (
-    USER_COLLEC_VERSION == 'auto' or
-    $pwg_loaded_plugins[USER_COLLEC_ID]['version'] == 'auto' or
-    version_compare($pwg_loaded_plugins[USER_COLLEC_ID]['version'], USER_COLLEC_VERSION, '<')
-  )
-  {
-    include_once(USER_COLLEC_PATH . 'include/install.inc.php');
-    user_collections_install();
-    
-    if ( $pwg_loaded_plugins[USER_COLLEC_ID]['version'] != 'auto' and USER_COLLEC_VERSION != 'auto' )
-    {
-      $query = '
-UPDATE '. PLUGINS_TABLE .'
-SET version = "'. USER_COLLEC_VERSION .'"
-WHERE id = "'. USER_COLLEC_ID .'"';
-      pwg_query($query);
-      
-      $pwg_loaded_plugins[USER_COLLEC_ID]['version'] = USER_COLLEC_VERSION;
-      
-      if (defined('IN_ADMIN'))
-      {
-        $_SESSION['page_infos'][] = 'UserCollections updated to version '. USER_COLLEC_VERSION;
-      }
-    }
-  }
-  
+  global $conf;
+
+  include_once(USER_COLLEC_PATH . 'maintain.inc.php');
+  $maintain = new UserCollections_maintain(USER_COLLEC_ID);
+  $maintain->autoUpdate(USER_COLLEC_VERSION, 'install');
+
   load_language('plugin.lang', USER_COLLEC_PATH);
-  
+
   $conf['user_collections'] = unserialize($conf['user_collections']);
 }
@@ -100,12 +77,11 @@
  * admin plugins menu
  */
-function user_collections_admin_menu($menu) 
+function user_collections_admin_menu($menu)
 {
-  array_push($menu, array(
+  $menu[] = array(
     'NAME' => 'User Collections',
     'URL' => USER_COLLEC_ADMIN,
-  ));
+    );
+
   return $menu;
 }
-
-?>
Index: /extensions/UserCollections/maintain.inc.php
===================================================================
--- /extensions/UserCollections/maintain.inc.php	(revision 25677)
+++ /extensions/UserCollections/maintain.inc.php	(revision 25678)
@@ -2,33 +2,126 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-defined('USER_COLLEC_ID') or define('USER_COLLEC_ID', basename(dirname(__FILE__)));
-include_once(PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/include/install.inc.php');
+class UserCollections_maintain extends PluginMaintain
+{
+  private $installed = false;
 
-function plugin_install() 
-{
-  user_collections_install();
-  
-  define('user_collections_installed', true);
-}
+  function install($plugin_version, &$errors=array())
+  {
+    global $conf, $prefixeTable;
 
-function plugin_activate()
-{
-  if (!defined('user_collections_intalled'))
+    if (empty($conf['user_collections']))
+    {
+      $conf['user_collections'] = serialize(array(
+        'allow_mails' => true,
+        'allow_public' => true,
+        ));
+
+      conf_update_param('user_collections', $conf['user_collections']);
+    }
+
+    // create tables
+    $query = '
+CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collections` (
+  `id` mediumint(8) NOT NULL AUTO_INCREMENT,
+  `user_id` smallint(5) DEFAULT NULL,
+  `name` varchar(255) NOT NULL,
+  `date_creation` datetime NOT NULL,
+  `comment` text NULL,
+  `nb_images` mediumint(8) NOT NULL DEFAULT 0,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
+;';
+    pwg_query($query);
+
+    $query = '
+CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collection_images` (
+  `col_id` mediumint(8) NOT NULL,
+  `image_id` mediumint(8) NOT NULL,
+  `add_date` datetime NULL,
+  UNIQUE KEY `UNIQUE` (`col_id`,`image_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+;';
+    pwg_query($query);
+
+    $query = '
+CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collection_shares` (
+  `id` mediumint(8) NOT NULL AUTO_INCREMENT,
+  `col_id` mediumint(8) NOT NULL,
+  `share_key` varchar(64) NOT NULL,
+  `params` text NULL,
+  `add_date` datetime NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `share_key` (`share_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
+;';
+    pwg_query($query);
+
+
+    // version 2.0.0
+    $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'collection_images` LIKE "add_date";');
+    if (!pwg_db_num_rows($result))
+    {
+      pwg_query('ALTER TABLE `'.$prefixeTable.'collection_images` ADD `add_date` datetime NULL;');
+    }
+
+    $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'collections` LIKE "comment";');
+    if (!pwg_db_num_rows($result))
+    {
+      pwg_query('ALTER TABLE `'.$prefixeTable.'collections` ADD `comment` text NULL;');
+      pwg_query('ALTER TABLE `'.$prefixeTable.'collections` DROP `active`;');
+    }
+
+    // version 2.1.0
+    $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'collections` LIKE "public";');
+    if (pwg_db_num_rows($result))
+    {
+      $now = date('Y-m-d H:i:s');
+
+      $query = '
+SELECT id, public_id
+  FROM `'.$prefixeTable.'collections`
+  WHERE public = 1
+;';
+      $result = pwg_query($query);
+
+      $inserts = array();
+      while ($row = pwg_db_fetch_assoc($result))
+      {
+        $inserts[] = array(
+          'col_id' => $row['id'],
+          'share_key' => $row['public_id'],
+          'params' => serialize(array('password'=>'','deadline'=>'')),
+          'add_date' => $now,
+          );
+      }
+
+      mass_inserts($prefixeTable.'collection_shares',
+        array('col_id','share_key','params','add_date'),
+        $inserts
+        );
+
+      pwg_query('ALTER TABLE `'.$prefixeTable.'collections` DROP `public`, DROP `public_id`;');
+    }
+  }
+
+  function activate($plugin_version, &$errors=array())
   {
-    user_collections_install();
+    if (!$this->installed)
+    {
+      $this->install($plugin_version, $errors);
+    }
+  }
+
+  function deactivate(){}
+
+  function uninstall()
+  {
+    global $prefixeTable;
+
+    conf_delete_param('user_collections');
+
+    pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collections`;');
+    pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collection_images`;');
+    pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collection_shares`;');
   }
 }
-
-function plugin_uninstall() 
-{
-  global $prefixeTable, $conf;
-  
-  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "user_collections";');
-  pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collections`;');
-  pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collection_images`;');
-  pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collection_shares`;');
-  
-  unset($conf['user_collections']);
-}
-
-?>
Index: /extensions/UserCollections/template/buttons/clear.tpl
===================================================================
--- /extensions/UserCollections/template/buttons/clear.tpl	(revision 25678)
+++ /extensions/UserCollections/template/buttons/clear.tpl	(revision 25678)
@@ -0,0 +1,3 @@
+<a href="{$U_CLEAR}" title="{'Clear this collection'|translate}" class="pwg-state-default pwg-button" rel="nofollow" onClick="return confirm('{'Are you sure?'|translate|escape:javascript}');">
+  <span class="pwg-icon user-collections-clear-icon" style="background:url('{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/bin.png') center center no-repeat;">&nbsp;</span><span class="pwg-button-text">{'Clear'|translate}</span>
+</a>
Index: /extensions/UserCollections/template/buttons/delete.tpl
===================================================================
--- /extensions/UserCollections/template/buttons/delete.tpl	(revision 25678)
+++ /extensions/UserCollections/template/buttons/delete.tpl	(revision 25678)
@@ -0,0 +1,3 @@
+<a href="{$U_DELETE}" title="{'Delete this collection'|translate}" class="pwg-state-default pwg-button" rel="nofollow" onClick="return confirm('{'Are you sure?'|translate|escape:javascript}');">
+  <span class="pwg-icon user-collections-delete-icon" style="background:url('{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/delete.png') center center no-repeat;">&nbsp;</span><span class="pwg-button-text">{'Delete'|translate}</span>
+</a>
Index: /extensions/UserCollections/template/buttons/index.php
===================================================================
--- /extensions/UserCollections/template/buttons/index.php	(revision 25678)
+++ /extensions/UserCollections/template/buttons/index.php	(revision 25678)
@@ -0,0 +1,6 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
Index: /extensions/UserCollections/template/buttons/mail.tpl
===================================================================
--- /extensions/UserCollections/template/buttons/mail.tpl	(revision 25678)
+++ /extensions/UserCollections/template/buttons/mail.tpl	(revision 25678)
@@ -0,0 +1,3 @@
+<a href="#mail_form" title="{'Send this collection my mail'|translate}" class="mail_colorbox_open pwg-state-default pwg-button" rel="nofollow">
+  <span class="pwg-icon user-collections-mail-icon" style="background:url('{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/mail.png') center center no-repeat;">&nbsp;</span><span class="pwg-button-text">{'Send'|translate}</span>
+</a>
Index: /extensions/UserCollections/template/buttons/share.tpl
===================================================================
--- /extensions/UserCollections/template/buttons/share.tpl	(revision 25678)
+++ /extensions/UserCollections/template/buttons/share.tpl	(revision 25678)
@@ -0,0 +1,3 @@
+<a href="#share_form" title="{'Share this collection'|translate}" class="share_colorbox_open pwg-state-default pwg-button" rel="nofollow">
+  <span class="pwg-icon user-collections-share-icon" style="background:url('{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/share.png') center center no-repeat;">&nbsp;</span><span class="pwg-button-text">{'Share'|translate}</span>
+</a>
Index: /extensions/UserCollections/template/collection_edit.tpl
===================================================================
--- /extensions/UserCollections/template/collection_edit.tpl	(revision 25677)
+++ /extensions/UserCollections/template/collection_edit.tpl	(revision 25678)
@@ -1,2 +1,3 @@
+{strip}
 {combine_css path=$USER_COLLEC_PATH|cat:'template/style_collections.css'}
 
@@ -4,72 +5,77 @@
 
 {*<!-- datepicker and timepicker -->*}
-{include file='include/datepicker.inc.tpl'}
-{combine_script id='jquery.ui.timepicker' load='footer' require='jquery.ui.datepicker,jquery.ui.slider' path=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/jquery-ui-timepicker-addon.js'}
-
-{assign var="timepicker_language" value=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/i18n/jquery-ui-timepicker-'|cat:$lang_info.code|cat:'.js'}
-{if "PHPWG_ROOT_PATH"|@constant|@cat:$timepicker_language|@file_exists}
-{combine_script id="jquery.ui.timepicker-$lang_info.code" load='footer' require='jquery.ui.timepicker' path=$timepicker_language}
+{combine_script id='jquery.ui.datepicker' load='footer' path='themes/default/js/ui/jquery.ui.datepicker.js'}
+{combine_script id='jquery.ui.timepicker' load='footer' require='jquery.ui.slider' path=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/jquery-ui-timepicker-addon.js'}
+
+{assign var=datepicker_language value='themes/default/js/ui/i18n/jquery.ui.datepicker-'|cat:$lang_info.code|cat:'.js'}
+{if 'PHPWG_ROOT_PATH'|constant|cat:$datepicker_language|file_exists}
+{combine_script id='jquery.ui.datepicker-'|cat:$lang_info.code load='footer' require='jquery.ui.datepicker' path=$datepicker_language}
+{/if}
+
+{assign var=timepicker_language value=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/i18n/jquery-ui-timepicker-'|cat:$lang_info.code|cat:'.js'}
+{if 'PHPWG_ROOT_PATH'|constant|cat:$timepicker_language|file_exists}
+{combine_script id='jquery.ui.timepicker-'|cat:$lang_info.code load='footer' require='jquery.ui.timepicker' path=$timepicker_language}
 {/if}
 
 {combine_css path='themes/default/js/ui/theme/jquery.ui.core.css'}
 {combine_css path='themes/default/js/ui/theme/jquery.ui.theme.css'}
+{combine_css path='themes/default/js/ui/theme/jquery.ui.datepicker.css'}
 {combine_css path='themes/default/js/ui/theme/jquery.ui.slider.css'}
 {combine_css path=$USER_COLLEC_PATH|cat:'template/resources/jquery-timepicker/jquery-ui-timepicker-addon.css'}
-
-
-{footer_script require='jquery,jquery.ui.timepicker'}
-var bg_color = $('#the_page #content').css('background-color');
-if (!bg_color || bg_color=='transparent') {ldelim}
-  bg_color = $('body').css('background-color');
+{/strip}
+
+{footer_script require='jquery'}
+var bg_color = jQuery('#the_page #content').css('background-color');
+if (!bg_color || bg_color=='transparent') {
+  bg_color = jQuery('body').css('background-color');
 }
 
 {if isset($U_SHARE)}
-{literal}
   var $share_form = jQuery('#share_form');
-  
+
   // functions
   jQuery.fn.extend({
       hideVis: function() {
-          $(this).css('visibility', 'hidden');
+          jQuery(this).css('visibility', 'hidden');
           return this;
       },
       showVis: function() {
-          $(this).css('visibility', 'visible');
+          jQuery(this).css('visibility', 'visible');
           return this;
       },
       toggleVis: function(toggle) {
-          if ($(this).css('visibility')=='hidden' || toggle === true){
-              return $(this).showVis();
+          if (jQuery(this).css('visibility')=='hidden' || toggle === true){
+              return jQuery(this).showVis();
           } else {
-              return $(this).hideVis();
+              return jQuery(this).hideVis();
           }
       }
   });
-  
+
   function enterShareKeyEdit() {
       $share_form.find('.url-edit').show();
       $share_form.find('.url-normal').hide();
-      jQuery(".share_colorbox_open").colorbox.resize({speed:0});
+      jQuery('.share_colorbox_open').colorbox.resize({ldelim}speed:0});
   }
   function exitShareKeyEdit() {
       $share_form.find('.url-edit').hide();
       $share_form.find('.url-normal').show();
-      jQuery(".share_colorbox_open").colorbox.resize({speed:0});
+      jQuery('.share_colorbox_open').colorbox.resize({ldelim}speed:0});
   }
-  
+
   // hide some inputs
   exitShareKeyEdit();
-  
+
   // display key
   $share_form.find('.url-more').text($share_form.find('input[name="share_key"]').val());
-  
+
   // url edition
-  $share_form.find('.edit_share_key').on('click', function() {
+  $share_form.find('.edit_share_key').on('click', function(e) {
       enterShareKeyEdit();
-      return false;
-  });
-  $share_form.find('.set_share_key').on('click', function() {
+      e.preventDefault();
+  });
+  $share_form.find('.set_share_key').on('click', function(e) {
       if ($share_form.find('input[name="share_key"]').val().length < 8) {
-          alert("{/literal}{'The key must be at least 8 characters long'|@translate|escape:javascript}{literal}");
+          alert('{'The key must be at least 8 characters long'|translate|escape:javascript}');
       }
       else {
@@ -77,22 +83,22 @@
           exitShareKeyEdit();
       }
-      return false;
-  });
-  $share_form.find('.cancel_share_key').on('click', function() {
+      e.preventDefault();
+  });
+  $share_form.find('.cancel_share_key').on('click', function(e) {
       $share_form.find('input[name="share_key"]').val($share_form.find('.url-more').text());
       exitShareKeyEdit();
-      return false;
+      e.preventDefault();
   });
   $share_form.find('.url-more').on('dblclick', function() {
       enterShareKeyEdit();
   });
-  
+
   // optional inputs
   $share_form.find('.share-option').each(function() {
-      $share_form.find('input[name="'+ $(this).data('for') +'"]').hideVis();
+      $share_form.find('input[name="'+ jQuery(this).data('for') +'"]').hideVis();
   }).on('change', function() {
-      $share_form.find('input[name="'+ $(this).data('for') +'"]').toggleVis($(this).is(':checked'));
-  });
-  
+      $share_form.find('input[name="'+ jQuery(this).data('for') +'"]').toggleVis($(this).is(':checked'));
+  });
+
   // datetime picker
   $share_form.find('input[name="share_deadline"]').datetimepicker({
@@ -100,90 +106,63 @@
       minDate: new Date()
   });
-  
-  
+
+
   // popup
-  jQuery(".share_colorbox_open").colorbox({
-    {/literal}{if isset($share.open)}open: true, transition:"none",{/if}{literal}
+  jQuery('.share_colorbox_open').colorbox({
+    {if isset($share.open)}open: true, transition:"none",{/if}
     inline:true
   });
-  jQuery(".share_colorbox_close").click(function() {
-    jQuery(".share_colorbox_open").colorbox.close();
-    return false;
-  });
-  jQuery("#share_form").css('background-color', bg_color);
-{/literal}
+  jQuery('.share_colorbox_close').click(function(e) {
+    jQuery('.share_colorbox_open').colorbox.close();
+    e.preventDefault();
+  });
+  jQuery('#share_form').css('background-color', bg_color);
 {/if}
 
 {if isset($U_MAIL)}
-{literal}
-  jQuery(".mail_colorbox_open").colorbox({
-    {/literal}{if isset($contact.open)}open: true, transition:"none",{/if}{literal}
+  jQuery('.mail_colorbox_open').colorbox({
+    {if isset($contact.open)}open: true, transition:"none",{/if}
     inline:true
   });
-  jQuery(".mail_colorbox_close").click(function() {
-    jQuery(".mail_colorbox_open").colorbox.close();
-    return false;
-  });
-  
-  
-  jQuery("#mail_form").css('background-color', bg_color);
-{/literal}
-{/if}
-
-{literal}
-jQuery("#edit_form_show").click(function() {
-  jQuery("#edit_form_show").hide();
-  jQuery(".additional_info").hide();
-  jQuery("#edit_form").show();
+  jQuery('.mail_colorbox_close').click(function(e) {
+    jQuery('.mail_colorbox_open').colorbox.close();
+    e.preventDefault();
+  });
+
+
+  jQuery('#mail_form').css('background-color', bg_color);
+{/if}
+
+jQuery('#edit_form_show').click(function() {
+  jQuery('#edit_form_show').hide();
+  jQuery('.additional_info').hide();
+  jQuery('#edit_form').show();
 });
-jQuery("#edit_form_hide").click(function() {
-  jQuery("#edit_form_show").show();
-  jQuery(".additional_info").show();
-  jQuery("#edit_form").hide();
+jQuery('#edit_form_hide').click(function() {
+  jQuery('#edit_form_show').show();
+  jQuery('.additional_info').show();
+  jQuery('#edit_form').hide();
 });
-{/literal}
 {/footer_script}
 
 
-{* <!-- Menubar & titrePage --> *}
-{if $themeconf.name == "stripped" or $themeconf.parent == "stripped"}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/stripped.tpl'}
-  {assign var="clear" value="true"}
-{elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/simple.tpl'}
-  {assign var="clear" value="true"}
-{else}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/default.tpl'}
-{/if}
-
-{if isset($errors) or not empty($infos)}
-{include file='infos_errors.tpl'}
-{/if}
-
-
 {if isset($collection)}
 
-{if !empty($CONTENT_DESCRIPTION)}
-<div class="additional_info">
-	{$CONTENT_DESCRIPTION}
-</div>
-{/if}
-
-<p style="text-align:center;"><input type="submit" id="edit_form_show" value="{'Edit'|@translate}"></p>
+<p style="text-align:center;"><input type="submit" id="edit_form_show" value="{'Edit'|translate}"></p>
 
 {* <!-- edit collection -->*}
 <form action="{$F_ACTION}" method="post" id="edit_form" style="display:none;">
 <fieldset id="colProperties">
-  <legend>{'Properties'|@translate}</legend>
-  
-  <p class="title"><label for="name">{'Name'|@translate}</label></p>
+  <legend>{'Edit'|translate}</legend>
+
+  <p class="title"><label for="name">{'Name'|translate}</label></p>
   <p><input type="text" name="name" id="name" value="{$collection.NAME|escape:html}" size="60"></p>
-  
-  <p class="title"><label for="comment">{'Description'|@translate}</label></p>
+
+  <p class="title"><label for="comment">{'Description'|translate}</label></p>
   <p><textarea name="comment" id="comment" style="width:400px;height:100px;">{$collection.COMMENT}</textarea></p>
 
   <p>
-    <input type="submit" name="save_col" value="{'Save'|@translate}">
-    <a id="edit_form_hide">{'Cancel'|@translate}</a>
+    <input type="submit" name="save_col" value="{'Save'|translate}">
+    <a id="edit_form_hide">{'Cancel'|translate}</a>
   </p>
 </fieldset>
@@ -195,5 +174,5 @@
   <form id="share_form" class="uc_form" action="{$F_ACTION}" method="post">
     {include file='infos_errors.tpl' errors=$share.errors infos=$share.infos}
-    
+
     <table>
       <tr>
@@ -201,25 +180,25 @@
           <span class="url-base">{$U_SHARE}</span><span class="url-more url-normal"></span>
           <input type="text" name="share_key" class="url-edit" size="20" value="{$share.share_key}">
-          <button class="url-normal edit_share_key">{'Edit'|@translate}</button>
-          <button class="url-edit set_share_key">{'OK'|@translate}</button>
-          <a href="#" class="url-edit cancel_share_key">{'Cancel'|@translate}</button>
+          <button class="url-normal edit_share_key">{'Edit'|translate}</button>
+          <button class="url-edit set_share_key">{'OK'|translate}</button>
+          <a href="#" class="url-edit cancel_share_key">{'Cancel'|translate}</button>
         </td>
       </tr>
       <tr>
         <td class="title"><label>
-          {'Password'|@translate}
+          {'Password'|translate}
           <input type="checkbox" name="use_share_password" data-for="share_password" class="share-option">
         </label></td>
         <td>
-          <input type="text" name="share_password" size="25" maxlength="25" value="{$share.password}" placeholder="{'Password'|@translate}">
+          <input type="text" name="share_password" size="25" maxlength="25" value="{$share.password}" placeholder="{'Password'|translate}">
         </td>
       </tr>
       <tr>
         <td class="title"><label>
-          {'Expiration date'|@translate}
+          {'Expiration date'|translate}
           <input type="checkbox" name="use_share_deadline" data-for="share_deadline" class="share-option">
         </label></td>
         <td>
-          <input type="text" name="share_deadline" size="25" value="{$share.deadline}" placeholder="{'Date'|@translate}">
+          <input type="text" name="share_deadline" size="25" value="{$share.deadline}" placeholder="{'Date'|translate}">
         </td>
       </tr>
@@ -227,18 +206,18 @@
         <td class="title">&nbsp;</td>
         <td>
-          <input class="submit" type="submit" name="add_share" value="{'Add'|@translate}">
-          <a class="share_colorbox_close" href="#">{'Cancel'|@translate}</a>
+          <input class="submit" type="submit" name="add_share" value="{'Add'|translate}">
+          <a class="share_colorbox_close" href="#">{'Cancel'|translate}</a>
           <input type="hidden" name="key" value="{$UC_TKEY}">
         </td>
       </tr>
     </table>
-    
+
   {if not empty($collection.SHARES)}
     <table class="shares_list">
       <tr class="header">
-        <th>{'Share key'|@translate}</th>
-        <th>{'Creation date'|@translate}</th>
-        <th>{'Password'|@translate}</th>
-        <th>{'Expiration date'|@translate}</th>
+        <th>{'Share key'|translate}</th>
+        <th>{'Creation date'|translate}</th>
+        <th>{'Password'|translate}</th>
+        <th>{'Expiration date'|translate}</th>
         <th></th>
       </tr>
@@ -247,7 +226,7 @@
         <td><a href="{$share.url}">{$share.share_key}</a></td>
         <td>{$share.add_date_readable}</td>
-        <td>{if $share.params.password}{'Yes'|@translate}{else}{'No'|@translate}{/if}</td>
-        <td>{if $share.params.deadline}{$share.params.deadline_readable}{else}{'No'|@translate}{/if}</td>
-        <td><a href="{$share.u_delete}" onClick="return confirm('{'Are you sure?'|@translate}');">
+        <td>{if $share.params.password}{'Yes'|translate}{else}{'No'|translate}{/if}</td>
+        <td>{if $share.params.deadline}{$share.params.deadline_readable}{else}{'No'|translate}{/if}</td>
+        <td><a href="{$share.u_delete}" onClick="return confirm('{'Are you sure?'|translate}');">
           <img src="{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/delete.png" width=16 height=16></a>
         </td>
@@ -268,5 +247,5 @@
     <table>
       <tr>
-        <td class="title"><label for="sender_name">{'Your name'|@translate}</label></td>
+        <td class="title"><label for="sender_name">{'Your name'|translate}</label></td>
         <td>
           <input type="text" name="sender_name" id="sender_name" size="40" value="{$contact.sender_name}">
@@ -274,5 +253,5 @@
       </tr>
       <tr>
-        <td class="title"><label for="sender_email">{'Your e-mail'|@translate}</label></td>
+        <td class="title"><label for="sender_email">{'Your e-mail'|translate}</label></td>
         <td>
           <input type="text" name="sender_email" id="sender_email" size="40" value="{$contact.sender_email}">
@@ -280,5 +259,5 @@
       </tr>
       <tr>
-        <td class="title"><label for="recipient_name">{'Recipient name'|@translate}</label></td>
+        <td class="title"><label for="recipient_name">{'Recipient name'|translate}</label></td>
         <td>
           <input type="text" name="recipient_name" id="recipient_name" size="40" value="{$contact.recipient_name}">
@@ -286,5 +265,5 @@
       </tr>
       <tr>
-        <td class="title"><label for="recipient_email">{'Recipient e-mail'|@translate}</label></td>
+        <td class="title"><label for="recipient_email">{'Recipient e-mail'|translate}</label></td>
         <td>
           <input type="text" name="recipient_email" id="recipient_email" size="40" value="{$contact.recipient_email}">
@@ -292,5 +271,5 @@
       </tr>
       <tr>
-        <td class="title"><label for="nb_images">{'Number of images'|@translate}</label></td>
+        <td class="title"><label for="nb_images">{'Number of images'|translate}</label></td>
         <td>
           <select name="nb_images">
@@ -302,5 +281,5 @@
       </tr>
       <tr>
-        <td class="title"><label for="message">{'Message (optional)'|@translate}</label></td>
+        <td class="title"><label for="message">{'Message (optional)'|translate}</label></td>
         <td><textarea name="message" id="message" rows="6" style="width:350px;">{$contact.message}</textarea></td>
       </tr>
@@ -308,6 +287,6 @@
         <td class="title">&nbsp;</td>
         <td>
-          <input class="submit" type="submit" name="send_mail" value="{'Send'|@translate}">
-          <a class="mail_colorbox_close" href="#">{'Cancel'|@translate}</a>
+          <input class="submit" type="submit" name="send_mail" value="{'Send'|translate}">
+          <a class="mail_colorbox_close" href="#">{'Cancel'|translate}</a>
           <input type="hidden" name="key" value="{$UC_TKEY}">
         </td>
@@ -318,19 +297,7 @@
 {/if}
 
-
-{* <!-- collection content -->*}
-{if $collection.NB_IMAGES > 0}
-<ul class="thumbnails" id="thumbnails">
-{$THUMBNAILS}
-</ul>
-{else}
-<p><i>{'This collection is empty'|@translate}</i></p>
-{/if}
-
-{if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
-
-{/if}
-
-{if isset($clear)}<div style="clear: both;"></div>
-</div>{/if}
-</div>{* <!-- content --> *}
+{if empty($THUMBNAILS)}
+<p><i>{'This collection is empty'|translate}</i></p>
+{/if}
+
+{/if}
Index: /extensions/UserCollections/template/collection_view.tpl
===================================================================
--- /extensions/UserCollections/template/collection_view.tpl	(revision 25677)
+++ /extensions/UserCollections/template/collection_view.tpl	(revision 25678)
@@ -1,30 +1,14 @@
 {combine_css path=$USER_COLLEC_PATH|cat:'template/style_collections.css'}
 {include file=$USER_COLLEC_ABS_PATH|cat:'template/thumbnails_colorbox.tpl'}
-
-
-{* <!-- Menubar & titrePage --> *}
-{if $themeconf.name == "stripped" or $themeconf.parent == "stripped"}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/stripped.tpl'}
-  {assign var="clear" value="true"}
-{elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/simple.tpl'}
-  {assign var="clear" value="true"}
-{else}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/default.tpl'}
-{/if}
-
-{if isset($errors) or not empty($infos)}
-{include file='infos_errors.tpl'}
-{/if}
 
 {if $UC_MODE == 'password'}
 <form action="{$F_LOGIN_ACTION}" method="post" name="login_form" class="properties">
   <fieldset>
-    <legend>{'Restricted access'|@translate}</legend>
+    <legend>{'Restricted access'|translate}</legend>
 
     <ul>
       <li>
         <span class="property">
-          <label for="uc_password">{'Password'|@translate}</label>
+          <label for="uc_password">{'Password'|translate}</label>
         </span>
         <input tabindex="1" class="login" type="password" name="uc_password" id="uc_password" size="25" maxlength="25">
@@ -34,29 +18,8 @@
 
   <p>
-    <input tabindex="2" type="submit" value="{'Submit'|@translate}">
+    <input tabindex="2" type="submit" value="{'Submit'|translate}">
   </p>
 </form>
 
-<script type="text/javascript"><!--
-document.login_form.username.focus();
-//--></script>
-
-{else}
-{if !empty($CONTENT_DESCRIPTION)}
-<div class="additional_info">
-	{$CONTENT_DESCRIPTION}
-</div>
+<script>document.login_form.username.focus();</script>
 {/if}
-
-{if !empty($THUMBNAILS)}
-<ul class="thumbnails" id="thumbnails">
-{$THUMBNAILS}
-</ul>
-{/if}
-
-{if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
-{/if}
-
-{if isset($clear)}<div style="clear: both;"></div>
-</div>{/if}
-</div>{* <!-- content --> *}
Index: /extensions/UserCollections/template/collections_list.tpl
===================================================================
--- /extensions/UserCollections/template/collections_list.tpl	(revision 25677)
+++ /extensions/UserCollections/template/collections_list.tpl	(revision 25678)
@@ -2,42 +2,22 @@
 
 {footer_script require='jquery'}
-jQuery(".new_col").click(function() {ldelim}
-  var name = prompt("{'Collection name:'|@translate}");
-  if (name != null) {ldelim}
-    $(this).attr("href",  $(this).attr("href") +"&name="+ name);
+jQuery('.new_col').click(function() {
+  var name = prompt('{'Collection name:'|translate|escape:javascript}');
+  if (name != null) {
+    jQuery(this).attr('href',  jQuery(this).attr('href') +'&name='+ name);
     return true;
-  } else {ldelim}
+  }
+  else {
     return false;
   }
 });
 
-jQuery(".titrePage h2").append(" [{$COLLECTIONS_COUNT}]");
+jQuery('.titrePage h2').append(' [{$COLLECTIONS_COUNT}]');
 {/footer_script}
 
-{* <!-- Menubar & titrePage --> *}
-{if $themeconf.name == "stripped" or $themeconf.parent == "stripped"}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/stripped.tpl'}
-  {assign var="clear" value="true"}
-{elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/simple.tpl'}
-  {assign var="clear" value="true"}
-{else}
-  {include file=$USER_COLLEC_ABS_PATH|@cat:'template/themes/default.tpl'}
+
+<p style="text-align:left;font-weight:bold;margin:20px;"><a href="{$U_CREATE}" class="new_col">{'Create a new collection'|translate}</a></p>
+
+{if empty($CATEGORIES)}
+{'You have no collection'|translate}
 {/if}
-
-{if isset($errors) or not empty($infos)}
-{include file='infos_errors.tpl'}
-{/if}
-
-
-<p style="text-align:left;font-weight:bold;margin:20px;"><a href="{$U_CREATE}" class="new_col">{'Create a new collection'|@translate}</a></p>
-
-{if !empty($CATEGORIES)}
-{$CATEGORIES}
-{else}
-{'You have no collection'|@translate}
-{/if}
-
-{if isset($clear)}<div style="clear: both;"></div>
-</div>{/if}
-</div>{* <!-- content --> *}
Index: /extensions/UserCollections/template/index.php
===================================================================
--- /extensions/UserCollections/template/index.php	(revision 25677)
+++ /extensions/UserCollections/template/index.php	(revision 25678)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2012 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 );
@@ -28,3 +5,2 @@
 header( 'Location: '.$url );
 exit();
-?>
Index: tensions/UserCollections/template/mail.css
===================================================================
--- /extensions/UserCollections/template/mail.css	(revision 25677)
+++ 	(revision )
@@ -1,80 +1,0 @@
-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 {
-  min-width:600px;
-  max-width:800px;
-  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:2px solid #CE2E5A;
-  font-size:10px;
-  padding:5px;
-}
-
-#the_image {
-  text-align:center;
-}
-  #the_image a {
-    position:relative;
-    display:inline-block;
-    border:10px solid #444;
-  }
-  #the_image span {
-    display:block;
-    width:100%;
-    position:absolute;
-    bottom:-10px;
-    left:0;
-    text-align:center;
-    background:#444;
-  }
-  #the_image img {
-    max-width:150px;
-    border:none;
-  }
-
-.button {
-  margin-top:25px;
-  text-align:center;
-}
-
-.button  a {
-  padding:8px 15px;
-  background:#A80D24;
-  color:#bbb;
-  border:1px solid #CE2E5A;
-  text-decoration:none;
-  font-size:14px;
-  font-weight:bold;
-}
Index: tensions/UserCollections/template/mail.tpl
===================================================================
--- /extensions/UserCollections/template/mail.tpl	(revision 25677)
+++ 	(revision )
@@ -1,62 +1,0 @@
-<!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}">
-  
-  {math assign=tn_width equation="min(x,150)"  x=$derivative_params->max_width()}
-  <style type="text/css">{strip}<!--
-  {$UC_MAIL_CSS}
-  #the_image a {ldelim}
-    width:{$tn_width}px;
-    height:{$tn_width}px;
-  }
-  #the_page {ldelim}
-    width:{math equation="x*4+120" x=$tn_width}px;
-  }
-  -->{/strip}</style>
-</head>
-
-<body>
-<div id="the_page">
-
-<div id="the_header">
-<b>{$MAIL_TITLE}</b>
-</div>
-
-<div id="the_content">
-
-<p>
-  {'Hello <b>%s</b>, %s sent you a photos collection from <a href="%s">%s</a>'|@translate|sprintf:$PARAMS.recipient_name:$PARAMS.sender_name:$GALLERY_URL:$GALLERY_TITLE}
-</p>
-
-<p id="the_image">
-{foreach from=$thumbnails item=element}
-  <a href="{$element.URL}">
-    <span>{$element.NAME|truncate:25:"..."}</span>
-    <img src="{$element.THUMB}" alt="{$element.TN_ALT}">
-  </a>
-{/foreach}
-</p>
-
-{if $PARAMS.message}
-<p>
-  <blockquote>{$PARAMS.message}</blockquote>
-</p>
-{/if}
-
-<p class="button">
-  <a href="{$COL_URL}">{'Click here to view the complete collection'|@translate}</a>
-</p>
-
-</div>
-
-<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}
-  - User Collections
-</div>
-
-</div>
-</body>
-</html>
Index: /extensions/UserCollections/template/menublock.tpl
===================================================================
--- /extensions/UserCollections/template/menublock.tpl	(revision 25677)
+++ /extensions/UserCollections/template/menublock.tpl	(revision 25678)
@@ -3,5 +3,5 @@
   <p>{strip}
     {if $block->data.NB_COL == 0}
-      {'You have no collection'|@translate}
+      {'You have no collection'|translate}
     {else}
       <a href="{$block->data.U_LIST}">{$pwg->l10n_dec('You have %d collection', 'You have %d collections', $block->data.NB_COL)}</a>
@@ -12,9 +12,9 @@
 		{foreach from=$block->data.collections item=col}{strip}
 		<li>
-      <a href="{$col.u_edit}">{$col.name}</a>&nbsp; 
+      <a href="{$col.u_edit}">{$col.name}</a>&nbsp;
       <span class="menuInfoCat">[<span class="nbImagesCollec-{$col.id}">{$col.nb_images}</span>]</span>
     </li>
 		{/strip}{/foreach}
-    {if isset($block->data.MORE)}<li class="menuInfoCat"><a href="{$block->data.U_LIST}">{'%d more...'|@translate|sprintf:$block->data.MORE}</a></li>{/if}
+    {if isset($block->data.MORE)}<li class="menuInfoCat"><a href="{$block->data.U_LIST}">{'%d more...'|translate:$block->data.MORE}</a></li>{/if}
 	</ul>
   {/if}
Index: /extensions/UserCollections/template/picture_button.tpl
===================================================================
--- /extensions/UserCollections/template/picture_button.tpl	(revision 25677)
+++ /extensions/UserCollections/template/picture_button.tpl	(revision 25678)
@@ -1,6 +1,6 @@
 {include file=$USER_COLLEC_ABS_PATH|cat:'template/thumbnails_css_js.tpl'}
 
-{footer_script require='jquery'}{literal}
-jQuery().ready(function() {
+{footer_script require='jquery'}
+jQuery(function() {
   jQuery("#collectionsLink").click(function() {
 	  var elt = jQuery("#collectionsDropdown");
@@ -17,8 +17,8 @@
   });
 });
-{/literal}{/footer_script}
+{/footer_script}
 
-<a id="collectionsLink" title="{'Add to collection'|@translate}" class="pwg-state-default pwg-button addCollection" rel="nofollow" data-id="{$current.id}" data-cols="[{$CURRENT_COLLECTIONS}]">
+<a id="collectionsLink" title="{'Add to collection'|translate}" class="pwg-state-default pwg-button addCollection" rel="nofollow" data-id="{$current.id}" data-cols="[{$CURRENT_COLLECTIONS}]">
   <span class="pwg-icon" style="background:url('{$ROOT_URL}{$USER_COLLEC_PATH}template/resources/image_add.png') center center no-repeat;"></span>
-  <span class="pwg-button-text">{'Add to collection'|@translate}</span>
+  <span class="pwg-button-text">{'Add to collection'|translate}</span>
 </a>
Index: /extensions/UserCollections/template/resources/index.php
===================================================================
--- /extensions/UserCollections/template/resources/index.php	(revision 25677)
+++ /extensions/UserCollections/template/resources/index.php	(revision 25678)
@@ -1,26 +1,3 @@
 <?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery                                    |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2012 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 );
@@ -28,3 +5,2 @@
 header( 'Location: '.$url );
 exit();
-?>
Index: /extensions/UserCollections/template/style_collections.css
===================================================================
--- /extensions/UserCollections/template/style_collections.css	(revision 25677)
+++ /extensions/UserCollections/template/style_collections.css	(revision 25678)
@@ -10,5 +10,5 @@
     margin-bottom:10px;
   }
-  
+
 #publicURL {
   display:inline-block;
@@ -77,5 +77,5 @@
     padding:3px;
   }
-  
+
 #share_form .url-base {
   font-size:0.9em;
@@ -104,5 +104,5 @@
   border-bottom:1px solid #111;
 }
-  
+
 .shares_list tr.row2 td { background-color:#222; }
 .shares_list tr.row1 td { background-color:#333; }
Index: /extensions/UserCollections/template/text/html/mail.tpl
===================================================================
--- /extensions/UserCollections/template/text/html/mail.tpl	(revision 25678)
+++ /extensions/UserCollections/template/text/html/mail.tpl	(revision 25678)
@@ -0,0 +1,55 @@
+{math assign=tn_width equation="min(x,150)"  x=$derivative_params->max_width()}
+<style type="text/css">{strip}
+#contentTable {
+  width:{math equation="x*4+200" x=$tn_width}px;
+}
+
+#the_image {
+  text-align:center;
+  margin:1em 0;
+}
+  #the_image a {
+    border:none;
+  }
+  #the_image img {
+    width:{$tn_width}px;
+    height:{$tn_width}px;
+  }
+
+#button {
+  margin-top:2em;
+  text-align:center;
+}
+
+#button  a {
+  padding:8px 15px;
+  background:#A80D24;
+  color:#fff;
+  border:1px solid #CE2E5A;
+  text-decoration:none;
+  font-size:14px;
+  font-weight:bold;
+}
+{/strip}</style>
+
+<p>
+  {'Hello <b>%s</b>, %s sent you a photos collection from <a href="%s">%s</a>'|translate:$PARAMS.recipient_name:$PARAMS.sender_name:$GALLERY_URL:$GALLERY_TITLE}
+</p>
+
+{if isset($THUMBNAILS)}
+<p id="the_image">
+{foreach from=$THUMBNAILS item=element}
+  <a href="{$element.URL}" title="{$element.NAME|escape:html}">
+    <img src="{$element.THUMB}" alt="{$element.TN_ALT|escape:html}" class="photo">
+  </a>
+{/foreach}
+</p>
+{/if}
+
+{if $PARAMS.message}
+<blockquote>{$PARAMS.message}</blockquote>
+{/if}
+
+<p id="button">
+  <a href="{$COL_URL}">{'Click here to view the complete collection'|translate}</a>
+</p>
Index: /extensions/UserCollections/template/text/plain/mail.tpl
===================================================================
--- /extensions/UserCollections/template/text/plain/mail.tpl	(revision 25678)
+++ /extensions/UserCollections/template/text/plain/mail.tpl	(revision 25678)
@@ -0,0 +1,9 @@
+{'Hello %s, %s sent you a photos collection from "%s"'|translate:$PARAMS.recipient_name:$PARAMS.sender_name:$GALLERY_TITLE}
+
+{if $PARAMS.message}
+----
+{$PARAMS.message}
+----
+{/if}
+
+{'Click here to view the complete collection'|translate} : {$COL_URL}
Index: /extensions/UserCollections/template/thumbnails_colorbox.tpl
===================================================================
--- /extensions/UserCollections/template/thumbnails_colorbox.tpl	(revision 25677)
+++ /extensions/UserCollections/template/thumbnails_colorbox.tpl	(revision 25678)
@@ -1,21 +1,21 @@
-{if not isset($UC_NO_LIGHTBOX)}
 {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
-{combine_css path='themes/default/js/plugins/colorbox/style2/colorbox.css'}
-{/if}
+{combine_css id='colorbox' path='themes/default/js/plugins/colorbox/style2/colorbox.css'}
 
-{footer_script}
-jQuery("a.preview-box").colorbox({ldelim}
-  rel: ".preview-box",
-  href: function() {ldelim} return $(this).data('src'); },
-  title: function() {ldelim}
-    var title = $(this).children("img.thumbnail").attr("alt");
-    {if $F_ACTION} title+= ' · <a class="addCollection" data-id="'+ $(this).data('id') +'" rel="nofollow">{'Remove from collection'|@translate|escape:javascript}</a>';{/if}
-    title+= ' · <a href="'+ $(this).attr('href') +'" target="_blank">{'jump to photo'|@translate|escape:javascript} →</a>';
+{footer_script require='jquery'}
+jQuery('a.preview-box').colorbox({
+  rel: '.preview-box',
+  href: function() {
+    return jQuery(this).data('src');
+  },
+  title: function() {
+    var title = jQuery(this).children('img.thumbnail').attr("alt");
+    {if $F_ACTION} title+= ' · <a class="addCollection" data-id="'+ jQuery(this).data('id') +'" rel="nofollow">{'Remove from collection'|translate|escape:javascript}</a>';{/if}
+    title+= ' · <a href="'+ jQuery(this).attr('href') +'" target="_blank">{'jump to photo'|translate|escape:javascript} →</a>';
     return  title;
   }
 });
-jQuery(document).on("click", "#cboxTitle .addCollection", function() {ldelim}
+jQuery(document).on('click', '#cboxTitle .addCollection', function() {
   jQuery.colorbox.close();
-  jQuery("#thumbnails a.addCollection[data-id='"+ $(this).data('id')+"']").trigger("click");
+  jQuery('#thumbnails a.addCollection[data-id="'+ jQuery(this).data('id') +'"]').trigger('click');
   return false;
 });
Index: /extensions/UserCollections/template/thumbnails_css_js.tpl
===================================================================
--- /extensions/UserCollections/template/thumbnails_css_js.tpl	(revision 25677)
+++ /extensions/UserCollections/template/thumbnails_css_js.tpl	(revision 25678)
@@ -4,8 +4,8 @@
 {if not $UC_IN_EDIT}
 {footer_script require='jquery'}
-var $cdm = jQuery("#collectionsDropdown");
+var $cdm = jQuery('#collectionsDropdown');
 
 {if not $IN_PICTURE}
-$cdm.on("mouseleave", function() {ldelim}
+$cdm.on('mouseleave', function() {
   $cdm.hide();
 });
@@ -13,153 +13,157 @@
 
 // click on "create collection" button
-$cdm.find("a.new").on("click", function(event) {ldelim}
+$cdm.find('a.new').on('click', function(e) {
   jQuery(this).hide().next().show().focus();
-  event.stopPropagation();
-  return false;
+  e.stopPropagation();
+  e.preventDefault();
 });
 
 // events on "new collection" input
-$cdm.find("input.new").on({ldelim}
+$cdm.find('input.new').on({
   // ENTER or ESC pressed
-  "keyup": function(event) {ldelim}
-    if (event.which == 27) {ldelim}
+  keyup: function(e) {
+    if (e.which == 27) {
       jQuery(this).val('').hide().prev().show();
       return;
     }
-    
-    if (event.which != 13) return;
-    
+
+    if (e.which != 13) {
+      return;
+    }
+
     jQuery(this).hide().prev().show();
     var name = jQuery(this).val();
     jQuery(this).val('');
-    
-    if (name == "" || name == null) return;
-    
-    jQuery.ajax({ldelim}
-      type: "GET",
-      dataType: "json",
-      url: "{$ROOT_URL}ws.php",
-      data: {ldelim}
-        format: "json",
-        method: "pwg.collections.create",
+
+    if (name == '' || name == null) {
+      return;
+    }
+
+    jQuery.ajax({
+      type: 'GET',
+      dataType: 'json',
+      url: '{$ROOT_URL}ws.php',
+      data: {
+        format: 'json',
+        method: 'pwg.collections.create',
         name: name,
       },
-      success: function(data) {ldelim}
-        if (data.stat == 'ok') {ldelim}
+      success: function(data) {
+        if (data.stat == 'ok') {
           var col = data.result;
           var html = '<span>&#9733;</span> <a class="add" data-id="'+ col.id +'">'+ col.name +'</a> '
             +'<span class="menuInfoCat">[<span class="nbImagesCollec-'+ col.id +'">'+ col.nb_images +'</span>]</span> '
-            +'<a class="remove" data-id="'+ col.id +'">{'(remove)'|@translate}</a>'
+            +'<a class="remove" data-id="'+ col.id +'">{'(remove)'|translate|escape:javscript}</a>'
             +'<br>';
-          
-          $cdm.children(".switchBoxFooter").before(html);
-          $cdm.children(".noCollecMsg").remove();
-        }
-        else {ldelim}
+
+          $cdm.children('.switchBoxFooter').before(html);
+          $cdm.children('.noCollecMsg').remove();
+        }
+        else {
           alert(data.message);
         }
       },
-      error: function() {ldelim}
-        alert("{'An unknown error occured'|@translate}");
+      error: function() {
+        alert('{'An unknown error occured'|translate|escape:javascript}');
       }
     });
-    
-    return false;
   },
   // prevent click propagation
-  "click": function(event) {ldelim}
-    event.stopPropagation();
+  click: function(e) {
+    e.stopPropagation();
   }
 });
 
 // add and remove links (delegate for new collections)
-$cdm.on("click", ".add, .remove", function() {ldelim}
-  var img_id = $cdm.data("img_id");
-  var col_id = jQuery(this).data("id");
-  var method = jQuery(this).hasClass("add") ? "pwg.collections.addImages" : "pwg.collections.removeImages";
-  
-  jQuery.ajax({ldelim}
-    type: "GET",
-    dataType: "json",
-    url: "{$ROOT_URL}ws.php",
-    data: {ldelim}
-      format: "json",
+$cdm.on('click', '.add, .remove', function(e) {
+  var img_id = $cdm.data('img_id');
+  var col_id = jQuery(this).data('id');
+  var method = jQuery(this).hasClass('add') ? 'pwg.collections.addImages' : 'pwg.collections.removeImages';
+
+  jQuery.ajax({
+    type: 'GET',
+    dataType: 'json',
+    url: '{$ROOT_URL}ws.php',
+    data: {
+      format: 'json',
       method: method,
       col_id: col_id,
       image_ids: img_id
     },
-    success: function(data) {ldelim}
-      if (data.stat == 'ok') {ldelim}
+    success: function(data) {
+      if (data.stat == 'ok') {
         // update col counters
-        jQuery(".nbImagesCollec-"+col_id).html(data.result.nb_images);
-        
+        jQuery('.nbImagesCollec-'+ col_id).html(data.result.nb_images);
+
         // update item datas
-        var $target = jQuery(".addCollection[data-id='"+ img_id +"']");
-        var col_ids = $target.data("cols");
-        if (method == "pwg.collections.addImages" && col_ids.indexOf(col_id) == -1)
+        var $target = jQuery('.addCollection[data-id="'+ img_id +'"]');
+        var col_ids = $target.data('cols');
+        if (method == 'pwg.collections.addImages' && col_ids.indexOf(col_id) == -1) {
           col_ids[ col_ids.length ] = col_id;
-        else if (method == "pwg.collections.removeImages")
+        }
+        else if (method == 'pwg.collections.removeImages') {
           col_ids.splice(col_ids.indexOf(col_id), 1);
-        $target.data("col", col_ids);
-      }
-      else {ldelim}
+        }
+        $target.data('col', col_ids);
+      }
+      else {
         alert(data.message);
       }
     },
-    error: function() {ldelim}
-      alert("{'An unknown error occured'|@translate}");
-    }
-  });
-  
+    error: function() {
+      alert('{'An unknown error occured'|translate|escape:javascript}');
+    }
+  });
+
   $cdm.hide();
-  return false;
+  e.preventDefault();
 });
 
 // main button, open the menu
-jQuery(".addCollection").on("click", function(event) {ldelim}
-  var img_id = jQuery(this).data("id");
-  var col_ids = jQuery(this).data("cols");
-  
-  $cdm.data("img_id", img_id);
-  
-  $cdm.children(".add").each(function() {ldelim}   
-    if (col_ids.indexOf($(this).data("id")) != -1) {ldelim}
-      $(this).css("font-weight", "bold").next().next().show();
-    }
-    else {ldelim}
-      $(this).css("font-weight", "normal").next().next().hide();
-    }
-  });
-  
+jQuery('.addCollection').on('click', function(e) {
+  var img_id = jQuery(this).data('id');
+  var col_ids = jQuery(this).data('cols');
+
+  $cdm.data('img_id', img_id);
+
+  $cdm.children('.add').each(function() {
+    if (col_ids.indexOf($(this).data('id')) != -1) {
+      $(this).css('font-weight', 'bold').next().next().show();
+    }
+    else {
+      $(this).css('font-weight', 'normal').next().next().hide();
+    }
+  });
+
   {if not $IN_PICTURE}
-  $cdm.css({ldelim}
-    "top": event.pageY-5-$(window).scrollTop(),
-    "left": Math.min(event.pageX-jQuery(window).scrollLeft()-20, jQuery(window).width()-$cdm.outerWidth(true)-5) 
+  $cdm.css({
+    'top': e.pageY-5-$(window).scrollTop(),
+    'left': Math.min(e.pageX-jQuery(window).scrollLeft()-20, jQuery(window).width()-$cdm.outerWidth(true)-5)
   });
   $cdm.show();
   {/if}
-  
-  return false;
+
+  e.preventDefault();
 });
 
 // try to respect theme colors
-$cdm.children(".switchBoxFooter").css("border-top-color", $cdm.children(".switchBoxTitle").css("border-bottom-color"));
+$cdm.children('.switchBoxFooter').css('border-top-color', $cdm.children('.switchBoxTitle').css('border-bottom-color'));
 {/footer_script}
 
 <div id="collectionsDropdown" class="switchBox">
-  <div class="switchBoxTitle">{'Collections'|@translate}</div>
-  
+  <div class="switchBoxTitle">{'Collections'|translate}</div>
+
   {foreach from=$COLLECTIONS item=col}
     <span>&#9733;</span> <a class="add" data-id="{$col.id}">{$col.name}</a>
     <span class="menuInfoCat">[<span class="nbImagesCollec-{$col.id}">{$col.nb_images}</span>]</span>
-    <a class="remove" data-id="{$col.id}">{'(remove)'|@translate}</a>
+    <a class="remove" data-id="{$col.id}">{'(remove)'|translate}</a>
     <br>
   {foreachelse}
-    <span class="noCollecMsg">{'You have no collection'|@translate}</span>
+    <span class="noCollecMsg">{'You have no collection'|translate}</span>
   {/foreach}
-  
+
   <div class="switchBoxFooter">
-  <span>&#10010;</span> <a class="new">{'Create a new collection'|@translate}</a>
-  <input type="text" class="new" placeholder="{'Name'|@translate}" size="25"/>
+  <span>&#10010;</span> <a class="new">{'Create a new collection'|translate}</a>
+  <input type="text" class="new" placeholder="{'Name'|translate}" size="25"/>
   </div>
 </div>
@@ -168,41 +172,44 @@
 {else}
 {footer_script require='jquery'}
-jQuery(".addCollection").on("click", function(event) {ldelim}
+jQuery('.addCollection').on('click', function(e) {
   var $trigger = jQuery(this);
-  var img_id = jQuery(this).data("id");
+  var img_id = jQuery(this).data('id');
   var col_id = {$collection.ID};
-  
-  jQuery.ajax({ldelim}
-    type: "GET",
-    dataType: "json",
-    url: "{$ROOT_URL}ws.php",
-    data: {ldelim}
-      format: "json",
-      method: "pwg.collections.removeImages",
+
+  jQuery.ajax({
+    type: 'GET',
+    dataType: 'json',
+    url: '{$ROOT_URL}ws.php',
+    data: {
+      format: 'json',
+      method: 'pwg.collections.removeImages',
       col_id: col_id,
       image_ids: img_id
     },
-    success: function(data) {ldelim}
-      if (data.stat == 'ok') {ldelim}
-        $trigger.parent("li").hide("fast", function() {ldelim}
+    success: function(data) {
+      if (data.stat == 'ok') {
+        $trigger.parent('li').hide('fast', function() {
           jQuery(this).remove();
-          if (typeof GThumb != "undefined") GThumb.build();
+          if (typeof GThumb != 'undefined') {
+            GThumb.build();
+          }
         });
-        
-        jQuery(".nbImagesCollec-"+col_id).html(data.result.nb_images);
-        if (typeof batchdown_count != 'undefined') batchdown_count = data.result.nb_images;
-      }
-      else {ldelim}
+
+        jQuery('.nbImagesCollec-'+ col_id).html(data.result.nb_images);
+        if (typeof batchdown_count != 'undefined') {
+          batchdown_count = data.result.nb_images;
+        }
+      }
+      else {
         alert(data.message);
       }
     },
-    error: function() {ldelim}
-      alert("{'An unknown error occured'|@translate}");
-    }
-  });
-  
-  event.stopPropagation();
-  event.preventDefault();
-  return false;
+    error: function() {
+      alert('{'An unknown error occured'|translate|escape:javascript}');
+    }
+  });
+
+  e.stopPropagation();
+  e.preventDefault();
 });
 {/footer_script}
