Index: /extensions/pbase2piwigo/admin.php
===================================================================
--- /extensions/pbase2piwigo/admin.php	(revision 26200)
+++ /extensions/pbase2piwigo/admin.php	(revision 26201)
@@ -1,8 +1,7 @@
 <?php
-if (!defined('PBASE_PATH')) die('Hacking attempt!');
+defined('PBASE_PATH') or die('Hacking attempt!');
 
 global $template, $page, $conf;
 
-// $conf['pbase2piwigo'] = unserialize($conf['pbase2piwigo']);
 load_language('plugin.lang', PBASE_PATH);
 
@@ -21,5 +20,4 @@
   'PBASE_ADMIN' => PBASE_ADMIN,
   ));
+
 $template->assign_var_from_handle('ADMIN_CONTENT', 'pbase2piwigo');
-
-?>
Index: /extensions/pbase2piwigo/admin/import.php
===================================================================
--- /extensions/pbase2piwigo/admin/import.php	(revision 26200)
+++ /extensions/pbase2piwigo/admin/import.php	(revision 26201)
@@ -1,4 +1,4 @@
 <?php
-if (!defined('PBASE_PATH')) die('Hacking attempt!');
+defined('PBASE_PATH') or die('Hacking attempt!');
 
 include_once(PBASE_PATH.'include/functions.inc.php');
@@ -6,7 +6,7 @@
 $step = null;
 
-if (test_remote_download() === false)
+if (!test_remote_download())
 {
-  array_push($page['errors'], l10n('No download method available. PBase2piwigo needs cURL extension or allow_url_fopen=true'));
+  $page['errors'][] = l10n('No download method available. PBase2piwigo needs cURL extension or allow_url_fopen=true');
 }
 else
@@ -52,5 +52,5 @@
     if (isset($_SESSION['pbase_empty_error']))
     {
-      array_push($page['errors'], l10n('Import queue is empty'));
+      $page['errors'][] = l10n('Import queue is empty');
       unset($_SESSION['pbase_empty_error']);
     }
@@ -132,5 +132,3 @@
 $template->assign('STEP', $_GET['action']);
 
