Index: /extensions/Google2Piwigo/admin.php
===================================================================
--- /extensions/Google2Piwigo/admin.php	(revision 29250)
+++ /extensions/Google2Piwigo/admin.php	(revision 29251)
@@ -5,4 +5,5 @@
 
 load_language('plugin.lang', PICASA_WA_PATH);
+$conf['google2piwigo'] = safe_unserialize($conf['google2piwigo']);
 
 if (!file_exists(PICASA_WA_CACHE))
Index: /extensions/Google2Piwigo/include/ws_functions.inc.php
===================================================================
--- /extensions/Google2Piwigo/include/ws_functions.inc.php	(revision 29250)
+++ /extensions/Google2Piwigo/include/ws_functions.inc.php	(revision 29251)
@@ -28,5 +28,7 @@
   }
   
-  global $conf, $pwg_loaded_plugins;
+  global $conf;
+  
+  $conf['google2piwigo'] = safe_unserialize($conf['google2piwigo']);
   
   include_once(PHPWG_ROOT_PATH . 'admin/include/functions.php');
@@ -130,13 +132,14 @@
   if (!empty($params['fills']))
   {
-    $params['fills'] = rtrim($params['fills'], ',');
-    $params['fills'] = explode(',', $params['fills']);
+    $fills = rtrim($params['fills'], ',');
+    $fills = explode(',', $fills);
+    $fills = array_flip($fills);
   
     $updates = array();
-    if (in_array('fill_name', $params['fills']))        $updates['name'] = pwg_db_real_escape_string($photo['title']); 
-    if (in_array('fill_date', $params['fills']))        $updates['date_creation'] = date('Y-m-d H:i:s', $photo['timestamp']);
-    if (in_array('fill_author', $params['fills']))      $updates['author'] = pwg_db_real_escape_string($photo['author']);
-    if (in_array('fill_description', $params['fills'])) $updates['comment'] = pwg_db_real_escape_string($photo['description']);
-    if (in_array('fill_geotag', $params['fills']) and !empty($photo['latlon']))
+    if (isset($fills['fill_name']))        $updates['name'] = pwg_db_real_escape_string($photo['title']); 
+    if (isset($fills['fill_date']))        $updates['date_creation'] = date('Y-m-d H:i:s', $photo['timestamp']);
+    if (isset($fills['fill_author']))      $updates['author'] = pwg_db_real_escape_string($photo['author']);
+    if (isset($fills['fill_description'])) $updates['comment'] = pwg_db_real_escape_string($photo['description']);
+    if (isset($fills['fill_geotag']) and !empty($photo['latlon']))
     {
       $latlon = explode(' ', $photo['latlon']);
@@ -157,5 +160,5 @@
     }
     
-    if (!empty($photo['tags']) and in_array('fill_tags', $params['fills']))
+    if (!empty($photo['tags']) and isset($fills['fill_tags']))
     {
       set_tags(get_tag_ids($photo['tags']), $photo['image_id']);
Index: /extensions/Google2Piwigo/main.inc.php
===================================================================
--- /extensions/Google2Piwigo/main.inc.php	(revision 29250)
+++ /extensions/Google2Piwigo/main.inc.php	(revision 29251)
@@ -17,12 +17,12 @@
 define('PICASA_WA_ADMIN', get_root_url() . 'admin.php?page=plugin-' . PICASA_WA_ID);
 define('PICASA_WA_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/');
-define('PICASA_WA_VERSION',  'auto');
 
 
-include_once(PICASA_WA_PATH . 'include/ws_functions.inc.php');
+if (defined('IN_WS'))
+{
+  include_once(PICASA_WA_PATH . 'include/ws_functions.inc.php');
 
-
-add_event_handler('init', 'picasa_wa_init');
-add_event_handler('ws_add_methods', 'picasa_wa_add_ws_method');
+  add_event_handler('ws_add_methods', 'picasa_wa_add_ws_method');
+}
 
 if (defined('IN_ADMIN'))
@@ -66,12 +66,2 @@
   }
 }
-
-function picasa_wa_init()
-{
-  global $conf;
-  include_once(PICASA_WA_PATH . 'maintain.inc.php');
-  $maintain = new Google2Piwigo_maintain(PICASA_WA_ID);
-  $maintain->autoUpdate(PICASA_WA_VERSION, 'install');
-
-  $conf['google2piwigo'] = unserialize($conf['google2piwigo']);
-}
Index: /extensions/Google2Piwigo/maintain.class.php
===================================================================
--- /extensions/Google2Piwigo/maintain.class.php	(revision 29251)
+++ /extensions/Google2Piwigo/maintain.class.php	(revision 29251)
@@ -0,0 +1,67 @@
+<?php
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
+
+class Google2Piwigo_maintain extends PluginMaintain
+{
+  private $default_conf = array(
+    'api_key' => null,
+    'secret_key' => null,
+    'auth_endpoint' => 'https://accounts.google.com/o/oauth2/auth',
+    'token_endpoint' => 'https://accounts.google.com/o/oauth2/token'
+    );
+
+  function install($plugin_version, &$errors=array())
+  {
+    global $conf;
+
+    if (empty($conf['google2piwigo']))
+    {
+      conf_update_param('google2piwigo', $conf['google2piwigo'], $this->default_conf);
+    }
+
+    mkgetdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/', MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
+  }
+
+  function update($old_version, $new_version, &$errors=array())
+  {
+    $this->install($new_version, $errors);
+  }
+
+  function uninstall()
+  {
+    global $conf;
+
+    conf_delete_param('google2piwigo');
+
+    self::rrmdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/');
+  }
+
+  static 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 && self::rrmdir($path);
+        }
+        else
+        {
+          $return = $return && @unlink($path);
+        }
+      }
+    }
+
+    return $return && @rmdir($dir);
+  }
+}
Index: tensions/Google2Piwigo/maintain.inc.php
===================================================================
--- /extensions/Google2Piwigo/maintain.inc.php	(revision 29250)
+++ 	(revision )
@@ -1,79 +1,0 @@
-<?php
-defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
-
-class Google2Piwigo_maintain extends PluginMaintain
-{
-  private $installed = false;
-
-  private $default_conf = array(
-    'api_key' => null,
-    'secret_key' => null,
-    'auth_endpoint' => 'https://accounts.google.com/o/oauth2/auth',
-    'token_endpoint' => 'https://accounts.google.com/o/oauth2/token'
-    );
-
-  function install($plugin_version, &$errors=array())
-  {
-    global $conf;
-
-    if (empty($conf['google2piwigo']))
-    {
-      $conf['google2piwigo'] = serialize($this->default_conf);
-      conf_update_param('google2piwigo', $conf['google2piwigo']);
-    }
-
-    mkgetdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/', MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
-
-    $this->installed = true;
-  }
-
-  function activate($plugin_version, &$errors=array())
-  {
-    if (!$this->installed)
-    {
-      $this->install($plugin_version, $errors);
-    }
-  }
-
-  function deactivate()
-  {
-  }
-
-  function uninstall()
-  {
-    global $conf;
-
-    conf_delete_param('google2piwigo');
-
-    self::rrmdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'picasa_wa_cache/');
-  }
-
-  static 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 && self::rrmdir($path);
-        }
-        else
-        {
-          $return = $return && @unlink($path);
-        }
-      }
-    }
-
-    return $return && @rmdir($dir);
-  }
-}
