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

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

using conf_update_param() and pwg_db_real_escape_string()

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