Index: extensions/photo_update/admin.php
===================================================================
--- extensions/photo_update/admin.php	(revision 16982)
+++ extensions/photo_update/admin.php	(revision 16982)
@@ -0,0 +1,131 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if( !defined("PHPWG_ROOT_PATH") )
+{
+  die ("Hacking attempt!");
+}
+
+include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+define('COMMUNITY_BASE_URL', get_root_url().'admin.php?page=plugin-community');
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+
+check_status(ACCESS_ADMINISTRATOR);
+
+// +-----------------------------------------------------------------------+
+// | Basic checks                                                          |
+// +-----------------------------------------------------------------------+
+
+$_GET['image_id'] = $_GET['tab'];
+
+check_input_parameter('image_id', $_GET, false, PATTERN_ID);
+
+$admin_photo_base_url = get_root_url().'admin.php?page=photo-'.$_GET['image_id'];
+
+// +-----------------------------------------------------------------------+
+// | Process form                                                          |
+// +-----------------------------------------------------------------------+
+
+load_language('plugin.lang', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+  
+if (isset($_FILES['photo_update']))
+{
+  include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
+  
+  if ($_FILES['photo_update']['error'] !== UPLOAD_ERR_OK)
+  {
+    $error_message = file_upload_error_message($_FILES['photo_update']['error']);
+
+    array_push(
+      $page['errors'],
+      $error_message
+      );
+  }
+  else
+  {
+    add_uploaded_file(
+      $_FILES['photo_update']['tmp_name'],
+      $_FILES['photo_update']['name'],
+      null,
+      null,
+      $_GET['image_id']
+      );
+
+    $page['photo_update_refresh_thumbnail'] = true;
+
+    array_push(
+      $page['infos'],
+      l10n('The photo was updated')
+      );
+  }
+}
+
+// +-----------------------------------------------------------------------+
+// | Tabs                                                                  |
+// +-----------------------------------------------------------------------+
+
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+$page['tab'] = 'update';
+
+$tabsheet = new tabsheet();
+$tabsheet->set_id('photo');
+$tabsheet->select('update');
+$tabsheet->assign();
+
+// +-----------------------------------------------------------------------+
+// |                             template init                             |
+// +-----------------------------------------------------------------------+
+
+$template->set_filenames(
+  array(
+    'plugin_admin_content' => dirname(__FILE__).'/admin.tpl'
+    )
+  );
+
+// retrieving direct information about picture
+$query = '
+SELECT *
+  FROM '.IMAGES_TABLE.'
+  WHERE id = '.$_GET['image_id'].'
+;';
+$row = pwg_db_fetch_assoc(pwg_query($query));
+
+$template->assign(
+  array(
+    'TN_SRC' => DerivativeImage::thumb_url($row).(isset($_FILES['photo_update']) ? '?'.time() : ''),
+    'TITLE' => render_element_name($row),
+    )
+  );
+
+// +-----------------------------------------------------------------------+
+// | sending html code                                                     |
+// +-----------------------------------------------------------------------+
+
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: extensions/photo_update/admin.tpl
===================================================================
--- extensions/photo_update/admin.tpl	(revision 16982)
+++ extensions/photo_update/admin.tpl	(revision 16982)
@@ -0,0 +1,21 @@
+<h2>{$TITLE} &#8250; {'Edit photo'|@translate} {$TABSHEET_TITLE}</h2>
+
+<fieldset>
+  <legend>{'Photo Update'|@translate}</legend>
+  <table>
+    <tr>
+      <td id="albumThumbnail">
+        <img src="{$TN_SRC}" alt="{'Thumbnail'|@translate}" class="Thumbnail">
+      </td>
+      <td style="vertical-align:top">
+        <form id="photo_update" method="post" action="" enctype="multipart/form-data">
+          <p style="text-align:left; margin-top:0;">
+            <strong>{'Select a file'|@translate}</strong><br>
+            <input type="file" size="60" name="photo_update">
+          </p>
+          <p style="text-align:left"><input class="submit" type="submit" value="{'Update'|@translate}" name="photo_update"></p>
+        </form>
+      </td>
+    </tr>
+  </table>
+</fieldset>
Index: extensions/photo_update/main.inc.php
===================================================================
--- extensions/photo_update/main.inc.php	(revision 16025)
+++ extensions/photo_update/main.inc.php	(revision 16982)
@@ -14,84 +14,16 @@
 }
 
-add_event_handler('loc_begin_admin', 'photo_update_add_form');
-function photo_update_add_form()
-{
-  global $template;
-
-  $template->set_prefilter('picture_modify', 'photo_update_add_form_prefilter');
-}
-
-function photo_update_add_form_prefilter($content, &$smarty)
-{
-  $search = '#<form id="associations"#';
-  $replacement = '
-<form id="photo_update" method="post" action="{$F_ACTION}" enctype="multipart/form-data">
-  <fieldset>
-    <legend>{\'Photo Update\'|@translate}</legend>
-
-    <p style="text-align:left" class="file"><input type="file" size="60" name="photo_update"></p>
-    <p style="text-align:left"><input class="submit" type="submit" value="{\'Update\'|@translate}" name="photo_update"></p>
-  </fieldset>
-</form>
-
-<form id="associations"
-';
-
-  return preg_replace($search, $replacement, $content);
-}
-
-add_event_handler('loc_begin_admin_page', 'photo_update_process_update');
-function photo_update_process_update()
-{
-  load_language('plugin.lang', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+add_event_handler('tabsheet_before_select','photo_update_add_tab', 50, 2);
+function photo_update_add_tab($sheets, $id)
+{  
+  if ($id == 'photo')
+  {
+    $sheets['update'] = array(
+      'caption' => l10n('Update'),
+      'url' => get_root_url().'admin.php?page=plugin-photo_update-'.$_GET['image_id'],
+      );
+  }
   
-  global $page, $template;
-  
-  if (isset($_FILES['photo_update']))
-  {
-    include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
-    
-    if ($_FILES['photo_update']['error'] !== UPLOAD_ERR_OK)
-    {
-      $error_message = file_upload_error_message($_FILES['photo_update']['error']);
-
-      array_push(
-        $page['errors'],
-        $error_message
-        );
-    }
-    else
-    {
-      check_status(ACCESS_ADMINISTRATOR);
-      check_input_parameter('image_id', $_GET, false, PATTERN_ID);
-
-      add_uploaded_file(
-        $_FILES['photo_update']['tmp_name'],
-        $_FILES['photo_update']['name'],
-        null,
-        null,
-        $_GET['image_id']
-        );
-
-      $page['photo_update_refresh_thumbnail'] = true;
-
-      $template->set_prefilter('picture_modify', 'photo_update_force_thumbnail_refresh_prefilter');
-
-      $template->assign('REFRESH_KEY', time());
-      
-      array_push(
-        $page['infos'],
-        l10n('The photo was updated')
-        );
-    }
-  }
-}
-
-function photo_update_force_thumbnail_refresh_prefilter($content, &$smarty)
-{
-  $search = '#<img src="{\$TN_SRC}"#';
-  $replacement = '<img src="{$TN_SRC}?{$REFRESH_KEY}"';
-
-  return preg_replace($search, $replacement, $content);
+  return $sheets;
 }
 ?>
