Index: /trunk/admin.php
===================================================================
--- /trunk/admin.php	(revision 10593)
+++ /trunk/admin.php	(revision 10594)
@@ -148,6 +148,6 @@
     'U_CONFIG_EXTENTS'=> $link_start.'extend_for_templates',
     'U_CONFIG_MENUBAR'=> $link_start.'menubar',
-    'U_CONFIG_LANGUAGES' => $link_start.'languages_installed',
-    'U_CONFIG_THEMES'=> $link_start.'themes_installed',
+    'U_CONFIG_LANGUAGES' => $link_start.'languages',
+    'U_CONFIG_THEMES'=> $link_start.'themes',
     'U_CATEGORIES'=> $link_start.'cat_list',
     'U_MOVE'=> $link_start.'cat_move',
@@ -165,5 +165,5 @@
     'U_ADMIN'=> PHPWG_ROOT_PATH.'admin.php',
     'U_LOGOUT'=> PHPWG_ROOT_PATH.'index.php?act=logout',
-    'U_PLUGINS'=> $link_start.'plugins_list',
+    'U_PLUGINS'=> $link_start.'plugins',
     'U_ADD_PHOTOS' => $link_start.'photos_add',
     'U_CHANGE_THEME' => PHPWG_ROOT_PATH.'admin.php?change_theme=1',
Index: /trunk/admin/include/functions.php
===================================================================
--- /trunk/admin/include/functions.php	(revision 10593)
+++ /trunk/admin/include/functions.php	(revision 10594)
@@ -2073,7 +2073,5 @@
       return 2;
 
-    case 'plugins_list':
-    case 'plugins_update':
-    case 'plugins_new':
+    case 'plugins':
     case 'plugin':
       return 3;
@@ -2092,9 +2090,7 @@
     case 'extend_for_templates':
     case 'menubar':
-    case 'themes_new':
-    case 'themes_installed':
+    case 'themes':
     case 'theme':
-    case 'languages_installed':
-    case 'languages_new':
+    case 'languages':
       return 5;
   }
Index: /trunk/admin/include/languages.class.php
===================================================================
--- /trunk/admin/include/languages.class.php	(revision 10593)
+++ /trunk/admin/include/languages.class.php	(revision 10594)
@@ -34,22 +34,4 @@
   {
     $this->get_fs_languages($target_charset);
-  }
-
-  /**
-   * Set tabsheet for languages pages.
-   * @param string selected page.
-   */
-  function set_tabsheet($selected)
-  {
-    include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
-
-    $link = get_root_url().'admin.php?page=';
-
-    $tabsheet = new tabsheet();
-    $tabsheet->add('languages_installed', l10n('Installed Languages'), $link.'languages_installed');
-    $tabsheet->add('languages_update', l10n('Check for updates'), $link.'languages_update');
-    $tabsheet->add('languages_new', l10n('Add New Language'), $link.'languages_new');
-    $tabsheet->select($selected);
-    $tabsheet->assign();
   }
 
Index: /trunk/admin/include/plugins.class.php
===================================================================
--- /trunk/admin/include/plugins.class.php	(revision 10593)
+++ /trunk/admin/include/plugins.class.php	(revision 10594)
@@ -40,22 +40,4 @@
       $this->db_plugins_by_id[$db_plugin['id']] = $db_plugin;
     }
-  }
-
-  /**
-   * Set tabsheet for plugins pages.
-   * @param string selected page.
-   */
-  function set_tabsheet($selected)
-  {
-    include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
-
-    $link = get_root_url().'admin.php?page=';
-
-    $tabsheet = new tabsheet();
-    $tabsheet->add('plugins_list', l10n('Plugin list'), $link.'plugins_list');
-    $tabsheet->add('plugins_update', l10n('Check for updates'), $link.'plugins_update');
-    $tabsheet->add('plugins_new', l10n('Other plugins'), $link.'plugins_new');
-    $tabsheet->select($selected);
-    $tabsheet->assign();
   }
 
Index: /trunk/admin/include/themes.class.php
===================================================================
--- /trunk/admin/include/themes.class.php	(revision 10593)
+++ /trunk/admin/include/themes.class.php	(revision 10594)
@@ -39,22 +39,4 @@
       $this->db_themes_by_id[$db_theme['id']] = $db_theme;
     }
-  }
-
-  /**
-   * Set tabsheet for themes pages.
-   * @param string selected page.
-   */
-  function set_tabsheet($selected)
-  {
-    include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
-
-    $link = get_root_url().'admin.php?page=';
-
-    $tabsheet = new tabsheet();
-    $tabsheet->add('themes_installed', l10n('Installed Themes'), $link.'themes_installed');
-    $tabsheet->add('themes_update', l10n('Check for updates'), $link.'themes_update');
-    $tabsheet->add('themes_new', l10n('Add New Theme'), $link.'themes_new');
-    $tabsheet->select($selected);
-    $tabsheet->assign();
   }
 
Index: /trunk/admin/include/updates.class.php
===================================================================
--- /trunk/admin/include/updates.class.php	(revision 10593)
+++ /trunk/admin/include/updates.class.php	(revision 10594)
@@ -16,7 +16,12 @@
   var $merged_extension_url = 'http://piwigo.org/download/merged_extensions.txt';
 
