Index: extensions/CommentEditor/admin/config.tab.php
===================================================================
--- extensions/CommentEditor/admin/config.tab.php	(revision 3462)
+++ extensions/CommentEditor/admin/config.tab.php	(revision 3462)
@@ -0,0 +1,37 @@
+<?php
+/* $Id: config.tab.php,v 1.1 2009/06/26 08:56:33 Criss Exp $ */
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+check_status(ACCESS_ADMINISTRATOR);
+if (isset($_POST['submit'])) {
+    $new_value = false;
+    if (isset($_POST['ce_display_info'])) {
+        if ("1" == $_POST['ce_display_info']) {
+            $new_value = true;
+        }
+    }
+    $ce_config->setValue(CE_CFG_DISPLAY_INFO, $new_value);
+    $new_value = false;
+    if (isset($_POST['ce_display_error'])) {
+        if ("1" == $_POST['ce_display_error']) {
+            $new_value = true;
+        }
+    }
+    $ce_config->setValue(CE_CFG_DISPLAY_ERROR, $new_value);
+
+
+    // Save config
+    $saved = $ce_config->saveConfig();
+    global $page;
+    if ($saved) {
+        array_push($page['infos'], l10n('ce_config_saved'));
+    } else {
+        array_push($page['errors'], l10n('ce_config_saved_with_errors'));
+    }
+}
+
+$template->assign('display_info',
+  ($ce_config->getValue(CE_CFG_DISPLAY_INFO))? CE_CHECKED:'');
+$template->assign('display_error',
+  ($ce_config->getValue(CE_CFG_DISPLAY_ERROR))? CE_CHECKED:'');
+
+?>
Index: extensions/CommentEditor/admin/index.php
===================================================================
--- extensions/CommentEditor/admin/index.php	(revision 3462)
+++ extensions/CommentEditor/admin/index.php	(revision 3462)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php,v 1.1 2009/06/26 08:56:33 Criss Exp $
+// | last update   : $Date: 2009/06/26 08:56:33 $
+// | last modifier : $Author: Criss $
+// | revision      : $Revision: 1.1 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/CommentEditor/admin/template/config.tab.tpl
===================================================================
--- extensions/CommentEditor/admin/template/config.tab.tpl	(revision 3462)
+++ extensions/CommentEditor/admin/template/config.tab.tpl	(revision 3462)
@@ -0,0 +1,27 @@
+{* $Id: config.tab.tpl,v 1.1 2009/06/26 08:56:33 Criss Exp $ *}
+<div class="titrePage">
+    <h2>{$CE.title} [{$CE.version}]<br>{'ce_tab_config'|@translate}</h2>
+</div>
+<h3>{'ce_config_desc'|@translate}</h3>
+<form method="post" action="{$CE_F_ACTION}" id="update" enctype="multipart/form-data">
+<fieldset>
+  <legend>{'ce_label_config'|@translate}</legend>
+  <ul>
+    <li>
+      <label>
+        <input type="checkbox" name="ce_display_info" value="1" {$display_info} />
+        {'ce_label_display_info'|@translate}
+      </label>
+    </li>
+    <li>
+      <label>
+        <input type="checkbox" name="ce_display_error" value="1" {$display_error} />
+        {'ce_label_display_error'|@translate}
+      </label>
+    </li>
+  </ul>
+  
+</fieldset>
+{* ----------- CONFIGURATION ----------- *}
+<p><input class="submit" type="submit" value="{'button_submit'|@translate}" name="submit"></p>
+</form>
Index: extensions/CommentEditor/admin/template/index.php
===================================================================
--- extensions/CommentEditor/admin/template/index.php	(revision 3462)
+++ extensions/CommentEditor/admin/template/index.php	(revision 3462)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php,v 1.1 2009/06/26 08:56:33 Criss Exp $
+// | last update   : $Date: 2009/06/26 08:56:33 $
+// | last modifier : $Author: Criss $
+// | revision      : $Revision: 1.1 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/CommentEditor/administration.php
===================================================================
--- extensions/CommentEditor/administration.php	(revision 3462)
+++ extensions/CommentEditor/administration.php	(revision 3462)
@@ -0,0 +1,61 @@
+<?php
+/* $Id: administration.php,v 1.1 2009/06/26 08:56:32 Criss Exp $ */
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+$config_tabs[]='config';
+
+global $template, $page;
+// Include language advices
+load_language('plugin.lang', CE_PATH);
+
+$ce_plugin = get_plugin_data($plugin_id);
+$ce_config = $ce_plugin->getConfig();
+
+// Tabs management
+if (!isset($_GET['tab'])) {
+    $page['tab'] = $config_tabs[0];
+} else {
+    $page['tab'] = $_GET['tab'];
+}
+
+if (!in_array($page['tab'], $config_tabs)) {
+    $page['tab'] = $config_tabs[0];
+}
+
+
+$base_admin_url = get_admin_plugin_menu_link(__FILE__);
+
+$tabsheet = new tabsheet();
+
+foreach ($config_tabs as $current_tab) {
+    $tab_name = 'tab_'.$current_tab;
+    $tabsheet->add($current_tab,
+                   l10n($tab_name),
+                   $base_admin_url.'&amp;tab='.$current_tab);
+}
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// Define common values
+$template->set_filenames(array(
+                            'plugin_admin_content' => CE_AMDIN_TPL
+                                                      . $page['tab']
+                                                      . '.tab.tpl'
+                          )
+                      );
+
+
+// Define common values
+$ce_common = array(
+    'version' => CE_VERSION,
+    'title'   => $ce_plugin->plugin_id,
+);
+$template->assign('CE', $ce_common);
+
+// Include specific tab
+include_once (CE_ADMIN . $page['tab'] . '.tab.php');
+
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: extensions/CommentEditor/classes/ce_comment.class.php
===================================================================
--- extensions/CommentEditor/classes/ce_comment.class.php	(revision 3443)
+++ extensions/CommentEditor/classes/ce_comment.class.php	(revision 3462)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: ce_comment.class.php,v 1.5 2009/06/18 14:48:19 Criss Exp $ */
+/* $Id: ce_comment.class.php,v 1.6 2009/06/26 08:56:33 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
@@ -7,90 +7,90 @@
  */
 class CE_Comment {
-    var $id;
-    var $infos = array();
-    var $query;
-    private static $s_user_list = null;
+  var $id;
+  var $infos = array();
+  var $query;
+  private static $s_user_list = null;
 
-    private static function updateUsers() {
-        $users = array();
-        $query = '
-            SELECT username
-            FROM '. USERS_TABLE .'
-            ORDER BY username';
-        $result = pwg_query( $query );
-        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
-            $users = array_merge($users, array($row['username'] => $row['username']));
+  private static function updateUsers() {
+    $users = array();
+    $query = '
+      SELECT username
+      FROM '. USERS_TABLE .'
+      ORDER BY username';
+    $result = pwg_query( $query );
+    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
+      $users = array_merge($users, array($row['username'] => $row['username']));
+    }
+    return $users;
+  }
+
+  static function getUsers() {
+    if (null == self::$s_user_list) {
+      // Init user list
+      self::$s_user_list = self::updateUsers();
+    }
+    return self::$s_user_list;
+  }
+
+  function CE_Comment($comment_id) {
+    $this->id = $comment_id;
+    $this->query = '
+      SELECT com.id AS comment_id
+         , com.image_id
+         , com.author
+         , com.date
+         , com.content
+         , com.validated
+        FROM '.COMMENTS_TABLE.' AS com
+        WHERE com.id = ' . $comment_id;
+    $result = pwg_query($this->query);
+    $this->infos = mysql_fetch_array($result, MYSQL_ASSOC);
+  }
+
+  function validateAuthor($author) {
+    $user_list = self::getUsers();
+    if (array_key_exists( strtolower($author),
+                          array_change_key_case($user_list, CASE_LOWER))) {
+      // Look in user list to have right case !
+      foreach ($user_list as $user) {
+        if (0 == strcasecmp($author, $user)) {
+          return $user;
         }
-        return $users;
+      }
     }
+    return $author;
+  }
 
-    static function getUsers() {
-        if (null == self::$s_user_list) {
-            // Init user list
-            self::$s_user_list = self::updateUsers();
-        }
-        return self::$s_user_list;
+  function isKnownAuthor() {
+    if (in_array($this->infos['author'], self::getUsers())) {
+      return true;
     }
+    return false;
+  }
 
-    function CE_Comment($comment_id) {
-        $this->id = $comment_id;
-        $this->query = '
-            SELECT com.id AS comment_id
-                 , com.image_id
-                 , com.author
-                 , com.date
-                 , com.content
-                 , com.validated
-              FROM '.COMMENTS_TABLE.' AS com
-              WHERE com.id = ' . $comment_id;
-        $result = pwg_query($this->query);
-        $this->infos = mysql_fetch_array($result, MYSQL_ASSOC);
+  function setInfo($key, $value) {
+    if (null == $key) {
+      return;
     }
+    $this->infos[$key] = $value;
+  }
 
-    function validateAuthor($author) {
-        $user_list = self::getUsers();
-        if (array_key_exists(   strtolower($author),
-                                array_change_key_case($user_list, CASE_LOWER))) {
-            // Look in user list to have right case !
-            foreach ($user_list as $user) {
-                if (0 == strcasecmp($author, $user)) {
-                    return $user;
-                }
-            }
-        }
-        return $author;
+  function getInfo($key = null) {
+    if (null == $key) {
+      return $this->infos;
     }
+    return $this->infos[$key];
+  }
 
-    function isKnownAuthor() {
-        if (in_array($this->infos['author'], self::getUsers())) {
-            return true;
-        }
-        return false;
+  function isAuthor($user) {
+    if (!isset ($this->infos['author'])) {
+      return false;
     }
+    return (0 == strcmp($this->infos['author'], $user))?true:false;
+  }
 
-    function setInfo($key, $value) {
-        if (null == $key) {
-            return;
-        }
-        $this->infos[$key] = $value;
-    }
-
-    function getInfo($key = null) {
-        if (null == $key) {
-            return $this->infos;
-        }
-        return $this->infos[$key];
-    }
-
-    function isAuthor($user) {
-        if (!isset ($this->infos['author'])) {
-            return false;
-        }
-        return (0 == strcmp($this->infos['author'], $user))?true:false;
-    }
-
-    function __toString() {
-        return print_r($this->infos, true);
-    }
+  function __toString() {
+    return print_r($this->infos, true);
+  }
 }
 ?>
Index: extensions/CommentEditor/classes/ce_config.class.php
===================================================================
--- extensions/CommentEditor/classes/ce_config.class.php	(revision 3462)
+++ extensions/CommentEditor/classes/ce_config.class.php	(revision 3462)
@@ -0,0 +1,116 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+/**
+ * CE_Config class
+ */
+class CE_Config {
+
+  var $config_values;
+  var $default_config;
+
+  /* ************************ */
+  /* ** Constructor        ** */
+  /* ************************ */
+
+  function CE_Config($default_config = array()) {
+    $this->default_config = $default_config;
+  }
+
+  /* ************************ */
+  /* ** Get/Set methods    ** */
+  /* ************************ */
+
+  function getValue($key) {
+      if (isset($this->config_values[$key])) {
+          return $this->config_values[$key];
+      }
+      return null;
+  }
+
+  function setValue($key, $value) {
+      $this->config_values[$key] = $value;
+  }
+
+  /* ************************ */
+  /* ** Loading methods    ** */
+  /* ************************ */
+
+  function loadConfig() {
+    $query = '
+        SELECT value
+        FROM '.CONFIG_TABLE.'
+        WHERE param = \''.CE_CFG_DB_KEY.'\'
+        ;';
+    $result = pwg_query($query);
+    if($result) {
+      $row = mysql_fetch_row($result);
+      if(is_string($row[0])) {
+        $this->config_values = unserialize($row[0]);
+      }
+    }
+    $this->loadDefaultConfig();
+  }
+
+  private function loadDefaultConfig() {
+    foreach ($this->default_config as $key => $value) {
+      if (!isset($this->config_values[$key])) {
+        $this->config_values[$key] = $value;
+      }
+    }
+  }
+
+  /* ************************ */
+  /* ** Saving  methods    ** */
+  /* ************************ */
+
+  function saveConfig() {
+    $query = '
+        REPLACE INTO '.CONFIG_TABLE.'
+        VALUES(
+          \''.CE_CFG_DB_KEY.'\',
+          \''.serialize($this->config_values).'\',
+          \''. CE_CFG_DB_COMMENT . '\')
+        ;';
+    $result = pwg_query($query);
+    if($result) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  /* ************************ */
+  /* ** Maintain  methods  ** */
+  /* ************************ */
+
+  static function install($plugin_id, $default_config = array()) {
+    $query = '
+        REPLACE INTO '.CONFIG_TABLE.'
+        VALUES(
+          \''.$plugin_id.'\',
+          \''.serialize($default_config).'\',
+          \'Factory settings for '. $plugin_id . '\')
+        ;';
+    $result = pwg_query($query);
+    if($result) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  static function uninstall($plugin_id) {
+    $query = '
+        DELETE FROM '.CONFIG_TABLE.'
+        WHERE param = \''.$plugin_id.'\'
+        ;';
+    $result = pwg_query($query);
+    if($result) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+}
+?>
Index: extensions/CommentEditor/classes/ce_plugin.class.php
===================================================================
--- extensions/CommentEditor/classes/ce_plugin.class.php	(revision 3443)
+++ extensions/CommentEditor/classes/ce_plugin.class.php	(revision 3462)
@@ -1,7 +1,5 @@
 <?php
-/* $Id: ce_plugin.class.php,v 1.8 2009/06/22 22:18:14 Criss Exp $ */
+/* $Id: ce_plugin.class.php,v 1.11 2009/06/26 09:17:01 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-ce_require_class("CE_Comment");
 
 /**
@@ -10,353 +8,425 @@
 class CE_Plugin {
 
-    var $comments_ids;
-
-    /* ************************ */
-    /* ** Trigger management ** */
-    /* ************************ */
-
-    /**
-     * Update comment ID array
-     */
-    function render_comment_content($content) {
-        $author = null;
-        $id = null;
-        switch (script_basename()) {
-            case "comments":
-                global $comment;
-                $author = $comment['author'];
-                $id = $comment['comment_id'];
-                break;
-            case "picture":
-                global $row;
-                $author = $row['author'];
-                $id = $row['id'];
-                break;
-            default:
-                // Not in right script
-                return $content;
-        }
-        global $template, $user;
-        if ((!is_a_guest() and ($user['username'] == $author))
-            or is_admin()) {
-            $key = count($template->get_template_vars('comments'));
-            $this->comments_ids[$key] = $id;
-        }
+  var $comments_ids;
+  var $config;
+  var $plugin_id;
+
+  /* ************************ */
+  /* ** Constructor        ** */
+  /* ************************ */
+
+  function CE_Plugin($plugin_id, $config = null) {
+    $this->plugin_id = $plugin_id;
+    $this->config = $config;
+    if (null != $this->config) {
+      $this->config->loadConfig();
+    }
+  }
+
+  function getConfig() {
+    return $this->config;
+  }
+
+  /* ************************ */
+  /* ** Trigger management ** */
+  /* ************************ */
+
+  function get_admin_plugin_menu_links($menu) {
+    array_push(
+        $menu,
+        array(
+            'NAME' => $this->plugin_id,
+            'URL' => $this->get_plugin_admin_url()
+        )
+    );
+    return $menu;
+  }
+
+  /**
+   * Update comment ID array
+   */
+  function render_comment_content($content) {
+    $author = null;
+    $id = null;
+    switch (script_basename()) {
+      case "comments":
+        global $comment;
+        $author = $comment['author'];
+        $id = $comment['comment_id'];
+        break;
+      case "picture":
+        global $row;
+        $author = $row['author'];
+        $id = $row['id'];
+        break;
+      default:
+        // Not in right script
         return $content;
     }
-
-    /**
-     * Check whether the page contains comments.
-     * Add an edit link if user is allowed to edit comment
-     */
-    function loc_begin_page_header() {
-        global $template;
-        $comments = $template->get_template_vars('comments');
-        if (!isset($comments) or (null == $comments)) {
-            // No comment...
-            return;
-        }
-        foreach ($comments as $key => $value) {
-            if (isset($this->comments_ids[$key])) {
-                // User allowed to have edit link
-                $current_id = $this->comments_ids[$key];
-                $comments[$key]['U_ID'] =  $current_id;
-                $comments[$key]['DATE'] .= ' - <a href="';
-                $comments[$key]['DATE'] .= $this->getEditUrl($current_id);
-                $comments[$key]['DATE'] .= '">';
-                $comments[$key]['DATE'] .= 'Edit';
-                $comments[$key]['DATE'] .= '</a>';
-            }
-        }
-        $template->assign('comments', $comments);
-    }
-
-    /**
-     * Check whether a comment edit or update is requested.
-     */
-    function loc_begin_index() {
-        $comment_id = "";
-        $action = $this->isCommentEdit($_SERVER['QUERY_STRING'], $comment_id);
-        switch ($action) {
+    global $template, $conf, $user;
+    if ((!is_a_guest() and ($user[$conf['user_fields']['username']] == $author))
+        or is_admin()) {
+      $key = count($template->get_template_vars('comments'));
+      $this->comments_ids[$key] = $id;
+    }
+    return $content;
+  }
+
+  /**
+   * Check whether the page contains comments.
+   * Add an edit link if user is allowed to edit comment
+   */
+  function loc_begin_page_header() {
+    global $template;
+    $comments = $template->get_template_vars('comments');
+    if (!isset($comments) or (null == $comments)) {
+      // No comment...
+      return;
+    }
+    // Include language advices
+    load_language('plugin.lang', CE_PATH);
+    foreach ($comments as $key => $value) {
+      if (isset($this->comments_ids[$key])) {
+        // User allowed to have edit link
+        $current_id = $this->comments_ids[$key];
+        $comments[$key]['U_ID'] =  $current_id;
+        $comments[$key]['DATE'] .= ' - <a href="';
+        $comments[$key]['DATE'] .= $this->getEditUrl($current_id);
+        $comments[$key]['DATE'] .= '">';
+        $comments[$key]['DATE'] .= l10n('comment_edit_tool');
+        $comments[$key]['DATE'] .= '</a>';
+      }
+    }
+    $template->assign('comments', $comments);
+  }
+
+  /**
+   * Check whether a comment edit or update is requested.
+   */
+  function loc_begin_index() {
+    $this->doAction();
+  }
+
+  function loc_begin_picture() {
+    $this->doAction();
+  }
+
+  /* ************************ */
+  /* ** Private functions  ** */
+  /* ************************ */
+
+  function doAction() {
+    $comment_id = "";
+    $action = $this->isCommentEdit($_SERVER['QUERY_STRING'], $comment_id);
+    switch ($action) {
+      case CE_ACTION_EDIT:
+        // Edit
+        $this->editComment($comment_id);
+        break;
+      case CE_ACTION_UPDATE:
+        $this->updateComment();
+        break;
+      case CE_ACTION_ERROR:
+        $infos = array('comment_edit_forbidden');
+        $this->displayError($infos);
+        break;
+      case CE_ACTION_NONE:
+        // Not an edit mode
+        break;
+    }
+  }
+
+  function getTemplate($p_template = 'edit.tpl') {
+    return realpath(CE_TEMPLATE . $p_template);
+  }
+
+  function isCommentEdit($p_query_string, &$p_comment_id) {
+    $params = split('\&', $p_query_string);
+    $action = CE_ACTION_NONE;
+    $comment_id = "";
+    foreach ($params as $current_param) {
+      $key_value = split('=', $current_param);
+      if (isset($key_value[1])) {
+        if (CE_ACTION == $key_value[0] && CE_ACTION_NONE == $action) {
+          switch ($key_value[1]) {
             case CE_ACTION_EDIT:
-                // Edit
-                $this->editComment($comment_id);
-                break;
             case CE_ACTION_UPDATE:
-                $this->updateComment();
-                break;
-            case CE_ACTION_ERROR:
-                $infos = array('comment_edit_forbidden');
-                $this->displayError($infos);
-                break;
-            case CE_ACTION_NONE:
-                // Not an edit mode
-                break;
-        }
-    }
-
-    /* ************************ */
-    /* ** Private functions  ** */
-    /* ************************ */
-
-    function getTemplate($p_template = 'edit.tpl') {
-        return realpath(CE_TEMPLATE . $p_template);
-    }
-
-    function isCommentEdit($p_query_string, &$p_comment_id) {
-        $params = split('\&', $p_query_string);
-        $action = CE_ACTION_NONE;
-        $comment_id = "";
-        foreach ($params as $current_param) {
-            $key_value = split('=', $current_param);
-            if (isset($key_value[1])) {
-                if (CE_ACTION == $key_value[0] && CE_ACTION_NONE == $action) {
-                    //CE_ACTION_EDIT == $lKeyVal[1]
-                    switch ($key_value[1]) {
-                        case CE_ACTION_EDIT:
-                        case CE_ACTION_UPDATE:
-                            $action = $key_value[1];
-                            break;
-                    }
-                }
-                if (CE_ID == $key_value[0]) {
-                    $comment_id = $key_value[1];
-                }
-            }
-        }
-        if (CE_ACTION_EDIT == $action) {
-            if (is_numeric($comment_id)) {
-                $p_comment_id = intval($comment_id);
-            } else {
-                $action = CE_ACTION_ERROR;
-            }
-        }
-        return $action;
-    }
-
-    function isEditAllowed($p_comment) {
-        if ((FALSE == $p_comment->getInfo()) or
-             is_a_guest()) {
-            return false;
-        }
-        if (is_admin() and !is_adviser()) {
-            return true;
-        }
-        global $user;
-        return $p_comment->isAuthor($user['username']);
-    }
-
-    function editComment($p_comment_id) {
-        //  Include language advices
-        load_language('plugin.lang', CE_PATH);
-
-        $comment = new CE_Comment($p_comment_id);
-        $infos = array();
-        if (!$this->isEditAllowed($comment)) {
-            // Not allowed
-            array_push($infos, 'comment_edit_forbidden');
-            $this->displayError($infos);
-            return;
-        }
-        $this->displayComment($comment);
-    }
-
-    function updateComment() {
-        //  Include language advices
-        load_language('plugin.lang', CE_PATH);
-
-        $infos = array();
-        if ((!isset($_POST['commentid'])) or
-            (!isset($_POST['imageid']))) {
-            array_push($infos, 'comment_access_invalid');
-            $this->displayError($infos);
-            return;
-        }
-        if (!is_numeric($_POST['imageid'])) {
-            array_push($infos, 'comment_access_invalid');
-            $this->displayError($infos);
-            return;
-        }
-        $comment = new CE_Comment($_POST['commentid']);
-
-        if (!$this->isEditAllowed($comment)) {
-            array_push($infos, 'comment_edit_forbidden');
-            $this->displayError($infos);
-            return;
-        }
-        $image_id = $comment->getInfo('image_id');
-        if (intval($_POST['imageid']) != intval($image_id)) {
-            array_push($infos, 'comment_access_invalid');
-            $this->displayError($infos);
-            return;
-        }
-        if (isset($_POST['author'])) {
-            $comment->setInfo('author', $_POST['author']);
-        } else if ((isset($_POST['freeauthorck'])) and
-                   (isset($_POST['freeauthor']))) {
-            // Free author
-            $new_author = trim(stripslashes($_POST['freeauthor']));
-            $new_author = $comment->validateAuthor($new_author);
-            $comment->setInfo('author', $new_author);
-        }
-
-        $comment_array = array(
-            'author'        => trim( stripslashes($comment->getInfo('author')) ),
-            'content'       => trim( stripslashes($_POST['content']) ),
-            'image_id'      => $image_id,
-            'comment_id'    => $comment->getInfo('comment_id'),
-        );
-
-        // Deactivate anti-flood system
-        global $conf;
-        $old_anti_flood = $conf['anti-flood_time'];
-        $conf['anti-flood_time'] = 0;
-
-        $comment_action = update_user_comment($comment_array, @$_POST['key'], $infos );
-
-        // Reactivate anti-flood system
-        $conf['anti-flood_time'] = $old_anti_flood;
-
-        switch ($comment_action) {
-            case 'moderate':
-              array_push( $infos, 'comment_to_validate' );
-            case 'validate':
-              array_push( $infos, 'comment_added');
-              break;
-            case 'reject':
-              set_status_header(403);
-              array_push($infos, 'comment_not_added' );
+              $action = $key_value[1];
               break;
             default:
-              trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
+          }
         }
-        // allow plugins to notify what's going on
-        trigger_action( 'user_comment_insertion',
-                        array_merge($comment_array, array('action'=>$comment_action)));
-        if ($comment_action=='reject') {
-            $this->displayError($infos);
-        } else {
-            $this->displayInfo($infos);
+        if (CE_ID == $key_value[0]) {
+          $comment_id = $key_value[1];
         }
-    }
-
-    function getCommentId($p_string_delete) {
-        $comment_id = "";
-        $elements = split('\?', $p_string_delete);
-        if (count($elements) > 1) {
-            $elem_var = split('\&amp;', $elements[1]);
-            foreach ($elem_var as $var) {
-                $key_value = split('=', $var);
-                if (count($key_value) > 1) {
-                    switch ($key_value[0]) {
-                        case 'comment_to_delete':
-                        case 'delete':
-                            $comment_id = $key_value[1];
-                            break;
-                        default:
-                            // No ID
-                    }
-                }
-            }
+      }
+    }
+    if (CE_ACTION_EDIT == $action) {
+      if (is_numeric($comment_id)) {
+        $p_comment_id = intval($comment_id);
+      } else {
+        $action = CE_ACTION_ERROR;
+      }
+    }
+    return $action;
+  }
+
+  function isEditAllowed($p_comment) {
+    if ((FALSE == $p_comment->getInfo()) or
+        is_a_guest()) {
+      return false;
+    }
+    if (is_admin() and !is_adviser()) {
+      return true;
+    }
+    global $conf, $user;
+    return $p_comment->isAuthor($user[$conf['user_fields']['username']]);
+  }
+
+  function editComment($p_comment_id) {
+    $comment = new CE_Comment($p_comment_id);
+    $infos = array();
+    if (!$this->isEditAllowed($comment)) {
+      // Not allowed
+      array_push($infos, 'comment_edit_forbidden');
+      $this->displayError($infos);
+      return;
+    }
+    $this->displayComment($comment);
+  }
+
+  function updateComment() {
+    $infos = array();
+    if ((!isset($_POST['ce_commentid'])) or
+        (!isset($_POST['ce_imageid']))) {
+      array_push($infos, 'comment_access_invalid');
+      $this->displayError($infos);
+      return;
+    }
+    if (!is_numeric($_POST['ce_imageid'])) {
+      array_push($infos, 'comment_access_invalid');
+      $this->displayError($infos);
+      return;
+    }
+    $comment = new CE_Comment($_POST['ce_commentid']);
+
+    if (!$this->isEditAllowed($comment)) {
+      array_push($infos, 'comment_edit_forbidden');
+      $this->displayError($infos);
+      return;
+    }
+    $image_id = $comment->getInfo('image_id');
+    if (intval($_POST['ce_imageid']) != intval($image_id)) {
+      array_push($infos, 'comment_access_invalid');
+      $this->displayError($infos);
+      return;
+    }
+    if (isset($_POST['ce_author'])) {
+      $comment->setInfo('author', $_POST['ce_author']);
+    } else if ((isset($_POST['ce_freeauthorck'])) and
+               (isset($_POST['ce_freeauthor']))) {
+      // Free author
+      $new_author = trim(stripslashes($_POST['ce_freeauthor']));
+      $new_author = $comment->validateAuthor($new_author);
+      $comment->setInfo('author', $new_author);
+    }
+
+    $comment_array = array(
+      'author'      => trim( stripslashes($comment->getInfo('author')) ),
+      'content'     => trim( stripslashes($_POST['ce_content']) ),
+      'image_id'    => $image_id,
+      'comment_id'  => $comment->getInfo('comment_id'),
+    );
+
+    // Deactivate anti-flood system
+    global $conf;
+    $old_anti_flood = $conf['anti-flood_time'];
+    $conf['anti-flood_time'] = 0;
+
+    $comment_action = update_user_comment($comment_array, @$_POST['key'], $infos );
+
+    // Reactivate anti-flood system
+    $conf['anti-flood_time'] = $old_anti_flood;
+
+    switch ($comment_action) {
+      case 'moderate':
+        array_push( $infos, 'comment_to_validate' );
+      case 'validate':
+        array_push( $infos, 'comment_added');
+        break;
+      case 'reject':
+        set_status_header(403);
+        array_push($infos, 'comment_not_added' );
+        break;
+      default:
+        trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
+    }
+
+    // allow plugins to notify what's going on
+    trigger_action( 'user_comment_insertion',
+                    array_merge($comment_array, array('action'=>$comment_action)));
+    if ($comment_action=='reject') {
+      $this->displayError($infos);
+    } else {
+      $this->displayInfo($infos);
+    }
+  }
+
+  function getCommentId($p_string_delete) {
+    $comment_id = "";
+    $elements = split('\?', $p_string_delete);
+    if (count($elements) > 1) {
+      $elem_var = split('\&amp;', $elements[1]);
+      foreach ($elem_var as $var) {
+        $key_value = split('=', $var);
+        if (count($key_value) > 1) {
+          switch ($key_value[0]) {
+            case 'comment_to_delete':
+            case 'delete':
+              $comment_id = $key_value[1];
+              break;
+            default:
+              // No ID
+          }
         }
-        return $comment_id;
-    }
-
-    function displayError($p_error) {
+      }
+    }
+    return $comment_id;
+  }
+
+  function displayError($p_error) {
+    if ($this->config->getValue(CE_CFG_DISPLAY_ERROR)) {
         $this->displayMessage($p_error, CE_TYPE_ERROR, CE_ERRORS);
     }
-
-    function displayInfo($p_info) {
-        $this->displayMessage($p_info, CE_TYPE_INFO, CE_INFOS);
-    }
-
-    function displayMessage($p_message, $p_type, $p_image) {
-        //  Include language advices
-        load_language('plugin.lang', CE_PATH);
-
-        $messages = array();
-        foreach ($p_message as $message) {
-            array_push($messages, l10n($message));
-        }
-        $message_array = array(
-            'TYPE'  => $p_type,
-            'IMG'   => $p_image,
-            'TITLE' => l10n($p_type),
-            'MSG'   => $messages
-        );
-
-        global $template;
-        if ("" == $template->get_template_vars('U_HOME')) {
-            $template->assign('U_HOME', make_index_url());
-        }
-        $template->set_filenames(array('ce_message'=>$this->getTemplate('message.tpl')));
-        $template->block_html_head( '',
-                                    '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">',
-                                    $smarty, $repeat);
-        $begin = 'PLUGIN_INDEX_CONTENT_BEFORE';
-        $template->assign('message', $message_array);
-        $old_begin = $template->get_template_vars($begin);
-        $template->assign($begin, $template->parse('ce_message', true));
-        $template->concat($begin, $old_begin);
-    }
-
-    function displayComment($p_comment) {
-        global $template;
-        $template->set_filenames(array('ce_edit'=>$this->getTemplate()));
-        $template->block_html_head( '',
-                                    '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">',
-                                    $smarty, $repeat);
+  }
+
+  function displayInfo($p_info) {
+    if ($this->config->getValue(CE_CFG_DISPLAY_INFO)) {
+      $this->displayMessage($p_info, CE_TYPE_INFO, CE_INFOS);
+    }
+  }
+
+  function displayMessage($p_message, $p_type, $p_image) {
+    // Include language advices
+    load_language('plugin.lang', CE_PATH);
+
+    $messages = array();
+    foreach ($p_message as $message) {
+      array_push($messages, l10n($message));
+    }
+    $message_array = array(
+      'TYPE'  => $p_type,
+      'IMG'   => $p_image,
+      'TITLE' => l10n($p_type),
+      'MSG'   => $messages
+    );
+
+    global $template;
+    if ("" == $template->get_template_vars('U_HOME')) {
+      $template->assign('U_HOME', make_index_url());
+    }
+    $template->set_filenames(array('ce_message'=>$this->getTemplate('message.tpl')));
+    $template->block_html_head( '',
+                  '<link rel="stylesheet" type="text/css" href="'
+                  .CE_INCLUDE . $this->getScriptName() . '.css'
+                  .'">',
+    $smarty, $repeat);
+    if (!$this->setBeginEndFields($begin, $end)) {
+      return;
+    }
+
+    $template->assign('message', $message_array);
+    $old_begin = $template->get_template_vars($begin);
+    $template->assign($begin, $template->parse('ce_message', true));
+    $template->concat($begin, $old_begin);
+  }
+
+  function displayComment($p_comment) {
+    // Include language advices
+    load_language('plugin.lang', CE_PATH);
+
+    global $template;
+    $template->set_filenames(array('ce_edit'=>$this->getTemplate()));
+    $template->block_html_head( '',
+                  '<link rel="stylesheet" type="text/css" href="'
+                  .CE_INCLUDE . $this->getScriptName() . '.css'
+                  .'">',
+    $smarty, $repeat);
+
+    if (!$this->setBeginEndFields($begin, $end)) {
+      return;
+    }
+
+    $tpl_comment = array(
+      'CONTENT'   => $p_comment->getInfo('content'),
+      'KEY'       => $p_comment->getInfo('comment_id'),
+      'AUTHOR'    => $p_comment->getInfo('author'),
+      'IMAGE'     => $p_comment->getInfo('image_id'),
+      'DISABLED'  => !is_admin(),
+      'USERS'     => CE_Comment::getUsers(),
+      'F_ACTION'  => $this->getUpdateUrl(),
+      'FREEAUTHOR'=> ($p_comment->isKnownAuthor())?'':'checked="checked"'
+      );
+      if ("" == $template->get_template_vars('U_HOME')) {
+        $template->assign('U_HOME', make_index_url());
+      }
+      $template->assign('comment', $tpl_comment);
+      $old_begin = $template->get_template_vars($begin);
+      $template->assign($begin, $template->parse('ce_edit', true));
+      $template->concat($begin, $old_begin);
+  }
+
+  function setBeginEndFields(&$begin, &$end) {
+    switch (script_basename()) {
+      case 'index':
         $begin = 'PLUGIN_INDEX_CONTENT_BEFORE';
         $end = 'PLUGIN_INDEX_CONTENT_AFTER';
-        $template->assign($begin, null);
-        $template->assign($end, null);
-        $tpl_comment = array(
-            'CONTENT'   => $p_comment->getInfo('content'),
-            'KEY'       => $p_comment->getInfo('comment_id'),
-            'AUTHOR'    => $p_comment->getInfo('author'),
-            'IMAGE'     => $p_comment->getInfo('image_id'),
-            'DISABLED'  => !is_admin(),
-            'USERS'     => CE_Comment::getUsers(),
-            'F_ACTION'  => $this->getUpdateUrl(),
-            'FREEAUTHOR'=> ($p_comment->isKnownAuthor())?'':'checked="checked"'
-        );
-        if ("" == $template->get_template_vars('U_HOME')) {
-            $template->assign('U_HOME', make_index_url());
-        }
-        $template->assign('comment', $tpl_comment);
-        $template->concat($begin, $template->parse('ce_edit', true));
-
-    }
-
-    function getScriptName() {
-        // By now, still in index page
-        // return script_basename();
+        break;
+      case 'picture':
+        $begin = 'PLUGIN_PICTURE_BEFORE';
+        $end = 'PLUGIN_PICTURE_AFTER';
+        break;
+      default:
+        return FALSE;
+    }
+    return TRUE;
+  }
+
+  function getScriptName() {
+    switch (script_basename()) {
+      case 'index':
+      case 'picture':
+        return script_basename();
+      default:
         return 'index';
     }
-
-    function getEditUrl($comment_id) {
-        $url  = get_root_url() . $this->getScriptName() . '.php';
-        // By now, still in index pages without params
-        // $url .= get_query_string_diff(array(CE_ACTION, CE_ID));
-        $url = add_url_params(  $url,
-                                array(
-                                    CE_ACTION => CE_ACTION_EDIT,
-                                    CE_ID=>$comment_id
-                                )
-        );
-        return $url;
-    }
-
-    function getUpdateUrl() {
-        $url  = get_root_url() . script_basename() .'.php';
-        // By now, still in index pages without params
-        // $url .= get_query_string_diff(array(CE_ACTION, CE_ID));
-        $url = add_url_params(  $url,
-                                array(
-                                    CE_ACTION => CE_ACTION_UPDATE
-                                )
-        );
-        return $url;
-    }
+  }
+
+  function getEditUrl($comment_id) {
+    $url  = get_root_url() . $this->getScriptName() . '.php';
+    $url .= get_query_string_diff(array(CE_ACTION, CE_ID));
+    $url = add_url_params($url,
+                          array(
+                            CE_ACTION => CE_ACTION_EDIT,
+                            CE_ID=>$comment_id
+                          )
+            );
+    return $url;
+  }
+
+  function getUpdateUrl() {
+    $url  = get_root_url() . $this->getScriptName() .'.php';
+    $url .= get_query_string_diff(array(CE_ACTION, CE_ID));
+    $url = add_url_params($url,
+                          array(
+                            CE_ACTION => CE_ACTION_UPDATE
+                          )
+            );
+    return $url;
+  }
+
+  function get_plugin_admin_url() {
+    return get_admin_plugin_menu_link(CE_PATH . 'administration.php');
+  }
 
 }
Index: extensions/CommentEditor/include/ce_common.inc.php
===================================================================
--- extensions/CommentEditor/include/ce_common.inc.php	(revision 3443)
+++ extensions/CommentEditor/include/ce_common.inc.php	(revision 3462)
@@ -1,14 +1,19 @@
 <?php
-/* $Id: ce_common.inc.php,v 1.8 2009/06/22 22:18:13 Criss Exp $ */
+/* $Id: ce_common.inc.php,v 1.11 2009/06/26 09:49:27 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
+// Define constants
 define('CE_INCLUDE_DIR',   'include/');
 define('CE_CLASSES_DIR',   'classes/');
 define('CE_IMAGES_DIR',    'images/');
 define('CE_TEMPLATE_DIR',  'template/');
+define('CE_ADMIN_DIR',     'admin/');
+
 define('CE_CLASSES',       CE_PATH.CE_CLASSES_DIR);
 define('CE_INCLUDE',       CE_PATH.CE_INCLUDE_DIR);
 define('CE_TEMPLATE',      CE_PATH.CE_TEMPLATE_DIR);
-define('CE_STYLE',         CE_INCLUDE.'edit.css');
+define('CE_ADMIN',         CE_PATH.CE_ADMIN_DIR);
+define('CE_AMDIN_TPL',     CE_ROOT.CE_ADMIN_DIR.CE_TEMPLATE_DIR);
+
 define('CE_ERRORS',        CE_INCLUDE.'errors.png');
 define('CE_INFOS',         CE_INCLUDE.'infos.png');
@@ -27,6 +32,22 @@
 @include_once(CE_INCLUDE.'ce_functions.inc.php');
 
-// Load class file
+// Load class files
+ce_require_class("CE_Config");
+ce_require_class("CE_Comment");
 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');
+
+// Config default values
+$ce_config_default[CE_CFG_DISPLAY_ERROR]  = true;
+$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 3443)
+++ extensions/CommentEditor/include/ce_functions.inc.php	(revision 3462)
@@ -1,4 +1,4 @@
 <?php
-/* $Id: ce_functions.inc.php,v 1.3 2009/06/17 19:08:23 Criss Exp $ */
+/* $Id: ce_functions.inc.php,v 1.6 2009/06/26 08:56:32 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
@@ -9,5 +9,5 @@
  */
 function ce_require_class($aClassName) {
-    require_once CE_CLASSES .strtolower($aClassName) . '.class.php';
+  require_once CE_CLASSES .strtolower($aClassName) . '.class.php';
 }
 
@@ -72,5 +72,5 @@
   {
     if ( empty($comm['author'])) {
-        $comm['author'] = $user['username'];
+        $comm['author'] = $user[$conf['user_fields']['username']];
     }
   }
Index: extensions/CommentEditor/include/edit.css
===================================================================
--- extensions/CommentEditor/include/edit.css	(revision 3443)
+++ 	(revision )
@@ -1,27 +1,0 @@
-/* Comment edition */
-div#comments {
-	padding-top: 5px;
-	padding-bottom: 5px;
-}
-/* Message display */
-div.message-img, div.message-list {
-    float: left;
-	overflow: auto;
-}
-div.message-img {
-    padding-left: 10px;
-    padding-top: 5px;
-    padding-bottom: 5px;
-}
-ul.message-list {
-    list-style: none;
-}
-div#message-block {
-    overflow: auto;
-}
-div.message-error, div.message-info {
-    font-weight: bold;
-}
-div.message-error {
-	color: #ff0000;
-}
Index: extensions/CommentEditor/include/index.css
===================================================================
--- extensions/CommentEditor/include/index.css	(revision 3462)
+++ extensions/CommentEditor/include/index.css	(revision 3462)
@@ -0,0 +1,27 @@
+/* Comment edition */
+div#ce-comments {
+	padding-top: 5px;
+	padding-bottom: 5px;
+}
+/* Message display */
+div.ce-message-img, div.ce-message-list {
+  float: left;
+	overflow: auto;
+}
+div.ce-message-img {
+	padding-left: 10px;
+	padding-top: 5px;
+	padding-bottom: 5px;
+}
+ul.ce-message-list {
+  list-style: none;
+}
+div#ce-message-block {
+  overflow: auto;
+}
+div.ce-message-error, div.ce-message-info {
+  font-weight: bold;
+}
+div.ce-message-error {
+	color: #ff0000;
+}
Index: extensions/CommentEditor/include/picture.css
===================================================================
--- extensions/CommentEditor/include/picture.css	(revision 3462)
+++ extensions/CommentEditor/include/picture.css	(revision 3462)
@@ -0,0 +1,31 @@
+/* Comment edition */
+div#ce-comments {
+	padding-top: 5px;
+	padding-bottom: 5px;
+}
+div#ce-content {
+  margin: 0;
+}
+/* Message display */
+div.ce-message-img, div.ce-message-list {
+  float: left;
+	overflow: auto;
+}
+div.ce-message-img {
+	padding-left: 10px;
+	padding-top: 5px;
+	padding-bottom: 5px;
+}
+ul.ce-message-list {
+  list-style: none;
+}
+div#ce-message-block {
+  overflow: auto;
+  margin: 0;
+}
+div.ce-message-error, div.ce-message-info {
+  font-weight: bold;
+}
+div.ce-message-error {
+	color: #ff0000;
+}
Index: extensions/CommentEditor/language/en_UK/plugin.lang.php
===================================================================
--- extensions/CommentEditor/language/en_UK/plugin.lang.php	(revision 3443)
+++ extensions/CommentEditor/language/en_UK/plugin.lang.php	(revision 3462)
@@ -1,15 +1,35 @@
 <?php
-/* $Id: plugin.lang.php,v 1.3 2009/06/17 19:08:25 Criss Exp $ */
+/* $Id: plugin.lang.php,v 1.4 2009/06/26 08:56:33 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 global $lang;
 
+// ==================================================================
+// Edit block
 $lang['comment_edit'] = 'Comment edition';
 $lang['comment_author'] = 'Author';
 $lang['comment_author_free'] = 'Free choice of the author';
 $lang['comment_content'] = 'Comment';
+$lang['comment_edit_tool'] = 'Edit';
 
+
+// ==================================================================
+// Message block
 $lang[CE_TYPE_INFO] = 'Information';
 $lang[CE_TYPE_ERROR] = 'Error';
 $lang['comment_edit_forbidden'] = 'You are not allowed to edit this comment';
 $lang['comment_access_invalid'] = 'Invalid access';
+
+// ==================================================================
+// Config
+$lang['ce_config_saved'] = 'Configuration successfully saved';
+$lang['ce_config_saved_with_errors'] = 'Configuration saved with errors';
+
+// ==================================================================
+// Config tab
+$lang['ce_tab_config'] = 'Configuration';
+$lang['ce_config_desc'] = 'Plugin main configuration';
+$lang['ce_label_config'] = 'General configuration';
+$lang['ce_label_display_info'] = 'Display informative messages';
+$lang['ce_label_display_error'] = 'Display error messages';
+
 ?>
Index: extensions/CommentEditor/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/CommentEditor/language/fr_FR/plugin.lang.php	(revision 3443)
+++ extensions/CommentEditor/language/fr_FR/plugin.lang.php	(revision 3462)
@@ -1,16 +1,33 @@
 <?php
-/* $Id: plugin.lang.php,v 1.4 2009/06/22 22:18:12 Criss Exp $ */
+/* $Id: plugin.lang.php,v 1.5 2009/06/26 08:56:33 Criss Exp $ */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 global $lang;
 
-
+// ==================================================================
+// Edit block
 $lang['comment_edit'] = 'Edition de commentaire';
 $lang['comment_author'] = 'Auteur';
 $lang['comment_author_free'] = 'Choix libre de l\'auteur';
 $lang['comment_content'] = 'Commentaire';
+$lang['comment_edit_tool'] = 'Editer';
 
+// ==================================================================
+// Message block
 $lang[CE_TYPE_INFO] = 'Information';
 $lang[CE_TYPE_ERROR] = 'Erreur';
-$lang['comment_edit_forbidden'] = 'Vous n\'êtes pas autorisé à éditer ce commentaire';
+$lang['comment_edit_forbidden'] = 'Vous n\'êtes pas autorisé à  éditer ce commentaire';
 $lang['comment_access_invalid'] = 'Accès invalide';
+
+// ==================================================================
+// Config
+$lang['ce_config_saved'] = 'Configuration sauvée avec succès';
+$lang['ce_config_saved_with_errors'] = 'Configuration sauvée mais avec des erreurs';
+
+// ==================================================================
+// Config tab
+$lang['ce_tab_config'] = 'Configuration';
+$lang['ce_config_desc'] = 'Configuration principale du plugin';
+$lang['ce_label_config'] = 'Configuration générale';
+$lang['ce_label_display_info'] = 'Afficher les messages informatifs';
+$lang['ce_label_display_error'] = 'Afficher les messages d\'erreurs';
 ?>
Index: extensions/CommentEditor/main.inc.php
===================================================================
--- extensions/CommentEditor/main.inc.php	(revision 3443)
+++ extensions/CommentEditor/main.inc.php	(revision 3462)
@@ -1,7 +1,7 @@
 <?php
-/* $Id: main.inc.php,v 1.9 2009/06/22 22:18:14 Criss Exp $ */
+/* $Id: main.inc.php,v 1.13 2009/06/26 09:49:12 Criss Exp $ */
 /*
  Plugin Name: Comment Editor
- Version: 1.0.g
+ Version: 1.0.h
  Description: Allow to edit comment
  Plugin URI: http://piwigo.org/ext/extension_view.php?eid=296
@@ -12,46 +12,64 @@
 /** History **
 
-    2009-06-22 1.0.g
-                        Deactivate anti-flood on update
-                        Adviser can edit only its comments
-                        Language file converted in UTF-8
-                        Add home link in edit and message block title bar
+  2009-06-?? 1.0.h
+                    Display edit block on picture page if request comes
+                    from this page
+                    Add simple administration configuration management
+                    Add and remove default configuration from database
+                    on plugin install / uninstall
 
-    2009-06-22 1.0.f
-                        Add edit link for author even if he's not an admin
-                        Code cleanup
+  2009-06-22 1.0.g
+                    Deactivate anti-flood on update
+                    Adviser can edit only its comments
+                    Language file converted in UTF-8
+                    Add home link in edit and message block title bar
 
-    2009-06-18 1.0.e
-                        Check existence of function update_user_comment()
+  2009-06-22 1.0.f
+                    Add edit link for author even if he's not an admin
+                    Code cleanup
 
-    2009-06-18 1.0.d
-                        Improve sanity checking
+  2009-06-18 1.0.e
+                    Check existence of function update_user_comment()
 
-    2009-06-18 1.0.c
-                        Add maintain.inc.php file
-                        Fix bug in CE_Comment::validateAuthor()
+  2009-06-18 1.0.d
+                    Improve sanity checking
 
-    2009-06-18 1.0.b
-                        Fix plugin URI to be available in plugin update
-                        check page.
-                        Reduce code line size.
+  2009-06-18 1.0.c
+                    Add maintain.inc.php file
+                    Fix bug in CE_Comment::validateAuthor()
+
+  2009-06-18 1.0.b
+                    Fix plugin URI to be available in plugin update
+                    check page.
+                    Reduce code line size.
 
 */
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-define('CE_VERSION',       '1.0.g');
-define('CE_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
-define('CE_ROOT', dirname(__FILE__).'/');
+define('CE_VERSION',  '1.0.h');
+define('CE_PATH',     PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+define('CE_ROOT',     dirname(__FILE__).'/');
 include_once(CE_PATH . 'include/ce_common.inc.php');
 
+$ce_config = new CE_Config($ce_config_default);
+$ce_plugin = new CE_Plugin($plugin['id'], $ce_config);
 
-$ce_plugin = new CE_Plugin();
-add_event_handler(  'render_comment_content',
-                    array(&$ce_plugin, 'render_comment_content'));
-add_event_handler(  'loc_begin_page_header',
-                    array(&$ce_plugin, 'loc_begin_page_header'));
-add_event_handler(  'loc_begin_index',
-                    array(&$ce_plugin, 'loc_begin_index'), 1);
-
+add_event_handler('get_admin_plugin_menu_links',
+                  array(&$ce_plugin, 'get_admin_plugin_menu_links'));
+add_event_handler('render_comment_content',
+                  array(&$ce_plugin, 'render_comment_content'));
+add_event_handler('loc_begin_page_header',
+                  array(&$ce_plugin, 'loc_begin_page_header'));
+switch (script_basename()) {
+  case 'index':
+    add_event_handler('loc_begin_index',
+                      array(&$ce_plugin, 'loc_begin_index'), 1);
+    break;
+  case 'picture':
+    add_event_handler('loc_begin_picture',
+                      array(&$ce_plugin, 'loc_begin_picture'), 1);
+    break;
+  default:
+}
 set_plugin_data($plugin['id'], $ce_plugin);
 
Index: extensions/CommentEditor/maintain.inc.php
===================================================================
--- extensions/CommentEditor/maintain.inc.php	(revision 3443)
+++ extensions/CommentEditor/maintain.inc.php	(revision 3462)
@@ -1,15 +1,25 @@
 <?php
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
 
-function plugin_install() {
-    // Nothing special
+if (!defined('CE_PATH')) {
+  define('CE_PATH',     PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+}
+if (!defined('CE_ROOT')) {
+  define('CE_ROOT',     dirname(__FILE__).'/');
 }
 
-function plugin_activate() {
-    // Nothing special
+function plugin_install($plugin_id) {
+  include_once(CE_PATH . 'include/ce_common.inc.php');
+  $install = CE_Config::install($plugin_id, $ce_config_default);
+}
+
+function plugin_activate($plugin_id) {
+  // Nothing special
 }
 
 function plugin_uninstall($plugin_id) {
-    // Nothing special
+  include_once(CE_PATH . 'include/ce_common.inc.php');
+  $uninstall = CE_Config::uninstall($plugin_id);
 }
 ?>
Index: extensions/CommentEditor/template/edit.tpl
===================================================================
--- extensions/CommentEditor/template/edit.tpl	(revision 3443)
+++ extensions/CommentEditor/template/edit.tpl	(revision 3462)
@@ -1,57 +1,57 @@
-{* $Id: edit.tpl,v 1.4 2009/06/22 22:18:13 Criss Exp $ *}
+{* $Id: edit.tpl,v 1.7 2009/06/26 09:17:01 Criss Exp $ *}
 {if !$comment.DISABLED}
 <script type="text/javascript">
 function toggleDisabled(aToggle, aList1, aList2) {ldelim}
-    var lCheckBox = document.getElementById(aToggle);
-    var lList1 = document.getElementById(aList1);
-    var lList2 = document.getElementById(aList2);
-    lList1.disabled = lCheckBox.checked;
-    lList2.disabled = !lCheckBox.checked;
+  var lCheckBox = document.getElementById(aToggle);
+  var lList1 = document.getElementById(aList1);
+  var lList2 = document.getElementById(aList2);
+  lList1.disabled = lCheckBox.checked;
+  lList2.disabled = !lCheckBox.checked;
 }
 </script>
 {/if}        
-<div id="content" class="content">
-    <div class="titrePage">
-        <ul class="categoryActions">
-            <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li>
-        </ul>
-        <h2>{'comment_edit'|@translate}</h2>
-    </div>
-    <div id="comments">
-        <form  method="post" action="{$comment.F_ACTION}" class="filter" id="editComment">
-        <table>
-        <tr>
-            <td>{'comment_author'|@translate}</td>
-            {if $comment.DISABLED}
-            <td colspan="3">
-                <input type="text" name="author" disabled="disabled" value="{$comment.AUTHOR}">
-            {else}
-            <td>
-                {html_options name=author id=authorlist options=$comment.USERS selected=$comment.AUTHOR}
-            </td>
-            <td align="right">
-                <input type="checkbox" name="freeauthorck" id="freeauthorck" value="1" onchange="toggleDisabled('freeauthorck', 'authorlist', 'freeauthorfield');" {$comment.FREEAUTHOR}> {'comment_author_free'|@translate}
-            </td>
-            <td align="right">
-                <input type="text" name="freeauthor" id="freeauthorfield" value="{$comment.AUTHOR}" >
-                <script type="text/javascript">toggleDisabled('freeauthorck', 'authorlist', 'freeauthorfield');</script>
-            {/if}
-            </td>
-        </tr>
-        <tr>
-            <td>{'comment_content'|@translate}</td>
-            <td colspan="3">
-                <textarea name="content" id="contentid" rows="5" cols="80">{$comment.CONTENT}</textarea>
-            </td>
-        </tr>
-        <tr>
-            <td colspan="4" align="center">
-                <input type="hidden" name="imageid" value="{$comment.IMAGE}" />
-                <input type="hidden" name="commentid" value="{$comment.KEY}" />
-                <input class="submit" type="submit" value="{'Submit'|@translate}">
-            </td>
-        </tr>
-        </table>
-        </form>
-    </div>
+<div id="ce-content" class="content">
+  <div class="titrePage">
+    <ul class="categoryActions">
+      <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li>
+    </ul>
+  <h2>{'comment_edit'|@translate}</h2>
+  </div>
+  <div id="ce-comments">
+    <form  method="post" action="{$comment.F_ACTION}" class="filter" id="editComment">
+    <table>
+    <tr>
+      <td>{'comment_author'|@translate}</td>
+      {if $comment.DISABLED}
+      <td colspan="3">
+        <input type="text" name="ce_author" disabled="disabled" value="{$comment.AUTHOR}">
+      {else}
+      <td>
+        {html_options name=ce_author id=ce_authorlist options=$comment.USERS selected=$comment.AUTHOR}
+      </td>
+      <td align="right">
+        <input type="checkbox" name="ce_freeauthorck" id="ce_freeauthorck" value="1" onchange="toggleDisabled('ce_freeauthorck', 'ce_authorlist', 'ce_freeauthorfield');" {$comment.FREEAUTHOR}> {'comment_author_free'|@translate}
+      </td>
+      <td align="right">
+        <input type="text" name="ce_freeauthor" id="ce_freeauthorfield" value="{$comment.AUTHOR}" >
+        <script type="text/javascript">toggleDisabled('ce_freeauthorck', 'ce_authorlist', 'ce_freeauthorfield');</script>
+      {/if}
+      </td>
+    </tr>
+    <tr>
+      <td>{'comment_content'|@translate}</td>
+      <td colspan="3">
+        <textarea name="ce_content" id="ce_contentid" rows="5" cols="80">{$comment.CONTENT}</textarea>
+      </td>
+    </tr>
+    <tr>
+      <td colspan="4" align="center">
+        <input type="hidden" name="ce_imageid" value="{$comment.IMAGE}" />
+        <input type="hidden" name="ce_commentid" value="{$comment.KEY}" />
+        <input class="submit" type="submit" value="{'Submit'|@translate}">
+      </td>
+    </tr>
+    </table>
+    </form>
+  </div>
 </div>
Index: extensions/CommentEditor/template/message.tpl
===================================================================
--- extensions/CommentEditor/template/message.tpl	(revision 3443)
+++ extensions/CommentEditor/template/message.tpl	(revision 3462)
@@ -1,21 +1,21 @@
-{* $Id: message.tpl,v 1.4 2009/06/22 22:18:13 Criss Exp $ *}
-<div class="content" id="message-block">
-    <div class="titrePage">
-        <ul class="categoryActions">
-            <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li>
-        </ul>
-        <h2 id="message-header">{'CommentEditor'|@translate} - {$message.TITLE}</h2>
+{* $Id: message.tpl,v 1.6 2009/06/26 09:17:01 Criss Exp $ *}
+<div class="content" id="ce-message-block">
+  <div class="titrePage">
+    <ul class="categoryActions">
+      <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li>
+    </ul>
+    <h2 id="ce-message-header">{'CommentEditor'|@translate} - {$message.TITLE}</h2>
+  </div>
+  <div class="ce-message-{$message.TYPE}">
+    <div class="ce-message-img">
+      <img src="{$message.IMG}" alt="{$message.TITLE}" title="{$message.TITLE}" class="button">
     </div>
-    <div class="message-{$message.TYPE}">
-        <div class="message-img">
-            <img src="{$message.IMG}" alt="{$message.TITLE}" title="{$message.TITLE}" class="button">
-        </div>
-        <div class="message-list">
-            <ul class="message-list">
-                {foreach from=$message.MSG item=msg}
-                <li>{$msg}</li>
-                {/foreach}
-            </ul>
-        </div>
+    <div class="ce-message-list">
+      <ul class="ce-message-list">
+        {foreach from=$message.MSG item=msg}
+        <li>{$msg}</li>
+        {/foreach}
+      </ul>
     </div>
+  </div>
 </div>
