Index: /extensions/CommentEditor/administration.php
===================================================================
--- /extensions/CommentEditor/administration.php	(revision 3472)
+++ /extensions/CommentEditor/administration.php	(revision 3473)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: administration.php,v 1.2 2009/06/26 14:40:27 Criss Exp $ */
+/* $Id: administration.php,v 1.3 2009/06/29 11:43:18 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
@@ -49,5 +49,5 @@
 // Define common values
 $ce_common = array(
-    'version' => CE_VERSION,
+    'version' => $ce_plugin->getVersion(),
     'title'   => $ce_plugin->plugin_id,
 );
Index: /extensions/CommentEditor/classes/ce_config.class.php
===================================================================
--- /extensions/CommentEditor/classes/ce_config.class.php	(revision 3472)
+++ /extensions/CommentEditor/classes/ce_config.class.php	(revision 3473)
@@ -89,6 +89,6 @@
         REPLACE INTO '.CONFIG_TABLE.'
         VALUES(
-          \''.$plugin_id.'\',
-          \''.serialize($default_config).'\',
+          \'' . $plugin_id . '\',
+          \'' . serialize($default_config) . '\',
           \'Factory settings for '. $plugin_id . '\')
         ;';
@@ -104,5 +104,5 @@
     $query = '
         DELETE FROM '.CONFIG_TABLE.'
-        WHERE param = \''.$plugin_id.'\'
+        WHERE param = \'' . $plugin_id . '\'
         ;';
     $result = pwg_query($query);
Index: /extensions/CommentEditor/classes/ce_plugin.class.php
===================================================================
--- /extensions/CommentEditor/classes/ce_plugin.class.php	(revision 3472)
+++ /extensions/CommentEditor/classes/ce_plugin.class.php	(revision 3473)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: ce_plugin.class.php,v 1.11 2009/06/26 09:17:01 Criss Exp $ */
+/* $Id: ce_plugin.class.php,v 1.12 2009/06/29 11:43:18 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
@@ -110,4 +110,15 @@
   function loc_begin_picture() {
     $this->doAction();
+  }
+
+  /* ************************ */
+  /* ** Accessors          ** */
+  /* ************************ */
+
+  function getVersion() {
+    if (isset($this->config->config_values[CE_CFG_VERSION])) {
+      return $this->config->config_values[CE_CFG_VERSION];
+    }
+    return CE_VERSION;
   }
 
Index: /extensions/CommentEditor/include/ce_common.inc.php
===================================================================
--- /extensions/CommentEditor/include/ce_common.inc.php	(revision 3472)
+++ /extensions/CommentEditor/include/ce_common.inc.php	(revision 3473)
@@ -1,5 +1,12 @@
 <?php
-/* $Id: ce_common.inc.php,v 1.11 2009/06/26 09:49:27 Criss Exp $ */
+/* $Id: ce_common.inc.php,v 1.12 2009/06/29 11:43:18 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+/* ************************** */
+/* ** Constants            ** */
+/* ************************** */
+
+// Version update
+define('CE_VERSION',  '1.0.j');
 
 // Define constants
@@ -16,4 +23,5 @@
 define('CE_AMDIN_TPL',     CE_ROOT.CE_ADMIN_DIR.CE_TEMPLATE_DIR);
 
+define('CE_OBSOLETE',      'obsolete.list');
 define('CE_ERRORS',        CE_INCLUDE.'errors.png');
 define('CE_INFOS',         CE_INCLUDE.'infos.png');
@@ -29,4 +37,20 @@
 define('CE_ACTION_ERROR',  'error_comment');
 
+// Config keys
+if (isset($plugin)) {
+  define('CE_CFG_DB_KEY',     $plugin['id']);
+  define('CE_CFG_DB_COMMENT', 'Configuration of plugin ' . $plugin['id']);
+}
+define('CE_CFG_DISPLAY_ERROR',  'display_error');
+define('CE_CFG_DISPLAY_INFO',   'display_info');
+define('CE_CFG_VERSION',        'version');
+
+// Templates usage
+define('CE_CHECKED',  'checked="checked"');
+
+/* ************************** */
+/* ** Includes             ** */
+/* ************************** */
+
 // Include plugin functions
 @include_once(CE_INCLUDE.'ce_functions.inc.php');
@@ -37,11 +61,7 @@
 ce_require_class("CE_Plugin");
 
-// Config keys
-if (isset($plugin)) {
-  define('CE_CFG_DB_KEY',     $plugin['id']);
-  define('CE_CFG_DB_COMMENT', 'Configuration of plugin ' . $plugin['id']);
-}
-define('CE_CFG_DISPLAY_ERROR',  'display_error');
-define('CE_CFG_DISPLAY_INFO',   'display_info');
+/* ************************** */
+/* ** Variable definitions ** */
+/* ************************** */
 
 // Config default values
