Index: /extension/user_mass_register/admin.php
===================================================================
--- /extension/user_mass_register/admin.php	(revision 18826)
+++ /extension/user_mass_register/admin.php	(revision 18826)
@@ -0,0 +1,213 @@
+<?php
+if (!defined("PHPWG_ROOT_PATH"))
+{
+  die ("Hacking attempt!");
+}
+
+// +-----------------------------------------------------------------------+
+// | Functions                                                             |
+// +-----------------------------------------------------------------------+
+
+function register_user_and_notify($login, $password, $mail_address)
+{
+  global $conf;
+  
+  $errors = register_user($login, $password, $mail_address, false);
+
+  if (empty($errors))
+  {
+    include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+        
+    $keyargs_content = array(
+      get_l10n_args('Hello %s,', $login),
+      get_l10n_args('Thank you for registering at %s!', $conf['gallery_title']),
+      get_l10n_args('', ''),
+      get_l10n_args('Here are your connection settings', ''),
+      get_l10n_args('Username: %s', $login),
+      get_l10n_args('Password: %s', $password),
+      get_l10n_args('Email: %s', $mail_address),
+      get_l10n_args('', ''),
+      get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()),
+      );
+    
+    pwg_mail(
+      $mail_address,
+      array(
+        'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'),
+        'content' => l10n_args($keyargs_content),
+        'content_format' => 'text/plain',
+        )
+      );
+  }
+
+  return $errors;
+}
+
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok                      |
+// +-----------------------------------------------------------------------+
+
+check_status(ACCESS_ADMINISTRATOR);
+
+load_language('plugin.lang', UMR_PATH);
+
+// +-----------------------------------------------------------------------+
+// | Tabs                                                                  |
+// +-----------------------------------------------------------------------+
+
+$page['tab'] = 'home';
+
+// tabsheet
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+$tabsheet = new tabsheet();
+$tabsheet->set_id('umr');
+
+$tabsheet->add('home', l10n('User Mass Register'), UMR_ADMIN . '-home');
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// +-----------------------------------------------------------------------+
+// | Actions                                                               |
+// +-----------------------------------------------------------------------+
+
+if (isset($_POST['submit']))
+{
+  $emails = explode("\n", $_POST['emails']);
+
+  $emails_to_create = array();
+  $emails_rejected = array();
+  $emails_already_exist = array();
+  $emails_created = array();
+  $emails_on_error = array();
+  
+  foreach ($emails as $email)
+  {
+    $email = trim($email);
+
+    // this test requires PHP 5.2+
+    if (filter_var($email, FILTER_VALIDATE_EMAIL) !== false)
+    {
+      $emails_to_check[] = $email;
+      
+      if (!get_userid_by_email($email))
+      {
+        $emails_to_create[] = $email;
+      }
+      else
+      {
+        $emails_existing[] = $email;
+      }
+    }
+    elseif (!empty($email))
+    {
+      $emails_rejected[] = $email;
+    }
+  }
+
+  foreach ($emails_to_create as $email)
+  {    
+    // find a username
+    list($base_username,) = explode('@', $email);
+    
+    $username = $base_username;
+    $i = 2;
+    while (get_userid($username))
+    {
+      $username = $base_username.($i++);
+    }
+
+    // find a password
+    $password = generate_key(8);
+
+    $errors = register_user_and_notify($username, $password, $email);
+    if (!empty($errors))
+    {
+      $emails_on_error[] = $email;
+    }
+    else
+    {
+      $emails_created[] = $email;
+    }
+  }
+
+  $emails_for_form = array();
+  
+  if (!empty($emails_created))
+  {
+    array_push(
+      $page['infos'],
+      sprintf(
+        l10n('%d users registered'),
+        count($emails_created)
+        )
+      );
+  }
+
+  if (!empty($emails_on_error))
+  {
+    array_push(
+      $page['errors'],
+      sprintf(
+        l10n('%d registrations on error: %s'),
+        count($emails_on_error),
+        implode(', ', $emails_on_error)
+        )
+      );
+
+    $emails_for_form = array_merge($emails_for_form, $emails_on_error);
+  }
+  
+  if (!empty($emails_rejected))
+  {
+    array_push(
+      $page['errors'],
+      sprintf(
+        l10n('%d email addresses rejected: %s'),
+        count($emails_rejected),
+        implode(', ', $emails_rejected)
+        )
+      );
+
+    $emails_for_form = array_merge($emails_for_form, $emails_rejected);
+  }
+
+  if (!empty($emails_existing))
+  {
+    array_push(
+      $page['warnings'],
+      sprintf(
+        l10n('%d email addresses already exist: %s'),
+        count($emails_existing),
+        implode(', ', $emails_existing)
+        )
+      );
+  }  
+}
+
+// +-----------------------------------------------------------------------+
+// | form                                                                  |
+// +-----------------------------------------------------------------------+
+
+// define template file
+$template->set_filename('umr_content', realpath(UMR_PATH . 'admin.tpl'));
+
+// template vars
+$template->assign(array(
+  'UMR_PATH'=> get_root_url() . UMR_PATH, // used for images, scripts, ... access
+  'UMR_ABS_PATH'=> realpath(UMR_PATH),    // used for template inclusion (Smarty needs a real path)
+  'UMR_ADMIN' => UMR_ADMIN,
+  ));
+
+if (isset($emails_for_form) and !empty($emails_for_form))
+{
+  $template->assign('EMAILS', implode("\n", $emails_for_form));
+}
+
+// +-----------------------------------------------------------------------+
+// | sending html code                                                     |
+// +-----------------------------------------------------------------------+
+
+// send page content
+$template->assign_var_from_handle('ADMIN_CONTENT', 'umr_content');
+
+?>
Index: /extension/user_mass_register/admin.tpl
===================================================================
--- /extension/user_mass_register/admin.tpl	(revision 18826)
+++ /extension/user_mass_register/admin.tpl	(revision 18826)
@@ -0,0 +1,13 @@
+<div class="titrePage">
+	<h2>User Mass Register</h2>
+</div>
+
+<form method="post" action="" class="properties">
+  <p style="text-align:left;">
+    <strong>{'Email addresses'|@translate}</strong> {'(one on each line)'|@translate}<br>
+    <textarea name="emails" style="width:500px;height:300px;">{$EMAILS}</textarea>
+  </p>
+
+  <p style="text-align:left;"><input type="submit" name="submit" value="{'Register users'|@translate}"></p>
+
+</form>
Index: /extension/user_mass_register/index.php
===================================================================
--- /extension/user_mass_register/index.php	(revision 18826)
+++ /extension/user_mass_register/index.php	(revision 18826)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extension/user_mass_register/language/en_UK/description.txt
===================================================================
--- /extension/user_mass_register/language/en_UK/description.txt	(revision 18826)
+++ /extension/user_mass_register/language/en_UK/description.txt	(revision 18826)
@@ -0,0 +1,1 @@
+Register many users at once
Index: /extension/user_mass_register/language/en_UK/index.php
===================================================================
--- /extension/user_mass_register/language/en_UK/index.php	(revision 18826)
+++ /extension/user_mass_register/language/en_UK/index.php	(revision 18826)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extension/user_mass_register/language/en_UK/intro.html
===================================================================
--- /extension/user_mass_register/language/en_UK/intro.html	(revision 18826)
+++ /extension/user_mass_register/language/en_UK/intro.html	(revision 18826)
@@ -0,0 +1,30 @@
+<p>
+  <h4>You are a common user?</h4>
+  If so, this plugin is totally useless and you should delete it!
+</p>
+
+<p>
+  <h4>You want to develop a Piwigo plugin?</h4>
+  This plugin is an example of a simple plugin structure, but with cool options:
+  <ul class="square-list">
+    <li>Multilingual plugin</li>
+    <li>Installation and upgrade process</li>
+    <li>Administration page</li>
+    <li>Public page</li>
+    <li>Add tabs to core admin pages</li>
+    <li>Add filters and actions to the Batch Manager</li>
+    <li>Simple template prefilter (on picture.php page)</li>
+    <li>Add new method to the API</li>
+  </ul>
+</p>
+
+<p>
+  <h4>Important note</h4>
+  This skeleton reflects the way I (Mistic, member of the Piwigo.or team) develop, it's absolutely not a perfect and unique solution.<br>
+  You should not use the Skeleton files for your own plugin, it includes features useless for most plugins but making Piwigo slower and heavier. You should see how it works and try to implement these features whith your habits of coding and your knowledges.
+</p>
+
+<p>
+  <h4>Licensing</h4>
+  This work is in the public domain, without any license, you can entirely re-use it and say it's your own work :-)
+</p>
Index: /extension/user_mass_register/language/en_UK/plugin.lang.php
===================================================================
--- /extension/user_mass_register/language/en_UK/plugin.lang.php	(revision 18826)
+++ /extension/user_mass_register/language/en_UK/plugin.lang.php	(revision 18826)
@@ -0,0 +1,10 @@
+<?php
+$lang['User Mass Register'] = 'User Mass Register';
+$lang['Email addresses'] = 'Email addresses';
+$lang['(one on each line)'] = '(one on each line)';
+$lang['Register users'] = 'Register users';
+$lang['%d users registered'] = '%d users registered';
+$lang['%d registrations on error: %s'] = '%d registrations on error: %s';
+$lang['%d email addresses rejected: %s'] = '%d email addresses rejected: %s';
+$lang['%d email addresses already exist: %s'] = '%d email addresses already exist: %s';
+?>
Index: /extension/user_mass_register/language/fr_FR/description.txt
===================================================================
--- /extension/user_mass_register/language/fr_FR/description.txt	(revision 18826)
+++ /extension/user_mass_register/language/fr_FR/description.txt	(revision 18826)
@@ -0,0 +1,1 @@
+Enregistrement d'utilisateurs en masse
Index: /extension/user_mass_register/language/fr_FR/index.php
===================================================================
--- /extension/user_mass_register/language/fr_FR/index.php	(revision 18826)
+++ /extension/user_mass_register/language/fr_FR/index.php	(revision 18826)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extension/user_mass_register/language/fr_FR/intro.html
===================================================================
--- /extension/user_mass_register/language/fr_FR/intro.html	(revision 18826)
+++ /extension/user_mass_register/language/fr_FR/intro.html	(revision 18826)
@@ -0,0 +1,30 @@
+<p>
+  <h4>Vous êtes utilisateur ?</h4>
+  Dans ce cas: rien, et vous feriez mieux de supprimer ce plugin !
+</p>
+
+<p>
+  <h4>Vous souhaitez développer un plugin pour Piwigo ?</h4>
+  Ce plugin est un exemple de structure basique de plugin, mais avec des fonctionnalités cool :
+  <ul class="square-list">
+    <li>Plugin multilingue</li>
+    <li>Procédure d'installation et mise à jour automatique</li>
+    <li>Page d'administration</li>
+    <li>Page publique</li>
+    <li>Ajout d'onglet sur les pages d'administration existantes</li>
+    <li>Ajout des filtres et actions au gestionnaire de lots</li>
+    <li>Préfiltre de template simple (sur page picture.php)</li>
+    <li>Ajout d'une méthode à l'API</li>
+  </ul>
+</p>
+
+<p>
+  <h4>Note importante</h4>
+  Skeleton reflète la façon dont je (Mistic, membre de l'équipe Piwigo.org) développe, ce n'est certainement pas un solution parfaite et unique.<br>
+  Vous ne devriez pas directement developper vos plugins à partir du code de Skeleton, il inclut des fonctionnalités inutiles pour la plupart des plugins mais qui rendent Piwigo plus lourd et plus lent. Préférez comprendre comment ça fonctionne et implémenter les fonctionnalités à votre façon.
+</p>
+
+<p>
+  <h4>License</h4>
+  Ce plugin est dans le domaine publique, aucune license ne s'y applique, vous pouvez sans problème vous approprier le code sans contrepartie ou mention :-)
+</p>
Index: /extension/user_mass_register/language/fr_FR/plugin.lang.php
===================================================================
--- /extension/user_mass_register/language/fr_FR/plugin.lang.php	(revision 18826)
+++ /extension/user_mass_register/language/fr_FR/plugin.lang.php	(revision 18826)
@@ -0,0 +1,10 @@
+<?php
+$lang['User Mass Register'] = 'Inscriptions d\'utilisateur en masse';
+$lang['Email addresses'] = 'Adresses email';
+$lang['(one on each line)'] = '(une par ligne)';
+$lang['Register users'] = 'Enregistrer les utilisateurs';
+$lang['%d users registered'] = '%d utilisateurs enregistrés';
+$lang['%d registrations on error: %s'] = '%d enregistrement en erreur : %s';
+$lang['%d email addresses rejected: %s'] = '%d adresses email rejetées : %s';
+$lang['%d email addresses already exist: %s'] = '%d adresse email existent déjà : %s';
+?>
Index: /extension/user_mass_register/language/index.php
===================================================================
--- /extension/user_mass_register/language/index.php	(revision 18826)
+++ /extension/user_mass_register/language/index.php	(revision 18826)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extension/user_mass_register/main.inc.php
===================================================================
--- /extension/user_mass_register/main.inc.php	(revision 18826)
+++ /extension/user_mass_register/main.inc.php	(revision 18826)
@@ -0,0 +1,45 @@
+<?php 
+/*
+Plugin Name: User Mass Register
+Version: auto
+Description: Register several users at once
+Plugin URI: auto
+Author: plg
+Author URI: http://le-gall.net/pierrick
+*/
+
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
+
+global $prefixeTable;
+
+// +-----------------------------------------------------------------------+
+// | Define plugin constants                                               |
+// +-----------------------------------------------------------------------+
+
+defined('UMR_ID') or define('UMR_ID', basename(dirname(__FILE__)));
+define('UMR_PATH' ,   PHPWG_PLUGINS_PATH . UMR_ID . '/');
+define('UMR_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . UMR_ID);
+
+// +-----------------------------------------------------------------------+
+// | Add event handlers                                                    |
+// +-----------------------------------------------------------------------+
+
+// admin plugins menu link
+add_event_handler('get_admin_plugin_menu_links', 'umr_admin_plugin_menu_links');
+
+/**
+ * admin plugins menu link
+ */
+function umr_admin_plugin_menu_links($menu) 
+{
+  array_push(
+    $menu,
+    array(
+      'NAME' => 'User Mass Register',
+      'URL' => UMR_ADMIN,
+      )
+    );
+  
+  return $menu;
+}
+?>