-  function __construct()
+  function __construct($page='updates')
   {
     $this->types = array('plugins', 'themes', 'languages');
+
+    if (in_array($page, $this->types))
+    {
+      $this->types = array($page);
+    }
     $this->default_themes = array('clear', 'dark', 'Sylvia');
     $this->default_plugins = array('admin_multi_view', 'c13y_upgrade', 'language_switch', 'LocalFilesEditor');
Index: /trunk/admin/languages.php
===================================================================
--- /trunk/admin/languages.php	(revision 10594)
+++ /trunk/admin/languages.php	(revision 10594)
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo 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/tabsheet.class.php');
+
+$my_base_url = get_root_url().'admin.php?page=languages';
+
+if (isset($_GET['tab']))
+  $page['tab'] = $_GET['tab'];
+else
+  $page['tab'] = 'installed';
+
+$tabsheet = new tabsheet();
+$tabsheet->add('installed', l10n('Installed Languages'), $my_base_url.'&amp;tab=installed');
+$tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&amp;tab=update');
+$tabsheet->add('new', l10n('Add New Language'), $my_base_url.'&amp;tab=new');
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+if ($page['tab'] == 'update')
+  include(PHPWG_ROOT_PATH.'admin/updates_ext.php');
+else
+  include(PHPWG_ROOT_PATH.'admin/languages_'.$page['tab'].'.php');
+
+?>
Index: /trunk/admin/languages_installed.php
===================================================================
--- /trunk/admin/languages_installed.php	(revision 10593)
+++ /trunk/admin/languages_installed.php	(revision 10594)
@@ -35,5 +35,4 @@
 $languages = new languages();
 $languages->get_db_languages();
-$languages->set_tabsheet($page['page']);
 
 //--------------------------------------------------perform requested actions
Index: /trunk/admin/languages_new.php
===================================================================
--- /trunk/admin/languages_new.php	(revision 10593)
+++ /trunk/admin/languages_new.php	(revision 10594)
@@ -35,5 +35,4 @@
 $languages = new languages();
 $languages->get_db_languages();
-$languages->set_tabsheet($page['page']);
 
 // +-----------------------------------------------------------------------+
Index: unk/admin/languages_update.php
===================================================================
--- /trunk/admin/languages_update.php	(revision 10593)
+++ 	(revision )
@@ -1,133 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo 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/languages.class.php');
-
-$base_url = get_root_url().'admin.php?page='.$page['page'];
-
-$languages = new languages();
-
-$languages->set_tabsheet($page['page']);
-
-//-----------------------------------------------------------automatic upgrade
-if (isset($_GET['language']) and isset($_GET['revision']))
-{
-  if (!is_webmaster())
-  {
-    array_push($page['errors'], l10n('Webmaster status is required.'));
-  }
-  else
-  {
-    check_pwg_token();
-    
-    $language_id = $_GET['language'];
-    $revision = $_GET['revision'];
-
-    $upgrade_status = $languages->extract_language_files('upgrade', $revision, $language_id);
-
-    switch ($upgrade_status)
-    {
-      case 'ok':
-        array_push($page['infos'],
-           sprintf(
-              l10n('%s has been successfully upgraded.'),
-              $languages->fs_languages[$_GET['language']]['name']));
-        break;
-
-      case 'temp_path_error':
-        array_push($page['errors'], l10n('Can\'t create temporary file.'));
-        break;
-
-      case 'dl_archive_error':
-        array_push($page['errors'], l10n('Can\'t download archive.'));
-        break;
-
-      case 'archive_error':
-        array_push($page['errors'], l10n('Can\'t read or extract archive.'));
-        break;
-
-      default:
-        array_push($page['errors'],
-          sprintf(l10n('An error occured during extraction (%s).'), $upgrade_status)
-        );
-    }
-
-    $languages->languages();
-    $template->delete_compiled_templates();
-  }
-}
-
-// +-----------------------------------------------------------------------+
-// |                     start template output                             |
-// +-----------------------------------------------------------------------+
-$template->set_filenames(array('languages' => 'languages_update.tpl'));
-
-if ($languages->get_server_languages())
-{
-  foreach($languages->fs_languages as $language_id => $fs_language)
-  {
-    if (isset($fs_language['extension'])
-      and isset($languages->server_languages[$fs_language['extension']]))
-    {
-      $language_info = $languages->server_languages[$fs_language['extension']];
-
-      if (!$languages->language_version_compare($fs_language['version'], $language_info['revision_name']))
-      {
-        $url_auto_update = $base_url
-          . '&amp;revision=' . $language_info['revision_id']
-          . '&amp;language=' . $language_id
-          . '&amp;pwg_token='.get_pwg_token()
-          ;
-
-        $template->append('update_languages', array(
-          'ID' => $language_info['extension_id'],
-          'EXT_NAME' => $fs_language['name'],
-          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$language_info['extension_id'],
-          'EXT_DESC' => trim($language_info['extension_description'], " \n\r"),
-          'REV_DESC' => trim($language_info['revision_description'], " \n\r"),
-          'CURRENT_VERSION' => $fs_language['version'],
-          'NEW_VERSION' => $language_info['revision_name'],
-          'AUTHOR' => $language_info['author_name'],
-          'DOWNLOADS' => $language_info['extension_nb_downloads'],
-          'URL_UPDATE' => $url_auto_update,
-          'URL_DOWNLOAD' => $language_info['download_url'] . '&amp;origin=piwigo_download'
-          )
-        );
-      }
-    }
-  }
-}
-else
-{
-  $template->assign('SERVER_ERROR', true);
-  array_push($page['errors'], l10n('Can\'t connect to server.'));
-}
-
-$template->assign_var_from_handle('ADMIN_CONTENT', 'languages');
-?>
Index: /trunk/admin/plugins.php
===================================================================
--- /trunk/admin/plugins.php	(revision 10594)
+++ /trunk/admin/plugins.php	(revision 10594)
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo 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/tabsheet.class.php');
+
+$my_base_url = get_root_url().'admin.php?page=plugins';
+
+if (isset($_GET['tab']))
+  $page['tab'] = $_GET['tab'];
+else
+  $page['tab'] = 'installed';
+
+$tabsheet = new tabsheet();
+$tabsheet->add('installed', l10n('Plugin list'), $my_base_url.'&amp;tab=installed');
+$tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&amp;tab=update');
+$tabsheet->add('new', l10n('Other plugins'), $my_base_url.'&amp;tab=new');
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+if ($page['tab'] == 'update')
+  include(PHPWG_ROOT_PATH.'admin/updates_ext.php');
+else
+  include(PHPWG_ROOT_PATH.'admin/plugins_'.$page['tab'].'.php');
+
+?>
Index: /trunk/admin/plugins_installed.php
===================================================================
--- /trunk/admin/plugins_installed.php	(revision 10594)
+++ /trunk/admin/plugins_installed.php	(revision 10594)
@@ -0,0 +1,180 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo 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/plugins.class.php');
+
+$template->set_filenames(array('plugins' => 'plugins_list.tpl'));
+
+// TODO : use a session parameter
+$plugin_order = isset($_GET['plugin_order']) ? $_GET['plugin_order'] : 'state';
+$plugin_display = isset($_GET['plugin_display']) ? $_GET['plugin_display'] : 'compact';
+
+$base_url = get_root_url().'admin.php?page='.$page['page'].'&amp;plugin_order='.$plugin_order.'&amp;plugin_display='.$plugin_display;
+$pwg_token = get_pwg_token();
+$action_url = $base_url.'&amp;plugin='.'%s'.'&amp;pwg_token='.$pwg_token;
+
+$plugins = new plugins();
+
+//--------------------------------------------------perform requested actions
+if (isset($_GET['action']) and isset($_GET['plugin']))
+{
+  if (in_array($_GET['action'], array('install', 'uninstall')) AND !is_webmaster())
+  {
+    array_push($page['errors'], l10n('Webmaster status is required.'));
+  }
+  else
+  {
+    check_pwg_token();
+
+    $page['errors'] = $plugins->perform_action($_GET['action'], $_GET['plugin']);
+
+    if (empty($page['errors']))
+    {
+      if ($_GET['action'] == 'activate' or $_GET['action'] == 'deactivate')
+      {
+        $template->delete_compiled_templates();
+      }
+      redirect($base_url);
+    }
+  }
+}
+
+// +-----------------------------------------------------------------------+
+// |                     start template output                             |
+// +-----------------------------------------------------------------------+
+
+$plugins->sort_fs_plugins('name');
+$plugins->get_merged_extensions();
+$plugins->get_incompatible_plugins();
+$merged_plugins = false;
+$tpl_plugins = array();
+
+foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
+{
+  if (isset($_SESSION['incompatible_plugins'][$plugin_id])
+    and $fs_plugin['version'] != $_SESSION['incompatible_plugins'][$plugin_id])
+  {
+    // Incompatible plugins must be reinitilized
+    $plugins->get_incompatible_plugins(true);
+  }
+
+  $tpl_plugin = array(
+    'ID' => $plugin_id,
+    'NAME' => $fs_plugin['name'],
+    'VISIT_URL' => $fs_plugin['uri'],
+    'VERSION' => $fs_plugin['version'],
+    'DESC' => $fs_plugin['description'],
+    'AUTHOR' => $fs_plugin['author'],
+    'AUTHOR_URL' => @$fs_plugin['author uri'],
+    'U_ACTION' => sprintf($action_url, $plugin_id),
+    'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]),
+    );
+
+  if (isset($plugins->db_plugins_by_id[$plugin_id]))
+  {
+    $tpl_plugin['STATE'] = $plugins->db_plugins_by_id[$plugin_id]['state'];
+  }
+  else
+  {
+    $tpl_plugin['STATE'] = 'inactive';
+  }
+
+  if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions']))
+  {
+    $plugins->perform_action('uninstall', $plugin_id);
+    $tpl_plugin['STATE'] = 'merged';
+    $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.');
+    $merged_plugins = true;
+  }
+
+  array_push($tpl_plugins, $tpl_plugin);
+}
+
+$template->append('plugin_states', 'active');
+$template->append('plugin_states', 'inactive');
+
+if ($merged_plugins)
+{
+  $template->append('plugin_states', 'merged');
+}
+
+$missing_plugin_ids = array_diff(
+  array_keys($plugins->db_plugins_by_id),
+  array_keys($plugins->fs_plugins)
+  );
+
+if (count($missing_plugin_ids) > 0)
+{
+  foreach($missing_plugin_ids as $plugin_id)
+  {
+    array_push(
+      $tpl_plugins,
+      array(
+        'NAME' => $plugin_id,
+        'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
+        'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'),
+        'U_ACTION' => sprintf($action_url, $plugin_id),
+        'STATE' => 'missing',
+        )
+      );
+  }
+  $template->append('plugin_states', 'missing');
+}
+
+// sort plugins : state or name
+if ($plugin_order == 'name')
+{
+  function cmp($a, $b)
+  { 
+    return strcasecmp($a['NAME'], $b['NAME']); 
+  } 
+}
+else
+{
+  function cmp($a, $b)
+  { 
+    $s = array('merged' => 0, 'missing' => 1, 'active' => 2, 'inactive' => 3);
+    
+    if($a['STATE'] == $b['STATE'])
+      return strcasecmp($a['NAME'], $b['NAME']); 
+    else
+      return $s[$a['STATE']] >= $s[$b['STATE']]; 
+  }
+  $plugin_order = 'state';
+}
+
+usort($tpl_plugins, 'cmp');
+$template->assign(array(
+  'plugin_order' => $plugin_order,
+  'plugin_display' => $plugin_display,
+  'plugins' => $tpl_plugins,
+  'PWG_TOKEN' => $pwg_token,
+));
+
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
+?>
Index: unk/admin/plugins_list.php
===================================================================
--- /trunk/admin/plugins_list.php	(revision 10593)
+++ 	(revision )
@@ -1,183 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo 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/plugins.class.php');
-
-$template->set_filenames(array('plugins' => 'plugins_list.tpl'));
-
-// TODO : use a session parameter
-$plugin_order = isset($_GET['plugin_order']) ? $_GET['plugin_order'] : 'state';
-$plugin_display = isset($_GET['plugin_display']) ? $_GET['plugin_display'] : 'compact';
-
-$base_url = get_root_url().'admin.php?page='.$page['page'].'&amp;plugin_order='.$plugin_order.'&amp;plugin_display='.$plugin_display;
-$pwg_token = get_pwg_token();
-$action_url = $base_url.'&amp;plugin='.'%s'.'&amp;pwg_token='.$pwg_token;
-
-$plugins = new plugins();
-
-//--------------------------------------------------perform requested actions
-if (isset($_GET['action']) and isset($_GET['plugin']))
-{
-  if (in_array($_GET['action'], array('install', 'uninstall')) AND !is_webmaster())
-  {
-    array_push($page['errors'], l10n('Webmaster status is required.'));
-  }
-  else
-  {
-    check_pwg_token();
-
-    $page['errors'] = $plugins->perform_action($_GET['action'], $_GET['plugin']);
-
-    if (empty($page['errors']))
-    {
-      if ($_GET['action'] == 'activate' or $_GET['action'] == 'deactivate')
-      {
-        $template->delete_compiled_templates();
-      }
-      redirect($base_url);
-    }
-  }
-}
-
-//--------------------------------------------------------------------Tabsheet
-$plugins->set_tabsheet($page['page']);
-
-// +-----------------------------------------------------------------------+
-// |                     start template output                             |
-// +-----------------------------------------------------------------------+
-
-$plugins->sort_fs_plugins('name');
-$plugins->get_merged_extensions();
-$plugins->get_incompatible_plugins();
-$merged_plugins = false;
-$tpl_plugins = array();
-
-foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
-{
-  if (isset($_SESSION['incompatible_plugins'][$plugin_id])
-    and $fs_plugin['version'] != $_SESSION['incompatible_plugins'][$plugin_id])
-  {
-    // Incompatible plugins must be reinitilized
-    $plugins->get_incompatible_plugins(true);
-  }
-
-  $tpl_plugin = array(
-    'ID' => $plugin_id,
-    'NAME' => $fs_plugin['name'],
-    'VISIT_URL' => $fs_plugin['uri'],
-    'VERSION' => $fs_plugin['version'],
-    'DESC' => $fs_plugin['description'],
-    'AUTHOR' => $fs_plugin['author'],
-    'AUTHOR_URL' => @$fs_plugin['author uri'],
-    'U_ACTION' => sprintf($action_url, $plugin_id),
-    'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]),
-    );
-
-  if (isset($plugins->db_plugins_by_id[$plugin_id]))
-  {
-    $tpl_plugin['STATE'] = $plugins->db_plugins_by_id[$plugin_id]['state'];
-  }
-  else
-  {
-    $tpl_plugin['STATE'] = 'inactive';
-  }
-
-  if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions']))
-  {
-    $plugins->perform_action('uninstall', $plugin_id);
-    $tpl_plugin['STATE'] = 'merged';
-    $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.');
-    $merged_plugins = true;
-  }
-
-  array_push($tpl_plugins, $tpl_plugin);
-}
-
-$template->append('plugin_states', 'active');
-$template->append('plugin_states', 'inactive');
-
-if ($merged_plugins)
-{
-  $template->append('plugin_states', 'merged');
-}
-
-$missing_plugin_ids = array_diff(
-  array_keys($plugins->db_plugins_by_id),
-  array_keys($plugins->fs_plugins)
-  );
-
-if (count($missing_plugin_ids) > 0)
-{
-  foreach($missing_plugin_ids as $plugin_id)
-  {
-    array_push(
-      $tpl_plugins,
-      array(
-        'NAME' => $plugin_id,
-        'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
-        'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'),
-        'U_ACTION' => sprintf($action_url, $plugin_id),
-        'STATE' => 'missing',
-        )
-      );
-  }
-  $template->append('plugin_states', 'missing');
-}
-
-// sort plugins : state or name
-if ($plugin_order == 'name')
-{
-  function cmp($a, $b)
-  { 
-    return strcasecmp($a['NAME'], $b['NAME']); 
-  } 
-}
-else
-{
-  function cmp($a, $b)
-  { 
-    $s = array('merged' => 0, 'missing' => 1, 'active' => 2, 'inactive' => 3);
-    
-    if($a['STATE'] == $b['STATE'])
-      return strcasecmp($a['NAME'], $b['NAME']); 
-    else
-      return $s[$a['STATE']] >= $s[$b['STATE']]; 
-  }
-  $plugin_order = 'state';
-}
-
-usort($tpl_plugins, 'cmp');
-$template->assign(array(
-  'plugin_order' => $plugin_order,
-  'plugin_display' => $plugin_display,
-  'plugins' => $tpl_plugins,
-  'PWG_TOKEN' => $pwg_token,
-));
-
-$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
-?>
Index: /trunk/admin/plugins_new.php
===================================================================
--- /trunk/admin/plugins_new.php	(revision 10593)
+++ /trunk/admin/plugins_new.php	(revision 10594)
@@ -31,5 +31,5 @@
 $template->set_filenames(array('plugins' => 'plugins_new.tpl'));
 
