| // | Plugin description : | // | Ce plugin permet l'enregistrement d'un utilisateur directement dans | // | PunBB (http://www.punbb.org) - This plugin allows to automatically | // | register a PWG user in a PunBB forum (http://www.punbb.org) | // +-----------------------------------------------------------------------+ // | 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 PunBB ** // ************************************** include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); echo '

Migration des comptes PhpWebGallery vers PunBB

'; // 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['punbb_admin'])) { echo 'Transfert du compte : '.$row['username'].' --> '; $query_1 = " INSERT INTO ".$conf['punbb_prefix']."users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES('".$row['username']."', '".$conf['punbb_id_default_group']."', '".$row['password']."', '".$row['mail_address']."', '".$conf['punbb_email_setting']."', '".$conf['punbb_save_pass']."', '".$conf['punbb_timezone']."', '".$conf['punbb_language']."', '".$conf['punbb_style']."','".$registred."', '".$registred_ip."', '".$registred."');"; $result_1 = pwg_query($query_1); // Get PunBB user Id $id_user_punbb = mysql_insert_id(); // Get PWG user Id $user_id_pwg = get_userid($row['username']); // Insert of PWG user id and PunBB user id on correspondence table $query_2 = " INSERT INTO ".PLUGIN_REGISTER_PUNBB_ID." (id_user_pwg, id_user_punbb) VALUES('".$user_id_pwg."', '".$id_user_punbb."');"; $result_2 = pwg_query($query_2); echo 'Migration done !
'; } } //TODO: Get the migration result into a template ?>