Index: tensions/header_manager/include/install.inc.php
===================================================================
--- /extensions/header_manager/include/install.inc.php	(revision 17653)
+++ 	(revision )
@@ -1,39 +1,0 @@
-<?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-function header_manager_install()
-{
-  global $conf, $prefixeTable;
-
-  // configuration
-  if (empty($conf['header_manager']))
-  {
-    $header_manager_default_config = serialize(array(
-      'width' => 1000,
-      'height' => 150,
-      'image' => 'random',
-      'display' => 'image_only'
-      ));
-    
-    conf_update_param('header_manager', $header_manager_default_config);
-  }
-
-  // banners directory
-  if (!file_exists(PWG_LOCAL_DIR . 'banners/')) 
-  {
-    mkdir(PWG_LOCAL_DIR . 'banners/', 0755);
-  }
-
-  // banners table
-  $query = '
-CREATE TABLE IF NOT EXISTS `' .$prefixeTable . 'category_banner` (
-  `category_id` smallint(5) unsigned NOT NULL,
-  `image` varchar(255) NOT NULL,
-  `deep` tinyint(1) DEFAULT 1,
-  PRIMARY KEY (`category_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8
-;';
-  pwg_query($query);
-}
-
-?>
Index: /extensions/header_manager/main.inc.php
===================================================================
--- /extensions/header_manager/main.inc.php	(revision 17653)
+++ /extensions/header_manager/main.inc.php	(revision 17654)
@@ -18,27 +18,55 @@
 define('HEADER_MANAGER_VERSION', '1.0.3');
 
+
 add_event_handler('init', 'header_manager_init');
+  
+if (defined('IN_ADMIN'))
+{
+  add_event_handler('get_admin_plugin_menu_links', 'header_manager_admin_menu');
+  add_event_handler('tabsheet_before_select', 'header_manager_tab', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
+  add_event_handler('delete_categories', 'header_manager_delete_categories');
+}
+else if (!defined('PWG_HELP'))
+{
+  add_event_handler('render_page_banner', 'header_manager_render');
+}
 
+include_once(HEADER_MANAGER_PATH . 'include/functions.inc.php');
+include_once(HEADER_MANAGER_PATH . 'include/header_manager.inc.php');
+
+
+/**
+ * update plugin & unserialize conf
+ */
 function header_manager_init()
 {
-  if (defined('PWG_HELP')) return;
+  global $conf, $pwg_loaded_plugins, $page;
   
-  global $conf;
+  if (
+    $pwg_loaded_plugins['header_manager']['version'] == 'auto' or
+    version_compare($pwg_loaded_plugins['header_manager']['version'], HEADER_MANAGER_VERSION, '<')
+  )
+  {
+    include_once(HEADER_MANAGER_PATH . 'maintain.inc.php');
+    plugin_install();
+    
+    if ($pwg_loaded_plugins['header_manager']['version'] != 'auto')
+    {
+      $query = '
+UPDATE '. PLUGINS_TABLE .'
+SET version = "'. HEADER_MANAGER_VERSION .'"
+WHERE id = "header_manager"';
+      pwg_query($query);
+      
+      $pwg_loaded_plugins['header_manager']['version'] = HEADER_MANAGER_VERSION;
+      
+      if (defined('IN_ADMIN'))
+      {
+        $_SESSION['page_infos'][] = 'Header Manager updated to version '. HEADER_MANAGER_VERSION;
+      }
+    }
+  }
+  
   $conf['header_manager'] = unserialize($conf['header_manager']);
-    
-  include_once(HEADER_MANAGER_PATH . 'include/functions.inc.php');
-  include_once(HEADER_MANAGER_PATH . 'include/header_manager.inc.php');
-  
-  if (!defined('IN_ADMIN'))
-  {
-    add_event_handler('render_page_banner', 'header_manager_render');
-  }
-  else
-  {
-    add_event_handler('loc_begin_admin_page', 'header_manager_check_version');
-    add_event_handler('get_admin_plugin_menu_links', 'header_manager_admin_menu');
-    add_event_handler('tabsheet_before_select', 'header_manager_tab', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
-    add_event_handler('delete_categories', 'header_manager_delete_categories');
-  }
 }
 
@@ -73,36 +101,3 @@
 }
 
-/**
- * updating the plugin
- */
-function header_manager_check_version()
-{
-  global $pwg_loaded_plugins, $page;
-  
-  if (
-    ( 
-      @$page['page'] == 'intro' or 
-      @$_GET['section'] == 'header_manager/admin.php' 
-    )
-    and 
-    (
-      $pwg_loaded_plugins['header_manager']['version'] == 'auto' or
-      version_compare($pwg_loaded_plugins['header_manager']['version'], HEADER_MANAGER_VERSION, '<')
-    ) 
-  )
-  {
-    include_once(HEADER_MANAGER_PATH . 'include/install.inc.php');
-    header_manager_install();
-    
-    if ($pwg_loaded_plugins['header_manager']['version'] != 'auto')
-    {
-      $query = '
-UPDATE '. PLUGINS_TABLE .'
-SET version = "'. HEADER_MANAGER_VERSION .'"
-WHERE id = "header_manager"';
-      pwg_query($query);
-    }
-  }
-}
-
 ?>
Index: /extensions/header_manager/maintain.inc.php
===================================================================
--- /extensions/header_manager/maintain.inc.php	(revision 17653)
+++ /extensions/header_manager/maintain.inc.php	(revision 17654)
@@ -2,9 +2,39 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
   
-include_once(PHPWG_PLUGINS_PATH . 'header_manager/include/install.inc.php');
-
 function plugin_install() 
 {
-  header_manager_install();
+  global $conf, $prefixeTable;
+
+  // configuration
+  if (empty($conf['header_manager']))
+  {
+    $header_manager_default_config = serialize(array(
+      'width' => 1000,
+      'height' => 150,
+      'image' => 'random',
+      'display' => 'image_only'
+      ));
+    
+    conf_update_param('header_manager', $header_manager_default_config);
+    $conf['header_manager'] = $header_manager_default_config;
+  }
+
+  // banners directory
+  if (!file_exists(PWG_LOCAL_DIR . 'banners/')) 
+  {
+    mkdir(PWG_LOCAL_DIR . 'banners/', 0755);
+  }
+
+  // banners table
+  $query = '
+CREATE TABLE IF NOT EXISTS `' .$prefixeTable . 'category_banner` (
+  `category_id` smallint(5) unsigned NOT NULL,
+  `image` varchar(255) NOT NULL,
+  `deep` tinyint(1) DEFAULT 1,
+  PRIMARY KEY (`category_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+;';
+  pwg_query($query);
+  
   define('header_manager_installed', true);
 }
@@ -14,5 +44,5 @@
   if (!defined('header_manager_installed'))
   {
-    header_manager_install()
+    plugin_install();
   }
 }