-$base_url = get_root_url().'admin.php?page='.$page['page'];
+$base_url = get_root_url().'admin.php?page='.$page['page'].'&amp;'.$page['tab'];
 
 $plugins = new plugins();
@@ -82,7 +82,4 @@
 }
 
-//--------------------------------------------------------------------Tabsheet
-$plugins->set_tabsheet($page['page']);
-
 //---------------------------------------------------------------Order options
 $template->assign('order_options',
Index: unk/admin/plugins_update.php
===================================================================
--- /trunk/admin/plugins_update.php	(revision 10593)
+++ 	(revision )
@@ -1,153 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo 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/plugins.class.php');
-
-$template->set_filenames(array('plugins' => 'plugins_update.tpl'));
-
-$base_url = get_root_url().'admin.php?page='.$page['page'];
-
-$plugins = new plugins();
-
-//-----------------------------------------------------------automatic upgrade
-if (isset($_GET['plugin']) and isset($_GET['revision']))
-{
-  if (!is_webmaster())
-  {
-    array_push($page['errors'], l10n('Webmaster status is required.'));
-  }
-  else
-  {
-    check_pwg_token();
-    
-    $plugin_id = $_GET['plugin'];
-    $revision = $_GET['revision'];
-
-    if (isset($plugins->db_plugins_by_id[$plugin_id])
-      and $plugins->db_plugins_by_id[$plugin_id]['state'] == 'active')
-    {
-      $plugins->perform_action('deactivate', $plugin_id);
-
-      redirect($base_url
-        . '&revision=' . $revision
-        . '&plugin=' . $plugin_id
-        . '&pwg_token='.get_pwg_token()
-        . '&reactivate=true');
-    }
-
-    $upgrade_status = $plugins->extract_plugin_files('upgrade', $revision, $plugin_id);
-
-    if (isset($_GET['reactivate']))
-    {
-      $plugins->perform_action('activate', $plugin_id);
-    }
-
-    $template->delete_compiled_templates();
-
-    redirect($base_url.'&plugin='.$plugin_id.'&upgradestatus='.$upgrade_status);
-  }
-}
-
-//--------------------------------------------------------------upgrade result
-if (isset($_GET['upgradestatus']) and isset($_GET['plugin']))
-{
-  switch ($_GET['upgradestatus'])
-  {
-    case 'ok':
-      array_push($page['infos'],
-         sprintf(
-            l10n('%s has been successfully upgraded.'),
-            $plugins->fs_plugins[$_GET['plugin']]['name']));
-      break;
-
-    case 'temp_path_error':
-      array_push($page['errors'], l10n('Can\'t create temporary file.'));
-      break;
-
-    case 'dl_archive_error':
-      array_push($page['errors'], l10n('Can\'t download archive.'));
-      break;
-
-    case 'archive_error':
-      array_push($page['errors'], l10n('Can\'t read or extract archive.'));
-      break;
-
-    default:
-      array_push($page['errors'],
-        sprintf(l10n('An error occured during extraction (%s).'), $_GET['upgradestatus']),
-        l10n('Please check "plugins" folder and sub-folders permissions (CHMOD).'));
-  }  
-}
-
-//--------------------------------------------------------------------Tabsheet
-$plugins->set_tabsheet($page['page']);
-
-// +-----------------------------------------------------------------------+
-// |                     start template output                             |
-// +-----------------------------------------------------------------------+
-if ($plugins->get_server_plugins())
-{
-  foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
-  {
-    if (isset($fs_plugin['extension'])
-      and isset($plugins->server_plugins[$fs_plugin['extension']]))
-    {
-      $plugin_info = $plugins->server_plugins[$fs_plugin['extension']];
-
-      if (!$plugins->plugin_version_compare($fs_plugin['version'], $plugin_info['revision_name']))
-      {
-        $url_auto_update = $base_url
-          . '&amp;revision=' . $plugin_info['revision_id']
-          . '&amp;plugin=' . $plugin_id
-          . '&amp;pwg_token='.get_pwg_token()
-          ;
-
-        $template->append('plugins', array(
-          'ID' => $plugin_info['extension_id'],
-          'EXT_NAME' => $fs_plugin['name'],
-          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin_info['extension_id'],
-          'EXT_DESC' => trim($plugin_info['extension_description'], " \n\r"),
-          'REV_DESC' => trim($plugin_info['revision_description'], " \n\r"),
-          'CURRENT_VERSION' => $fs_plugin['version'],
-          'NEW_VERSION' => $plugin_info['revision_name'],
-          'AUTHOR' => $plugin_info['author_name'],
-          'DOWNLOADS' => $plugin_info['extension_nb_downloads'],
-          'URL_UPDATE' => $url_auto_update,
-          'URL_DOWNLOAD' => $plugin_info['download_url'] . '&amp;origin=piwigo_download'));
-      }
-    }
-  }
-}
-else
-{
-  $template->assign('SERVER_ERROR', true);
-  array_push($page['errors'], l10n('Can\'t connect to server.'));
-}
-
-$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
-?>
Index: /trunk/admin/themes.php
===================================================================
--- /trunk/admin/themes.php	(revision 10594)
+++ /trunk/admin/themes.php	(revision 10594)
@@ -0,0 +1,50 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo 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/tabsheet.class.php');
+
+$my_base_url = get_root_url().'admin.php?page=themes';
+
+if (isset($_GET['tab']))
+  $page['tab'] = $_GET['tab'];
+else
+  $page['tab'] = 'installed';
+
+$tabsheet = new tabsheet();
+$tabsheet->add('installed', l10n('Installed Themes'), $my_base_url.'&amp;tab=installed');
+$tabsheet->add('update', l10n('Check for updates'), $my_base_url.'&amp;tab=update');
+$tabsheet->add('new', l10n('Add New Theme'), $my_base_url.'&amp;tab=new');
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+if ($page['tab'] == 'update')
+  include(PHPWG_ROOT_PATH.'admin/updates_ext.php');
+else
+  include(PHPWG_ROOT_PATH.'admin/themes_'.$page['tab'].'.php');
+
+?>
Index: unk/admin/themes/default/template/languages_update.tpl
===================================================================
--- /trunk/admin/themes/default/template/languages_update.tpl	(revision 10593)
+++ 	(revision )
@@ -1,58 +1,0 @@
-{footer_script require='jquery.effects.blind'}{literal}
-jQuery(document).ready(function(){
-	jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() {
-		id = this.id.split('_');
-		jQuery("#revdesc_"+id[1]).toggle('blind');
-    jQuery(".button_"+id[1]).toggle();
-		return false;
-	});
-});
-{/literal}{/footer_script}
-
-<div class="titrePage">
-  <h2>{'Languages'|@translate}</h2>
-</div>
-
-{if not empty($update_languages)}
-<div id="availablePlugins">
-<fieldset>
-<legend>{'Languages which need upgrade'|@translate}</legend>
-{foreach from=$update_languages item=language name=languages_loop}
-<div class="pluginBox">
-  <table>
-    <tr>
-      <td class="pluginBoxNameCell">
-        {$language.EXT_NAME}
-      </td>
-      <td>
-        <a href="{$language.URL_UPDATE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'Install'|@translate}</a>
-        | <a href="{$language.URL_DOWNLOAD}">{'Download'|@translate}</a>
-        | <a class="externalLink" href="{$language.EXT_URL}">{'Visit language site'|@translate}</a>
-      </td>
-    </tr>
-    <tr>
-      <td>
-        {'Version'|@translate} {$language.CURRENT_VERSION}
-      </td>
-      <td class="pluginDesc" id="desc_{$language.ID}">
-        <em>{'Downloads'|@translate}: {$language.DOWNLOADS}</em>
-        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$language.ID}">
-        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$language.ID}" style="display:none;">
-        {'New Version'|@translate} : {$language.NEW_VERSION}
-        | {'By %s'|@translate|@sprintf:$language.AUTHOR}
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td class="pluginDesc">
-        <p id="revdesc_{$language.ID}" style="display:none;">{$language.REV_DESC|htmlspecialchars|nl2br}</p>
-      </td>
-    </tr>
-  </table>
-</div>
-{/foreach}
-</fieldset>
-</div>
-{elseif not isset($SERVER_ERROR)}
-<p>{'All languages are up to date.'|@translate}</p>
-{/if}
Index: /trunk/admin/themes/default/template/plugins_list.tpl
===================================================================
--- /trunk/admin/themes/default/template/plugins_list.tpl	(revision 10593)
+++ /trunk/admin/themes/default/template/plugins_list.tpl	(revision 10594)
@@ -82,5 +82,5 @@
   <span class="sort">
     <form action="" method="get" name="change_order">
