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

Revision 8842, 37.5 KB checked in by Eric, 9 years ago (diff)

Set compatibility for Piwigo 2.2-RC

  • Property svn:eol-style set to LF
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'].';'.addslashes($_POST['FluxBB_admin']).';'.addslashes($_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'].';'.addslashes($_POST['FluxBB_admin']).';'.addslashes($_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'].';'.addslashes($_POST['FluxBB_admin']).';'.addslashes($_POST['FluxBB_guest']).';'.$_POST['FluxBB_del_pt'].';'.$_POST['FluxBB_confirm'].';'.$_POST['FluxBB_details'].';false;0';
612        }
613      }
614
615      $query = '
616UPDATE '.CONFIG_TABLE.'
617SET value="'.$conf['Register_FluxBB'].'"
618WHERE param="Register_FluxBB"
619LIMIT 1
620;';
621
622      pwg_query($query);
623     
624      array_push($page['infos'], l10n('save_config'));
625    }
626  }
627
628  $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
629
630  $template->assign(
631    array
632    (
633      'REGFLUXBB_PATH'       => REGFLUXBB_PATH,
634      'REGFLUXBB_VERSION'    => $version,
635      'FluxBB_PREFIX'        => $conf_Register_FluxBB[0],
636      'FluxBB_ADMIN'         => stripslashes($conf_Register_FluxBB[1]),
637      'FluxBB_GUEST'         => stripslashes($conf_Register_FluxBB[2]),
638      'FluxBB_DEL_PT_TRUE'   => (isset($conf_Register_FluxBB[3]) and $conf_Register_FluxBB[3] == 'true') ? 'checked="checked"' : '',
639      'FluxBB_DEL_PT_FALSE'  => (isset($conf_Register_FluxBB[3]) and $conf_Register_FluxBB[3] == 'false') ? 'checked="checked"' : '',
640      'FluxBB_CONFIRM_TRUE'  => (isset($conf_Register_FluxBB[4]) and $conf_Register_FluxBB[4] == 'true') ? 'checked="checked"' : '',
641      'FluxBB_CONFIRM_FALSE' => (isset($conf_Register_FluxBB[4]) and $conf_Register_FluxBB[4] == 'false') ? 'checked="checked"' : '',
642      'FluxBB_DETAILS_TRUE'  => (isset($conf_Register_FluxBB[5]) and $conf_Register_FluxBB[5] == 'true') ? 'checked="checked"' : '',
643      'FluxBB_DETAILS_FALSE' => (isset($conf_Register_FluxBB[5]) and $conf_Register_FluxBB[5] == 'false') ? 'checked="checked"' : '',
644    )
645  );
646
647// If UAM exists and if UAM ConfirmMail is set, we can set this feature
648  if (function_exists('FindAvailableConfirmMailID'))
649  { 
650    $conf_UAM = unserialize($conf['UserAdvManager']);
651    $UAM_bridge = false;
652   
653    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')
654    {
655      $UAM_bridge = true;
656    }
657 
658    $template->assign(
659      array
660      (
661        'UAM_BRIDGE'            => $UAM_bridge,
662        'FluxBB_UAM_LINK_TRUE'  => (isset($conf_Register_FluxBB[6]) and $conf_Register_FluxBB[6] == 'true') ? 'checked="checked"' : '',
663        'FluxBB_UAM_LINK_FALSE' => (isset($conf_Register_FluxBB[6]) and $conf_Register_FluxBB[6] == 'false') ? 'checked="checked"' : '',
664        'FluxBB_GROUP'          => $conf_Register_FluxBB[7],
665      )
666    );
667  }
668   
669  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/manage.tpl');
670  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
671
672        break;
673
674        case 'Migration':
675 
676  $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
677       
678  if (isset($_POST['Migration']))
679  {
680    array_push($page['infos'], l10n('Mig_Start').'<br><br>');
681 
682    array_push($page['infos'], l10n('Mig_Del_Link').'<br><br>');
683
684    $query = "TRUNCATE ".Register_FluxBB_ID_TABLE.";";
685    $result = pwg_query($query);
686 
687 
688    $msg_Mig_Del_AllUsers = '';
689
690    $query = "
691SELECT username, id
692FROM ".FluxBB_USERS_TABLE."
693;";
694
695    $result = pwg_query($query);
696       
697    while ($row = pwg_db_fetch_assoc($result))
698    {
699      if((stripslashes($row['username']) != stripslashes($conf_Register_FluxBB[2])) and (stripslashes($row['username']) != stripslashes($conf_Register_FluxBB[1])))
700      {
701        $msg_Mig_Del_AllUsers .= '<br> - '.l10n('Mig_Del_User').stripslashes($row['username']);
702       
703        FluxBB_Deluser($row['id'], false);
704      }
705    }
706
707    array_push($page['infos'], l10n('Mig_Del_AllUsers').$msg_Mig_Del_AllUsers.'<br><br>');
708
709
710    $query = "
711SELECT id, username, password, mail_address
712FROM ".USERS_TABLE."
713;";
714
715    $result = pwg_query($query);
716 
717    $registred = time();
718    $registred_ip = $_SERVER['REMOTE_ADDR'];
719 
720    $msg_Mig_Add_AllUsers = '';
721 
722    while ($row = pwg_db_fetch_assoc($result))
723    {
724      if((stripslashes($row['username']) != 'guest') and (stripslashes($row['username']) != stripslashes($conf_Register_FluxBB[1])))
725      {
726        $msg_Mig_Add_AllUsers .= '<br> - '.l10n('Mig_Add_User').stripslashes($row['username']);
727
728        FluxBB_Adduser($row['id'], stripslashes($row['username']), $row['password'], $row['mail_address']);
729      }
730    }
731
732    array_push($page['infos'], l10n('Mig_Add_AllUsers').$msg_Mig_Add_AllUsers.'<br><br>');
733
734
735    $query = "
736SELECT id, username, password, mail_address
737FROM ".USERS_TABLE."
738WHERE username = '".$conf_Register_FluxBB[1]."'
739;";
740
741    $row = pwg_db_fetch_assoc(pwg_query($query));
742
743    if (!empty($row))
744    {
745      array_push($page['infos'], l10n('Sync_User').stripslashes($row['username']).'<br><br>');
746     
747      FluxBB_Updateuser($row['id'], stripslashes($row['username']), $row['password'], $row['mail_address']);
748    }
749
750    array_push($page['infos'], l10n('Mig_End'));
751  }
752  else if ( isset($_POST['Audit']))
753  {
754    Audit_PWG_FluxBB();
755  }
756
757  $template->assign(
758    array
759    (
760      'REGFLUXBB_PATH'    => REGFLUXBB_PATH,
761      'REGFLUXBB_VERSION' => $version,
762    )
763  );
764
765  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/migration.tpl');
766  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
767
768        break;
769 
770        case 'Synchro':
771 
772  if ( isset($_POST['Synchro']))
773  {
774    global $page,$conf, $errors;
775
776    $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
777
778    $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__);
779 
780
781    $msg_error_PWG_Dup = '';
782    $msg_error_FluxBB_Dup = '';
783    $msg_error_Link_Break = '';
784    $msg_error_Link_Bad = '';
785    $msg_error_Synchro = '';
786    $msg_ok_Synchro = '';
787    $msg_error_FluxBB2PWG = '';
788    $msg_error_PWG2FluxBB = '';
789
790
791    $query = "
792SELECT COUNT(*) AS nbr_dup, id, username
793FROM ".USERS_TABLE."
794GROUP BY BINARY username
795HAVING COUNT(*) > 1
796;";
797
798    $result = pwg_query($query);
799 
800    while($row = pwg_db_fetch_assoc($result))
801      $msg_error_PWG_Dup .= '<br>'.l10n('Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']);
802
803      if ($msg_error_PWG_Dup <> '')
804        $msg_error_PWG_Dup = l10n('Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Advise_PWG_Dup');
805 
806
807    $query = "
808SELECT COUNT(*) AS nbr_dup, username
809FROM ".FluxBB_USERS_TABLE."
810GROUP BY BINARY username
811HAVING COUNT(*) > 1
812;";
813
814    $result = pwg_query($query);
815 
816    while($row = pwg_db_fetch_assoc($result))
817    {
818      $msg_error_FluxBB_Dup .= '<br>'.l10n('Error_FluxBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']);
819
820      $subquery = "
821SELECT id, username, email
822FROM ".FluxBB_USERS_TABLE."
823WHERE BINARY username = BINARY '".$row['username']."'
824;";
825
826      $subresult = pwg_query($subquery);
827 
828      while($subrow = pwg_db_fetch_assoc($subresult))
829      {
830        $msg_error_FluxBB_Dup .= '<br>id:'.$subrow['id'].'='.stripslashes($subrow['username']).' ('.$subrow['email'].')';
831 
832        $msg_error_FluxBB_Dup .= ' <a href="';
833     
834        $msg_error_FluxBB_Dup .= add_url_params($page_Register_FluxBB_admin, array(
835          'action' => 'del_user',
836          'id' => $subrow['id'],
837        ));
838
839        $msg_error_FluxBB_Dup .= '" title="'.l10n('Del_User').stripslashes($subrow['username']).'"';
840
841        $msg_error_FluxBB_Dup .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
842
843        $msg_error_FluxBB_Dup .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($subrow['username']).'" /></a>';
844      }
845    }
846
847    if ($msg_error_FluxBB_Dup <> '')
848      $msg_error_FluxBB_Dup = l10n('Sync_Check_Dup').$msg_error_FluxBB_Dup.'<br>'.l10n('Advise_FluxBB_Dup');
849 
850
851    if ($msg_error_FluxBB_Dup == '' and $msg_error_PWG_Dup == '')
852    {
853      $query = "
854SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail
855FROM ".FluxBB_USERS_TABLE." AS bb, ".USERS_TABLE." as pwg
856WHERE bb.id NOT in (
857  SELECT id_user_FluxBB
858  FROM ".Register_FluxBB_ID_TABLE."
859  )
860AND pwg.id NOT in (
861  SELECT id_user_pwg
862  FROM ".Register_FluxBB_ID_TABLE."
863  )
864AND pwg.username = bb.username
865AND pwg.mail_address = bb.email
866;";
867
868      $result = pwg_query($query);
869   
870      while($row = pwg_db_fetch_assoc($result))
871      {
872        $msg_error_Link_Break .= '<br>'.l10n('New_Link').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')';
873 
874        FluxBB_Linkuser($row['pwg_id'], $row['bb_id']);
875      }
876 
877      if ($msg_error_Link_Break == '')
878        array_push($page['infos'], l10n('Sync_Link_Break').'<br>'.l10n('Sync_OK'));
879      else
880        $msg_error_Link_Break = l10n('Sync_Link_Break').$msg_error_Link_Break;
881 
882   
883      $query = "
884SELECT 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
885FROM ".FluxBB_USERS_TABLE." AS bb
886INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id
887INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
888WHERE BINARY pwg.username <> BINARY bb.username
889;";
890
891      $result = pwg_query($query);
892   
893      while($row = pwg_db_fetch_assoc($result))
894      {
895        $msg_error_Link_Bad .= '<br>'.l10n('Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')';
896
897        $subquery = "
898DELETE FROM ".Register_FluxBB_ID_TABLE."
899WHERE id_user_pwg = ".$row['pwg_id']."
900AND id_user_FluxBB = ".$row['bb_id']."
901;";
902
903        $subresult = pwg_query($subquery);
904      }
905
906
907      $query = "
908SELECT COUNT(*) as nbr_dead
909FROM ".Register_FluxBB_ID_TABLE." AS Link
910WHERE id_user_FluxBB NOT IN (
911  SELECT id
912  FROM ".FluxBB_USERS_TABLE."
913  )
914OR id_user_pwg NOT IN (
915  SELECT id
916  FROM ".USERS_TABLE."
917  )
918;";
919
920      $Compteur = pwg_db_fetch_assoc(pwg_query($query));
921   
922      if ( !empty($Compteur) and $Compteur['nbr_dead'] > 0)
923      { 
924        $msg_error_Link_Bad .= '<br>'.l10n('Link_Dead').$Compteur['nbr_dead'];
925   
926        $query = "
927DELETE FROM ".Register_FluxBB_ID_TABLE."
928WHERE id_user_FluxBB NOT IN (
929  SELECT id
930  FROM ".FluxBB_USERS_TABLE."
931  )
932OR id_user_pwg NOT IN (
933  SELECT id
934  FROM ".USERS_TABLE."
935  )
936;";
937
938        $result = pwg_query($query);
939      }
940   
941     
942      $query = "
943SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.id AS bb_id
944FROM ".FluxBB_USERS_TABLE." AS bb
945INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id
946INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
947GROUP BY link.id_user_pwg, link.id_user_FluxBB
948HAVING COUNT(*) > 1
949;";
950
951      $result = pwg_query($query);
952   
953      while($row = pwg_db_fetch_assoc($result))
954      {
955        $msg_error_Link_Bad .= '<br>'.l10n('Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')';
956 
957        FluxBB_Linkuser($row['pwg_id'], $row['bb_id']);
958      }
959
960      if ($msg_error_Link_Bad == '')
961        array_push($page['infos'], l10n('Sync_Link_Bad').'<br>'.l10n('Sync_OK'));
962      else
963        $msg_error_Link_Bad = l10n('Sync_Link_Bad').$msg_error_Link_Bad;
964 
965   
966      $query = "
967SELECT 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
968FROM ".FluxBB_USERS_TABLE." AS FluxBB
969INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = FluxBB.id
970INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id
971AND BINARY pwg.username = BINARY FluxBB.username
972ORDER BY LOWER(pwg.username)
973;";
974
975      $result = pwg_query($query);
976   
977      while($row = pwg_db_fetch_assoc($result))
978      {
979        if ( ($row['pwg_pwd'] != $row['bb_pwd']) or ($row['pwg_eml'] != $row['bb_eml']) )
980        {
981          $msg_error_Synchro .= '<br>'.l10n('Sync_User').stripslashes($row['username']);
982 
983          $query = "
984SELECT id, username, password, mail_address
985FROM ".USERS_TABLE."
986WHERE BINARY id = '".$row['pwg_id']."'
987;";
988
989          $data = pwg_db_fetch_assoc(pwg_query($query));
990       
991          if (!empty($data))
992            FluxBB_Updateuser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']);
993        }
994      }
995 
996      if ($msg_error_Synchro == '')
997        array_push($page['infos'], l10n('Sync_DataUser').'<br>'.l10n('Sync_OK'));
998      else
999        $msg_error_Synchro = l10n('Sync_DataUser').$msg_error_Synchro;
1000
1001 
1002      $query = "
1003SELECT username, mail_address FROM ".USERS_TABLE."
1004WHERE BINARY username <> BINARY 'guest'
1005AND id not in (
1006  SELECT id_user_pwg FROM ".Register_FluxBB_ID_TABLE."
1007  )
1008AND BINARY username not in (
1009  SELECT username FROM ".FluxBB_USERS_TABLE."
1010  )
1011ORDER BY LOWER(username)
1012;";
1013
1014      $result = pwg_query($query);
1015 
1016      while($row = pwg_db_fetch_assoc($result))
1017      {
1018        $msg_error_PWG2FluxBB .= '<br>'.l10n('Add_User').stripslashes($row['username']).' ('.$row['mail_address'].')';
1019
1020        $query = "
1021SELECT id, username, password, mail_address
1022FROM ".USERS_TABLE."
1023WHERE BINARY username = BINARY '".$row['username']."'
1024LIMIT 1
1025;";
1026
1027        $data = pwg_db_fetch_assoc(pwg_query($query));
1028     
1029        if (!empty($data))
1030          FluxBB_Adduser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']); 
1031      }
1032 
1033      if ($msg_error_PWG2FluxBB == '')
1034        array_push($page['infos'], l10n('Sync_PWG2FluxBB').'<br>'.l10n('Sync_OK'));
1035      else
1036        $msg_error_PWG2FluxBB = l10n('Sync_PWG2FluxBB').$msg_error_PWG2FluxBB;
1037   
1038 
1039      $query = "
1040SELECT id, username, email FROM ".FluxBB_USERS_TABLE."
1041WHERE BINARY username <> BINARY '".$conf_Register_FluxBB[2]."'
1042AND id not in (
1043  SELECT id_user_FluxBB FROM ".Register_FluxBB_ID_TABLE."
1044  )
1045AND BINARY username not in (
1046  SELECT username FROM ".USERS_TABLE."
1047  )
1048ORDER BY LOWER(username)
1049;";
1050
1051      $result = pwg_query($query);
1052 
1053      while($row = pwg_db_fetch_assoc($result))
1054      {
1055        $msg_error_FluxBB2PWG .= '<br>'.l10n('Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')';
1056 
1057        $msg_error_FluxBB2PWG .= ' <a href="';
1058     
1059        $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array(
1060          'action' => 'del_user',
1061          'id' => $row['id'],
1062        ));
1063
1064        $msg_error_FluxBB2PWG .= '" title="'.l10n('Del_User').stripslashes($row['username']).'"';
1065
1066        $msg_error_FluxBB2PWG .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' ';
1067
1068        $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>';
1069      }
1070 
1071      if ($msg_error_FluxBB2PWG == '')
1072        array_push($page['infos'], l10n('Sync_FluxBB2PWG').'<br>'.l10n('Sync_OK'));
1073      else
1074        $msg_error_FluxBB2PWG = l10n('Sync_FluxBB2PWG').$msg_error_FluxBB2PWG;
1075    }
1076    else
1077      $errors[] = l10n('Advise_Check_Dup');
1078
1079
1080    if ($msg_error_PWG_Dup <> '')
1081      $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>' );
1082 
1083    if ($msg_error_FluxBB_Dup <> '')
1084      $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>' );
1085
1086    if ($msg_error_Link_Break <> '')
1087      $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' );
1088
1089    if ($msg_error_Link_Bad <> '')
1090      $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' );
1091
1092    if ($msg_error_Synchro <> '')
1093      $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' );
1094
1095    if ($msg_error_PWG2FluxBB <> '')
1096      $errors[] = $msg_error_PWG2FluxBB . ( ($msg_error_FluxBB2PWG == '') ? '' : '<br><br>' );
1097
1098    if ($msg_error_FluxBB2PWG <> '')
1099      $errors[] = $msg_error_FluxBB2PWG;
1100  }
1101  else if ( isset($_POST['Audit']))
1102  {
1103    Audit_PWG_FluxBB();
1104  }
1105
1106  $template->assign(
1107    array
1108    (
1109      'REGFLUXBB_PATH'    => REGFLUXBB_PATH,
1110      'REGFLUXBB_VERSION' => $version,
1111    )
1112  );
1113
1114  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/synchro.tpl');
1115  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');   
1116
1117        break;
1118}
1119?>
Note: See TracBrowser for help on using the repository browser.