Index: /extensions/export_data/admin.php
===================================================================
--- /extensions/export_data/admin.php	(revision 27092)
+++ /extensions/export_data/admin.php	(revision 27092)
@@ -0,0 +1,78 @@
+<?php
+if (!defined("PHPWG_ROOT_PATH"))
+{
+  die ("Hacking attempt!");
+}
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+
+check_status(ACCESS_ADMINISTRATOR);
+
+load_language('plugin.lang', EXPORT_DATA_PATH);
+
+// +-----------------------------------------------------------------------+
+// | Tabs                                                                  |
+// +-----------------------------------------------------------------------+
+
+$page['tab'] = 'home';
+
+// tabsheet
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+$tabsheet = new tabsheet();
+$tabsheet->set_id('export_data');
+
+$tabsheet->add('home', l10n('Export Data'), EXPORT_DATA_ADMIN);
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// +-----------------------------------------------------------------------+
+// | Actions                                                               |
+// +-----------------------------------------------------------------------+
+
+if (isset($_GET['type']) and 'albums' == $_GET['type'])
+{
+  // output headers so that the file is downloaded rather than displayed
+  header('Content-Type: text/csv; charset=utf-8');
+  header('Content-Disposition: attachment; filename=piwigo-albums.csv');
+  
+  // create a file pointer connected to the output stream
+  $output = fopen('php://output', 'w');
+  
+  $query = '
+SELECT
+    id,
+    name,
+    permalink
+  FROM '.CATEGORIES_TABLE.'
+  ORDER BY id ASC
+;';
+  $result = pwg_query($query);
+
+  set_make_full_url();
+  while ($row = pwg_db_fetch_assoc($result))
+  {
+    fputcsv($output, array('url' => make_index_url(array('category' => $row))));
+  }
+  exit();
+}
+
+// +-----------------------------------------------------------------------+
+// | form                                                                  |
+// +-----------------------------------------------------------------------+
+
+// define template file
+$template->set_filename('export_data_content', realpath(EXPORT_DATA_PATH . 'admin.tpl'));
+
+// template vars
+$template->assign('EXPORT_DATA_ADMIN', EXPORT_DATA_ADMIN);
+
+// +-----------------------------------------------------------------------+
+// | sending html code                                                     |
+// +-----------------------------------------------------------------------+
+
+// send page content
+$template->assign_var_from_handle('ADMIN_CONTENT', 'export_data_content');
+
+?>
Index: /extensions/export_data/admin.tpl
===================================================================
--- /extensions/export_data/admin.tpl	(revision 27092)
+++ /extensions/export_data/admin.tpl	(revision 27092)
@@ -0,0 +1,11 @@
+{literal}
+<style>
+fieldset p {text-align:left;margin:0;}
+</style>
+{/literal}
+
+<div class="titrePage">
+	<h2>{'Export Data'|@translate}</h2>
+</div>
+
+<a href="{$EXPORT_DATA_ADMIN}&amp;type=albums">{'Export albums'|@translate}</a>
Index: /extensions/export_data/index.php
===================================================================
--- /extensions/export_data/index.php	(revision 27092)
+++ /extensions/export_data/index.php	(revision 27092)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/export_data/language/en_UK/description.txt
===================================================================
--- /extensions/export_data/language/en_UK/description.txt	(revision 27092)
+++ /extensions/export_data/language/en_UK/description.txt	(revision 27092)
@@ -0,0 +1,1 @@
+Extract data from database into a spreadsheet
Index: /extensions/export_data/language/en_UK/index.php
===================================================================
--- /extensions/export_data/language/en_UK/index.php	(revision 27092)
+++ /extensions/export_data/language/en_UK/index.php	(revision 27092)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/export_data/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/export_data/language/en_UK/plugin.lang.php	(revision 27092)
+++ /extensions/export_data/language/en_UK/plugin.lang.php	(revision 27092)
@@ -0,0 +1,4 @@
+<?php
+$lang['Export Data'] = 'Export Data';
+$lang['Export albums'] = 'Export albums';
+?>
Index: /extensions/export_data/language/fr_FR/description.txt
===================================================================
--- /extensions/export_data/language/fr_FR/description.txt	(revision 27092)
+++ /extensions/export_data/language/fr_FR/description.txt	(revision 27092)
@@ -0,0 +1,1 @@
+Extraire des données de la base de données vers un tableur
Index: /extensions/export_data/language/fr_FR/index.php
===================================================================
--- /extensions/export_data/language/fr_FR/index.php	(revision 27092)
+++ /extensions/export_data/language/fr_FR/index.php	(revision 27092)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/export_data/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/export_data/language/fr_FR/plugin.lang.php	(revision 27092)
+++ /extensions/export_data/language/fr_FR/plugin.lang.php	(revision 27092)
@@ -0,0 +1,4 @@
+<?php
+$lang['Export Data'] = 'Extraction de données';
+$lang['Export albums'] = 'Extraire les albums';
+?>
Index: /extensions/export_data/language/index.php
===================================================================
--- /extensions/export_data/language/index.php	(revision 27092)
+++ /extensions/export_data/language/index.php	(revision 27092)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/export_data/main.inc.php
===================================================================
--- /extensions/export_data/main.inc.php	(revision 27092)
+++ /extensions/export_data/main.inc.php	(revision 27092)
@@ -0,0 +1,45 @@
+<?php 
+/*
+Plugin Name: Export Data
+Version: auto
+Description: Export data from database into a spreadsheet
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
+Author: plg
+Author URI: http://le-gall.net/pierrick
+*/
+
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
+
+global $prefixeTable;
+
+// +-----------------------------------------------------------------------+
+// | Define plugin constants                                               |
+// +-----------------------------------------------------------------------+
+
+defined('EXPORT_DATA_ID') or define('EXPORT_DATA_ID', basename(dirname(__FILE__)));
+define('EXPORT_DATA_PATH' ,   PHPWG_PLUGINS_PATH . EXPORT_DATA_ID . '/');
+define('EXPORT_DATA_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . EXPORT_DATA_ID);
+
+// +-----------------------------------------------------------------------+
+// | Add event handlers                                                    |
+// +-----------------------------------------------------------------------+
+
+// admin plugins menu link
+add_event_handler('get_admin_plugin_menu_links', 'export_data_admin_plugin_menu_links');
+
+/**
+ * admin plugins menu link
+ */
+function export_data_admin_plugin_menu_links($menu) 
+{
+  array_push(
+    $menu,
+    array(
+      'NAME' => 'Export Data',
+      'URL' => EXPORT_DATA_ADMIN,
+      )
+    );
+  
+  return $menu;
+}
+?>