-$template->set_filename('pbase2piwigo', dirname(__FILE__) . '/template/import.tpl');
-
-?>
+$template->set_filename('pbase2piwigo', realpath(PBASE_PATH . 'admin/template/import.tpl'));
Index: /extensions/pbase2piwigo/admin/template/import.analyze.tpl
===================================================================
--- /extensions/pbase2piwigo/admin/template/import.analyze.tpl	(revision 26200)
+++ /extensions/pbase2piwigo/admin/template/import.analyze.tpl	(revision 26201)
@@ -1,68 +1,71 @@
 {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
-{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
-{combine_css path="admin/themes/default/uploadify.jGrowl.css"}
+{combine_script id='jquery.jgrowl' load='footer' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
+{combine_css path="themes/default/js/plugins/jquery.jGrowl.css"}
 
 {footer_script require='jquery.ajaxmanager,jquery.jgrowl'}
-var errorHead   = '{'ERROR'|@translate|@escape:'javascript'}';
-var errorMsg    = '{'an error happened'|@translate|@escape:'javascript'}';
-var successHead = '{'Success'|@translate|@escape:'javascript'}';
+(function($){
+  var queue_lenght = 0;
 
-{literal}
-var queue_lenght = 0;
+  var queuedManager = $.manageAjax.create('queued', {
+    queue: true,  
+    maxRequests: 1
+  });
 
-var queuedManager = jQuery.manageAjax.create('queued', {
-  queue: true,  
-  maxRequests: 1
-});
+  function add_cat_to_parse_queue(url, path) {
+    queuedManager.add({
+      type: 'POST',
+      dataType: 'json',
+      url: 'ws.php?format=json',
+      data: { method: 'pwg.pBase.parse', url: url, path: path },
+      success: function(data) {
+        if (data['stat'] == 'ok') {
+          cats = data['result']['categories'];
+          for (i in cats) {
+            queue_lenght++;
+            add_cat_to_parse_queue(cats[i]['url'], cats[i]['path']);
+          }
+          $('#preview').html($('#preview').html()+data['result']['path']+"\n");
+        }
+        else {
+          $.jGrowl(data['message'], {
+            theme: 'error', sticky: true,
+            header: '{'ERROR'|translate}'
+          });
+          $('.loading').toggle();
+        }
+        
+        queue_lenght--; 
+        if (data['stat'] == 'ok' && queue_lenght == 0) {
+          window.location.reload();
+        }
+      },
+      error: function () {
+        $.jGrowl('{'an error happened'|translate|escape:javascript}', {
+          theme: 'error', sticky: true,
+          header: '{'ERROR'|translate}'
+        });
+        $('.loading').toggle();
+      }
+    });
+  }
 
-function add_cat_to_parse_queue(url, path) {
-  queuedManager.add({
-    type: 'POST',
-    dataType: 'json',
-    url: 'ws.php?format=json',
-    data: { method: 'pwg.pBase.parse', url: url, path: path },
-    success: function(data) {
-      if (data['stat'] == 'ok') {
-        cats = data['result']['categories'];
-        for (i in cats) {
-          queue_lenght++;
-          add_cat_to_parse_queue(cats[i]['url'], cats[i]['path']);
-        }
-        $('#preview').html($('#preview').html()+data['result']['path']+"\n");
-      } else {
-        jQuery.jGrowl(data['message'], { theme: 'error', header: errorHead, sticky: true });
-        jQuery('.loading').toggle();
-      }
-      
-      queue_lenght--; 
-      if (data['stat'] == 'ok' && queue_lenght == 0) {
-        window.location.reload();
-      }
-    },
-    error: function () {
-      jQuery.jGrowl(errorMsg, { theme: 'error', header: errorHead, sticky: true });
-      jQuery('.loading').toggle();
+  $('#begin_analyse').click(function() {
+    login = $('#pbase_login').val();
+    
+    if (login != '') {
+      queue_lenght++;
+      add_cat_to_parse_queue('http://www.pbase.com/'+ login +'/root', '/root');
+      $('.loading').toggle();
     }
+    return false;
   });
-}
-{/literal}
-
-jQuery('#begin_analyse').click(function() {ldelim}
-  login = $('#pbase_login').val();
-  
-  if (login != '') {ldelim}
-    queue_lenght++;
-    add_cat_to_parse_queue('http://www.pbase.com/'+ login +'/root', '/root');
-    jQuery('.loading').toggle();
-  }
-  return false;
-});
+}(jQuery));
 {/footer_script}
 
 
 <form action="{$PBASE_ADMIN}-import" method="post">
-<p><label>{'PBase login'|@translate} <input type="text" id="pbase_login"></label></p>
-<p class="loading"><input type="submit" id="begin_analyse" value="{'Begin analyse'|@translate}"></p>
-<p class="loading" style="display:none;"><img src="{$PBASE_PATH}admin/template/loader-{$themeconf.name}.gif"></p>
+  <p><label>{'PBase login'|translate} <input type="text" id="pbase_login"></label></p>
+  <p class="loading"><input type="submit" id="begin_analyse" value="{'Begin analyse'|translate}"></p>
+  <p class="loading" style="display:none;"><img src="{$PBASE_PATH}admin/template/loader-{$themeconf.name}.gif"></p>
 </form>
 
Index: /extensions/pbase2piwigo/admin/template/import.config.tpl
===================================================================
--- /extensions/pbase2piwigo/admin/template/import.config.tpl	(revision 26200)
+++ /extensions/pbase2piwigo/admin/template/import.config.tpl	(revision 26201)
@@ -2,5 +2,5 @@
 {include file='include/add_album.inc.tpl'}
 
-{footer_script require='jquery.ui.resizable'}{literal}
+{footer_script require='jquery.ui.resizable'}
 jQuery(".categoryList").resizable({
   handles: "s,e,se",
@@ -9,9 +9,9 @@
   ghost: true
 });
-{/literal}{/footer_script}
+{/footer_script}
 
 <form action="{$F_ACTION}" method="post">
 <fieldset>
-  <legend>{'Select albums to import'|@translate}</legend>
+  <legend>{'Select albums to import'|translate}</legend>
   
   <select name="categories[]" class="categoryList" multiple="multiple" size="20">
@@ -19,37 +19,37 @@
   </select>
   
-  <b>{'Nb albums'|@translate}</b>: {$nb_categories}<br>
-  <b>{'Nb photos'|@translate}</b>: {$nb_pictures}<br>
+  <b>{'Nb albums'|translate}</b>: {$nb_categories}<br>
+  <b>{'Nb photos'|translate}</b>: {$nb_pictures}<br>
   
   <br>
-  <a href="{$RESET_LINK}" onClick="return confirm('{'Are you sure?'|@translate}');">{'Reset'|@translate}</a>
+  <a href="{$RESET_LINK}" onClick="return confirm('{'Are you sure?'|translate}');">{'Reset'|translate}</a>
 </fieldset>
 
 <fieldset>
-  <legend>{'Configuration'|@translate}</legend>
+  <legend>{'Configuration'|translate}</legend>
   
-  <p><label><input type="checkbox" name="recursive" value="1" checked="checked"> <b>{'Recursive'|@translate}</b></label></p>
+  <p><label><input type="checkbox" name="recursive" value="1" checked="checked"> <b>{'Recursive'|translate}</b></label></p>
   
   <p id="albumSelectWrapper">
-    <b>{'Import in this album'|@translate}:</b>
+    <b>{'Import in this album'|translate}:</b>
     <select style="width:400px" name="parent_category" id="albumSelect" size="1">
       <option value="0">------------</option>
       {html_options options=$category_parent_options}
     </select>
-    {'... or '|@translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
+    {'... or '|translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|translate}">{'create a new album'|translate}</a>
   </p>
     
   <p>
-    <b>{'Fill these fields from pBase datas'|@translate}:</b>
-    <label><input type="checkbox" name="fills[]" value="fill_name" checked="checked"> {'Photo name'|@translate}</label>
-    <label><input type="checkbox" name="fills[]" value="fill_author" checked="checked"> {'Author'|@translate}</label>
-    <label><input type="checkbox" name="fills[]" value="fill_tags" checked="checked"> {'Tags'|@translate}</label>
-    <label><input type="checkbox" name="fills[]" value="fill_taken" checked="checked"> {'Creation date'|@translate}</label>
-    <label><input type="checkbox" name="fills[]" value="fill_comment" checked="checked"> {'Description'|@translate}</label>
+    <b>{'Fill these fields from pBase datas'|translate}:</b>
+    <label><input type="checkbox" name="fills[]" value="fill_name" checked="checked"> {'Photo name'|translate}</label>
+    <label><input type="checkbox" name="fills[]" value="fill_author" checked="checked"> {'Author'|translate}</label>
+    <label><input type="checkbox" name="fills[]" value="fill_tags" checked="checked"> {'Tags'|translate}</label>
+    <label><input type="checkbox" name="fills[]" value="fill_taken" checked="checked"> {'Creation date'|translate}</label>
+    <label><input type="checkbox" name="fills[]" value="fill_comment" checked="checked"> {'Description'|translate}</label>
   </p>
 </fieldset>
 
   <p class="bottomButtons">
-    <input type="submit" value="{'Begin transfer'|@translate}">    
+    <input type="submit" value="{'Begin transfer'|translate}">    
   </p>
 </form>
Index: /extensions/pbase2piwigo/admin/template/import.init_import.tpl
===================================================================
--- /extensions/pbase2piwigo/admin/template/import.init_import.tpl	(revision 26200)
+++ /extensions/pbase2piwigo/admin/template/import.init_import.tpl	(revision 26201)
@@ -1,130 +1,162 @@
 {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
-{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
+{combine_script id='jquery.jgrowl' load='footer' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
+{combine_css path="themes/default/js/plugins/jquery.jGrowl.css"}
+
 {combine_script id='MultiGetSet' load='header' path=$PBASE_PATH|cat:'admin/template/MultiGetSet.js'}
-{combine_css path="admin/themes/default/uploadify.jGrowl.css"}
 
 {footer_script require='jquery.ajaxmanager,jquery.jgrowl'}
-var errorHead   = '{'ERROR'|@translate|@escape:'javascript'}';
-var errorMsg    = '{'an error happened'|@translate|@escape:'javascript'}';
-var successHead = '{'Success'|@translate|@escape:'javascript'}';
-var errors_final_msg = '{'%1$d errors occured. %2$d albums and %3$d photos added.'|@translate}';
+(function($){
+  var errors_final_msg = '{'%1$d errors occured. %2$d albums and %3$d photos added.'|translate|escape:javascript}';
+  var final_manage_link = '{'Manage this set of %d photos'|translate}';
 
-{literal}
-// custom classe for counters listening
-var MyClass = function(){
-  var public = this;
-  var private = {};
-  
-  private.lenght = 0;
-  private.errors = 0;
-  private.categories = 0;
-  private.pictures = 0;
-  
-  MultiGetSet({
-    public: public,
-    private: private,
-    handler: Observable
+  // custom class for counters listening
+  var MyClass = function(){
+    var public = this;
+    var private = {};
+    
+    private.lenght = 0;
+    private.errors = 0;
+    private.categories = 0;
+    private.pictures = 0;
+    
+    MultiGetSet({
+      public: public,
+      private: private,
+      handler: Observable
+    });
+  };
+
+  var queue = new MyClass();
+
+  queue.listen("lenght", function(opt){
+    if (opt.newValue == 0) {
+      $(".loading").css('display', 'none');
+      if (queue.get("errors") == 0) {
+        $(".infos").css('display', 'block');
+      }
+      else {
+        errors_final_msg = errors_final_msg.replace('%1$d', queue.get("errors"));
+        errors_final_msg = errors_final_msg.replace('%2$d', queue.get("categories"));
+        errors_final_msg = errors_final_msg.replace('%3$d', queue.get("pictures"));
+        final_manage_link = final_manage_link.replac('%d', queue.get("pictures"));
+        
+        $(".warnings").css('display', '').find('.i').html(errors_final_msg);
+        $(".warnings").find('.a').html('<a href="{$MANAGE_LINK}">' + final_manage_link + '</a>');
+      }
+    }
   });
-};
-
-var queue = new MyClass();
-
-queue.listen("lenght", function(opt){
-  if (opt.newValue == 0) {
-    $(".loading").css('display', 'none');
-    if (queue.get("errors") == 0) {
-      $(".infos").css('display', 'block');
-    } else {
-      errors_final_msg = errors_final_msg.replace('%1$d', queue.get("errors"));
-      errors_final_msg = errors_final_msg.replace('%2$d', queue.get("categories"));
-      errors_final_msg = errors_final_msg.replace('%3$d', queue.get("pictures"));
-      
-      $(".warnings").css('display', '').html('<ul><li>'+ errors_final_msg +'</li></ul>');
-    }
-  }
-});
-queue.listen("categories", function(opt) {
-  $(".nb_categories").html(opt.newValue);
-});
-queue.listen("pictures", function(opt) {
-  $(".nb_pictures").html(opt.newValue);
-});
-queue.listen("errors", function(opt) {
-  $(".nb_errors").html(opt.newValue);
-});
+  queue.listen("categories", function(opt) {
+    $(".nb_categories").html(opt.newValue);
+  });
+  queue.listen("pictures", function(opt) {
+    $(".nb_pictures").html(opt.newValue);
+  });
+  queue.listen("errors", function(opt) {
+    $(".nb_errors").html(opt.newValue);
+  });
 
 
-var queuedManager = jQuery.manageAjax.create('queued', {
-  queue: true,  
-  maxRequests: 1
-});
+  var queuedManager = $.manageAjax.create('queued', {
+    queue: true,  
+    maxRequests: 1
+  });
 
-function add_cat_to_add_queue(path, parent_id, recursive, fills) {
-  queuedManager.add({
-    type: 'POST',
-    dataType: 'json',
-    url: 'ws.php?format=json',
-    data: { method: 'pwg.pBase.addCat', path: path, parent_id: parent_id, recursive: recursive },
-    success: function(data) {
-      if (data['stat'] == 'ok') {
-        data = data['result'];
-        
-        for (i in data['pictures']) {
-          queue.increment("lenght");
-          add_picture_to_add_queue(data['pictures'][i], data['category_id'], fills);
+  function add_cat_to_add_queue(path, parent_id, recursive, fills) {
+    queuedManager.add({
+      type: 'POST',
+      dataType: 'json',
+      url: 'ws.php?format=json',
+      data: {
+        method: 'pwg.pBase.addCat',
+        path: path,
+        parent_id: parent_id,
+        recursive: recursive
+      },
+      success: function(data) {
+        if (data['stat'] == 'ok') {
+          data = data['result'];
+          
+          for (i in data['pictures']) {
+            queue.increment("lenght");
+            add_picture_to_add_queue(data['pictures'][i], data['category_id'], fills);
+          }
+          if (recursive) {
+            for (i in data['categories']) {
+              queue.increment("lenght");
+              add_cat_to_add_queue(data['categories'][i], data['category_id'], recursive, fills);
+            }
+          }
+          
+          $.jGrowl(data['message'], {
+            theme: 'success', life: 4000, sticky: false,
+            header: '{'Success'|translate}'
+          });
+          queue.increment("categories");
         }
-        if (recursive) {
-          for (i in data['categories']) {
-            queue.increment("lenght");
-            add_cat_to_add_queue(data['categories'][i], data['category_id'], recursive, fills);
-          }
+        else {
+          $.jGrowl(data['result'], {
+            theme: 'error', sticky: true,
+            header: '{'ERROR'|translate}'
+          });
+          queue.increment("errors");
         }
         
-        jQuery.jGrowl(data['message'], { theme: 'success', header: successHead, life: 4000, sticky: false });
-        queue.increment("categories");
-      } else {
-        jQuery.jGrowl(data['result'], { theme: 'error', header: errorHead, sticky: true });
+        queue.decrement("lenght");
+      },
+      error: function () {
+        $.jGrowl('{'an error happened'|translate|escape:javascript}', {
+          theme: 'error', sticky: true,
+          header: '{'ERROR'|translate}'
+        });
         queue.increment("errors");
       }
-      
-      queue.decrement("lenght");
-    },
-    error: function () {
-      jQuery.jGrowl(errorMsg, { theme: 'error', header: errorHead, sticky: true });
-      queue.increment("errors");
-    }
-  });
-}
+    });
+  }
 
-function add_picture_to_add_queue(url, cat_id, fills) {
-  queuedManager.add({
-    type: 'POST',
-    dataType: 'json',
-    url: 'ws.php?format=json',
-    data: { method: 'pwg.pBase.addImage', url: url, category: cat_id, fills: fills },
-    success: function(data) {
-      if (data['stat'] == 'ok') {
-        jQuery.jGrowl(data['result'], { theme: 'success', header: successHead, life: 2000, sticky: false });
-        queue.increment("pictures");
-      } else {
-        jQuery.jGrowl(data['result'], { theme: 'error', header: errorHead, sticky: true });
+  function add_picture_to_add_queue(url, cat_id, fills) {
+    queuedManager.add({
+      type: 'POST',
+      dataType: 'json',
+      url: 'ws.php?format=json',
+      data: {
+        method: 'pwg.pBase.addImage',
+        url: url,
+        category: cat_id,
+        fills: fills
+      },
+      success: function(data) {
+        if (data['stat'] == 'ok') {
+          $.jGrowl(data['result'], {
+            theme: 'success', life: 2000, sticky: false,
+            header: '{'Success'|translate}'
+          });
+          queue.increment("pictures");
+        }
+        else {
+          $.jGrowl(data['result'], {
+            theme: 'error', sticky: true,
+            header: '{'ERROR'|translate}'
+          });
+          queue.increment("errors");
+        }
+        
+        queue.decrement("lenght");
+      },
+      error: function () {
+        $.jGrowl('{'an error happened'|translate|escape:javascript}', {
+          theme: 'error', sticky: true,
+          header: '{'ERROR'|translate}'
+        });
         queue.increment("errors");
       }
-      
-      queue.decrement("lenght");
-    },
-    error: function () {
-      jQuery.jGrowl(errorMsg, { theme: 'error', header: errorHead, sticky: true });
-      queue.increment("errors");
-    }
-  });
-}
-{/literal}
+    });
+  }
 
-{foreach from=$categories item=cat}
-add_cat_to_add_queue('{$cat}', {$PARENT_CATEGORY}, {$RECURSIVE}, '{$FILLS}');
-{/foreach}
+  {foreach from=$categories item=cat}
+  add_cat_to_add_queue('{$cat}', {$PARENT_CATEGORY}, {$RECURSIVE}, '{$FILLS}');
+  {/foreach}
 
-queue.set("lenght", {$categories|@count});
+  queue.set("lenght", {$categories|@count});
+}(jQuery));
 {/footer_script}
 
@@ -132,20 +164,20 @@
 <div class="infos" style="display:none;">
   <ul>
-    <li>{'Completed. %1$d albums and %2$d photos added.'|@translate|sprintf:$nb_categories:$nb_pictures}</li>
+    <li>{'Completed. %1$d albums and %2$d photos added.'|translate:$nb_categories:$nb_pictures}</li>
+    <li><a href="{$MANAGE_LINK}">{'Manage this set of %d photos'|translate:$nb_pictures}</a></li>
   </ul>
 </div>
 <div class="warnings" style="display:none;">
   <ul>
-    <li>null</li>
+    <li class="i"></li>
+    <li class="a"></li>
   </ul>
 </div>
 
 <p>
-  <b>{'Nb albums'|@translate}</b>: <span class="nb_categories">0</span>/{$nb_categories}<br>
-  <b>{'Nb photos'|@translate}</b>: <span class="nb_pictures">0</span>/{$nb_pictures}<br>
-  <b>{'Errors'|@translate}</b>: <span class="nb_errors">0</span><br>
+  <b>{'Nb albums'|translate}</b>: <span class="nb_categories">0</span>/{$nb_categories}<br>
+  <b>{'Nb photos'|translate}</b>: <span class="nb_pictures">0</span>/{$nb_pictures}<br>
+  <b>{'Errors'|translate}</b>: <span class="nb_errors">0</span><br>
   <br>
   <img class="loading" src="{$PBASE_PATH}admin/template/loader-{$themeconf.name}.gif">
 </p>
-
-{* <a href="{$MANAGE_LINK}">{'Manage this set of %d photos'|@translate|sprintf:$nb_pictures}</a> *}
Index: /extensions/pbase2piwigo/admin/template/import.tpl
===================================================================
--- /extensions/pbase2piwigo/admin/template/import.tpl	(revision 26200)
+++ /extensions/pbase2piwigo/admin/template/import.tpl	(revision 26201)
@@ -1,5 +1,2 @@
-{combine_css path=$PBASE_PATH|@cat:"admin/template/style.css"}
-
-
 <div class="titrePage">
 	<h2>PBase2Piwigo</h2>
@@ -10,8 +7,8 @@
 {include file=$PBASE_ABS_PATH|@cat:'admin/template/import.analyze.tpl'}
 
-{elseif $STEP == 'config'}
+{else if $STEP == 'config'}
 {include file=$PBASE_ABS_PATH|@cat:'admin/template/import.config.tpl'}
 
-{elseif $STEP == 'init_import'}
+{else if $STEP == 'init_import'}
 {include file=$PBASE_ABS_PATH|@cat:'admin/template/import.init_import.tpl'}
  
Index: /extensions/pbase2piwigo/include/functions.inc.php
===================================================================
--- /extensions/pbase2piwigo/include/functions.inc.php	(revision 26200)
+++ /extensions/pbase2piwigo/include/functions.inc.php	(revision 26201)
@@ -1,4 +1,4 @@
 <?php
-if (!defined('PBASE_PATH')) die('Hacking attempt!');
+defined('PBASE_PATH') or die('Hacking attempt!');
 
 /**
@@ -306,4 +306,28 @@
 
 /**
+ * count pictures and cats in the selected cat
+ * @param: &array tree
+ * @param: string $path
+ * @param: &int nb pictures
+ * @param: &int nb categories
+ * @param: bool recursive
+ * @return: void
+ */
+function count_pictures_cats(&$tree, $path, &$nb_pictures, &$nb_categories, $recursive=true)
+{
+  $current = &get_current_cat($tree, $path);
+  $nb_pictures+= $current['nb_pictures'];
+  $nb_categories++;
+  
+  if ( $recursive and !empty($current['categories']) )
+  {
+    foreach ($current['categories'] as $cat)
+    {
+      count_pictures_cats($tree, $cat['path'], $nb_pictures, $nb_categories, $recursive);
+    }
+  }
+}
+
+/**
  * test if a download method is available
  * @return: bool
@@ -421,28 +445,4 @@
     
     return false;
-  }
-}
-
-/**
- * count pictures and cats in the selected cat
- * @param: &array tree
- * @param: string $path
- * @param: &int nb pictures
- * @param: &int nb categories
- * @param: bool recursive
- * @return: void
- */
-function count_pictures_cats(&$tree, $path, &$nb_pictures, &$nb_categories, $recursive=true)
-{
-  $current = &get_current_cat($tree, $path);
-  $nb_pictures+= $current['nb_pictures'];
-  $nb_categories++;
-  
-  if ( $recursive and !empty($current['categories']) )
-  {
-    foreach ($current['categories'] as $cat)
-    {
-      count_pictures_cats($tree, $cat['path'], $nb_pictures, $nb_categories, $recursive);
-    }
   }
 }
@@ -516,4 +516,2 @@
   }
 }
-
-?>
Index: /extensions/pbase2piwigo/include/ws_functions.inc.php
===================================================================
--- /extensions/pbase2piwigo/include/ws_functions.inc.php	(revision 26200)
+++ /extensions/pbase2piwigo/include/ws_functions.inc.php	(revision 26201)
@@ -1,4 +1,4 @@
 <?php
-if (!defined('PBASE_PATH')) die('Hacking attempt!');
+defined('PBASE_PATH') or die('Hacking attempt!');
 
 function pbase_add_ws_method($arr)
@@ -14,5 +14,7 @@
       'fills' => array('default' => 'fill_name,fill_taken,fill_author,fill_comment,fill_tags'),
       ),
-    'Used by PBase2Piwigo'
+    'Used by PBase2Piwigo',
+    null,
+    array('hidden'=>true)
     );
     
@@ -25,5 +27,7 @@
       'recursive' => array('default' => true),
       ),
-    'Used by PBase2Piwigo'
+    'Used by PBase2Piwigo',
+    null,
+    array('hidden'=>true)
     );
     
@@ -35,5 +39,7 @@
       'path' => array(),
       ),
-    'Used by PBase2Piwigo'
+    'Used by PBase2Piwigo',
+    null,
+    array('hidden'=>true)
     );
 }
@@ -56,5 +62,5 @@
   include_once(PBASE_PATH.'include/functions.inc.php');
   
-  if (test_remote_download() === false)
+  if (!test_remote_download())
   {
     return new PwgError(null, l10n('No download method available'));
@@ -127,10 +133,10 @@
   else
   {
-    $category_id = ws_categories_add(array(
+    $new_cat = $service->invoke('pwg.categories.add', array(
       'name' => $category['title'].' <!--pbase-->',
       'parent' => $params['parent_id'],
       'comment' => pwg_db_real_escape_string($category['description']),
-      ), $service);
-    $category_id = $category_id['id'];
+      ));
+    $category_id = $new_cat['id'];
   }
   
@@ -140,10 +146,10 @@
     'pictures' => array(),
     'categories' => array(),
-    'message' => sprintf(l10n('Album "%s" created'), $category['title']),
+    'message' => l10n('Album "%s" created', $category['title']),
     );
     
   foreach ($category['pictures'] as &$pict)
   {
-    array_push($output['pictures'], $pict['url']);
+    $output['pictures'][] = $pict['url'];
   }
   if ($params['recursive'])
@@ -151,5 +157,5 @@
     foreach ($category['categories'] as &$cat)
     {
-      array_push($output['categories'], $cat['path']);
+      $output['categories'][] = $cat['path'];
     }
   }
@@ -231,5 +237,5 @@
       }
       
-      if ( !empty($photo['keywords']) and in_array('fill_tags', $params['fills']) )
+      if (!empty($photo['keywords']) and in_array('fill_tags', $params['fills']))
       {
         $raw_tags = implode(',', $photo['keywords']);
@@ -239,6 +245,4 @@
   }
   
-  return sprintf(l10n('Photo "%s" imported'), $photo['title']);
-}
-
-?>
+  return l10n('Photo "%s" imported', $photo['title']);
+}
Index: /extensions/pbase2piwigo/main.inc.php
===================================================================
--- /extensions/pbase2piwigo/main.inc.php	(revision 26200)
+++ /extensions/pbase2piwigo/main.inc.php	(revision 26201)
@@ -9,12 +9,18 @@
 */
 
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
 
 global $conf;
 
-define('PBASE_PATH',     PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
-define('PBASE_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__)));
+define('PBASE_ID',       basename(dirname(__FILE__)));
+define('PBASE_PATH',     PHPWG_PLUGINS_PATH . PBASE_ID . '/');
+define('PBASE_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . PBASE_ID);
 define('PBASE_FS_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/');
 
+
+include_once(PBASE_PATH . 'include/ws_functions.inc.php');
+
+
+add_event_handler('ws_add_methods', 'pbase_add_ws_method');
 
 if (defined('IN_ADMIN'))
@@ -22,18 +28,38 @@
   add_event_handler('get_admin_plugin_menu_links', 'pbase_admin_menu');
 
+  add_event_handler('get_batch_manager_prefilters', 'pbase_add_batch_manager_prefilters');
+  add_event_handler('perform_batch_manager_prefilters', 'pbase_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+
   function pbase_admin_menu($menu) 
   {
-    array_push($menu, array(
+    $menu[] = array(
       'NAME' => 'PBase2Piwigo',
       'URL' => PBASE_ADMIN,
-    ));
+      );
     return $menu;
   }
+
+  function pbase_add_batch_manager_prefilters($prefilters)
+  {
+    $prefilters[] = array(
+      'ID' => 'pbase',
+      'NAME' => l10n('Imported from PBase'),
+      );
+    return $prefilters;
+  }
+
+  function pbase_perform_batch_manager_prefilters($filter_sets, $prefilter)
+  {
+    if ($prefilter == 'pbase')
+    {
+      $query = '
+  SELECT id
+    FROM '.IMAGES_TABLE.'
+    WHERE file LIKE "pbase-%"
+  ;';
+      $filter_sets[] = array_from_query($query, 'id');
+    }
+
+    return $filter_sets;
+  }
 }
-
-
-include_once(PBASE_PATH . 'include/ws_functions.inc.php');
-
-add_event_handler('ws_add_methods', 'pbase_add_ws_method');
-
-?>
Index: tensions/pbase2piwigo/maintain.inc.php
===================================================================
--- /extensions/pbase2piwigo/maintain.inc.php	(revision 26200)
+++ 	(revision )
@@ -1,58 +1,0 @@
-<?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-
-function plugin_install() 
-{
-  global $conf;
-  
-  mkgetdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/', MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
-}
-
-function plugin_activate()
-{
-  global $conf;
-  
-  if (!file_exists(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/'))
-  {
-    mkgetdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/', MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
-  }
-}
-
-function plugin_uninstall() 
-{
-  global $conf;
-  
-  rrmdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'pbase_cache/');
-}
-
-function rrmdir($dir)
-{
-  if (!is_dir($dir))
-  {
-    return false;
-  }
-  $dir = rtrim($dir, '/');
-  $objects = scandir($dir);
-  $return = true;
-  
-  foreach ($objects as $object)
-  {
-    if ($object !== '.' && $object !== '..')
-    {
-      $path = $dir.'/'.$object;
-      if (filetype($path) == 'dir') 
-      {
-        $return = $return && rrmdir($path); 
-      }
-      else 
-      {
-        $return = $return && @unlink($path);
-      }
-    }
-  }
-  
-  return $return && @rmdir($dir);
-} 
-
-?>
