Index: /extensions/Register_PhpBB/admin/reg_phpbb_admin.php
===================================================================
--- /extensions/Register_PhpBB/admin/reg_phpbb_admin.php	(revision 7727)
+++ /extensions/Register_PhpBB/admin/reg_phpbb_admin.php	(revision 7727)
@@ -0,0 +1,144 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Register_PhpBB                                          |
+// | Plugin Version : 1.2a                                                 |
+// | File Version : 0.1                                                    |
+// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
+// | Plugin description :                                                  |
+// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
+// | phpbb - This plugin allows to automatically register a PWG user in a  |
+// | phpbb forum                                                           |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// ***************************************
+// ** Plugin Administration panel setup **
+// ***************************************
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+/* ****************************************************** */
+/* Plugin template initialisation for admin panel display */
+/* ****************************************************** */
+
+$me = get_plugin_data($plugin_id);
+
+global $template;
+
+// Setup plugin Language
+  $RPlang = ( isset($user['language']) ) ?
+    $user['language'] : $conf['default_language']; // en_UK.iso-8859-1
+  $my_path = dirname(__FILE__).'/../';
+  $rp = array();
+  if ( !@file_exists($my_path."language/$RPlang/lang.admin.regphpbb.php") )
+  {
+    $SIElang = 'en_UK.iso-8859-1';
+  }
+// Include language
+  @include_once( $my_path."language/$RPlang/lang.admin.regphpbb.php" );
+
+// Load configuration settings from database
+load_conf_from_db('param like \'phpbb\\_%\'');
+
+// Update configuration settings in database
+if ( isset($_POST['submit']) )
+{
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+  SET value="'.$_POST['phpbb_status'].'"
+  WHERE param="phpbb_status"
+  LIMIT 1';
+  pwg_query($query);
+
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+  SET value="'.$_POST['phpbb_prefix'].'"
+  WHERE param="phpbb_prefix"
+  LIMIT 1';
+  pwg_query($query);
+  
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+  SET value="'.$_POST['phpbb_admin'].'"
+  WHERE param="phpbb_admin"
+  LIMIT 1';
+  pwg_query($query);
+
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+  SET value="'.$_POST['phpbb_timezone'].'"
+  WHERE param="phpbb_timezone"
+  LIMIT 1';
+  pwg_query($query);
+  
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+  SET value="'.$_POST['phpbb_language'].'"
+  WHERE param="phpbb_language"
+  LIMIT 1';
+  pwg_query($query);
+  
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+  SET value="'.$_POST['phpbb_style'].'"
+  WHERE param="phpbb_style"
+  LIMIT 1';
+  pwg_query($query);
+  
+  $query = '
+UPDATE '.CONFIG_TABLE.'
+  SET value="'.$_POST['phpbb_del_pt'].'"
+  WHERE param="phpbb_del_pt"
+  LIMIT 1';
+  pwg_query($query);
+
+// Reload settings for correct display after update
+load_conf_from_db('param like \'phpbb\\_%\'');
+}
+
+// Users migration from PWG to PhpBB
+//TODO: How to insert migration results in pwg template or a new blank window ?
+if ( isset($_POST['Migration']) )
+{
+	include_once (PHPWG_ROOT_PATH.'plugins/Register_Phpbb/include/constants.php');
+	include (PHPWG_ROOT_PATH.'plugins/Register_Phpbb/reg_phpbb_migration.php');
+}
+
+// Users table synchronization
+//TODO: How to insert synchronization results in pwg template or a new blank window ?
+if ( isset($_POST['Synchro']) )
+{
+	include_once (PHPWG_ROOT_PATH.'plugins/Register_Phpbb/include/constants.php');
+	include (PHPWG_ROOT_PATH.'plugins/Register_Phpbb/reg_phpbb_synchro.php');
+}
+
+/* Template settings */
+$template->assign_vars(
+    array(
+      'PHPBB_STATUS' => $conf['phpbb_status'],
+	  'PHPBB_PREFIX' => $conf['phpbb_prefix'],
+      'PHPBB_ADMIN' => $conf['phpbb_admin'],
+      'PHPBB_TIMEZONE' => $conf['phpbb_timezone'],
+      'PHPBB_LANGUAGE' => $conf['phpbb_language'],
+      'PHPBB_STYLE' => $conf['phpbb_style'],
+      'PHPBB_DEL_PT' => $conf['phpbb_del_pt'],
+    )
+  );
+
+$template->set_filenames( array('plugin_admin_content' => dirname(__FILE__).'/reg_phpbb_admin.tpl') );
+
+$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Register_PhpBB/admin/reg_phpbb_admin.tpl
===================================================================
--- /extensions/Register_PhpBB/admin/reg_phpbb_admin.tpl	(revision 7727)
+++ /extensions/Register_PhpBB/admin/reg_phpbb_admin.tpl	(revision 7727)
@@ -0,0 +1,70 @@
+<div class="titrePage">
+  <h2>{lang:Title}</h2>
+</div>
+
+<p>{lang:Howto}</p>
+
+<br />
+
+<div align="left" style="margin-left: 1em; margin-right: 1em;">{lang:Install_Disclaimer}</div>
+
+<br />
+
+<form method="post" action="{RegPhpBB_F_ACTION}" class="general">
+<fieldset>
+	<legend>{lang:Update}</legend>
+	<div align="left">{lang:Update_Disclaimer}</div>
+</fieldset>
+</form>
+
+<br />
+
+<div align="left" style="margin-left: 1em; margin-right: 1em;">{lang:Install_Disclaimer2}</div>
+
+<br />
+
+<form method="post" action="{RegPhpBB_F_ACTION}" class="general">
+<fieldset>
+	<legend>{lang:Step1_Title}</legend>
+<div align="left">{lang:Step1_Disclaimer}</div>
+<ul>
+	<li><label>{lang:Phpbb_Prefix}</label><br />
+		<div align="center"><label><input type="text" name="phpbb_prefix" value="{PHPBB_PREFIX}" size="8" style="text-align: center;"/></label></div><br /><br />
+	</li>
+	<li><label>{lang:Phpbb_Admin}</label><br /><br />
+		<div align="center"><label><input type="text" name="phpbb_admin" value="{PHPBB_ADMIN}" size="12" style="text-align: center;"/></label></div><br /><br />
+	</li>
+	<li><label>{lang:Phpbb_Timezone}</label>
+		<div align="center"><label><input type="text" name="phpbb_timezone" value="{PHPBB_TIMEZONE}" size="1" style="text-align: center;"/></label></div><br /><br />
+	</li>
+	<li><label>{lang:Phpbb_Language}</label>
+		<div align="center"><label><input type="text" name="phpbb_language" value="{PHPBB_LANGUAGE}" size="8" style="text-align: center;"/></label></div><br /><br />
+	</li>
+	<li><label>{lang:Phpbb_Style}</label>
+		<div align="center"><label><input type="text" name="phpbb_style" value="{PHPBB_STYLE}" size="8" style="text-align: center;"/></label></div><br /><br />
+	</li>
+	<li><label>{lang:Phpbb_Del_Pt}</label>
+		<div align="center"><label><input type="text" name="phpbb_del_pt" value="{PHPBB_DEL_PT}" size="1" style="text-align: center;"/></label></div><br /><br />
+	</li>
+	<li><label>{lang:PluginActivation}</label><br />
+		<div align="center"><label><input type="text" name="phpbb_status" value="{PHPBB_STATUS}" style="text-align: center;"/></label></div><br /><br />
+	</li>
+</ul>
+	<div align="center"><input class="submit" type="submit" value="{lang:submit}" name="submit" /></div>
+</fieldset>
+</form>
+
+<form method="post" action="{RegPhpBB_F_ACTION}" class="general">
+<fieldset>
+	<legend>{lang:Step2_Title}</legend>
+	<div align="left">{lang:Step2_Text}</div>
+<br/>
+	<div align="center">{lang:Step22_Text}</div>
+<br/>
+	<div align="center"><input class="submit" type="submit" value="{lang:Step2_Btn}" name="Migration" /></div>
+<br />
+	<div align="left">{lang:Step3_Text}</div>
+<br/>
+	<div align="center"><input class="submit" type="submit" value="{lang:Step3_Btn}" name="Synchro" /></div>
+</fieldset>
+</form>
Index: /extensions/Register_PhpBB/include/constants.php
===================================================================
--- /extensions/Register_PhpBB/include/constants.php	(revision 7727)
+++ /extensions/Register_PhpBB/include/constants.php	(revision 7727)
@@ -0,0 +1,30 @@
+<?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: constants.php 2002 2007-05-04 22:43:06Z plg $
+// | last update   : $Date: 2007-05-05 00:43:06 +0200 (sam, 05 mai 2007) $
+// | last modifier : $Author: plg $
+// | revision      : $Revision: 2002 $
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+global $prefixeTable;
+
+define('PLUGIN_REGISTER_PHPBB_ID', $prefixeTable.'plugin_register_phpbb_id_user');
+?>
Index: /extensions/Register_PhpBB/language/en_UK.iso-8859-1/lang.admin.regphpbb.php
===================================================================
--- /extensions/Register_PhpBB/language/en_UK.iso-8859-1/lang.admin.regphpbb.php	(revision 7727)
+++ /extensions/Register_PhpBB/language/en_UK.iso-8859-1/lang.admin.regphpbb.php	(revision 7727)
@@ -0,0 +1,38 @@
+<?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 |
+// +-----------------------------------------------------------------------+
+//$lang_info['language_name'] = 'English';
+//$lang_info['country'] = ''Great Britain';
+//$lang_info['charset'] = 'iso-8859-1';
+//$lang_info['direction'] = 'ltr';
+//$lang_info['code'] = 'en';
+global $lang;
+$lang['Title'] = 'Register PhpBB';
+$lang['Howto'] = 'This plugin permits to record an user, registering on PWG, in a PhpBB forum, automatically. It\'s based on the Mod Register_PhpBB achieved by Flipflip that I thank, here, to have initialized the project. Special thanks to Rub (PWG Team) for his precious help.';
+$lang['Install_Disclaimer']='Warning ! After the complete activation of this plugin, all  users administrative manipulations  (manual addition, deletion, modification) for these two scripts (PWG and PhpBB) should be achieved through the admin interface of PWG. It\'s counseled to disactivate the registering of PhpBB but it is not obligatory. The two scripts can continue to function independently but the users who registers on the forum won\'t have a valid account to reach your gallery. On the contrary, an user who registers on the gallery becomes automatically member of the forum... That\'s the confessed goal of this plugin  ;-)';
+$lang['Update']='Update process';
+$lang['Update_Disclaimer']='<u>Only for those that used the Mod version of this plugin</u>, here are the steps to update :<br/><ol><li>Delete the whole code added to the source of PWG (refer to the Mod installation file)  in order to come back to a situation before application of the Mod.</li><li>Delete the PLUGIN_REGISTER_PHPBB_ID_USER table of the database. This table is created by the installation of the plugin, must be empty and won\'t be used.</li><li>Rename the MOD_REGISTER_PHPBB_ID_USER table in PLUGIN_REGISTER_PHPBB_ID_USER</li><li>Verify, correct and activate the behavior parameters of the plugin => <u>Go to step 1 - DO NOT PROCESS THE STEP 2 MIGRATION FUNCTIONS !</u></li><li>The resynchronisation is optional. It will put back in order table of correspondence.</li></ol>';
+$lang['Install_Disclaimer2']='In a first time, it is necessary to set the working parameters of the plugin with PhpBB, then, to copy the  PWG users accounts toward PhpBB. A third function is available in order to resynchronize the tables in the case where one addition or user\'s deletion took place badly. But you should not have to use it.<br/><br/>At the end of the 2 main steps, the plugin will be fully functional and you won\'t have to come back on this page anymore.';
+$lang['Step1_Title'] = 'Step 1 : Plugin settings';
+$lang['Step1_Disclaimer'] = 'Verify the parameters according to your PhpBB installation and correct them if needed. Modify, if the case arises, the behavior of the plugin to your suitability. Finally, don\'t forget to pass the activation of the plugin to 1 before recording your parameters!';
+$lang['PluginActivation']='Activate or Disactivate the registration in PhpBB<br/>
+0 --&gt; Disactivate (no automatic addition of the users in PhpBB)<br/>
+1 --&gt; Activate<br/>';
+$lang['Phpbb_Prefix']='PhpBB tables prefix :';
+$lang['Phpbb_Admin']='Username of the PWG administrator. <b><u>Must be identical to the PhpBB adminnistrator username</u></b> :';
+$lang['Phpbb_Timezone']='Time zone (de -12 à 14) :';
+$lang['Phpbb_Language']='Language (French, English) :';
+$lang['Phpbb_Style']='Forum style Id (default value is 1):';
+$lang['Phpbb_Del_Pt']='Delete user topics and posts when user is deleted.<br/>
+0 --&gt; Delete all<br/>
+1 --&gt; Do not delete topics and posts<br/>';
+$lang['Step2_Btn']='Migration';
+$lang['Step2_Title']='Step 2 : Migration of the PWG accounts toward PhpBB / Re synchronization of the accounts';
+$lang['Step2_Text']='Two cases here : <br/><br/><u>1) You never used the Mod Register_PhpBB and even less the same named plugin</u> -> In this case, your PhpBB table #_users must be empty of all account. You can then click <b>ONE TIME</b> on "Migration" button. If some mistakes occur during the operation, empty the tables [PhpBB] _users and [PWG] _plugin_register_PhpBB_id_user (via PhpMyAdmin for example), correct the reason of the problem and restart the operation of migration (to that moment only you can click again on the "Migration" button).';
+$lang['Step22_Text']='<b>NEVER RE DO THIS OPERATION MORE THAN ONE TIME</b> !';
+$lang['Step3_Btn']='Resynch';
+$lang['Step3_Text']='<u>2) You already used the Mod / plugin (update of a previous version of PWG toward the present)</u> -> It means that you already have an ID correspondence table  between PWG and PhpBB. The script of re synchronization will detect the present data while comparing the names of the users and their e-mail address in the two #_users tables (PWG and PhpBB) and will put up to date this table of correspondence. At the end of the operation, please verify the presence of possible duplicated users in PhpBB. If it is the case, it is necessary to suppress the oldest (sorting of the PhpBB users according to their registration date).<br/><br/>';
+?>
Index: /extensions/Register_PhpBB/language/fr_FR.iso-8859-1/lang.admin.regphpbb.php
===================================================================
--- /extensions/Register_PhpBB/language/fr_FR.iso-8859-1/lang.admin.regphpbb.php	(revision 7727)
+++ /extensions/Register_PhpBB/language/fr_FR.iso-8859-1/lang.admin.regphpbb.php	(revision 7727)
@@ -0,0 +1,38 @@
+<?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 |
+// +-----------------------------------------------------------------------+
+//$lang_info['language_name'] = 'Français';
+//$lang_info['country'] = 'France';
+//$lang_info['charset'] = 'iso-8859-1';
+//$lang_info['direction'] = 'ltr';
+//$lang_info['code'] = 'fr';
+global $lang;
+$lang['Title'] = 'Register PhpBB';
+$lang['Howto'] = 'Ce plugin permet d\'enregistrer automatiquement un utilisateur, s\'inscrivant sur PWG, dans un forum PhpBB. Il est basé sur le Mod Register_PhpBB réalisé par Flipflip que je remercie, ici, d\'avoir initialisé le projet. Remerciement spécial à Rub (PWG Team) pour son aide précieuse.';
+$lang['Install_Disclaimer']='Attention ! Après l\'activation complète de ce plugin, toutes les manipulations d\'administration des utilisateurs (ajout manuel, suppression, modification) des deux scripts (PWG et PhpBB) devront être réalisées à travers l\'interface d\'administration de PWG. Il est conseillé de désactiver l\'inscription de PhpBB mais ce n\'est pas obligatoire. Les deux scripts peuvent continuer à fonctionner indépendemment mais les utilisateurs s\'inscivant sur le forum n\'auront pas de compte valide pour accéder à votre galerie. Au contraire, un utilisateur qui s\'inscrit sur la galerie devient automatiquement membre du forum... C\'est le but avoué de ce plugin ;-)';
+$lang['Update']='Procédure pour mise à jour';
+$lang['Update_Disclaimer']='<u>Uniquement pour ceux qui utilisaient la version Mod de ce plugin</u>, voici les étapes pour mettre à jour :<br/><ol><li>Supprimez tout le code ajouté au source de PWG (se reporter au fichier d\'install accompagnant le Mod) afin de revenir à une situation avant application du Mod.</li><li>Supprimez la table PLUGIN_REGISTER_PHPBB_ID_USER de la base de donnée. Cette table est créée par l\'installation du plugin, doit être vide et ne sera pas utilisée.</li><li>Renommez la table MOD_REGISTER_PHPBB_ID_USER en PLUGIN_REGISTER_PHPBB_ID_USER</li><li>Vérifiez, corrigez et activez les paramètres de comportement du plugin => <u>Rendez vous à l\'étape 1 - NE FAITES PAS LA MIGRATION DE l\'ETAPE 2 !</u></li><li>La resynchronisation est optionnelle. Elle remettra à plat la table de correspondance.</li></ol>';
+$lang['Install_Disclaimer2']='Dans un premier temps, il faut configurer les paramètres de fonctionnement du plugin vis à vis de PhpBB puis copier les comptes utilisateurs présents dans PWG vers PhpBB. Une troisième fonction est disponible afin de resynchroniser les tables dans le cas où un ajout ou une suppression d\'utilisateur s\'est mal déroulée. Mais vous ne devriez pas avoir à l\'utiliser.<br/><br/>A l\'issue des 2 étapes principales, le plugin sera pleinement fonctionnel et vous n\'aurez plus à revenir sur cette page.';
+$lang['Step1_Title'] = 'Etape 1 : Configuration du plugin';
+$lang['Step1_Disclaimer'] = 'Vérifiez les paramètres relatifs à votre installation de PhpBB et corrigez les au besoin. Modifiez, le cas échéant, le comportement du plugin à votre convenance. Enfin, n\'oubliez pas de passer l\'activation du plugin à 1 avant d\'enregistrer vos paramètres !';
+$lang['PluginActivation']='Activer ou Désactiver l\'enregistrement dans PhpBB<br/>
+0 --&gt; Désactivé (pas d\'ajout automatique des utilisateurs dans PhpBB)<br/>
+1 --&gt; Activé<br/>';
+$lang['Phpbb_Prefix']='Préfixe des tables de PhpBB :';
+$lang['Phpbb_Admin']='Nom d\'utilisateur de l\'administrateur de PWG. <b><u>Doit être identique à celui de PhpBB</u></b> :';
+$lang['Phpbb_Timezone']='Zone de temps (de -12 à 14) :';
+$lang['Phpbb_Language']='Langue (French, English) :';
+$lang['Phpbb_Style']='Id du style du forum (1 par défaut) :';
+$lang['Phpbb_Del_Pt']='Suppression des topics et posts de l\'utilisateur lorsqu\'il est supprimé.<br/>
+0 --&gt; Supprimer tout<br/>
+1 --&gt; Ne supprime pas les posts et les topics<br/>';
+$lang['Step2_Btn']='Migration';
+$lang['Step2_Title']='Etape 2 : Migration des comptes PWG vers PhpBB / Resynchronisation des comptes';
+$lang['Step2_Text']='Deux cas de figure se présentent ici : <br/><br/><u>1) Vous n\'avez jamais utilisé le Mod Register_PhpBB et encore moins le plugin du même nom</u> -> Dans ce cas, votre table #_users de PhpBB doit être vide de tout compte. Vous pouvez alors cliquez <b>UNE FOIS</b> sur le bouton "Migration". Si des erreurs se produisent pendant l\'opération, videz les tables [PhpBB]_users et [PWG]_plugin_register_PhpBB_id_user (via PhpMyAdmin par exemple), corrigez la cause du problème et recommencez l\'opération de migration (à ce moment là seulement vous pouvez recliquer sur le bouton "Migration").';
+$lang['Step22_Text']='<b>NE JAMAIS EFFECTUER CETTE OPERATION PLUS D\'UNE FOIS DE SUITE</b> !';
+$lang['Step3_Btn']='Resynch';
+$lang['Step3_Text']='<u>2) Vous avez déjà utilisé le Mod / plugin (mise à jour d\'une version précédentes de PWG vers l\'actuelle)</u> -> Ceci signifie que vous disposez déjà d\'une table de correspondance des Id entre PWG et PhpBB. Le script de re synchronisation détectera les données présentes en comparant les noms des utilisateurs et leur adresse email dans les deux tables #_users (PWG et PhpBB) et mettra à jour cette table de correspondance. A l\'issue de l\'opération, veuillez vérifier la présence de doublons éventuels dans les utilisateurs de PhpBB. Si cela est le cas, il faut supprimer les plus anciens (tri des utilisateurs PhpBB selon leur date d\'incription).<br/><br/>';
+?>
Index: /extensions/Register_PhpBB/main.inc.php
===================================================================
--- /extensions/Register_PhpBB/main.inc.php	(revision 7727)
+++ /extensions/Register_PhpBB/main.inc.php	(revision 7727)
@@ -0,0 +1,58 @@
+<?php
+/*
+Plugin Name: Register PhpBB
+Version: 1.2a
+Description: Ce plugin permet d'enregistrer automatiquement un utilisateur de PWG dans un forum PhpBB. Rendez-vous dans le panneau d'administration du plugin pour finaliser les paramètres - This plugin allows to automatically register a PWG user in a PhpBB forum. Go to plugin administration panel to finalize the settings. Based on original Mod by Flipflip.
+Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=129
+Author: Eric
+Author URI: http://www.infernoweb.net
+*/
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+/* ******************* */
+/* Class of the plugin */
+/* ******************* */
+class Register_PhpBB
+{
+/* Set the administration panel of the plugin */
+  function plugin_admin_menu($menu)
+  {
+    array_push($menu,
+        array(
+          'NAME' => 'Register PhpBB',
+          'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/reg_phpbb_admin.php')
+        )
+      );
+    return $menu;
+  }
+
+/* User adding */
+  function PhpBB_Adduser($register_user)
+  {
+  	include_once (PHPWG_ROOT_PATH.'/include/constants.php');
+  	include_once (dirname(__FILE__).'/include/constants.php');
+	load_conf_from_db('param like \'phpbb\\_%\'');
+	global $conf;
+	if ($conf['phpbb_status'])
+		include (dirname(__FILE__).'/reg_phpbb_adduser.php');
+  }
+
+/* User deletion */
+   function PhpBB_Deluser($user_id)
+  {
+  	include_once (PHPWG_ROOT_PATH.'/include/constants.php');
+  	include_once (dirname(__FILE__).'/include/constants.php');
+	load_conf_from_db('param like \'phpbb\\_%\'');
+  	global $conf;
+	if ($conf['phpbb_status'])
+		include (dirname(__FILE__).'/reg_phpbb_deluser.php');
+  }
+}
+
+$obj = new Register_PhpBB(); /* class loading */
+
+add_event_handler( 'register_user', array(&$obj, 'PhpBB_Adduser') );
+add_event_handler( 'delete_user', array(&$obj, 'PhpBB_Deluser') );
+add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') );
+set_plugin_data($plugin['id'], $obj);
+?>
Index: /extensions/Register_PhpBB/maintain.inc.php
===================================================================
--- /extensions/Register_PhpBB/maintain.inc.php	(revision 7727)
+++ /extensions/Register_PhpBB/maintain.inc.php	(revision 7727)
@@ -0,0 +1,129 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Register_PhpBB                                          |
+// | Plugin Version : 1.2a                                                 |
+// | File Version : 0.2                                                    |
+// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
+// | Plugin description :                                                  |
+// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
+// | phpbb - This plugin allows to automatically register a PWG user in a  |
+// | phpbb forum                                                           |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// ******************************************
+// ** Database install - uninstall queries **
+// ******************************************
+
+  define('REGISTER_PHPBB_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+  include_once(REGISTER_PHPBB_PATH.'include/constants.php');
+  
+function plugin_install()
+{
+	$q = '
+INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+	VALUES
+	("phpbb_status","0","Activation of Register_PhpBB plugin");';
+
+  pwg_query($q);
+
+	$q = '
+INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+	VALUES
+	("phpbb_prefix","phpbb_","PhpBB prefix tables");';
+
+  pwg_query($q);
+
+	$q = '
+INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+	VALUES
+	("phpbb_admin","admin","PWG administrator username. Must be the same as PhpBB administrator username");';
+
+  pwg_query($q);
+
+	$q = '
+INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+	VALUES
+	("phpbb_timezone","1","Timezone");';
+
+  pwg_query($q);
+
+	$q = '
+INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+	VALUES
+	("phpbb_language","English","Language");';
+
+  pwg_query($q);
+
+	$q = '
+INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+	VALUES
+	("phpbb_style","1","Default forum\'s skin ID");';
+
+  pwg_query($q);
+  
+  	$q = '
+INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
+	VALUES
+	("phpbb_del_pt","1","Deletion of topics and posts from deleted user");';
+
+  pwg_query($q);
+
+	$q = '
+CREATE TABLE IF NOT EXISTS '.PLUGIN_REGISTER_PHPBB_ID.' (
+  id_user_pwg smallint(5) NOT NULL default "0",
+  id_user_phpbb int(10) NOT NULL default "0",
+  KEY id_user_pwg (id_user_pwg,id_user_phpbb));';
+
+  pwg_query($q);
+}
+
+
+function plugin_uninstall()
+{
+  $q = '
+DELETE FROM '.CONFIG_TABLE.' WHERE param="phpbb_status" LIMIT 1;';
+  pwg_query( $q );
+
+  $q = '
+DELETE FROM '.CONFIG_TABLE.' WHERE param="phpbb_prefix" LIMIT 1;';
+  pwg_query( $q );
+
+  $q = '
+DELETE FROM '.CONFIG_TABLE.' WHERE param="phpbb_admin" LIMIT 1;';
+  pwg_query( $q );
+
+  $q = '
+DELETE FROM '.CONFIG_TABLE.' WHERE param="phpbb_timezone" LIMIT 1;';
+  pwg_query( $q );
+
+  $q = '
+DELETE FROM '.CONFIG_TABLE.' WHERE param="phpbb_language" LIMIT 1;';
+  pwg_query( $q );
+
+  $q = '
+DELETE FROM '.CONFIG_TABLE.' WHERE param="phpbb_style" LIMIT 1;';
+  pwg_query( $q );
+
+  $q = '
+DELETE FROM '.CONFIG_TABLE.' WHERE param="phpbb_del_pt" LIMIT 1;';
+  pwg_query( $q );
+
+  $q = 'DROP TABLE '.PLUGIN_REGISTER_PHPBB_ID.';';
+  pwg_query( $q );
+}
+
+?>
Index: /extensions/Register_PhpBB/reg_phpbb_adduser.php
===================================================================
--- /extensions/Register_PhpBB/reg_phpbb_adduser.php	(revision 7727)
+++ /extensions/Register_PhpBB/reg_phpbb_adduser.php	(revision 7727)
@@ -0,0 +1,180 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Register_PhpBB                                          |
+// | Plugin Version : 1.2a                                                 |
+// | File Version : 0.3                                                    |
+// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
+// | Plugin description :                                                  |
+// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
+// | phpbb - This plugin allows to automatically register a PWG user in a  |
+// | phpbb forum                                                           |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// *****************************************
+// ** Add user to the PhpBB #_users table **
+// *****************************************
+
+// Load Plugin settings from database
+load_conf_from_db('param like \'phpbb\\_%\'');
+
+global $conf;
+
+// Password hashing method
+if (function_exists('sha1'))	// Only in PHP 4.3.0+
+	{
+    	$password = sha1($_POST['password']);
+	}
+else if (function_exists('mhash'))	// Only if Mhash library is loaded
+	{
+    	$password =  bin2hex(mhash(MHASH_SHA1, $_POST['password']));
+	}
+else
+	{
+    	$password =  md5($_POST['password']);
+	}
+
+// Getting the last user Id
+$query0 = '
+		SELECT MAX(user_id) AS total FROM
+		'.$conf['phpbb_prefix'].'users;
+	';
+$result0 = pwg_query($query0);
+$row0 = mysql_fetch_array($result0);
+
+// New user Id is the last one + 1
+$id_user_phpbb = $row0['total'] + 1;
+
+// Registration date and time
+$registred = time();
+
+// Check wich email var is used
+if (defined('IN_ADMIN') and IN_ADMIN) /* This is for adding a user in admin panel */
+	{
+		$mail = $_POST['email'];
+		$query1 = "
+        	INSERT INTO ".$conf['phpbb_prefix']."users
+			(user_id, user_active, user_actkey, username, user_password, user_session_time, user_session_page, user_lastvisit, user_regdate, user_level, user_posts, user_style, user_lang, user_dateformat, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_login_tries, user_last_login_try, user_viewemail, user_attachsig, user_allowhtml, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_rank, user_avatar_type, user_email)
+			VALUES (
+				'".$id_user_phpbb."',
+				'1',
+			    '',
+			    '".$_POST['login']."',
+			    '".$password."', 
+			    '0',
+			    '0',
+			    '".$registred."',
+			    '".$registred."', 
+				'0',
+			    '0',
+			    '".$conf['phpbb_style']."',
+			    '".$conf['phpbb_language']."',
+			    'D M d, Y g:i a',
+			    '0',
+			    '0',
+			    '0',
+			    '0',
+		    	'0',
+			    '0',
+			    '1',
+			    '0',
+		    	'1',
+			    '1',
+			    '1',
+			    '1',
+		    	'1',
+			    '0',
+			    '1',
+			    '1',
+		    	'0',
+			    '0',
+			    '".$mail."'
+			);
+		";
+		$result1 = pwg_query($query1);
+	}
+else /* This is when a user registered himself with the register form */
+	{
+		$query2 = "
+			INSERT INTO ".$conf['phpbb_prefix']."users
+			(user_id, user_active, user_actkey, username, user_password, user_session_time, user_session_page, user_lastvisit, user_regdate, user_level, user_posts, user_style, user_lang, user_dateformat, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_login_tries, user_last_login_try, user_viewemail, user_attachsig, user_allowhtml, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_rank, user_avatar_type, user_email)
+			VALUES (
+				'".$id_user_phpbb."',
+				'1',
+			    '',
+			    '".$_POST['login']."',
+			    '".$password."', 
+			    '0',
+			    '0',
+			    '".$registred."',
+			    '".$registred."', 
+				'0',
+			    '0',
+			    '".$conf['phpbb_style']."',
+			    '".$conf['phpbb_language']."',
+			    'D M d, Y g:i a',
+			    '0',
+			    '0',
+			    '0',
+			    '0',
+		    	'0',
+			    '0',
+			    '1',
+			    '0',
+		    	'1',
+			    '1',
+			    '1',
+			    '1',
+		    	'1',
+			    '0',
+			    '1',
+			    '1',
+		    	'0',
+			    '0',
+			    '".$_POST['mail_address']."'
+			);
+		";
+		$result2 = pwg_query($query2);
+	}
+
+// Processing forum groups
+$query3 = "
+		INSERT INTO ".$conf['phpbb_prefix']."groups
+			(group_name, group_description, group_single_user, group_moderator)
+		VALUES ('".$_POST['login']."', 'Personal User', 1, 0)";
+$result3 = pwg_query($query3);
+ 
+$group_id = mysql_insert_id();
+ 
+$query4 = "
+		INSERT INTO ".$conf['phpbb_prefix']."user_group
+			(group_id, user_id, user_pending)
+		VALUES ('".$group_id."','".$id_user_phpbb."','0');
+	";
+$result4 = pwg_query($query4);
+
+// Retrieve user ID in PhpBB user table
+//$id_user_phpbb = mysql_insert_id();
+
+// Retrieve user ID in PWG user table
+$user_id_pwg = get_userid($_POST['login']);
+
+// Insertion of the ID in the pwg/phpbb correspondence table
+$query5 = "
+        INSERT INTO ".PLUGIN_REGISTER_PHPBB_ID." (id_user_pwg, id_user_phpbb)
+        VALUES('".$user_id_pwg."', '".$id_user_phpbb."');";
+$result5 = pwg_query($query5);
+?>
Index: /extensions/Register_PhpBB/reg_phpbb_deluser.php
===================================================================
--- /extensions/Register_PhpBB/reg_phpbb_deluser.php	(revision 7727)
+++ /extensions/Register_PhpBB/reg_phpbb_deluser.php	(revision 7727)
@@ -0,0 +1,109 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Register_PhpBB                                          |
+// | Plugin Version : 1.2a                                                 |
+// | File Version : 0.1                                                    |
+// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
+// | Plugin description :                                                  |
+// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
+// | phpbb - This plugin allows to automatically register a PWG user in a  |
+// | phpbb forum                                                           |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// ********************************************
+// ** Delete user from the PhpBB users table **
+// ********************************************
+
+// Load Plugin settings from database
+load_conf_from_db('param like \'phpbb\\_%\'');
+
+global $conf;
+
+// ID selection in the pwg/phpbb correspondence table
+$query = "
+        SELECT id_user_phpbb, id_user_pwg FROM ".PLUGIN_REGISTER_PHPBB_ID."
+        WHERE id_user_pwg = ".$user_id.";
+    ";
+$result = pwg_query($query);
+
+while($data = mysql_fetch_array($result))
+{
+  // Selection du nom d'utilisateur
+  $query_0 = "
+		SELECT username, user_id
+		FROM ".$conf['phpbb_prefix']."users
+		WHERE user_id = ".$data['id_user_phpbb'].";
+	";
+  $result_0 = pwg_query($query_0);
+  
+  while ($data_0 = mysql_fetch_array($result_0))
+  {
+    // Suppression des liens groupe -- utilisateur
+    $query_1 = "
+			DELETE FROM ".$conf['phpbb_prefix']."groups
+			WHERE group_name = '".$data_0['username']."';
+		";
+    $result_1 = pwg_query($query_1);
+  }
+    
+  // Si égale à 0, suppression de tous les posts et topics
+  if ($conf['phpbb_del_pt'] == 0)
+  {
+    // Suppression des posts de l'utilisateur
+    $query_2 = "
+			DELETE FROM ".$conf['phpbb_prefix']."posts
+			WHERE poster_id = ".$data['id_user_phpbb'].";
+		";
+    $result_2 = pwg_query($query_2);
+
+    // Suppression des topics de cet utilisateur
+    $query_3 = "
+			DELETE FROM ".$conf['phpbb_prefix']."topics
+			WHERE topic_poster = ".$data['id_user_phpbb'].";
+		";
+    $result_3 = pwg_query($query_3);
+  }
+
+  // Suppression des abonnements de l'utilisateur
+  $query_4 = "
+  		DELETE FROM ".$conf['phpbb_prefix']."topics_watch
+		WHERE user_id = ".$data['id_user_phpbb'].";
+	";
+  $result_4 = pwg_query($query_4);
+  
+  // Suppression du compte utilisateur
+  $query_5 = "
+  		DELETE FROM ".$conf['phpbb_prefix']."users
+		WHERE user_id = ".$data['id_user_phpbb'].";
+	";
+  $result_5 = pwg_query($query_5);
+  
+  // Suppression des liens groupe -- utilisateur
+  $query_6 = "
+  		DELETE FROM ".$conf['phpbb_prefix']."user_group
+		WHERE user_id = ".$data['id_user_phpbb'].";
+	";
+  $result_6 = pwg_query($query_6);
+ 
+  // Suppression de la correspondance pwg/phpbb
+  $query_7 = "
+  		DELETE FROM ".PLUGIN_REGISTER_PHPBB_ID."
+  		WHERE id_user_pwg = ".$user_id.";
+	";
+  $result_7 = pwg_query($query_7);
+}
+?>
Index: /extensions/Register_PhpBB/reg_phpbb_migration.php
===================================================================
--- /extensions/Register_PhpBB/reg_phpbb_migration.php	(revision 7727)
+++ /extensions/Register_PhpBB/reg_phpbb_migration.php	(revision 7727)
@@ -0,0 +1,132 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Register_PhpBB                                          |
+// | Plugin Version : 1.2a                                                 |
+// | File Version : 0.1                                                    |
+// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
+// | Plugin description :                                                  |
+// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
+// | phpbb - This plugin allows to automatically register a PWG user in a  |
+// | phpbb forum                                                           |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// **************************************
+// ** User migration from PWG to PhpBB **
+// **************************************
+
+include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+
+echo '<h2>Migration des comptes PhpWebGallery vers PhpBB</h2>';
+
+// Select of PWG users
+$query = 'SELECT username, password, mail_address FROM '.USERS_TABLE.';';
+$result = pwg_query($query);
+
+$registred = time();
+$registred_ip = '127.0.0.1';
+
+while ($row = mysql_fetch_array($result))
+{
+    if(($row['username'] != 'guest') AND ($row['username'] != $conf['phpbb_admin']))
+    {
+        echo '<b>Transfert du compte :</b> '.$row['username'].' --> ';
+        
+        // Getting the last user Id
+        $query_1 = '
+				SELECT MAX(user_id) AS total
+				FROM '.$conf['phpbb_prefix'].'users;
+			';
+		$result_1 = pwg_query($query_1);
+    	$row_1 = mysql_fetch_array($result_1);
+		// The new user Id is the last one + 1
+		$user_id = $row_1['total'] + 1;
+        
+        $query_2 = "
+			INSERT INTO ".$conf['phpbb_prefix']."users
+			(user_id, user_active, user_actkey, username, user_password, user_session_time, user_session_page, user_lastvisit, user_regdate, user_level, user_posts, user_style, user_lang, user_dateformat, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_login_tries, user_last_login_try, user_viewemail, user_attachsig, user_allowhtml, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_rank, user_avatar_type, user_email)
+			VALUES (
+				'".$user_id."',
+				'1',
+			    '',
+			    '".$row['username']."',
+			    '".$row['password']."', 
+			    '0',
+			    '0',
+			    '".$registred."',
+			    '".$registred."', 
+				    '0',
+			    '0',
+			    '".$conf['phpbb_style']."',
+			    '".$conf['phpbb_language']."',
+			    'D M d, Y g:i a',
+			    '0',
+			    '0',
+			    '0',
+			    '0',
+		    	'0',
+			    '0',
+			    '1',
+			    '0',
+		    	'1',
+			    '1',
+			    '1',
+			    '1',
+		    	'1',
+			    '0',
+			    '1',
+			    '1',
+		    	'0',
+			    '0',
+			    '".$row['mail_address']."'
+			);
+		";
+        $result_2 = pwg_query($query_2);
+
+        // Get PhpBB user Id
+        $id_user_phpbb = mysql_insert_id();
+
+		$query_3 = "
+				INSERT INTO ".$conf['phpbb_prefix']."groups
+				(group_name, group_description, group_single_user, group_moderator)
+				VALUES ('".$row['username']."', 'Personal User', 1, 0);
+			";
+    	$result_3 = pwg_query($query_3);
+
+    	$group_id = mysql_insert_id();
+
+    	$query_4 = "
+				INSERT INTO ".$conf['phpbb_prefix']."user_group
+				(group_id, user_id, user_pending)
+				VALUES ('".$group_id."','".$id_user_phpbb."','0');
+			";
+    	$result_4 = pwg_query($query_4);
+
+        // Get PWG user Id
+        $user_id_pwg = get_userid($row['username']);
+
+        // Insert of PWG user id and PhpBB user id on correspondence table
+        $query_5 = "
+                INSERT INTO ".PLUGIN_REGISTER_PHPBB_ID." (id_user_pwg, id_user_phpbb)
+                VALUES('".$user_id_pwg."', '".$id_user_phpbb."');
+			";
+        $result_5 = pwg_query($query_5);
+        echo '<b>Migration done !</b><br>';
+    }
+}
+
+//TODO: Get the migration result into a template
+?>
Index: /extensions/Register_PhpBB/reg_phpbb_synchro.php
===================================================================
--- /extensions/Register_PhpBB/reg_phpbb_synchro.php	(revision 7727)
+++ /extensions/Register_PhpBB/reg_phpbb_synchro.php	(revision 7727)
@@ -0,0 +1,66 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Register_PhpBB                                          |
+// | Plugin Version : 1.2a                                                 |
+// | File Version : 0.1                                                    |
+// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
+// | Plugin description :                                                  |
+// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
+// | phpbb - This plugin allows to automatically register a PWG user in a  |
+// | phpbb forum                                                           |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// *********************************************
+// ** Correspondence table re synchronization **
+// *********************************************
+
+include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
+
+// Empty the ids from table
+$query_1 = "TRUNCATE ".PLUGIN_REGISTER_PHPBB_ID.";";
+$result_1 = pwg_query($query_1);
+
+// Selection of all PWG accounts
+$query = "
+        SELECT id AS id_pwg, username
+		FROM ".USERS_TABLE.";
+	";
+$result = pwg_query($query);
+
+while($data = mysql_fetch_array($result))
+{
+    // Selection of PhpBB user's id in relation with PWG user's id
+    $query_2 = "
+            SELECT user_id AS id_phpbb
+			FROM ".$conf['phpbb_prefix']."users
+			WHERE username = '".$data['username']."';
+		";
+    $result_2 = pwg_query($query_2);
+
+    while($data_1 = mysql_fetch_array($result_2))
+    {
+        // Insert PWG id and PhpBB id in correspondence table
+        $query_3 = "
+                INSERT INTO ".PLUGIN_REGISTER_PHPBB_ID." (id_user_pwg, id_user_phpbb)
+                VALUES (".$data['id_pwg'].", ".$data_1['id_phpbb'].");";
+        $result_3 = pwg_query($query_3);
+    }
+}
+echo 'Re synchronization done !';
+
+//TODO: Get re synchro result into a template
+?>
Index: /extensions/Register_PhpBB/reg_phpbb_update_profile.php
===================================================================
--- /extensions/Register_PhpBB/reg_phpbb_update_profile.php	(revision 7727)
+++ /extensions/Register_PhpBB/reg_phpbb_update_profile.php	(revision 7727)
@@ -0,0 +1,67 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Plugin Name : Register_PhpBB                                          |
+// | Plugin Version : 1.2a                                                 |
+// | File Version : 0.1                                                    |
+// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
+// | Plugin description :                                                  |
+// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
+// | phpbb - This plugin allows to automatically register a PWG user in a  |
+// | phpbb forum                                                           |
+// +-----------------------------------------------------------------------+
+// | 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.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Password hashing method
+if (function_exists('sha1'))	// Only in PHP 4.3.0+
+{
+    $password = sha1($_POST['use_new_pwd']);
+}
+else if (function_exists('mhash'))	// Only if Mhash library is loaded
+{
+    $password =  bin2hex(mhash(MHASH_SHA1, $_POST['use_new_pwd']));
+}
+else
+{
+    $password =  md5($_POST['use_new_pwd']);
+}
+
+// Retrieve user ID in PhpBB user table
+$query = '
+        SELECT id_user_phpbb
+        FROM '.PLUGIN_REGISTER_PHPBB_ID
+        .' WHERE id_user_pwg = '.$userdata['id'].';
+    ';
+$result = pwg_query($query);
+
+while($row = mysql_fetch_array($result))
+{
+    // Email modification
+    $query = '
+            UPDATE '.$conf['phpbb_prefix'].'users 
+            SET user_email = \''.$_POST['mail_address'].'\'';
+
+            // If new password field is empty
+            // the change is set in the PhpBB
+            // users table with password hashing.
+            if (!empty($_POST['use_new_pwd']))
+            {
+                $query.= ', user_password = \''.$password.'\'';
+            }
+            $query.= ' WHERE id = '.$row['id_user_phpbb'].';
+        ';
+    $result = pwg_query($query);
+}
+?>