-      <input type="hidden" name="page" value="plugins_list"/>
+      <input type="hidden" name="page" value="plugins"/>
       {'Sort order'|@translate} : 
       <select name="plugin_order" onchange="this.form.submit();">
Index: unk/admin/themes/default/template/plugins_update.tpl
===================================================================
--- /trunk/admin/themes/default/template/plugins_update.tpl	(revision 10593)
+++ 	(revision )
@@ -1,58 +1,0 @@
-{footer_script require='jquery.effects.blind'}{literal}
-jQuery(document).ready(function(){
-	jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() {
-		id = this.id.split('_');
-		jQuery("#revdesc_"+id[1]).toggle('blind');
-    jQuery(".button_"+id[1]).toggle();
-		return false;
-	});
-});
-{/literal}{/footer_script}
-
-<div class="titrePage">
-  <h2>{'Plugins'|@translate}</h2>
-</div>
-
-{if not empty($plugins)}
-<div id="availablePlugins">
-<fieldset>
-<legend>{'Plugins which need upgrade'|@translate}</legend>
-{foreach from=$plugins item=plugin name=plugins_loop}
-<div class="pluginBox">
-  <table>
-    <tr>
-      <td class="pluginBoxNameCell">
-        {$plugin.EXT_NAME}
-      </td>
-      <td>
-        <a href="{$plugin.URL_UPDATE}" onclick="return confirm('{'Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'|@translate|@escape:javascript}');">{'Install'|@translate}</a>
-        | <a href="{$plugin.URL_DOWNLOAD}">{'Download'|@translate}</a>
-        | <a class="externalLink" href="{$plugin.EXT_URL}">{'Visit plugin site'|@translate}</a>
-      </td>
-    </tr>
-    <tr>
-      <td>
-        {'Version'|@translate} {$plugin.CURRENT_VERSION}
-      </td>
-      <td class="pluginDesc" id="desc_{$plugin.ID}">
-        <em>{'Downloads'|@translate}: {$plugin.DOWNLOADS}</em>
-        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$plugin.ID}">
-        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$plugin.ID}" style="display:none;">
-        {'New Version'|@translate} : {$plugin.NEW_VERSION}
-        | {'By %s'|@translate|@sprintf:$plugin.AUTHOR}
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td class="pluginDesc">
-        <p id="revdesc_{$plugin.ID}" style="display:none;">{$plugin.REV_DESC|htmlspecialchars|nl2br}</p>
-      </td>
-    </tr>
-  </table>
-</div>
-{/foreach}
-</fieldset>
-</div>
-{elseif not isset($SERVER_ERROR)}
-<p>{'All plugins are up to date.'|@translate}</p>
-{/if}
Index: unk/admin/themes/default/template/themes_update.tpl
===================================================================
--- /trunk/admin/themes/default/template/themes_update.tpl	(revision 10593)
+++ 	(revision )
@@ -1,58 +1,0 @@
-{footer_script require='jquery.effects.blind'}{literal}
-jQuery(document).ready(function(){
-	jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() {
-		id = this.id.split('_');
-		jQuery("#revdesc_"+id[1]).toggle('blind');
-    jQuery(".button_"+id[1]).toggle();
-		return false;
-	});
-});
-{/literal}{/footer_script}
-
-<div class="titrePage">
-  <h2>{'Themes'|@translate}</h2>
-</div>
-
-{if not empty($update_themes)}
-<div id="availablePlugins">
-<fieldset>
-<legend>{'Themes which need upgrade'|@translate}</legend>
-{foreach from=$update_themes item=theme name=themes_loop}
-<div class="pluginBox">
-  <table>
-    <tr>
-      <td class="pluginBoxNameCell">
-        {$theme.EXT_NAME}
-      </td>
-      <td>
-        <a href="{$theme.URL_UPDATE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'Install'|@translate}</a>
-        | <a href="{$theme.URL_DOWNLOAD}">{'Download'|@translate}</a>
-        | <a class="externalLink" href="{$theme.EXT_URL}">{'Visit theme site'|@translate}</a>
-      </td>
-    </tr>
-    <tr>
-      <td>
-        {'Version'|@translate} {$theme.CURRENT_VERSION}
-      </td>
-      <td class="pluginDesc" id="desc_{$theme.ID}">
-        <em>{'Downloads'|@translate}: {$theme.DOWNLOADS}</em>
-        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$theme.ID}">
-        <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$theme.ID}" style="display:none;">
-        {'New Version'|@translate} : {$theme.NEW_VERSION}
-        | {'By %s'|@translate|@sprintf:$theme.AUTHOR}
-      </td>
-    </tr>
-    <tr>
-      <td></td>
-      <td class="pluginDesc">
-        <p id="revdesc_{$theme.ID}" style="display:none;">{$theme.REV_DESC|htmlspecialchars|nl2br}</p>
-      </td>
-    </tr>
-  </table>
-</div>
-{/foreach}
-</fieldset>
-</div>
-{elseif not isset($SERVER_ERROR)}
-<p>{'All themes are up to date.'|@translate}</p>
-{/if}
Index: /trunk/admin/themes_installed.php
===================================================================
--- /trunk/admin/themes_installed.php	(revision 10593)
+++ /trunk/admin/themes_installed.php	(revision 10594)
@@ -152,5 +152,4 @@
 
 
-$themes->set_tabsheet($page['page']);
 $template->set_filenames(array('themes' => 'themes_installed.tpl'));
 $template->assign_var_from_handle('ADMIN_CONTENT', 'themes');
