source: extensions/Register_FluxBB/branches/2.3/admin/admin.php @ 6899

Revision 6899, 38.4 KB checked in by Eric, 9 years ago (diff)

Merge from Trunk to Branch 2.3

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