source: extensions/Register_PhpBB/admin/admin.php @ 7795

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

Commit new release 2.1.a coded by Pierric

  • Property svn:eol-style set to LF
File size: 37.6 KB
Line 
1<?php
2
3global $user, $lang, $conf, $template, $errors;
4
5if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
6
7if (!defined('REGPHPBB_PATH')) define('REGPHPBB_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
8
9ini_set('error_reporting', E_ALL);
10ini_set('display_errors', true);
11
12include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
13include_once (PHPWG_ROOT_PATH.'/include/constants.php');
14
15$my_base_url = get_admin_plugin_menu_link(__FILE__);
16load_language('plugin.lang', REGPHPBB_PATH);
17
18// +-----------------------------------------------------------------------+
19// |                            Tabssheet                                  |
20// +-----------------------------------------------------------------------+
21if (!isset($_GET['tab']))
22  $page['tab'] = 'info';
23else
24  $page['tab'] = $_GET['tab'];
25
26$tabsheet = new tabsheet();
27$tabsheet->add('info',
28            l10n('Tab_Info'),
29            $my_base_url.'&amp;tab=info');
30$tabsheet->add('manage',
31            l10n('Tab_Manage'),
32            $my_base_url.'&amp;tab=manage');
33$tabsheet->add('Migration',
34            l10n('Tab_Migration'),
35            $my_base_url.'&amp;tab=Migration');
36$tabsheet->add('Synchro',
37            l10n('Tab_Synchro'),
38            $my_base_url.'&amp;tab=Synchro');
39$tabsheet->select($page['tab']);
40$tabsheet->assign();
41
42
43$page['infos'] = array();
44$error = array();
45
46// +-----------------------------------------------------------------------+
47// |                      Getting plugin version                           |
48// +-----------------------------------------------------------------------+
49$plugin =  RegPhpBB_Infos(REGPHPBB_PATH);
50$version = $plugin['version'] ;
51
52// +-----------------------------------------------------------------------+
53// |                            Functions
54// +-----------------------------------------------------------------------+
55function Audit_PWG_PhpBB()
56{
57  global $page, $conf, $errors;
58
59  $conf_Register_PhpBB = isset($conf['Register_PhpBB']) ? explode(";" , $conf['Register_PhpBB']) : array();
60
61  $page_Register_PhpBB_admin = get_admin_plugin_menu_link(__FILE__);
62
63
64
65  $msg_error_PWG_Dup = '';
66  $msg_error_PhpBB_Dup = '';
67  $msg_error_Link_Break = '';
68  $msg_error_Link_Bad = '';
69  $msg_error_Synchro = '';
70  $msg_ok_Synchro = '';
71  $msg_error_PWG2PhpBB = '';
72  $msg_error_PhpBB2PWG = '';
73
74
75
76  $query = "
77SELECT COUNT(*) AS nbr_dup, id, username
78FROM ".USERS_TABLE."
79GROUP BY BINARY username
80HAVING COUNT(*) > 1
81;";
82  $result = pwg_query($query);
83
84  while($row = pwg_db_fetch_assoc($result))
85    $msg_error_PWG_Dup .= '<br>'.l10n('Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']);
86
87  if ($msg_error_PWG_Dup == '')
88    array_push($page['infos'], l10n('Audit_PWG_Dup').'<br>'.l10n('Audit_OK'));
89  else
90    $msg_error_PWG_Dup = l10n('Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Advise_PWG_Dup');
91
92
93
94  $query = "
95SELECT COUNT(*) AS nbr_dup, username
96FROM ".PhpBB_USERS_TABLE."
97GROUP BY BINARY username
98HAVING COUNT(*) > 1
99;";
100  $result = pwg_query($query);
101
102  while($row = pwg_db_fetch_assoc($result))
103  {
104    $msg_error_PhpBB_Dup .= '<br>'.l10n('Error_PhpBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']);
105
106    $subquery = "
107SELECT user_id, username, user_email
108FROM ".PhpBB_USERS_TABLE."
109WHERE BINARY username = BINARY '".$row['username']."'
110;";
111    $subresult = pwg_query($subquery);
112
113    while($subrow = pwg_db_fetch_assoc($subresult))
114    {
115      $msg_error_PhpBB_Dup .= '<br>id:'.$subrow['user_id'].'='.stripslashes($subrow['username']).' ('.$subrow['user_email'].')';
116
117      if ( !is_adviser() )
118      {
119        $msg_error_PhpBB_Dup .= ' <a href="';
120
121        $msg_error_PhpBB_Dup .= add_url_params($page_Register_PhpBB_admin, array(
122          'action' => 'del_user',
123          'user_id' => $subrow['user_id'],
124        ));
125
126        $msg_error_PhpBB_Dup .= '" title="'.l10n('Del_User').stripslashes($subrow['username']).'"';
127
128        $msg_error_PhpBB_Dup .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
129
130        $msg_error_PhpBB_Dup .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').$subrow['username'].'" /></a>';
131      }
132    }
133  }
134
135  if ($msg_error_PhpBB_Dup == '')
136    array_push($page['infos'], l10n('Audit_PhpBB_Dup').'<br>'.l10n('Audit_OK'));
137  else
138    $msg_error_PhpBB_Dup = l10n('Audit_PhpBB_Dup').$msg_error_PhpBB_Dup.'<br>'.l10n('Advise_PhpBB_Dup');
139
140
141
142  $query = "
143SELECT pwg.id as pwg_id, bb.user_id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail
144FROM ".PhpBB_USERS_TABLE." AS bb, ".USERS_TABLE." as pwg
145WHERE bb.user_id NOT in (
146  SELECT id_user_PhpBB
147  FROM ".Register_PhpBB_ID_TABLE."
148  )
149AND pwg.id NOT in (
150  SELECT id_user_pwg
151  FROM ".Register_PhpBB_ID_TABLE."
152  )
153AND pwg.username = bb.username
154AND pwg.mail_address = bb.user_email
155;";
156
157  $result = pwg_query($query);
158
159  while($row = pwg_db_fetch_assoc($result))
160  {
161    $msg_error_Link_Break .= '<br>'.l10n('Error_Link_Break').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')';
162
163    if ( !is_adviser() )
164    {
165      $msg_error_Link_Break .= ' <a href="';
166
167      $msg_error_Link_Break .= add_url_params($page_Register_PhpBB_admin, array(
168        'action'   => 'new_link',
169        'pwg_id' => $row['pwg_id'],
170        'bb_id' => $row['bb_id'],
171      ));
172
173      $msg_error_Link_Break .= '" title="'.l10n('New_Link').stripslashes($row['pwg_user']).'"';
174
175      $msg_error_Link_Break .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
176
177      $msg_error_Link_Break .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/link_break.png" alt="'.l10n('New_Link').stripslashes($row['pwg_user']).'" /></a>';
178    }
179  }
180
181  if ($msg_error_Link_Break == '')
182    array_push($page['infos'], l10n('Audit_Link_Break').'<br>'.l10n('Audit_OK'));
183  else
184    $msg_error_Link_Break = l10n('Audit_Link_Break').$msg_error_Link_Break;
185
186
187
188  $query = "
189SELECT pwg.username as pwg_user, pwg.id as pwg_id, pwg.mail_address as pwg_mail, bb.user_id as bb_id, bb.username as bb_user, bb.user_email as bb_mail
190FROM ".PhpBB_USERS_TABLE." AS bb
191INNER JOIN ".Register_PhpBB_ID_TABLE." AS link ON link.id_user_PhpBB = bb.user_id
192INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
193WHERE pwg.username <> bb.username
194;";
195
196  $result = pwg_query($query);
197
198  while($row = pwg_db_fetch_assoc($result))
199  {
200    $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')';
201
202    if ( !is_adviser() )
203    {
204      $msg_error_Link_Bad .= ' <a href="';
205
206      $msg_error_Link_Bad .= add_url_params($page_Register_PhpBB_admin, array(
207        'action'   => 'link_del',
208        'pwg_id' => $row['pwg_id'],
209        'bb_id'  => $row['bb_id'],
210      ));
211
212      $msg_error_Link_Bad .= '" title="'.l10n('Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"';
213
214      $msg_error_Link_Bad .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
215
216      $msg_error_Link_Bad .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/link_delete.png" alt="'.l10n('Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>';
217
218      $msg_error_Link_Bad .= ' -- <a href="';
219
220      $msg_error_Link_Bad .= add_url_params($page_Register_PhpBB_admin, array(
221        'action' => 'sync_user',
222        'username' => stripslashes($row['pwg_user']),
223      ));
224
225      $msg_error_Link_Bad .= '" title="'.l10n('Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'"';
226
227      $msg_error_Link_Bad .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
228
229      $msg_error_Link_Bad .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/arrow_switch.png" alt="'.l10n('Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'" /></a>';
230    }
231  }
232
233
234  $query = "
235SELECT COUNT(*) as nbr_dead
236FROM ".Register_PhpBB_ID_TABLE." AS Link
237WHERE id_user_PhpBB NOT IN (
238  SELECT user_id
239  FROM ".PhpBB_USERS_TABLE."
240  )
241OR id_user_pwg NOT IN (
242  SELECT id
243  FROM ".USERS_TABLE."
244  )
245;";
246
247  $Compteur = pwg_db_fetch_assoc(pwg_query($query));
248
249  if (!empty($Compteur) and $Compteur['nbr_dead'] > 0)
250  {
251    $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dead').$Compteur['nbr_dead'];
252
253    if ( !is_adviser() )
254    {
255      $msg_error_Link_Bad .= ' <a href="';
256
257      $msg_error_Link_Bad .= add_url_params($page_Register_PhpBB_admin, array(
258        'action'   => 'link_dead',
259      ));
260
261      $msg_error_Link_Bad .= '" title="'.l10n('Link_Dead').$Compteur['nbr_dead'].'"';
262
263      $msg_error_Link_Bad .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
264
265      $msg_error_Link_Bad .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/link_delete.png" alt="'.l10n('Link_Dead').$Compteur['nbr_dead'].'" /></a>';
266    }
267  }
268
269  $query = "
270SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.user_id AS bb_id
271FROM ".PhpBB_USERS_TABLE." AS bb
272INNER JOIN ".Register_PhpBB_ID_TABLE." AS link ON link.id_user_PhpBB = bb.user_id
273INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
274GROUP BY link.id_user_pwg, link.id_user_PhpBB
275HAVING COUNT(*) > 1
276;";
277
278  $result = pwg_query($query);
279
280  while($row = pwg_db_fetch_assoc($result))
281  {
282    $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')';
283
284    if ( !is_adviser() )
285    {
286      $msg_error_Link_Bad .= ' <a href="';
287
288      $msg_error_Link_Bad .= add_url_params($page_Register_PhpBB_admin, array(
289        'action'   => 'new_link',
290        'pwg_id' => $row['pwg_id'],
291        'bb_id' => $row['bb_id'],
292      ));
293
294      $msg_error_Link_Bad .= '" title="'.l10n('Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"';
295
296      $msg_error_Link_Bad .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
297
298      $msg_error_Link_Bad .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/link_error.png" alt="'.l10n('Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>';
299    }
300  }
301
302  if ($msg_error_Link_Bad == '')
303    array_push($page['infos'], l10n('Audit_Link_Bad').'<br>'.l10n('Audit_OK'));
304  else
305    $msg_error_Link_Bad = l10n('Audit_Link_Bad').$msg_error_Link_Bad;
306
307
308
309  $query = "
310SELECT pwg.username as username, pwg.password as pwg_pwd, pwg.mail_address as pwg_eml, PhpBB.user_password as bb_pwd, PhpBB.user_email as bb_eml
311FROM ".PhpBB_USERS_TABLE." AS PhpBB
312INNER JOIN ".Register_PhpBB_ID_TABLE." AS link ON link.id_user_PhpBB = PhpBB.user_id
313INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
314AND BINARY pwg.username = BINARY PhpBB.username
315ORDER BY LOWER(pwg.username)
316;";
317
318  $result = pwg_query($query);
319
320  while($row = pwg_db_fetch_assoc($result))
321  {
322    if ( ($row['pwg_pwd'] != $row['bb_pwd']) or ($row['pwg_eml'] != $row['bb_eml']) )
323    {
324      $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']);
325
326      if ( !is_adviser() )
327      {
328        $msg_error_Synchro .= ' <a href="';
329
330        $msg_error_Synchro .= add_url_params($page_Register_PhpBB_admin, array(
331          'action' => 'sync_user',
332          'username' => stripslashes($row['username']),
333        ));
334
335        $msg_error_Synchro .= '" title="'.l10n('Sync_User').stripslashes($row['username']).'"';
336
337        $msg_error_Synchro .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
338        $msg_error_Synchro .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/user_refresh.png" alt="'.l10n('Sync_User').stripslashes($row['username']).'" /></a>';
339      }
340
341      if ($row['pwg_pwd'] != $row['bb_pwd'])
342        $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Pswd');
343
344      if ($row['pwg_eml'] != $row['bb_eml'])
345        $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Mail').'<br>-- PWG = '.$row['pwg_eml'].'<br>-- PhpBB = '.$row['bb_eml'];
346    }
347    else if ($conf_Register_PhpBB[4] == 'true')
348      $msg_ok_Synchro .= '<br> - '.stripslashes($row['username']).' ('.$row['pwg_eml'].')'.l10n('Audit_Synchro_OK');
349  }
350
351  if ($msg_error_Synchro <> '')
352    $msg_error_Synchro = l10n('Audit_Synchro').$msg_error_Synchro;
353
354  if ($msg_ok_Synchro <> '')
355    if ($msg_error_Synchro <> '')
356      array_push($page['infos'], l10n('Audit_Synchro').$msg_ok_Synchro.'<br><br>');
357    else
358      array_push($page['infos'], l10n('Audit_Synchro').$msg_ok_Synchro.'<br><br>'.l10n('Audit_OK'));
359
360
361  $query = "
362SELECT username, mail_address FROM ".USERS_TABLE."
363WHERE BINARY username <> BINARY 'guest'
364AND id not in (
365  SELECT id_user_pwg FROM ".Register_PhpBB_ID_TABLE."
366  )
367AND BINARY username not in (
368  SELECT username FROM ".PhpBB_USERS_TABLE."
369  )
370ORDER BY LOWER(username)
371;";
372
373  $result = pwg_query($query);
374
375  while($row = pwg_db_fetch_assoc($result))
376  {
377    $msg_error_PWG2PhpBB .= '<br>'.l10n('Error_PWG2PhpBB').stripslashes($row['username']).' ('.$row['mail_address'].')';
378
379    if ( !is_adviser() )
380    {
381      $msg_error_PWG2PhpBB .= ' <a href="';
382
383      $msg_error_PWG2PhpBB .= add_url_params($page_Register_PhpBB_admin, array(
384        'action' => 'add_user',
385        'username' => stripslashes($row['username']),
386      ));
387
388      $msg_error_PWG2PhpBB .= '" title="'.l10n('Add_User').stripslashes($row['username']).'" ';
389
390      $msg_error_PWG2PhpBB .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
391
392      $msg_error_PWG2PhpBB .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/user_add.png" alt="'.l10n('Add_User').stripslashes($row['username']).'" /></a>';
393    }
394  }
395
396  if ($msg_error_PWG2PhpBB == '')
397    array_push($page['infos'], l10n('Audit_PWG2PhpBB').'<br>'.l10n('Audit_OK'));
398  else
399    $msg_error_PWG2PhpBB = l10n('Audit_PWG2PhpBB').$msg_error_PWG2PhpBB;
400
401
402
403  $query = "
404SELECT user_id, username, user_email FROM ".PhpBB_USERS_TABLE."
405WHERE BINARY username <> BINARY '".$conf_Register_PhpBB[2]."'
406AND user_id not in (
407  SELECT id_user_PhpBB FROM ".Register_PhpBB_ID_TABLE."
408  )
409AND BINARY username not in (
410  SELECT username FROM ".USERS_TABLE."
411  )
412ORDER BY LOWER(username)
413;";
414
415  $result = pwg_query($query);
416
417  while($row = pwg_db_fetch_assoc($result))
418  {
419    $msg_error_PhpBB2PWG .= '<br>'.l10n('Error_PhpBB2PWG').stripslashes($row['username']).' ('.$row['user_email'].')';
420
421    if ( !is_adviser() )
422    {
423      $msg_error_PhpBB2PWG .= ' <a href="';
424
425      $msg_error_PhpBB2PWG .= add_url_params($page_Register_PhpBB_admin, array(
426        'action' => 'del_user',
427        'user_id' => $row['user_id'],
428      ));
429
430      $msg_error_PhpBB2PWG .= '" title="'.l10n('Del_User').stripslashes($row['username']).'"';
431
432      $msg_error_PhpBB2PWG .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
433
434      $msg_error_PhpBB2PWG .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>';
435    }
436  }
437
438  if ($msg_error_PhpBB2PWG == '')
439    array_push($page['infos'], l10n('Audit_PhpBB2PWG').'<br>'.l10n('Audit_OK'));
440  else
441    $msg_error_PhpBB2PWG = l10n('Audit_PhpBB2PWG').$msg_error_PhpBB2PWG;
442
443
444
445  if ($msg_error_PWG_Dup <> '')
446    $errors[] = $msg_error_PWG_Dup . ( ($msg_error_PhpBB_Dup == '' and $msg_error_Link_Break == '' and $msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
447
448  if ($msg_error_PhpBB_Dup <> '')
449    $errors[] = $msg_error_PhpBB_Dup . ( ($msg_error_Link_Break == '' and $msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
450
451  if ($msg_error_Link_Break <> '')
452    $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
453
454  if ($msg_error_Link_Bad <> '')
455    $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
456
457  if ($msg_error_Synchro <> '')
458    $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
459
460  if ($msg_error_PWG2PhpBB <> '')
461    $errors[] = $msg_error_PWG2PhpBB . ( ($msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
462
463  if ($msg_error_PhpBB2PWG <> '')
464    $errors[] = $msg_error_PhpBB2PWG;
465}
466
467
468
469
470// +-----------------------------------------------------------------------+
471// |                            Actions process
472// +-----------------------------------------------------------------------+
473
474if ( isset($_GET['action']) and ($_GET['action']=='link_dead') and !is_adviser() )
475{
476  $query = "
477DELETE FROM ".Register_PhpBB_ID_TABLE."
478WHERE id_user_PhpBB NOT IN (
479  SELECT user_id
480  FROM ".PhpBB_USERS_TABLE."
481  )
482OR id_user_pwg NOT IN (
483  SELECT id
484  FROM ".USERS_TABLE."
485  )
486;";
487
488  $result = pwg_query($query);
489
490  Audit_PWG_PhpBB();
491}
492else if ( isset($_GET['action']) and ($_GET['action']=='link_del') and isset($_GET['pwg_id']) and isset($_GET['bb_id']) and !is_adviser() )
493{
494  $query = "
495DELETE FROM ".Register_PhpBB_ID_TABLE."
496WHERE id_user_pwg = ".$_GET['pwg_id']."
497AND id_user_PhpBB = ".$_GET['bb_id']."
498;";
499
500  $result = pwg_query($query);
501
502  Audit_PWG_PhpBB();
503}
504else if ( isset($_GET['action']) and ($_GET['action']=='new_link') and isset($_GET['pwg_id']) and isset($_GET['bb_id']) and !is_adviser() )
505{
506  PhpBB_Linkuser($_GET['pwg_id'], $_GET['bb_id']);
507
508  Audit_PWG_PhpBB();
509}
510else if ( isset($_GET['action']) and ($_GET['action']=='sync_user') and isset($_GET['username']) and !is_adviser() )
511{
512  $query = "
513SELECT id AS id_pwg, username, password, mail_address
514FROM ".USERS_TABLE."
515WHERE BINARY username = BINARY '".pwg_db_real_escape_string($_GET['username'])."'
516LIMIT 1
517;";
518
519  $data = pwg_db_fetch_assoc(pwg_query($query));
520
521  if (!empty($data))
522  {
523    PhpBB_Updateuser($data['id_pwg'], stripslashes($data['username']), $data['password'], $data['mail_address']);
524  }
525
526  Audit_PWG_PhpBB();
527}
528else if ( isset($_GET['action']) and ($_GET['action']=='add_user') and isset($_GET['username']) and !is_adviser() )
529{
530  $query = "
531SELECT id, username, password, mail_address
532FROM ".USERS_TABLE."
533WHERE BINARY username = BINARY '".pwg_db_real_escape_string($_GET['username'])."'
534LIMIT 1
535;";
536
537  $data = pwg_db_fetch_assoc(pwg_query($query));
538
539  if (!empty($data))
540    PhpBB_Adduser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']);
541
542    Audit_PWG_PhpBB();
543}
544else if ( isset($_GET['action']) and ($_GET['action']=='del_user') and isset($_GET['id']) and !is_adviser() )
545{
546  PhpBB_Deluser( $_GET['id'], true );
547
548  Audit_PWG_PhpBB();
549}
550
551
552// +-----------------------------------------------------------------------+
553// |                            Tabssheet select                           |
554// +-----------------------------------------------------------------------+
555
556switch ($page['tab'])
557{
558  case 'info':
559
560  $template->assign(
561    array(
562      'REGPHPBB_PATH'    => REGPHPBB_PATH,
563      'REGPHPBB_VERSION' => $version,
564    )
565  );
566
567  $template->set_filename('plugin_admin_content', dirname(__FILE__).'/template/info.tpl');
568  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
569
570        break;
571
572        case 'manage':
573
574  if (isset($_POST['submit']) and !is_adviser() and isset($_POST['PhpBB_prefix']) and isset($_POST['PhpBB_admin']) and isset($_POST['PhpBB_guest']) and isset($_POST['PhpBB_confirm']) and isset($_POST['PhpBB_details']))
575  {
576
577/* Configuration controls */
578// Piwigo's admin username control
579    $query1 = "
580SELECT username, id
581FROM ".USERS_TABLE."
582WHERE id = ".$conf['webmaster_id']."
583;";
584
585    $pwgadmin = pwg_db_fetch_assoc(pwg_query($query1));
586
587// PhpBB's admin username control
588    $query2 = "
589SELECT username, user_id
590FROM ".PhpBB_USERS_TABLE."
591WHERE user_id = 2
592;";
593
594    $fbbadmin = pwg_db_fetch_assoc(pwg_query($query2));
595
596// PhpBB's Anonymous username control
597    $query3 = "
598SELECT username, user_id
599FROM ".PhpBB_USERS_TABLE."
600WHERE user_id = 1
601;";
602
603    $fbbguest = pwg_db_fetch_assoc(pwg_query($query3));
604
605// Compute configuration errors
606    if (stripslashes($pwgadmin['username']) != stripslashes($_POST['PhpBB_admin']))
607    {
608      array_push($page['errors'], l10n('error_config_admin1'));
609    }
610    if (stripslashes($pwgadmin['username']) != stripslashes($fbbadmin['username']))
611    {
612      array_push($page['errors'], l10n('error_config_admin2'));
613    }
614    if (stripslashes($fbbguest['username']) != stripslashes($_POST['PhpBB_guest']))
615    {
616      array_push($page['errors'], l10n('error_config_guest'));
617    }
618    elseif (count($page['errors']) == 0)
619    {
620      if (!function_exists('FindAvailableConfirmMailID'))
621      {
622      $conf['Register_PhpBB'] = $_POST['PhpBB_prefix'].';'.addslashes($_POST['PhpBB_admin']).';'.addslashes($_POST['PhpBB_guest']).';'.$_POST['PhpBB_confirm'].';'.$_POST['PhpBB_details'].';false;REGISTERED';
623      }
624      elseif (function_exists('FindAvailableConfirmMailID'))
625      {
626        $conf_UAM = unserialize($conf['UserAdvManager']);
627
628        if (isset($conf_UAM[1]) and ($conf_UAM[1] == 'true' or $conf_UAM[1] == 'local') and isset($conf_UAM[2]) and $conf_UAM[2] != '-1')
629        {
630          $conf['Register_PhpBB'] = $_POST['PhpBB_prefix'].';'.addslashes($_POST['PhpBB_admin']).';'.addslashes($_POST['PhpBB_guest']).';'.$_POST['PhpBB_confirm'].';'.$_POST['PhpBB_details'].';'.$_POST['PhpBB_UAM'].';'.$_POST['PhpBB_group'];
631        }
632        else
633        {
634          $conf['Register_PhpBB'] = $_POST['PhpBB_prefix'].';'.addslashes($_POST['PhpBB_admin']).';'.addslashes($_POST['PhpBB_guest']).';'.$_POST['PhpBB_confirm'].';'.$_POST['PhpBB_details'].';false;REGISTERED';
635        }
636      }
637
638      $query = '
639UPDATE '.CONFIG_TABLE.'
640SET value="'.$conf['Register_PhpBB'].'"
641WHERE param="Register_PhpBB"
642LIMIT 1
643;';
644
645      pwg_query($query);
646
647      array_push($page['infos'], l10n('save_config'));
648    }
649  }
650
651  $conf_Register_PhpBB = isset($conf['Register_PhpBB']) ? explode(";" , $conf['Register_PhpBB']) : array();
652
653  $template->assign(
654    array
655    (
656      'REGPHPBB_PATH'       => REGPHPBB_PATH,
657      'REGPHPBB_VERSION'    => $version,
658      'PhpBB_PREFIX'        => $conf_Register_PhpBB[0],
659      'PhpBB_ADMIN'         => stripslashes($conf_Register_PhpBB[1]),
660      'PhpBB_GUEST'         => stripslashes($conf_Register_PhpBB[2]),
661      'PhpBB_CONFIRM_TRUE'  => (isset($conf_Register_PhpBB[3]) and $conf_Register_PhpBB[3] == 'true') ? 'checked="checked"' : '',
662      'PhpBB_CONFIRM_FALSE' => (isset($conf_Register_PhpBB[3]) and $conf_Register_PhpBB[3] == 'false') ? 'checked="checked"' : '',
663      'PhpBB_DETAILS_TRUE'  => (isset($conf_Register_PhpBB[4]) and $conf_Register_PhpBB[4] == 'true') ? 'checked="checked"' : '',
664      'PhpBB_DETAILS_FALSE' => (isset($conf_Register_PhpBB[4]) and $conf_Register_PhpBB[4] == 'false') ? 'checked="checked"' : '',
665    )
666  );
667
668// If UAM exists and if UAM ConfirmMail is set, we can set this feature
669  if (function_exists('FindAvailableConfirmMailID'))
670  {
671    $conf_UAM = unserialize($conf['UserAdvManager']);
672    $UAM_bridge = false;
673
674    if (isset($conf_UAM[1]) and ($conf_UAM[1] == 'true' or $conf_UAM[1] == 'local') and isset($conf_UAM[2]) and $conf_UAM[2] != '-1')
675    {
676      $UAM_bridge = true;
677    }
678
679    $template->assign(
680      array
681      (
682        'UAM_BRIDGE'            => $UAM_bridge,
683        'PhpBB_UAM_LINK_TRUE'  => (isset($conf_Register_PhpBB[5]) and $conf_Register_PhpBB[5] == 'true') ? 'checked="checked"' : '',
684        'PhpBB_UAM_LINK_FALSE' => (isset($conf_Register_PhpBB[5]) and $conf_Register_PhpBB[5] == 'false') ? 'checked="checked"' : '',
685        'PhpBB_GROUP'          => $conf_Register_PhpBB[6],
686      )
687    );
688  }
689
690  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/manage.tpl');
691  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
692
693        break;
694
695        case 'Migration':
696
697  $conf_Register_PhpBB = isset($conf['Register_PhpBB']) ? explode(";" , $conf['Register_PhpBB']) : array();
698
699  if ( isset($_POST['Migration']) and !is_adviser() )
700  {
701    array_push($page['infos'], l10n('Mig_Start').'<br><br>');
702
703    array_push($page['infos'], l10n('Mig_Del_Link').'<br><br>');
704
705    $query = "TRUNCATE ".Register_PhpBB_ID_TABLE.";";
706    $result = pwg_query($query);
707
708
709    $msg_Mig_Del_AllUsers = '';
710
711    $query = "
712SELECT username, user_id, group_id
713FROM ".PhpBB_USERS_TABLE."
714WHERE group_id != '6'
715;";
716
717    $result = pwg_query($query);
718
719    while ($row = pwg_db_fetch_assoc($result))
720    {
721      if((stripslashes($row['username']) != stripslashes($conf_Register_PhpBB[2])) and (stripslashes($row['username']) != stripslashes($conf_Register_PhpBB[1])))
722      {
723        $msg_Mig_Del_AllUsers .= '<br> - '.l10n('Mig_Del_User').stripslashes($row['username']);
724
725        PhpBB_Deluser($row['user_id'], false);
726      }
727    }
728
729    array_push($page['infos'], l10n('Mig_Del_AllUsers').$msg_Mig_Del_AllUsers.'<br><br>');
730
731
732    $query = "
733SELECT id, username, password, mail_address
734FROM ".USERS_TABLE."
735;";
736
737    $result = pwg_query($query);
738
739    $registred = time();
740    $registred_ip = $_SERVER['REMOTE_ADDR'];
741
742    $msg_Mig_Add_AllUsers = '';
743
744    while ($row = pwg_db_fetch_assoc($result))
745    {
746      if((stripslashes($row['username']) != 'guest') and (stripslashes($row['username']) != stripslashes($conf_Register_PhpBB[1])))
747      {
748        $msg_Mig_Add_AllUsers .= '<br> - '.l10n('Mig_Add_User').stripslashes($row['username']);
749
750        PhpBB_Adduser($row['id'], stripslashes($row['username']), $row['password'], $row['mail_address']);
751      }
752    }
753
754    array_push($page['infos'], l10n('Mig_Add_AllUsers').$msg_Mig_Add_AllUsers.'<br><br>');
755
756
757    $query = "
758SELECT id, username, password, mail_address
759FROM ".USERS_TABLE."
760WHERE username = '".$conf_Register_PhpBB[1]."'
761;";
762
763    $row = pwg_db_fetch_assoc(pwg_query($query));
764
765    if (!empty($row))
766    {
767      array_push($page['infos'], l10n('Sync_User').stripslashes($row['username']).'<br><br>');
768
769      PhpBB_Updateuser($row['id'], stripslashes($row['username']), $row['password'], $row['mail_address']);
770    }
771
772    array_push($page['infos'], l10n('Mig_End'));
773  }
774  else if ( isset($_POST['Audit']))
775  {
776    Audit_PWG_PhpBB();
777  }
778
779  $template->assign(
780    array
781    (
782      'REGPHPBB_PATH'    => REGPHPBB_PATH,
783      'REGPHPBB_VERSION' => $version,
784    )
785  );
786
787  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/migration.tpl');
788  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
789
790        break;
791
792        case 'Synchro':
793
794  if ( isset($_POST['Synchro']) and !is_adviser() )
795  {
796    global $page,$conf, $errors;
797
798    $conf_Register_PhpBB = isset($conf['Register_PhpBB']) ? explode(";" , $conf['Register_PhpBB']) : array();
799
800    $page_Register_PhpBB_admin = get_admin_plugin_menu_link(__FILE__);
801
802
803    $msg_error_PWG_Dup = '';
804    $msg_error_PhpBB_Dup = '';
805    $msg_error_Link_Break = '';
806    $msg_error_Link_Bad = '';
807    $msg_error_Synchro = '';
808    $msg_ok_Synchro = '';
809    $msg_error_PhpBB2PWG = '';
810    $msg_error_PWG2PhpBB = '';
811
812
813    $query = "
814SELECT COUNT(*) AS nbr_dup, id, username
815FROM ".USERS_TABLE."
816GROUP BY BINARY username
817HAVING COUNT(*) > 1
818;";
819
820    $result = pwg_query($query);
821
822    while($row = pwg_db_fetch_assoc($result))
823      $msg_error_PWG_Dup .= '<br>'.l10n('Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']);
824
825      if ($msg_error_PWG_Dup <> '')
826        $msg_error_PWG_Dup = l10n('Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Advise_PWG_Dup');
827
828
829    $query = "
830SELECT COUNT(*) AS nbr_dup, username
831FROM ".PhpBB_USERS_TABLE."
832GROUP BY BINARY username
833HAVING COUNT(*) > 1
834;";
835
836    $result = pwg_query($query);
837
838    while($row = pwg_db_fetch_assoc($result))
839    {
840      $msg_error_PhpBB_Dup .= '<br>'.l10n('Error_PhpBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']);
841
842      $subquery = "
843SELECT user_id, username, user_email
844FROM ".PhpBB_USERS_TABLE."
845WHERE BINARY username = BINARY '".$row['username']."'
846;";
847
848      $subresult = pwg_query($subquery);
849
850      while($subrow = pwg_db_fetch_assoc($subresult))
851      {
852        $msg_error_PhpBB_Dup .= '<br>id:'.$subrow['user_id'].'='.stripslashes($subrow['username']).' ('.$subrow['user_email'].')';
853
854        if ( !is_adviser() )
855        {
856          $msg_error_PhpBB_Dup .= ' <a href="';
857
858          $msg_error_PhpBB_Dup .= add_url_params($page_Register_PhpBB_admin, array(
859            'action' => 'del_user',
860            'user_id' => $subrow['user_id'],
861          ));
862
863          $msg_error_PhpBB_Dup .= '" title="'.l10n('Del_User').stripslashes($subrow['username']).'"';
864
865          $msg_error_PhpBB_Dup .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
866
867          $msg_error_PhpBB_Dup .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($subrow['username']).'" /></a>';
868        }
869      }
870    }
871
872    if ($msg_error_PhpBB_Dup <> '')
873      $msg_error_PhpBB_Dup = l10n('Sync_Check_Dup').$msg_error_PhpBB_Dup.'<br>'.l10n('Advise_PhpBB_Dup');
874
875
876    if ($msg_error_PhpBB_Dup == '' and $msg_error_PWG_Dup == '')
877    {
878      $query = "
879SELECT pwg.id as pwg_id, bb.user_id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail
880FROM ".PhpBB_USERS_TABLE." AS bb, ".USERS_TABLE." as pwg
881WHERE bb.user_id NOT in (
882  SELECT id_user_PhpBB
883  FROM ".Register_PhpBB_ID_TABLE."
884  )
885AND pwg.id NOT in (
886  SELECT id_user_pwg
887  FROM ".Register_PhpBB_ID_TABLE."
888  )
889AND pwg.username = bb.username
890AND pwg.mail_address = bb.user_email
891;";
892
893      $result = pwg_query($query);
894
895      while($row = pwg_db_fetch_assoc($result))
896      {
897        $msg_error_Link_Break .= '<br>'.l10n('New_Link').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')';
898
899        PhpBB_Linkuser($row['pwg_id'], $row['bb_id']);
900      }
901
902      if ($msg_error_Link_Break == '')
903        array_push($page['infos'], l10n('Sync_Link_Break').'<br>'.l10n('Sync_OK'));
904      else
905        $msg_error_Link_Break = l10n('Sync_Link_Break').$msg_error_Link_Break;
906
907
908      $query = "
909SELECT pwg.username as pwg_user, pwg.id as pwg_id, pwg.mail_address as pwg_mail, bb.user_id as bb_id, bb.username as bb_user, bb.user_email as bb_mail
910FROM ".PhpBB_USERS_TABLE." AS bb
911INNER JOIN ".Register_PhpBB_ID_TABLE." AS link ON link.id_user_PhpBB = bb.user_id
912INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
913WHERE BINARY pwg.username <> BINARY bb.username
914;";
915
916      $result = pwg_query($query);
917
918      while($row = pwg_db_fetch_assoc($result))
919      {
920        $msg_error_Link_Bad .= '<br>'.l10n('Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')';
921
922        $subquery = "
923DELETE FROM ".Register_PhpBB_ID_TABLE."
924WHERE id_user_pwg = ".$row['pwg_id']."
925AND id_user_PhpBB = ".$row['bb_id']."
926;";
927
928        $subresult = pwg_query($subquery);
929      }
930
931
932      $query = "
933SELECT COUNT(*) as nbr_dead
934FROM ".Register_PhpBB_ID_TABLE." AS Link
935WHERE id_user_PhpBB NOT IN (
936  SELECT user_id
937  FROM ".PhpBB_USERS_TABLE."
938  )
939OR id_user_pwg NOT IN (
940  SELECT id
941  FROM ".USERS_TABLE."
942  )
943;";
944
945      $Compteur = pwg_db_fetch_assoc(pwg_query($query));
946
947      if ( !empty($Compteur) and $Compteur['nbr_dead'] > 0)
948      {
949        $msg_error_Link_Bad .= '<br>'.l10n('Link_Dead').$Compteur['nbr_dead'];
950
951        $query = "
952DELETE FROM ".Register_PhpBB_ID_TABLE."
953WHERE id_user_PhpBB NOT IN (
954  SELECT user_id
955  FROM ".PhpBB_USERS_TABLE."
956  )
957OR id_user_pwg NOT IN (
958  SELECT id
959  FROM ".USERS_TABLE."
960  )
961;";
962
963        $result = pwg_query($query);
964      }
965
966
967      $query = "
968SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.user_id AS bb_id
969FROM ".PhpBB_USERS_TABLE." AS bb
970INNER JOIN ".Register_PhpBB_ID_TABLE." AS link ON link.id_user_PhpBB = bb.user_id
971INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
972GROUP BY link.id_user_pwg, link.id_user_PhpBB
973HAVING COUNT(*) > 1
974;";
975
976      $result = pwg_query($query);
977
978      while($row = pwg_db_fetch_assoc($result))
979      {
980        $msg_error_Link_Bad .= '<br>'.l10n('Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')';
981
982        PhpBB_Linkuser($row['pwg_id'], $row['bb_id']);
983      }
984
985      if ($msg_error_Link_Bad == '')
986        array_push($page['infos'], l10n('Sync_Link_Bad').'<br>'.l10n('Sync_OK'));
987      else
988        $msg_error_Link_Bad = l10n('Sync_Link_Bad').$msg_error_Link_Bad;
989
990
991      $query = "
992SELECT pwg.id as pwg_id, pwg.username as username, pwg.password as pwg_pwd, pwg.mail_address as pwg_eml, PhpBB.user_id as bb_id, PhpBB.user_password as bb_pwd, PhpBB.user_email as bb_eml
993FROM ".PhpBB_USERS_TABLE." AS PhpBB
994INNER JOIN ".Register_PhpBB_ID_TABLE." AS link ON link.id_user_PhpBB = PhpBB.user_id
995INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
996AND BINARY pwg.username = BINARY PhpBB.username
997ORDER BY LOWER(pwg.username)
998;";
999
1000      $result = pwg_query($query);
1001
1002      while($row = pwg_db_fetch_assoc($result))
1003      {
1004        if ( ($row['pwg_pwd'] != $row['bb_pwd']) or ($row['pwg_eml'] != $row['bb_eml']) )
1005        {
1006          $msg_error_Synchro .= '<br>'.l10n('Sync_User').stripslashes($row['username']);
1007
1008          $query = "
1009SELECT id, username, password, mail_address
1010FROM ".USERS_TABLE."
1011WHERE BINARY id = '".$row['pwg_id']."'
1012;";
1013
1014          $data = pwg_db_fetch_assoc(pwg_query($query));
1015
1016          if (!empty($data))
1017            PhpBB_Updateuser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']);
1018        }
1019      }
1020
1021      if ($msg_error_Synchro == '')
1022        array_push($page['infos'], l10n('Sync_DataUser').'<br>'.l10n('Sync_OK'));
1023      else
1024        $msg_error_Synchro = l10n('Sync_DataUser').$msg_error_Synchro;
1025
1026
1027      $query = "
1028SELECT username, mail_address FROM ".USERS_TABLE."
1029WHERE BINARY username <> BINARY 'guest'
1030AND id not in (
1031  SELECT id_user_pwg FROM ".Register_PhpBB_ID_TABLE."
1032  )
1033AND BINARY username not in (
1034  SELECT username FROM ".PhpBB_USERS_TABLE."
1035  )
1036ORDER BY LOWER(username)
1037;";
1038
1039      $result = pwg_query($query);
1040
1041      while($row = pwg_db_fetch_assoc($result))
1042      {
1043        $msg_error_PWG2PhpBB .= '<br>'.l10n('Add_User').stripslashes($row['username']).' ('.$row['mail_address'].')';
1044
1045        $query = "
1046SELECT id, username, password, mail_address
1047FROM ".USERS_TABLE."
1048WHERE BINARY username = BINARY '".$row['username']."'
1049LIMIT 1
1050;";
1051
1052        $data = pwg_db_fetch_assoc(pwg_query($query));
1053
1054        if (!empty($data))
1055          PhpBB_Adduser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']);
1056      }
1057
1058      if ($msg_error_PWG2PhpBB == '')
1059        array_push($page['infos'], l10n('Sync_PWG2PhpBB').'<br>'.l10n('Sync_OK'));
1060      else
1061        $msg_error_PWG2PhpBB = l10n('Sync_PWG2PhpBB').$msg_error_PWG2PhpBB;
1062
1063
1064      $query = "
1065SELECT user_id, username, group_id, user_email FROM ".PhpBB_USERS_TABLE."
1066WHERE BINARY username <> BINARY '".$conf_Register_PhpBB[2]."'
1067AND user_id not in (
1068  SELECT id_user_PhpBB FROM ".Register_PhpBB_ID_TABLE."
1069  )
1070AND BINARY username not in (
1071  SELECT username FROM ".USERS_TABLE."
1072  )
1073AND group_id <> '6'
1074ORDER BY LOWER(username)
1075;";
1076
1077      $result = pwg_query($query);
1078
1079      while($row = pwg_db_fetch_assoc($result))
1080      {
1081        $msg_error_PhpBB2PWG .= '<br>'.l10n('Error_PhpBB2PWG').stripslashes($row['username']).' ('.$row['user_email'].')';
1082
1083        if ( !is_adviser() )
1084        {
1085          $msg_error_PhpBB2PWG .= ' <a href="';
1086
1087          $msg_error_PhpBB2PWG .= add_url_params($page_Register_PhpBB_admin, array(
1088            'action' => 'del_user',
1089            'user_id' => $row['user_id'],
1090          ));
1091
1092          $msg_error_PhpBB2PWG .= '" title="'.l10n('Del_User').stripslashes($row['username']).'"';
1093
1094          $msg_error_PhpBB2PWG .= $conf_Register_PhpBB[3]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
1095
1096          $msg_error_PhpBB2PWG .= '><img src="'.REGPHPBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>';
1097        }
1098      }
1099
1100      if ($msg_error_PhpBB2PWG == '')
1101        array_push($page['infos'], l10n('Sync_PhpBB2PWG').'<br>'.l10n('Sync_OK'));
1102      else
1103        $msg_error_PhpBB2PWG = l10n('Sync_PhpBB2PWG').$msg_error_PhpBB2PWG;
1104    }
1105    else
1106      $errors[] = l10n('Advise_Check_Dup');
1107
1108
1109    if ($msg_error_PWG_Dup <> '')
1110      $errors[] = $msg_error_PWG_Dup . ( ($msg_error_PhpBB_Dup == '' and $msg_error_Link_Break == '' and $msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
1111
1112    if ($msg_error_PhpBB_Dup <> '')
1113      $errors[] = $msg_error_PhpBB_Dup . ( ($msg_error_Link_Break == '' and $msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
1114
1115    if ($msg_error_Link_Break <> '')
1116      $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
1117
1118    if ($msg_error_Link_Bad <> '')
1119      $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
1120
1121    if ($msg_error_Synchro <> '')
1122      $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2PhpBB == '' and $msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
1123
1124    if ($msg_error_PWG2PhpBB <> '')
1125      $errors[] = $msg_error_PWG2PhpBB . ( ($msg_error_PhpBB2PWG == '') ? '' : '<br><br>' );
1126
1127    if ($msg_error_PhpBB2PWG <> '')
1128      $errors[] = $msg_error_PhpBB2PWG;
1129  }
1130  else if ( isset($_POST['Audit']))
1131  {
1132    Audit_PWG_PhpBB();
1133  }
1134
1135  $template->assign(
1136    array
1137    (
1138      'REGPHPBB_PATH'    => REGPHPBB_PATH,
1139      'REGPHPBB_VERSION' => $version,
1140    )
1141  );
1142
1143  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/synchro.tpl');
1144  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
1145
1146        break;
1147}
1148?>
Note: See TracBrowser for help on using the repository browser.