Index: /trunk/admin/themes_new.php
===================================================================
--- /trunk/admin/themes_new.php	(revision 10593)
+++ /trunk/admin/themes_new.php	(revision 10594)
@@ -32,5 +32,4 @@
 
 $themes = new themes();
-$themes->set_tabsheet('themes_new');
 
 // +-----------------------------------------------------------------------+
Index: unk/admin/themes_update.php
===================================================================
--- /trunk/admin/themes_update.php	(revision 10593)
+++ 	(revision )
@@ -1,133 +1,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo 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/themes.class.php');
-
-$base_url = get_root_url().'admin.php?page='.$page['page'];
-
-$themes = new themes();
-
-$themes->set_tabsheet($page['page']);
-
-//-----------------------------------------------------------automatic upgrade
-if (isset($_GET['theme']) and isset($_GET['revision']))
-{
-  if (!is_webmaster())
-  {
-    array_push($page['errors'], l10n('Webmaster status is required.'));
-  }
-  else
-  {
-    check_pwg_token();
-    
-    $theme_id = $_GET['theme'];
-    $revision = $_GET['revision'];
-
-    $upgrade_status = $themes->extract_theme_files('upgrade', $revision, $theme_id);
-
-    switch ($upgrade_status)
-    {
-      case 'ok':
-        array_push($page['infos'],
-           sprintf(
-              l10n('%s has been successfully upgraded.'),
-              $themes->fs_themes[$_GET['theme']]['name']));
-        break;
-
-      case 'temp_path_error':
-        array_push($page['errors'], l10n('Can\'t create temporary file.'));
-        break;
-
-      case 'dl_archive_error':
-        array_push($page['errors'], l10n('Can\'t download archive.'));
-        break;
-
-      case 'archive_error':
-        array_push($page['errors'], l10n('Can\'t read or extract archive.'));
-        break;
-
-      default:
-        array_push($page['errors'],
-          sprintf(l10n('An error occured during extraction (%s).'), $upgrade_status)
-        );
-    }
-
-    $themes->themes();
-    $template->delete_compiled_templates();
-  }
-}
-
-// +-----------------------------------------------------------------------+
-// |                     start template output                             |
-// +-----------------------------------------------------------------------+
-$template->set_filenames(array('themes' => 'themes_update.tpl'));
-
-if ($themes->get_server_themes())
-{
-  foreach($themes->fs_themes as $theme_id => $fs_theme)
-  {
-    if (isset($fs_theme['extension'])
-      and isset($themes->server_themes[$fs_theme['extension']]))
-    {
-      $theme_info = $themes->server_themes[$fs_theme['extension']];
-
-      if (!$themes->theme_version_compare($fs_theme['version'], $theme_info['revision_name']))
-      {
-        $url_auto_update = $base_url
-          . '&amp;revision=' . $theme_info['revision_id']
-          . '&amp;theme=' . $theme_id
-          . '&amp;pwg_token='.get_pwg_token()
-          ;
-
-        $template->append('update_themes', array(
-          'ID' => $theme_info['extension_id'],
-          'EXT_NAME' => $fs_theme['name'],
-          'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$theme_info['extension_id'],
-          'EXT_DESC' => trim($theme_info['extension_description'], " \n\r"),
-          'REV_DESC' => trim($theme_info['revision_description'], " \n\r"),
-          'CURRENT_VERSION' => $fs_theme['version'],
-          'NEW_VERSION' => $theme_info['revision_name'],
-          'AUTHOR' => $theme_info['author_name'],
-          'DOWNLOADS' => $theme_info['extension_nb_downloads'],
-          'URL_UPDATE' => $url_auto_update,
-          'URL_DOWNLOAD' => $theme_info['download_url'] . '&amp;origin=piwigo_download'
-          )
-        );
-      }
-    }
-  }
-}
-else
-{
-  $template->assign('SERVER_ERROR', true);
-  array_push($page['errors'], l10n('Can\'t connect to server.'));
-}
-
-$template->assign_var_from_handle('ADMIN_CONTENT', 'themes');
-?>
