Index: /extensions/nbc_HistoryIPExcluder/trunk/admin.php
===================================================================
--- /extensions/nbc_HistoryIPExcluder/trunk/admin.php	(revision 9870)
+++ /extensions/nbc_HistoryIPExcluder/trunk/admin.php	(revision 9870)
@@ -0,0 +1,3 @@
+<?php
+  include(HIPE_PATH.'admin/HIPE_admin.php');
+?>
Index: /extensions/nbc_HistoryIPExcluder/trunk/main.inc.php
===================================================================
--- /extensions/nbc_HistoryIPExcluder/trunk/main.inc.php	(revision 9869)
+++ /extensions/nbc_HistoryIPExcluder/trunk/main.inc.php	(revision 9870)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: History IP Excluder
-Version: 2.1.1
+Version: 2.2.0
 Description: Permet l'exclusion d'une IP ou d'une plage d'IP de l'historique et de les blacklister à l'inscription - Base MySql seulement! / Excludes one IP or a range of IP from the history and to blacklist them on registration - MySql database only!
 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=147
@@ -24,4 +24,7 @@
                   - Bug 1511 fixed - New function to blacklist excluded IPs or ranged IPs for registration
 
+2.2.0             - Compliance with Piwigo 2.2.x
+                  - Plugin directory renamed from nbc_HistoryIPExcluder to HistoryIPExcluder
+
 --------------------------------------------------------------------------------
 */
@@ -29,5 +32,4 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-if (!defined('HIPE_DIR')) define('HIPE_DIR' , basename(dirname(__FILE__)));
 if (!defined('HIPE_PATH')) define('HIPE_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
 
@@ -36,5 +38,4 @@
 load_language('plugin.lang', HIPE_PATH);
 
-add_event_handler('pwg_log_allowed', 'HIPE_IP_Filtrer');
 add_event_handler('get_admin_plugin_menu_links', 'HIPE_admin_menu');
 
@@ -51,5 +52,5 @@
     array(
       'NAME' => $name,
-      'URL' => get_admin_plugin_menu_link(HIPE_PATH.'admin/HIPE_admin.php')
+      'URL' => get_root_url().'admin.php?page=plugin-'.basename(HIPE_PATH)
     )
   );
@@ -58,4 +59,6 @@
 }
 
+// IP exclusion from logs
+add_event_handler('pwg_log_allowed', 'HIPE_IP_Filtrer');
 
 function HIPE_IP_Filtrer($do_log)
Index: /extensions/nbc_HistoryIPExcluder/trunk/maintain.inc.php
===================================================================
--- /extensions/nbc_HistoryIPExcluder/trunk/maintain.inc.php	(revision 9869)
+++ /extensions/nbc_HistoryIPExcluder/trunk/maintain.inc.php	(revision 9870)
@@ -1,28 +1,56 @@
 <?php
 
+if (!defined('HIPE_PATH')) define('HIPE_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+
+include_once (HIPE_PATH.'include/functions.inc.php');
+
 function plugin_install()
 {
   global $conf;
   
+// Set plugin parameters
   $default= array();
 
-  $q = '
+	$query = '
+SELECT param
+  FROM '.CONFIG_TABLE.'
+WHERE param = "HistoryIPExcluder"
+;';
+  $count = pwg_db_num_rows(pwg_query($query));
+  
+  if ($count == 0)
+  {
+    $q = '
 INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
 VALUES ("HistoryIPExcluder","","History IP Excluder parameters");
 ';
       
-  pwg_query($q);
-
-$default = array (
-  'Blacklist' => "0",
-  'Version'=> "2.1.1",
-);
-
-  $q = '
+    pwg_query($q);
+  }
+
+// Set plugin config
+  $plugin =  HIPE_infos(HIPE_PATH);
+  $version = $plugin['version'];
+
+  $default = array (
+    'Blacklist' => "0",
+    'Version'=> $version,
+  );
+
+	$query = '
+SELECT param
+  FROM '.CONFIG_TABLE.'
+WHERE param = "HistoryIPConfig"
+;';
+  $count = pwg_db_num_rows(pwg_query($query));
+  
+  if ($count == 0)
+  {
+    $q = '
 INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
 VALUES ("HistoryIPConfig","'.addslashes(serialize($default)).'","History IP Excluder options");
 ';
-      
-  pwg_query($q);
+    pwg_query($q);
+  }
 }
 
@@ -43,5 +71,5 @@
 	if ($count == 1)
 	{
-  /* upgrade from branch 2.0.0 to 2.0.1   */
+  /* upgrade from version 2.0.0 to 2.0.1  */
   /* ************************************ */
 		upgrade_200();
@@ -57,8 +85,16 @@
 	if ($count == 0)
 	{
-  /* upgrade from branch 2.1.0 to 2.1.1   */
+  /* upgrade from version 2.1.0 to 2.1.1  */
   /* ************************************ */
 		upgrade_210();
 	}
+
+  /* upgrade from version 2.1.1 to 2.2.0 */
+  /* *********************************** */
+  $HIPE_Config = unserialize($conf['HistoryIPConfig']);
+  if ($HIPE_Config['Version'] != "2.2.0")
+  {
+    upgrade_211();
+  }
 }
 
@@ -126,3 +162,56 @@
   pwg_query($q);
 }
+
+function upgrade_211()
+{
+  global $conf;
+
+// Update plugin version
+  $query = '
+SELECT value
+  FROM '.CONFIG_TABLE.'
+WHERE param = "HistoryIPConfig"
+;';
+  $result = pwg_query($query);
+  
+  $conf_HIPE = pwg_db_fetch_assoc($result);
+    
+  $Newconf_HIPE = unserialize($conf_HIPE['value']);
+  
+  $Newconf_HIPE[1] = '2.2.0';
+  
+  $update_conf = serialize($Newconf_HIPE);
+
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+SET value="'.addslashes($update_conf).'"
+WHERE param="HistoryIPConfig"
+LIMIT 1
+;';
+
+	pwg_query($query); 
+
+  // Create new HIPE entry in plugins table 
+  $query = '
+INSERT INTO '.PLUGINS_TABLE.' (id, state, version)
+VALUES ("HistoryIPExcluder","active","2.2.0")
+;';
+  
+  pwg_query($query);
+
+  // Delete old plugin entry in plugins table 
+  $query = '
+DELETE FROM '.PLUGINS_TABLE.'
+WHERE id="nbc_HistoryIPExcluder"
+LIMIT 1
+;';
+  
+  pwg_query($query);
+
+  // rename directory
+  if (!rename(PHPWG_PLUGINS_PATH.'nbc_HistoryIPExcluder', PHPWG_PLUGINS_PATH.'HistoryIPExcluder'))
+  {
+    die('Fatal error on plugin upgrade process : Unable to rename directory ! Please, rename manualy the plugin directory name from ../plugins/nbc_HistoryIPExcluder to ../plugins/HistoryIPExcluder.');
+  }
+}
 ?>
