source: extensions/Register_FluxBB/trunk/admin/admin.php @ 14918

Last change on this file since 14918 was 14918, checked in by Eric, 9 years ago

Code refactory
Compatilibity with Piwigo 2.4 and FluxBB 1.5 verifyed
language/fr_FR/plugin.lang.php sentence fixed

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