source: extensions/Register_PhpBB/reg_phpbb_deluser.php @ 7727

Last change on this file since 7727 was 7727, checked in by Eric, 13 years ago

Initial repository based on old 1.2a version

  • Property svn:eol-style set to LF
File size: 4.0 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Plugin Name : Register_PhpBB                                          |
4// | Plugin Version : 1.2a                                                 |
5// | File Version : 0.1                                                    |
6// | Plugin Version author : Eric <lucifer@infernoweb.net>                 |
7// | Plugin description :                                                  |
8// | Ce plugin permet l'enregistrement d'un utilisateur directement dans   |
9// | phpbb - This plugin allows to automatically register a PWG user in a  |
10// | phpbb forum                                                           |
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27// ********************************************
28// ** Delete user from the PhpBB users table **
29// ********************************************
30
31// Load Plugin settings from database
32load_conf_from_db('param like \'phpbb\\_%\'');
33
34global $conf;
35
36// ID selection in the pwg/phpbb correspondence table
37$query = "
38        SELECT id_user_phpbb, id_user_pwg FROM ".PLUGIN_REGISTER_PHPBB_ID."
39        WHERE id_user_pwg = ".$user_id.";
40    ";
41$result = pwg_query($query);
42
43while($data = mysql_fetch_array($result))
44{
45  // Selection du nom d'utilisateur
46  $query_0 = "
47                SELECT username, user_id
48                FROM ".$conf['phpbb_prefix']."users
49                WHERE user_id = ".$data['id_user_phpbb'].";
50        ";
51  $result_0 = pwg_query($query_0);
52 
53  while ($data_0 = mysql_fetch_array($result_0))
54  {
55    // Suppression des liens groupe -- utilisateur
56    $query_1 = "
57                        DELETE FROM ".$conf['phpbb_prefix']."groups
58                        WHERE group_name = '".$data_0['username']."';
59                ";
60    $result_1 = pwg_query($query_1);
61  }
62   
63  // Si égale à 0, suppression de tous les posts et topics
64  if ($conf['phpbb_del_pt'] == 0)
65  {
66    // Suppression des posts de l'utilisateur
67    $query_2 = "
68                        DELETE FROM ".$conf['phpbb_prefix']."posts
69                        WHERE poster_id = ".$data['id_user_phpbb'].";
70                ";
71    $result_2 = pwg_query($query_2);
72
73    // Suppression des topics de cet utilisateur
74    $query_3 = "
75                        DELETE FROM ".$conf['phpbb_prefix']."topics
76                        WHERE topic_poster = ".$data['id_user_phpbb'].";
77                ";
78    $result_3 = pwg_query($query_3);
79  }
80
81  // Suppression des abonnements de l'utilisateur
82  $query_4 = "
83                DELETE FROM ".$conf['phpbb_prefix']."topics_watch
84                WHERE user_id = ".$data['id_user_phpbb'].";
85        ";
86  $result_4 = pwg_query($query_4);
87 
88  // Suppression du compte utilisateur
89  $query_5 = "
90                DELETE FROM ".$conf['phpbb_prefix']."users
91                WHERE user_id = ".$data['id_user_phpbb'].";
92        ";
93  $result_5 = pwg_query($query_5);
94 
95  // Suppression des liens groupe -- utilisateur
96  $query_6 = "
97                DELETE FROM ".$conf['phpbb_prefix']."user_group
98                WHERE user_id = ".$data['id_user_phpbb'].";
99        ";
100  $result_6 = pwg_query($query_6);
101 
102  // Suppression de la correspondance pwg/phpbb
103  $query_7 = "
104                DELETE FROM ".PLUGIN_REGISTER_PHPBB_ID."
105                WHERE id_user_pwg = ".$user_id.";
106        ";
107  $result_7 = pwg_query($query_7);
108}
109?>
Note: See TracBrowser for help on using the repository browser.