@@ -49,5 +69,3 @@
 $ce_config_default[CE_CFG_DISPLAY_INFO]   = true;
 
-// Templates usage
-define('CE_CHECKED',  'checked="checked"')
 ?>
Index: /extensions/CommentEditor/include/ce_functions.inc.php
===================================================================
--- /extensions/CommentEditor/include/ce_functions.inc.php	(revision 3472)
+++ /extensions/CommentEditor/include/ce_functions.inc.php	(revision 3473)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: ce_functions.inc.php,v 1.6 2009/06/26 08:56:32 Criss Exp $ */
+/* $Id: ce_functions.inc.php,v 1.7 2009/06/29 11:43:18 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
@@ -10,4 +10,33 @@
 function ce_require_class($aClassName) {
   require_once CE_CLASSES .strtolower($aClassName) . '.class.php';
+}
+
+function ce_clean_obsolete_files($obsolete_file_list) {
+  if (!file_exists(CE_PATH.$obsolete_file_list)) {
+    return TRUE;
+  }
+  $obsolete = file(CE_PATH.$obsolete_file_list);
+  array_push($obsolete, $obsolete_file_list);
+  return ce_clean_obsolete_list($obsolete);
+}
+
+function ce_clean_obsolete_list($file_list = array(), &$errors = array()) {
+  if (!function_exists('unlink')) {
+      // No unlink available...
+      array_push($errors, l10n('ce_no_unlink'));
+      return FALSE;
+  }
+  $success = TRUE;
+  foreach ($file_list as $file) {
+    $file = CE_PATH . $file;
+    if (file_exists($file)) {
+      // Remove obsolete file
+      $success &= unlink($file);
+    }
+  }
+  if (!$success) {
+      array_push($errors, l10n('ce_unlink_errors'));
+  }
+  return $success;
 }
 
Index: /extensions/CommentEditor/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/CommentEditor/language/en_UK/plugin.lang.php	(revision 3472)
+++ /extensions/CommentEditor/language/en_UK/plugin.lang.php	(revision 3473)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: plugin.lang.php,v 1.5 2009/06/26 14:40:27 Criss Exp $ */
+/* $Id: plugin.lang.php,v 1.6 2009/06/29 11:43:18 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 global $lang;
@@ -22,4 +22,7 @@
 // ==================================================================
 // Config
+$lang['ce_inconsistent_version'] = '%s: inconsistent version numbers';
+$lang['ce_no_unlink'] = 'Function \'unlink\' not available...';
+$lang['ce_unlink_errors'] = 'Error occured during file deletion';
 $lang['ce_config_saved'] = 'Configuration successfully saved';
 $lang['ce_config_saved_with_errors'] = 'Configuration saved with errors';
Index: /extensions/CommentEditor/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/CommentEditor/language/fr_FR/plugin.lang.php	(revision 3472)
+++ /extensions/CommentEditor/language/fr_FR/plugin.lang.php	(revision 3473)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: plugin.lang.php,v 1.6 2009/06/26 14:40:27 Criss Exp $ */
+/* $Id: plugin.lang.php,v 1.7 2009/06/29 11:43:18 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 global $lang;
@@ -21,4 +21,7 @@
 // ==================================================================
 // Config
+$lang['ce_inconsistent_version'] = '%s : numéros de version incohérentes';
+$lang['ce_no_unlink'] = 'La fonction \'unlink\' n\'est pas disponible';
+$lang['ce_unlink_errors'] = 'Des erreurs ont eu lieu lors de la suppression de fichiers';
 $lang['ce_config_saved'] = 'Configuration sauvée avec succès';
 $lang['ce_config_saved_with_errors'] = 'Configuration sauvée mais avec des erreurs';
Index: /extensions/CommentEditor/language/it_IT/index.php
===================================================================
--- /extensions/CommentEditor/language/it_IT/index.php	(revision 3472)
+++ /extensions/CommentEditor/language/it_IT/index.php	(revision 3473)
@@ -5,7 +5,7 @@
 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
 // +-----------------------------------------------------------------------+
-// | file          : $Id: index.php,v 1.1 2009/06/15 21:42:12 cmarchad Exp $
-// | last update   : $Date: 2009/06/15 21:42:12 $
-// | last modifier : $Author: cmarchad $
+// | file          : $Id: index.php,v 1.1 2009/06/29 11:51:59 Criss Exp $
+// | last update   : $Date: 2009/06/29 11:51:59 $
+// | last modifier : $Author: Criss $
 // | revision      : $Revision: 1.1 $
 // +-----------------------------------------------------------------------+
Index: /extensions/CommentEditor/language/it_IT/plugin.lang.php
===================================================================
--- /extensions/CommentEditor/language/it_IT/plugin.lang.php	(revision 3472)
+++ /extensions/CommentEditor/language/it_IT/plugin.lang.php	(revision 3473)
@@ -1,16 +1,38 @@
 <?php
-/* $Id: plugin.lang.php,v 1.4 2009/06/22 22:18:12 Criss Exp $ */
+/* $Id: plugin.lang.php,v 1.1 2009/06/29 11:51:59 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 global $lang;
 
-
+// ==================================================================
+// Edit block
 $lang['comment_edit'] = 'Edizione dei commenti';
 $lang['comment_author'] = 'Autore';
 $lang['comment_author_free'] = 'Scelta libera del\'autore';
 $lang['comment_content'] = 'Commento';
+//$lang['comment_edit_tool'] = ''; // TODO
 
+
+// ==================================================================
+// Message block
 $lang[CE_TYPE_INFO] = 'Informazione';
 $lang[CE_TYPE_ERROR] = 'Errore';
 $lang['comment_edit_forbidden'] = 'Non siete autorizati ad editare questo commento';
 $lang['comment_access_invalid'] = 'Accesso invalido';
+
+// ==================================================================
+// Config
+//$lang['ce_inconsistent_version'] = '%s : '; // TODO
+//$lang['ce_no_unlink'] = ''; // TODO
+//$lang['ce_unlink_errors'] = ''; // TODO
+//$lang['ce_config_saved'] = ''; // TODO
+//$lang['ce_config_saved_with_errors'] = ''; // TODO
+//$lang['ce_button_submit'] = ''; // TODO
+
+// ==================================================================
+// Config tab
+//$lang['ce_tab_config'] = ''; // TODO
+//$lang['ce_config_desc'] = ''; // TODO
+//$lang['ce_label_config'] = ''; // TODO
+//$lang['ce_label_display_info'] = ''; // TODO
+//$lang['ce_label_display_error'] = ''; // TODO
 ?>
Index: /extensions/CommentEditor/main.inc.php
===================================================================
--- /extensions/CommentEditor/main.inc.php	(revision 3472)
+++ /extensions/CommentEditor/main.inc.php	(revision 3473)
@@ -1,7 +1,7 @@
 <?php
-/* $Id: main.inc.php,v 1.15 2009/06/26 14:42:03 Criss Exp $ */
+/* $Id: main.inc.php,v 1.17 2009/06/29 11:51:59 Criss Exp $ */
 /*
  Plugin Name: Comment Editor
- Version: 1.0.i
+ Version: 1.0.j
  Description: Allow to edit comment
  Plugin URI: http://piwigo.org/ext/extension_view.php?eid=296
@@ -11,4 +11,7 @@
 
 /** History **
+  2009-06-29 1.0.j
+                    Add obsolete files management
+                    Add italian language (thanks to Rio)
 
   2009-06-26 1.0.i
@@ -50,5 +53,4 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-define('CE_VERSION',  '1.0.i');
 define('CE_PATH',     PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
 define('CE_ROOT',     dirname(__FILE__).'/');
Index: /extensions/CommentEditor/maintain.inc.php
===================================================================
--- /extensions/CommentEditor/maintain.inc.php	(revision 3472)
+++ /extensions/CommentEditor/maintain.inc.php	(revision 3473)
@@ -10,10 +10,22 @@
 }
 
-function plugin_install($plugin_id) {
+function plugin_install($plugin_id, $version, &$errors) {
   include_once(CE_PATH . 'include/ce_common.inc.php');
+  // Include language advices
+  load_language('plugin.lang', CE_PATH);
+  if ($version != CE_VERSION) {
+      array_push($errors, sprintf(l10n('ce_inconsistent_version'), $plugin_id));
+      return;
+  }
+  $clean = ce_clean_obsolete_files(CE_OBSOLETE);
+  $ce_config_default[CE_CFG_VERSION] = $version;
   $install = CE_Config::install($plugin_id, $ce_config_default);
 }
 
-function plugin_activate($plugin_id) {
+function plugin_activate($plugin_id, $version, &$errors) {
+  // Nothing special
+}
+
+function plugin_deactivate($plugin_id) {
   // Nothing special
 }
@@ -23,3 +35,4 @@
   $uninstall = CE_Config::uninstall($plugin_id);
 }
+
 ?>
Index: /extensions/CommentEditor/obsolete.list
===================================================================
--- /extensions/CommentEditor/obsolete.list	(revision 3473)
+++ /extensions/CommentEditor/obsolete.list	(revision 3473)
@@ -0,0 +1,1 @@
+include/edit.css
