Ignore:
Timestamp:
11/17/09 18:18:07 (10 years ago)
Author:
Eric
Message:

[Register_FluxBB] Merged frim trunk to branch 2.1

  • Using sha1 hash instead of md5 for password hashing in FluxBB because FluxBB uses prior sha1 hash and md5 only in last sentence.
  • Escaping all characters in login names and be able to retreive them without slashes - FluxBB does not allow this so Piwigo's user names with escaped characters will not been escaped in FluxBB (ie : "it's" in Piwigo will be "It\'s" in FluxBB)
  • Code refactoring
  • Full HTML 4.0 for tpl
Location:
extensions/Register_FluxBB/branches/2.1
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/Register_FluxBB/branches/2.1/admin/Register_FluxBB_admin.php

    r3780 r4288  
    1919// +-----------------------------------------------------------------------+ 
    2020if (!isset($_GET['tab'])) 
    21     $page['tab'] = 'info'; 
     21  $page['tab'] = 'info'; 
    2222else 
    23     $page['tab'] = $_GET['tab']; 
     23  $page['tab'] = $_GET['tab']; 
    2424 
    2525$tabsheet = new tabsheet(); 
    2626$tabsheet->add('info', 
    27                l10n('Tab_Info'), 
    28                $my_base_url.'&tab=info'); 
     27            l10n('Tab_Info'), 
     28            $my_base_url.'&tab=info'); 
    2929$tabsheet->add('manage', 
    30                l10n('Tab_Manage'), 
    31                $my_base_url.'&tab=manage'); 
     30            l10n('Tab_Manage'), 
     31            $my_base_url.'&tab=manage'); 
    3232$tabsheet->add('Migration', 
    33                l10n('Tab_Migration'), 
    34                $my_base_url.'&tab=Migration'); 
     33            l10n('Tab_Migration'), 
     34            $my_base_url.'&tab=Migration'); 
    3535$tabsheet->add('Synchro', 
    36                l10n('Tab_Synchro'), 
    37                $my_base_url.'&tab=Synchro'); 
     36            l10n('Tab_Synchro'), 
     37            $my_base_url.'&tab=Synchro'); 
    3838$tabsheet->select($page['tab']); 
    3939$tabsheet->assign(); 
     
    6868 
    6969  $query = " 
    70     SELECT COUNT(*) AS nbr_dup, id, username 
    71     FROM ".USERS_TABLE."  
    72     GROUP BY BINARY username 
    73     HAVING COUNT(*) > 1 
    74   ;"; 
     70SELECT COUNT(*) AS nbr_dup, id, username 
     71FROM ".USERS_TABLE."  
     72GROUP BY BINARY username 
     73HAVING COUNT(*) > 1 
     74;"; 
    7575  $result = pwg_query($query); 
    7676   
    7777  while($row = mysql_fetch_array($result)) 
    78     $msg_error_PWG_Dup .= '<br/>'.l10n('Register_FluxBB_Error_PWG_Dup').$row['nbr_dup'].' x '.$row['username']; 
     78    $msg_error_PWG_Dup .= '<br/>'.l10n('Register_FluxBB_Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); 
    7979 
    8080  if ($msg_error_PWG_Dup == '') 
     
    8686 
    8787  $query = " 
    88     SELECT COUNT(*) AS nbr_dup, username 
    89     FROM ".FluxBB_USERS_TABLE."  
    90     GROUP BY BINARY username 
    91     HAVING COUNT(*) > 1 
    92   ;"; 
     88SELECT COUNT(*) AS nbr_dup, username 
     89FROM ".FluxBB_USERS_TABLE."  
     90GROUP BY BINARY username 
     91HAVING COUNT(*) > 1 
     92;"; 
    9393  $result = pwg_query($query); 
    9494   
    9595  while($row = mysql_fetch_array($result)) 
    9696  { 
    97     $msg_error_FluxBB_Dup .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB_Dup').$row['nbr_dup'].' x '.$row['username']; 
     97    $msg_error_FluxBB_Dup .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); 
    9898 
    9999    $subquery = " 
    100       SELECT id, username, email 
    101       FROM ".FluxBB_USERS_TABLE."  
    102       WHERE BINARY username = BINARY '".$row['username']."' 
    103     ;"; 
     100SELECT id, username, email 
     101FROM ".FluxBB_USERS_TABLE."  
     102WHERE BINARY username = BINARY '".$row['username']."' 
     103;"; 
    104104    $subresult = pwg_query($subquery); 
    105105   
    106106    while($subrow = mysql_fetch_array($subresult)) 
    107107    { 
    108       $msg_error_FluxBB_Dup .= '<br/>id:'.$subrow['id'].'='.$subrow['username'].' ('.$subrow['email'].')'; 
     108      $msg_error_FluxBB_Dup .= '<br/>id:'.$subrow['id'].'='.stripslashes($subrow['username']).' ('.$subrow['email'].')'; 
    109109   
    110110      if ( !is_adviser() ) 
     
    116116          'id' => $subrow['id'], 
    117117        )); 
    118         $msg_error_FluxBB_Dup .= '" title="'.l10n('Register_FluxBB_Del_User').$subrow['username'].'"'; 
     118         
     119        $msg_error_FluxBB_Dup .= '" title="'.l10n('Register_FluxBB_Del_User').stripslashes($subrow['username']).'"'; 
     120         
    119121        $msg_error_FluxBB_Dup .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
     122         
    120123        $msg_error_FluxBB_Dup .= '><img src="'.Register_FluxBB_PATH.'/icon/user_delete.png" alt="'.l10n('Register_FluxBB_Del_User').$subrow['username'].'" /></a>'; 
    121124      } 
     
    131134 
    132135  $query = " 
    133     SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail 
    134     FROM ".FluxBB_USERS_TABLE." AS bb, ".USERS_TABLE." as pwg 
    135     WHERE bb.id NOT in ( 
    136       SELECT id_user_FluxBB 
    137       FROM ".Register_FluxBB_ID_TABLE." 
    138     ) 
    139     AND pwg.id NOT in ( 
    140       SELECT id_user_pwg 
    141       FROM ".Register_FluxBB_ID_TABLE." 
    142     ) 
    143     AND pwg.username = bb.username 
    144     AND pwg.mail_address = bb.email 
    145   ;"; 
     136SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail 
     137FROM ".FluxBB_USERS_TABLE." AS bb, ".USERS_TABLE." as pwg 
     138WHERE bb.id NOT in ( 
     139  SELECT id_user_FluxBB 
     140  FROM ".Register_FluxBB_ID_TABLE." 
     141  ) 
     142AND pwg.id NOT in ( 
     143  SELECT id_user_pwg 
     144  FROM ".Register_FluxBB_ID_TABLE." 
     145  ) 
     146AND pwg.username = bb.username 
     147AND pwg.mail_address = bb.email 
     148;"; 
     149 
    146150  $result = pwg_query($query); 
    147151   
    148152  while($row = mysql_fetch_array($result)) 
    149153  { 
    150     $msg_error_Link_Break .= '<br/>'.l10n('Register_FluxBB_Error_Link_Break').$row['pwg_user'].' ('.$row['pwg_mail'].')'; 
     154    $msg_error_Link_Break .= '<br/>'.l10n('Register_FluxBB_Error_Link_Break').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'; 
    151155 
    152156    if ( !is_adviser() ) 
     
    159163        'bb_id' => $row['bb_id'], 
    160164      )); 
    161       $msg_error_Link_Break .= '" title="'.l10n('Register_FluxBB_New_Link').$row['pwg_user'].'"'; 
     165       
     166      $msg_error_Link_Break .= '" title="'.l10n('Register_FluxBB_New_Link').stripslashes($row['pwg_user']).'"'; 
     167       
    162168      $msg_error_Link_Break .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    163       $msg_error_Link_Break .= '><img src="'.Register_FluxBB_PATH.'/icon/link_break.png" alt="'.l10n('Register_FluxBB_New_Link').$row['pwg_user'].'" /></a>'; 
     169 
     170      $msg_error_Link_Break .= '><img src="'.Register_FluxBB_PATH.'/icon/link_break.png" alt="'.l10n('Register_FluxBB_New_Link').stripslashes($row['pwg_user']).'" /></a>'; 
    164171    } 
    165172  } 
     
    173180   
    174181  $query = " 
    175     SELECT 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 
    176     FROM ".FluxBB_USERS_TABLE." AS bb  
    177     INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
    178         INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
    179     WHERE pwg.username <> bb.username 
    180   ;"; 
     182SELECT 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 
     183FROM ".FluxBB_USERS_TABLE." AS bb  
     184INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
     185INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
     186WHERE pwg.username <> bb.username 
     187;"; 
     188 
    181189  $result = pwg_query($query); 
    182190   
    183191  while($row = mysql_fetch_array($result)) 
    184192  { 
    185     $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Error_Link_Del').$row['pwg_user'].' ('.$row['pwg_mail'].')'.' -- '.$row['bb_user'].' ('.$row['bb_mail'].')'; 
     193    $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Error_Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')'; 
    186194 
    187195    if ( !is_adviser() ) 
     
    194202        'bb_id'  => $row['bb_id'], 
    195203      )); 
    196       $msg_error_Link_Bad .= '" title="'.l10n('Register_FluxBB_Link_Del').$row['pwg_user'].' -- '.$row['bb_user'].'"'; 
     204       
     205      $msg_error_Link_Bad .= '" title="'.l10n('Register_FluxBB_Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; 
     206       
    197207      $msg_error_Link_Bad .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    198       $msg_error_Link_Bad .= '><img src="'.Register_FluxBB_PATH.'/icon/link_delete.png" alt="'.l10n('Register_FluxBB_Link_Del').$row['pwg_user'].' -- '.$row['bb_user'].'" /></a>'; 
     208       
     209      $msg_error_Link_Bad .= '><img src="'.Register_FluxBB_PATH.'/icon/link_delete.png" alt="'.l10n('Register_FluxBB_Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>'; 
    199210 
    200211      $msg_error_Link_Bad .= ' -- <a href="'; 
     
    202213      $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 
    203214        'action' => 'sync_user', 
    204         'username' => $row['pwg_user'], 
     215        'username' => stripslashes($row['pwg_user']), 
    205216      )); 
    206       $msg_error_Link_Bad .= '" title="'.l10n('Register_FluxBB_Sync_User').$row['pwg_user'].' --> '.$row['bb_user'].'"'; 
     217       
     218      $msg_error_Link_Bad .= '" title="'.l10n('Register_FluxBB_Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'"'; 
     219       
    207220      $msg_error_Link_Bad .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    208       $msg_error_Link_Bad .= '><img src="'.Register_FluxBB_PATH.'/icon/arrow_switch.png" alt="'.l10n('Register_FluxBB_Sync_User').$row['pwg_user'].' --> '.$row['bb_user'].'" /></a>'; 
    209     } 
    210   } 
    211  
    212  
    213   $query = " 
    214     SELECT COUNT(*) as nbr_dead 
    215     FROM ".Register_FluxBB_ID_TABLE." AS Link 
    216     WHERE id_user_FluxBB NOT IN ( 
    217       SELECT id 
    218       FROM ".FluxBB_USERS_TABLE." 
    219     ) 
    220     OR id_user_pwg NOT IN ( 
    221       SELECT id 
    222       FROM ".USERS_TABLE." 
    223     ) 
    224   ;"; 
     221       
     222      $msg_error_Link_Bad .= '><img src="'.Register_FluxBB_PATH.'/icon/arrow_switch.png" alt="'.l10n('Register_FluxBB_Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'" /></a>'; 
     223    } 
     224  } 
     225 
     226 
     227  $query = " 
     228SELECT COUNT(*) as nbr_dead 
     229FROM ".Register_FluxBB_ID_TABLE." AS Link 
     230WHERE id_user_FluxBB NOT IN ( 
     231  SELECT id 
     232  FROM ".FluxBB_USERS_TABLE." 
     233  ) 
     234OR id_user_pwg NOT IN ( 
     235  SELECT id 
     236  FROM ".USERS_TABLE." 
     237  ) 
     238;"; 
     239 
    225240  $Compteur = mysql_fetch_array(pwg_query($query)); 
    226241 
    227   if ( !empty($Compteur) and $Compteur['nbr_dead'] > 0) 
     242  if (!empty($Compteur) and $Compteur['nbr_dead'] > 0) 
    228243  {  
    229244    $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Error_Link_Dead').$Compteur['nbr_dead']; 
     
    234249   
    235250      $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 
    236       'action'   => 'link_dead', 
     251        'action'   => 'link_dead', 
    237252      )); 
     253       
    238254      $msg_error_Link_Bad .= '" title="'.l10n('Register_FluxBB_Link_Dead').$Compteur['nbr_dead'].'"'; 
     255       
    239256      $msg_error_Link_Bad .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
     257       
    240258      $msg_error_Link_Bad .= '><img src="'.Register_FluxBB_PATH.'/icon/link_delete.png" alt="'.l10n('Register_FluxBB_Link_Dead').$Compteur['nbr_dead'].'" /></a>'; 
    241259    } 
     
    243261 
    244262  $query = " 
    245     SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.id AS bb_id 
    246     FROM ".FluxBB_USERS_TABLE." AS bb  
    247     INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
    248         INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
    249     GROUP BY link.id_user_pwg, link.id_user_FluxBB 
    250     HAVING COUNT(*) > 1 
    251   ;"; 
     263SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.id AS bb_id 
     264FROM ".FluxBB_USERS_TABLE." AS bb  
     265INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
     266INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
     267GROUP BY link.id_user_pwg, link.id_user_FluxBB 
     268HAVING COUNT(*) > 1 
     269;"; 
     270 
    252271  $result = pwg_query($query); 
    253272   
    254273  while($row = mysql_fetch_array($result)) 
    255274  { 
    256     $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Error_Link_Dup').$row['nbr_dup'].' = '.$row['pwg_user'].' -- '.$row['bb_user'].')'; 
     275    $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Error_Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')'; 
    257276 
    258277    if ( !is_adviser() ) 
     
    265284        'bb_id' => $row['bb_id'], 
    266285      )); 
    267       $msg_error_Link_Bad .= '" title="'.l10n('Register_FluxBB_Link_Dup').$row['pwg_user'].' -- '.$row['bb_user'].'"'; 
     286       
     287      $msg_error_Link_Bad .= '" title="'.l10n('Register_FluxBB_Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; 
     288       
    268289      $msg_error_Link_Bad .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    269       $msg_error_Link_Bad .= '><img src="'.Register_FluxBB_PATH.'/icon/link_error.png" alt="'.l10n('Register_FluxBB_Link_Dup').$row['pwg_user'].' -- '.$row['bb_user'].'" /></a>'; 
     290       
     291      $msg_error_Link_Bad .= '><img src="'.Register_FluxBB_PATH.'/icon/link_error.png" alt="'.l10n('Register_FluxBB_Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>'; 
    270292    }       
    271293  } 
     
    279301   
    280302  $query = " 
    281     SELECT 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 
    282     FROM ".FluxBB_USERS_TABLE." AS FluxBB  
    283     INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = FluxBB.id 
    284         INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
    285         AND BINARY pwg.username = BINARY FluxBB.username 
    286         ORDER BY LOWER(pwg.username) 
    287   ;"; 
     303SELECT 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 
     304FROM ".FluxBB_USERS_TABLE." AS FluxBB  
     305INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = FluxBB.id 
     306INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
     307AND BINARY pwg.username = BINARY FluxBB.username 
     308ORDER BY LOWER(pwg.username) 
     309;"; 
     310 
    288311  $result = pwg_query($query); 
    289312   
     
    292315    if ( ($row['pwg_pwd'] != $row['bb_pwd']) or ($row['pwg_eml'] != $row['bb_eml']) ) 
    293316    { 
    294       $msg_error_Synchro .= '<br/>'.l10n('Register_FluxBB_Error_Synchro').$row['username']; 
     317      $msg_error_Synchro .= '<br/>'.l10n('Register_FluxBB_Error_Synchro').stripslashes($row['username']); 
    295318 
    296319      if ( !is_adviser() ) 
     
    300323        $msg_error_Synchro .= add_url_params($page_Register_FluxBB_admin, array( 
    301324          'action' => 'sync_user', 
    302           'username' => $row['username'], 
     325          'username' => stripslashes($row['username']), 
    303326        )); 
    304         $msg_error_Synchro .= '" title="'.l10n('Register_FluxBB_Sync_User').$row['username'].'"'; 
     327         
     328        $msg_error_Synchro .= '" title="'.l10n('Register_FluxBB_Sync_User').stripslashes($row['username']).'"'; 
     329         
    305330        $msg_error_Synchro .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    306         $msg_error_Synchro .= '><img src="'.Register_FluxBB_PATH.'/icon/user_refresh.png" alt="'.l10n('Register_FluxBB_Sync_User').$row['username'].'" /></a>'; 
     331        $msg_error_Synchro .= '><img src="'.Register_FluxBB_PATH.'/icon/user_refresh.png" alt="'.l10n('Register_FluxBB_Sync_User').stripslashes($row['username']).'" /></a>'; 
    307332      } 
    308333       
     
    313338        $msg_error_Synchro .= '<br>'.l10n('Register_FluxBB_Error_Synchro_Mail').'<br/>-- PWG = '.$row['pwg_eml'].'<br/>-- FluxBB = '.$row['bb_eml']; 
    314339    } 
    315     else 
    316       if ( $conf_Register_FluxBB[5] == 'true') 
    317         $msg_ok_Synchro .= '<br/> - '.$row['username'].' ('.$row['pwg_eml'].')'.l10n('Register_FluxBB_Audit_Synchro_OK'); 
     340    else if ($conf_Register_FluxBB[5] == 'true') 
     341      $msg_ok_Synchro .= '<br/> - '.stripslashes($row['username']).' ('.$row['pwg_eml'].')'.l10n('Register_FluxBB_Audit_Synchro_OK'); 
    318342  } 
    319343 
     
    329353 
    330354  $query = " 
    331     SELECT username, mail_address FROM ".USERS_TABLE." 
    332     WHERE BINARY username <> BINARY 'guest' 
    333     AND id not in ( 
    334       SELECT id_user_pwg FROM ".Register_FluxBB_ID_TABLE." 
    335     ) 
    336     AND BINARY username not in ( 
    337       SELECT username FROM ".FluxBB_USERS_TABLE." 
    338     ) 
    339         ORDER BY LOWER(username) 
    340   ;"; 
     355SELECT username, mail_address FROM ".USERS_TABLE." 
     356WHERE BINARY username <> BINARY 'guest' 
     357AND id not in ( 
     358  SELECT id_user_pwg FROM ".Register_FluxBB_ID_TABLE." 
     359  ) 
     360AND BINARY username not in ( 
     361  SELECT username FROM ".FluxBB_USERS_TABLE." 
     362  ) 
     363ORDER BY LOWER(username) 
     364;"; 
     365 
    341366  $result = pwg_query($query); 
    342367 
    343368  while($row = mysql_fetch_array($result)) 
    344369  { 
    345     $msg_error_PWG2FluxBB .= '<br/>'.l10n('Register_FluxBB_Error_PWG2FluxBB').$row['username'].' ('.$row['mail_address'].')'; 
     370    $msg_error_PWG2FluxBB .= '<br/>'.l10n('Register_FluxBB_Error_PWG2FluxBB').stripslashes($row['username']).' ('.$row['mail_address'].')'; 
    346371 
    347372    if ( !is_adviser() ) 
     
    351376      $msg_error_PWG2FluxBB .= add_url_params($page_Register_FluxBB_admin, array( 
    352377        'action' => 'add_user', 
    353         'username' => $row['username'], 
     378        'username' => stripslashes($row['username']), 
    354379      )); 
    355       $msg_error_PWG2FluxBB .= '" title="'.l10n('Register_FluxBB_Add_User').$row['username'].'" '; 
     380       
     381      $msg_error_PWG2FluxBB .= '" title="'.l10n('Register_FluxBB_Add_User').stripslashes($row['username']).'" '; 
     382       
    356383      $msg_error_PWG2FluxBB .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    357       $msg_error_PWG2FluxBB .= '><img src="'.Register_FluxBB_PATH.'/icon/user_add.png" alt="'.l10n('Register_FluxBB_Add_User').$row['username'].'" /></a>'; 
     384 
     385      $msg_error_PWG2FluxBB .= '><img src="'.Register_FluxBB_PATH.'/icon/user_add.png" alt="'.l10n('Register_FluxBB_Add_User').stripslashes($row['username']).'" /></a>'; 
    358386    } 
    359387  } 
     
    367395 
    368396  $query = " 
    369     SELECT id, username, email FROM ".FluxBB_USERS_TABLE." 
    370     WHERE BINARY username <> BINARY '".$conf_Register_FluxBB[2]."' 
    371     AND id not in ( 
    372       SELECT id_user_FluxBB FROM ".Register_FluxBB_ID_TABLE." 
    373     ) 
    374     AND BINARY username not in ( 
    375       SELECT username FROM ".USERS_TABLE." 
    376     ) 
    377         ORDER BY LOWER(username) 
    378   ;"; 
     397SELECT id, username, email FROM ".FluxBB_USERS_TABLE." 
     398WHERE BINARY username <> BINARY '".$conf_Register_FluxBB[2]."' 
     399AND id not in ( 
     400  SELECT id_user_FluxBB FROM ".Register_FluxBB_ID_TABLE." 
     401  ) 
     402AND BINARY username not in ( 
     403  SELECT username FROM ".USERS_TABLE." 
     404  ) 
     405ORDER BY LOWER(username) 
     406;"; 
     407 
    379408  $result = pwg_query($query); 
    380409 
    381410  while($row = mysql_fetch_array($result)) 
    382411  { 
    383     $msg_error_FluxBB2PWG .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB2PWG').$row['username'].' ('.$row['email'].')'; 
     412    $msg_error_FluxBB2PWG .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')'; 
    384413 
    385414    if ( !is_adviser() ) 
     
    391420        'id' => $row['id'], 
    392421      )); 
    393       $msg_error_FluxBB2PWG .= '" title="'.l10n('Register_FluxBB_Del_User').$row['username'].'"'; 
     422       
     423      $msg_error_FluxBB2PWG .= '" title="'.l10n('Register_FluxBB_Del_User').stripslashes($row['username']).'"'; 
     424       
    394425      $msg_error_FluxBB2PWG .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    395       $msg_error_FluxBB2PWG .= '><img src="'.Register_FluxBB_PATH.'/icon/user_delete.png" alt="'.l10n('Register_FluxBB_Del_User').$row['username'].'" /></a>'; 
     426 
     427      $msg_error_FluxBB2PWG .= '><img src="'.Register_FluxBB_PATH.'/icon/user_delete.png" alt="'.l10n('Register_FluxBB_Del_User').stripslashes($row['username']).'" /></a>'; 
    396428    } 
    397429  } 
     
    436468{ 
    437469  $query = " 
    438                 DELETE FROM ".Register_FluxBB_ID_TABLE." 
    439     WHERE id_user_FluxBB NOT IN ( 
    440       SELECT id 
    441       FROM ".FluxBB_USERS_TABLE." 
    442     ) 
    443     OR id_user_pwg NOT IN ( 
    444       SELECT id 
    445       FROM ".USERS_TABLE." 
    446     ) 
    447   ;"; 
     470DELETE FROM ".Register_FluxBB_ID_TABLE." 
     471WHERE id_user_FluxBB NOT IN ( 
     472  SELECT id 
     473  FROM ".FluxBB_USERS_TABLE." 
     474  ) 
     475OR id_user_pwg NOT IN ( 
     476  SELECT id 
     477  FROM ".USERS_TABLE." 
     478  ) 
     479;"; 
     480 
    448481  $result = pwg_query($query); 
    449482   
     
    453486{ 
    454487  $query = " 
    455                 DELETE FROM ".Register_FluxBB_ID_TABLE." 
    456                 WHERE id_user_pwg = ".$_GET['pwg_id']." 
    457                 AND id_user_FluxBB = ".$_GET['bb_id']." 
    458   ;"; 
     488DELETE FROM ".Register_FluxBB_ID_TABLE." 
     489WHERE id_user_pwg = ".$_GET['pwg_id']." 
     490AND id_user_FluxBB = ".$_GET['bb_id']." 
     491;"; 
     492 
    459493  $result = pwg_query($query); 
    460494   
     
    470504{ 
    471505  $query = " 
    472     SELECT id AS id_pwg, username, password, mail_address  
    473         FROM ".USERS_TABLE." 
    474         WHERE BINARY username = BINARY '".$_GET['username']."' 
    475         LIMIT 1 
    476   ;"; 
     506SELECT id AS id_pwg, username, password, mail_address  
     507FROM ".USERS_TABLE." 
     508WHERE BINARY username = BINARY '".mysql_real_escape_string($_GET['username'])."' 
     509LIMIT 1 
     510;"; 
     511 
    477512  $data = mysql_fetch_array(pwg_query($query)); 
    478513   
    479514  if (!empty($data)) 
    480515  { 
    481     FluxBB_Updateuser($data['id_pwg'], $data['username'], $data['password'], $data['mail_address']); 
     516    FluxBB_Updateuser($data['id_pwg'], stripslashes($data['username']), $data['password'], $data['mail_address']); 
    482517  } 
    483518   
     
    487522{ 
    488523  $query = " 
    489     SELECT id, username, password, mail_address  
    490         FROM ".USERS_TABLE." 
    491         WHERE BINARY username = BINARY '".$_GET['username']."' 
    492         LIMIT 1 
    493   ;"; 
     524SELECT id, username, password, mail_address  
     525FROM ".USERS_TABLE." 
     526WHERE BINARY username = BINARY '".mysql_real_escape_string($_GET['username'])."' 
     527LIMIT 1 
     528;"; 
     529 
    494530  $data = mysql_fetch_array(pwg_query($query)); 
    495531   
    496532  if (!empty($data)) 
    497     FluxBB_Adduser($data['id'], $data['username'], $data['password'], $data['mail_address']);   
    498    
    499   Audit_PWG_FluxBB(); 
     533    FluxBB_Adduser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']);   
     534   
     535    Audit_PWG_FluxBB(); 
    500536} 
    501537else if ( isset($_GET['action']) and ($_GET['action']=='del_user') and isset($_GET['id']) and !is_adviser() ) 
     
    513549switch ($page['tab']) 
    514550{ 
    515         case 'info': 
    516    
    517 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/info.tpl'); 
    518 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
     551  case 'info': 
     552   
     553  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/info.tpl'); 
     554  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
    519555 
    520556        break; 
     
    522558        case 'manage': 
    523559   
    524 if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['FluxBB_prefix']) and isset($_POST['FluxBB_admin']) and isset($_POST['FluxBB_guest'])  
    525   and isset($_POST['FluxBB_del_pt']) and isset($_POST['FluxBB_confirm']) and isset($_POST['FluxBB_details']) ) 
    526 { 
    527   $conf['Register_FluxBB'] = $_POST['FluxBB_prefix'].';'.$_POST['FluxBB_admin'].';'.$_POST['FluxBB_guest'].';'.$_POST['FluxBB_del_pt'].';'.$_POST['FluxBB_confirm'].';'.$_POST['FluxBB_details']; 
    528  
    529   $query = ' 
    530     UPDATE '.CONFIG_TABLE.' 
    531     SET value="'.$conf['Register_FluxBB'].'" 
    532     WHERE param="Register_FluxBB" 
    533     LIMIT 1 
    534   ;'; 
    535   pwg_query($query); 
    536  
    537   array_push($page['infos'], l10n('Register_FluxBB_save_config')); 
    538 } 
    539  
    540 $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); 
    541  
    542 $template->assign(array( 
     560  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']) ) 
     561  { 
     562    $conf['Register_FluxBB'] = $_POST['FluxBB_prefix'].';'.addslashes($_POST['FluxBB_admin']).';'.addslashes($_POST['FluxBB_guest']).';'.$_POST['FluxBB_del_pt'].';'.$_POST['FluxBB_confirm'].';'.$_POST['FluxBB_details']; 
     563 
     564    $query = ' 
     565UPDATE '.CONFIG_TABLE.' 
     566SET value="'.$conf['Register_FluxBB'].'" 
     567WHERE param="Register_FluxBB" 
     568LIMIT 1 
     569;'; 
     570 
     571    pwg_query($query); 
     572 
     573    array_push($page['infos'], l10n('Register_FluxBB_save_config')); 
     574  } 
     575 
     576  $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); 
     577 
     578  $template->assign(array( 
    543579    'FluxBB_PREFIX'           => $conf_Register_FluxBB[0], 
    544     'FluxBB_ADMIN'            => $conf_Register_FluxBB[1], 
    545     'FluxBB_GUEST'            => $conf_Register_FluxBB[2], 
     580    'FluxBB_ADMIN'            => stripslashes($conf_Register_FluxBB[1]), 
     581    'FluxBB_GUEST'            => stripslashes($conf_Register_FluxBB[2]), 
    546582    'FluxBB_DEL_PT_TRUE'      => (isset($conf_Register_FluxBB[3]) and $conf_Register_FluxBB[3] == 'true') ? 'checked="checked"' : '' , 
    547583    'FluxBB_DEL_PT_FALSE'     => (isset($conf_Register_FluxBB[3]) and $conf_Register_FluxBB[3] == 'false') ? 'checked="checked"' : '' , 
     
    550586    'FluxBB_DETAILS_TRUE'     => (isset($conf_Register_FluxBB[5]) and $conf_Register_FluxBB[5] == 'true') ? 'checked="checked"' : '' , 
    551587    'FluxBB_DETAILS_FALSE'    => (isset($conf_Register_FluxBB[5]) and $conf_Register_FluxBB[5] == 'false') ? 'checked="checked"' : '' , 
    552   ) 
    553 ); 
    554  
    555  
    556 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/manage.tpl'); 
    557 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
     588    ) 
     589  ); 
     590 
     591 
     592  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/manage.tpl'); 
     593  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
    558594 
    559595        break; 
     
    561597        case 'Migration': 
    562598         
    563 if ( isset($_POST['Migration']) and !is_adviser() ) 
    564 { 
    565   array_push($page['infos'], l10n('Register_FluxBB_Mig_Start').'<br/><br/>'); 
    566    
    567    
    568   array_push($page['infos'], l10n('Register_FluxBB_Mig_Del_Link').'<br/><br/>'); 
    569  
    570   $query = "TRUNCATE ".Register_FluxBB_ID_TABLE.";"; 
    571   $result = pwg_query($query); 
    572    
    573    
    574   $msg_Mig_Del_AllUsers = ''; 
    575  
    576   $query = " 
    577     SELECT username, id 
    578     FROM ".FluxBB_USERS_TABLE." 
    579   ;"; 
    580   $result = pwg_query($query); 
    581    
    582   while ($row = mysql_fetch_array($result)) 
    583   { 
    584     if(($row['username'] != $conf_Register_FluxBB[2]) and ($row['username'] != $conf_Register_FluxBB[1]) ) 
    585     { 
    586       $msg_Mig_Del_AllUsers .= '<br/> - '.l10n('Register_FluxBB_Mig_Del_User').$row['username']; 
     599  if ( isset($_POST['Migration']) and !is_adviser() ) 
     600  { 
     601    array_push($page['infos'], l10n('Register_FluxBB_Mig_Start').'<br/><br/>'); 
     602   
     603    array_push($page['infos'], l10n('Register_FluxBB_Mig_Del_Link').'<br/><br/>'); 
     604 
     605    $query = "TRUNCATE ".Register_FluxBB_ID_TABLE.";"; 
     606    $result = pwg_query($query); 
     607   
     608   
     609    $msg_Mig_Del_AllUsers = ''; 
     610 
     611    $query = " 
     612SELECT username, id 
     613FROM ".FluxBB_USERS_TABLE." 
     614;"; 
     615 
     616    $result = pwg_query($query); 
     617   
     618    while ($row = mysql_fetch_array($result)) 
     619    { 
     620      if((stripslashes($row['username']) != stripslashes($conf_Register_FluxBB[2])) and (stripslashes($row['username']) != stripslashes($conf_Register_FluxBB[1]))) 
     621      { 
     622        $msg_Mig_Del_AllUsers .= '<br/> - '.l10n('Register_FluxBB_Mig_Del_User').stripslashes($row['username']); 
    587623         
    588       FluxBB_Deluser($row['id'], false); 
    589     } 
    590   } 
    591  
    592   array_push($page['infos'], l10n('Register_FluxBB_Mig_Del_AllUsers').$msg_Mig_Del_AllUsers.'<br/><br/>'); 
    593  
    594  
    595   $query = " 
    596     SELECT id, username, password, mail_address 
    597     FROM ".USERS_TABLE." 
    598   ;"; 
    599   $result = pwg_query($query); 
    600    
    601   $registred = time(); 
    602   $registred_ip = $_SERVER['REMOTE_ADDR']; 
    603    
    604   $msg_Mig_Add_AllUsers = ''; 
    605    
    606   while ($row = mysql_fetch_array($result)) 
    607   { 
    608     if(($row['username'] != 'guest') and ($row['username'] != $conf_Register_FluxBB[1]) ) 
    609     { 
    610       $msg_Mig_Add_AllUsers .= '<br/> - '.l10n('Register_FluxBB_Mig_Add_User').$row['username']; 
    611  
    612       FluxBB_Adduser($row['id'], $row['username'], $row['password'], $row['mail_address']); 
    613     } 
    614   } 
    615  
    616   array_push($page['infos'], l10n('Register_FluxBB_Mig_Add_AllUsers').$msg_Mig_Add_AllUsers.'<br/><br/>'); 
    617  
    618  
    619   $query = " 
    620     SELECT id, username, password, mail_address 
    621     FROM ".USERS_TABLE." 
    622     WHERE username = '".$conf_Register_FluxBB[1]."' 
    623   ;"; 
    624   $row = mysql_fetch_array(pwg_query($query)); 
    625    
    626   if (!empty($row)) 
    627   { 
    628     array_push($page['infos'], l10n('Register_FluxBB_Sync_User').$row['username'].'<br/><br/>'); 
    629        
    630     FluxBB_Updateuser($row['id'], $row['username'], $row['password'], $row['mail_address']); 
    631   } 
    632  
    633   array_push($page['infos'], l10n('Register_FluxBB_Mig_End')); 
    634 } 
    635 else if ( isset($_POST['Audit'])) 
    636 { 
    637   Audit_PWG_FluxBB(); 
    638 } 
    639  
    640 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/migration.tpl'); 
    641 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
     624        FluxBB_Deluser($row['id'], false); 
     625      } 
     626    } 
     627 
     628    array_push($page['infos'], l10n('Register_FluxBB_Mig_Del_AllUsers').$msg_Mig_Del_AllUsers.'<br/><br/>'); 
     629 
     630 
     631    $query = " 
     632SELECT id, username, password, mail_address 
     633FROM ".USERS_TABLE." 
     634;"; 
     635 
     636    $result = pwg_query($query); 
     637   
     638    $registred = time(); 
     639    $registred_ip = $_SERVER['REMOTE_ADDR']; 
     640   
     641    $msg_Mig_Add_AllUsers = ''; 
     642   
     643    while ($row = mysql_fetch_array($result)) 
     644    { 
     645      if((stripslashes($row['username']) != 'guest') and (stripslashes($row['username']) != stripslashes($conf_Register_FluxBB[1]))) 
     646      { 
     647        $msg_Mig_Add_AllUsers .= '<br/> - '.l10n('Register_FluxBB_Mig_Add_User').stripslashes($row['username']); 
     648 
     649        FluxBB_Adduser($row['id'], stripslashes($row['username']), $row['password'], $row['mail_address']); 
     650      } 
     651    } 
     652 
     653    array_push($page['infos'], l10n('Register_FluxBB_Mig_Add_AllUsers').$msg_Mig_Add_AllUsers.'<br/><br/>'); 
     654 
     655 
     656    $query = " 
     657SELECT id, username, password, mail_address 
     658FROM ".USERS_TABLE." 
     659WHERE username = '".$conf_Register_FluxBB[1]."' 
     660;"; 
     661 
     662    $row = mysql_fetch_array(pwg_query($query)); 
     663 
     664    if (!empty($row)) 
     665    { 
     666      array_push($page['infos'], l10n('Register_FluxBB_Sync_User').stripslashes($row['username']).'<br/><br/>'); 
     667       
     668      FluxBB_Updateuser($row['id'], stripslashes($row['username']), $row['password'], $row['mail_address']); 
     669    } 
     670 
     671    array_push($page['infos'], l10n('Register_FluxBB_Mig_End')); 
     672  } 
     673  else if ( isset($_POST['Audit'])) 
     674  { 
     675    Audit_PWG_FluxBB(); 
     676  } 
     677 
     678  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/migration.tpl'); 
     679  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
    642680 
    643681        break; 
     
    645683        case 'Synchro': 
    646684   
    647 if ( isset($_POST['Synchro']) and !is_adviser() ) 
    648 { 
    649   global $page,$conf, $errors; 
    650  
    651   $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); 
    652  
    653   $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__); 
    654    
    655  
    656  
    657   $msg_error_PWG_Dup = ''; 
    658   $msg_error_FluxBB_Dup = ''; 
    659   $msg_error_Link_Break = ''; 
    660   $msg_error_Link_Bad = ''; 
    661   $msg_error_Synchro = ''; 
    662   $msg_ok_Synchro = ''; 
    663   $msg_error_FluxBB2PWG = ''; 
    664   $msg_error_PWG2FluxBB = ''; 
    665  
    666  
    667  
    668   $query = " 
    669     SELECT COUNT(*) AS nbr_dup, id, username 
    670     FROM ".USERS_TABLE."  
    671     GROUP BY BINARY username 
    672     HAVING COUNT(*) > 1 
    673   ;"; 
    674   $result = pwg_query($query); 
    675    
    676   while($row = mysql_fetch_array($result)) 
    677     $msg_error_PWG_Dup .= '<br/>'.l10n('Register_FluxBB_Error_PWG_Dup').$row['nbr_dup'].' x '.$row['username']; 
    678  
    679   if ($msg_error_PWG_Dup <> '') 
    680     $msg_error_PWG_Dup = l10n('Register_FluxBB_Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Register_FluxBB_Advise_PWG_Dup'); 
    681    
    682  
    683  
    684   $query = " 
    685     SELECT COUNT(*) AS nbr_dup, username 
    686     FROM ".FluxBB_USERS_TABLE."  
    687     GROUP BY BINARY username 
    688     HAVING COUNT(*) > 1 
    689   ;"; 
    690   $result = pwg_query($query); 
    691    
    692   while($row = mysql_fetch_array($result)) 
    693   { 
    694     $msg_error_FluxBB_Dup .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB_Dup').$row['nbr_dup'].' x '.$row['username']; 
    695  
    696     $subquery = " 
    697       SELECT id, username, email 
    698       FROM ".FluxBB_USERS_TABLE."  
    699       WHERE BINARY username = BINARY '".$row['username']."' 
    700     ;"; 
    701     $subresult = pwg_query($subquery); 
    702    
    703     while($subrow = mysql_fetch_array($subresult)) 
    704     { 
    705       $msg_error_FluxBB_Dup .= '<br/>id:'.$subrow['id'].'='.$subrow['username'].' ('.$subrow['email'].')'; 
    706    
    707       if ( !is_adviser() ) 
     685  if ( isset($_POST['Synchro']) and !is_adviser() ) 
     686  { 
     687    global $page,$conf, $errors; 
     688 
     689    $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); 
     690 
     691    $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__); 
     692   
     693 
     694    $msg_error_PWG_Dup = ''; 
     695    $msg_error_FluxBB_Dup = ''; 
     696    $msg_error_Link_Break = ''; 
     697    $msg_error_Link_Bad = ''; 
     698    $msg_error_Synchro = ''; 
     699    $msg_ok_Synchro = ''; 
     700    $msg_error_FluxBB2PWG = ''; 
     701    $msg_error_PWG2FluxBB = ''; 
     702 
     703 
     704    $query = " 
     705SELECT COUNT(*) AS nbr_dup, id, username 
     706FROM ".USERS_TABLE."  
     707GROUP BY BINARY username 
     708HAVING COUNT(*) > 1 
     709;"; 
     710 
     711    $result = pwg_query($query); 
     712   
     713    while($row = mysql_fetch_array($result)) 
     714      $msg_error_PWG_Dup .= '<br/>'.l10n('Register_FluxBB_Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); 
     715 
     716      if ($msg_error_PWG_Dup <> '') 
     717        $msg_error_PWG_Dup = l10n('Register_FluxBB_Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Register_FluxBB_Advise_PWG_Dup'); 
     718   
     719 
     720    $query = " 
     721SELECT COUNT(*) AS nbr_dup, username 
     722FROM ".FluxBB_USERS_TABLE."  
     723GROUP BY BINARY username 
     724HAVING COUNT(*) > 1 
     725;"; 
     726 
     727    $result = pwg_query($query); 
     728   
     729    while($row = mysql_fetch_array($result)) 
     730    { 
     731      $msg_error_FluxBB_Dup .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); 
     732 
     733      $subquery = " 
     734SELECT id, username, email 
     735FROM ".FluxBB_USERS_TABLE."  
     736WHERE BINARY username = BINARY '".$row['username']."' 
     737;"; 
     738 
     739      $subresult = pwg_query($subquery); 
     740   
     741      while($subrow = mysql_fetch_array($subresult)) 
    708742      { 
    709         $msg_error_FluxBB_Dup .= ' <a href="'; 
    710        
    711         $msg_error_FluxBB_Dup .= add_url_params($page_Register_FluxBB_admin, array( 
    712           'action' => 'del_user', 
    713           'id' => $subrow['id'], 
    714         )); 
    715         $msg_error_FluxBB_Dup .= '" title="'.l10n('Register_FluxBB_Del_User').$subrow['username'].'"'; 
    716         $msg_error_FluxBB_Dup .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    717         $msg_error_FluxBB_Dup .= '><img src="'.Register_FluxBB_PATH.'/icon/user_delete.png" alt="'.l10n('Register_FluxBB_Del_User').$subrow['username'].'" /></a>'; 
    718       } 
    719     } 
    720   } 
    721  
    722   if ($msg_error_FluxBB_Dup <> '') 
    723     $msg_error_FluxBB_Dup = l10n('Register_FluxBB_Sync_Check_Dup').$msg_error_FluxBB_Dup.'<br>'.l10n('Register_FluxBB_Advise_FluxBB_Dup'); 
    724  
    725    
    726  
    727   if ($msg_error_FluxBB_Dup == '' and $msg_error_PWG_Dup == '') 
    728   { 
    729     $query = " 
    730       SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail 
    731       FROM ".FluxBB_USERS_TABLE." AS bb, ".USERS_TABLE." as pwg 
    732       WHERE bb.id NOT in ( 
    733         SELECT id_user_FluxBB 
    734         FROM ".Register_FluxBB_ID_TABLE." 
    735       ) 
    736       AND pwg.id NOT in ( 
    737         SELECT id_user_pwg 
    738         FROM ".Register_FluxBB_ID_TABLE." 
    739       ) 
    740       AND pwg.username = bb.username 
    741       AND pwg.mail_address = bb.email 
    742     ;"; 
    743     $result = pwg_query($query); 
    744      
    745     while($row = mysql_fetch_array($result)) 
    746     { 
    747       $msg_error_Link_Break .= '<br/>'.l10n('Register_FluxBB_New_Link').$row['pwg_user'].' ('.$row['pwg_mail'].')'; 
    748    
    749       FluxBB_Linkuser($row['pwg_id'], $row['bb_id']); 
    750     } 
    751    
    752     if ($msg_error_Link_Break == '') 
    753       array_push($page['infos'], l10n('Register_FluxBB_Sync_Link_Break').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
     743        $msg_error_FluxBB_Dup .= '<br/>id:'.$subrow['id'].'='.stripslashes($subrow['username']).' ('.$subrow['email'].')'; 
     744   
     745        if ( !is_adviser() ) 
     746        { 
     747          $msg_error_FluxBB_Dup .= ' <a href="'; 
     748       
     749          $msg_error_FluxBB_Dup .= add_url_params($page_Register_FluxBB_admin, array( 
     750            'action' => 'del_user', 
     751            'id' => $subrow['id'], 
     752          )); 
     753 
     754          $msg_error_FluxBB_Dup .= '" title="'.l10n('Register_FluxBB_Del_User').stripslashes($subrow['username']).'"'; 
     755 
     756          $msg_error_FluxBB_Dup .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
     757 
     758          $msg_error_FluxBB_Dup .= '><img src="'.Register_FluxBB_PATH.'/icon/user_delete.png" alt="'.l10n('Register_FluxBB_Del_User').stripslashes($subrow['username']).'" /></a>'; 
     759        } 
     760      } 
     761    } 
     762 
     763    if ($msg_error_FluxBB_Dup <> '') 
     764      $msg_error_FluxBB_Dup = l10n('Register_FluxBB_Sync_Check_Dup').$msg_error_FluxBB_Dup.'<br>'.l10n('Register_FluxBB_Advise_FluxBB_Dup'); 
     765   
     766 
     767    if ($msg_error_FluxBB_Dup == '' and $msg_error_PWG_Dup == '') 
     768    { 
     769      $query = " 
     770SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail 
     771FROM ".FluxBB_USERS_TABLE." AS bb, ".USERS_TABLE." as pwg 
     772WHERE bb.id NOT in ( 
     773  SELECT id_user_FluxBB 
     774  FROM ".Register_FluxBB_ID_TABLE." 
     775  ) 
     776AND pwg.id NOT in ( 
     777  SELECT id_user_pwg 
     778  FROM ".Register_FluxBB_ID_TABLE." 
     779  ) 
     780AND pwg.username = bb.username 
     781AND pwg.mail_address = bb.email 
     782;"; 
     783 
     784      $result = pwg_query($query); 
     785     
     786      while($row = mysql_fetch_array($result)) 
     787      { 
     788        $msg_error_Link_Break .= '<br/>'.l10n('Register_FluxBB_New_Link').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'; 
     789   
     790        FluxBB_Linkuser($row['pwg_id'], $row['bb_id']); 
     791      } 
     792   
     793      if ($msg_error_Link_Break == '') 
     794        array_push($page['infos'], l10n('Register_FluxBB_Sync_Link_Break').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
     795      else 
     796        $msg_error_Link_Break = l10n('Register_FluxBB_Sync_Link_Break').$msg_error_Link_Break; 
     797   
     798     
     799      $query = " 
     800SELECT 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 
     801FROM ".FluxBB_USERS_TABLE." AS bb  
     802INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
     803INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
     804WHERE BINARY pwg.username <> BINARY bb.username 
     805;"; 
     806 
     807      $result = pwg_query($query); 
     808     
     809      while($row = mysql_fetch_array($result)) 
     810      { 
     811        $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')'; 
     812 
     813        $subquery = " 
     814DELETE FROM ".Register_FluxBB_ID_TABLE." 
     815WHERE id_user_pwg = ".$row['pwg_id']." 
     816AND id_user_FluxBB = ".$row['bb_id']." 
     817;"; 
     818 
     819        $subresult = pwg_query($subquery); 
     820      } 
     821 
     822 
     823      $query = " 
     824SELECT COUNT(*) as nbr_dead 
     825FROM ".Register_FluxBB_ID_TABLE." AS Link 
     826WHERE id_user_FluxBB NOT IN ( 
     827  SELECT id 
     828  FROM ".FluxBB_USERS_TABLE." 
     829  ) 
     830OR id_user_pwg NOT IN ( 
     831  SELECT id 
     832  FROM ".USERS_TABLE." 
     833  ) 
     834;"; 
     835 
     836      $Compteur = mysql_fetch_array(pwg_query($query)); 
     837     
     838      if ( !empty($Compteur) and $Compteur['nbr_dead'] > 0) 
     839      {  
     840        $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Link_Dead').$Compteur['nbr_dead']; 
     841     
     842        $query = " 
     843DELETE FROM ".Register_FluxBB_ID_TABLE." 
     844WHERE id_user_FluxBB NOT IN ( 
     845  SELECT id 
     846  FROM ".FluxBB_USERS_TABLE." 
     847  ) 
     848OR id_user_pwg NOT IN ( 
     849  SELECT id 
     850  FROM ".USERS_TABLE." 
     851  ) 
     852;"; 
     853 
     854        $result = pwg_query($query); 
     855      } 
     856     
     857       
     858      $query = " 
     859SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.id AS bb_id 
     860FROM ".FluxBB_USERS_TABLE." AS bb  
     861INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
     862INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
     863GROUP BY link.id_user_pwg, link.id_user_FluxBB 
     864HAVING COUNT(*) > 1 
     865;"; 
     866 
     867      $result = pwg_query($query); 
     868     
     869      while($row = mysql_fetch_array($result)) 
     870      { 
     871        $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')'; 
     872   
     873        FluxBB_Linkuser($row['pwg_id'], $row['bb_id']); 
     874      } 
     875 
     876      if ($msg_error_Link_Bad == '') 
     877        array_push($page['infos'], l10n('Register_FluxBB_Sync_Link_Bad').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
     878      else 
     879        $msg_error_Link_Bad = l10n('Register_FluxBB_Sync_Link_Bad').$msg_error_Link_Bad; 
     880   
     881     
     882      $query = " 
     883SELECT 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 
     884FROM ".FluxBB_USERS_TABLE." AS FluxBB  
     885INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = FluxBB.id 
     886INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
     887AND BINARY pwg.username = BINARY FluxBB.username 
     888ORDER BY LOWER(pwg.username) 
     889;"; 
     890 
     891      $result = pwg_query($query); 
     892     
     893      while($row = mysql_fetch_array($result)) 
     894      { 
     895        if ( ($row['pwg_pwd'] != $row['bb_pwd']) or ($row['pwg_eml'] != $row['bb_eml']) ) 
     896        { 
     897          $msg_error_Synchro .= '<br/>'.l10n('Register_FluxBB_Sync_User').stripslashes($row['username']); 
     898   
     899          $query = " 
     900SELECT id, username, password, mail_address  
     901FROM ".USERS_TABLE." 
     902WHERE BINARY id = '".$row['pwg_id']."' 
     903;"; 
     904 
     905          $data = mysql_fetch_array(pwg_query($query)); 
     906         
     907          if (!empty($data)) 
     908            FluxBB_Updateuser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']); 
     909        } 
     910      } 
     911   
     912      if ($msg_error_Synchro == '') 
     913        array_push($page['infos'], l10n('Register_FluxBB_Sync_DataUser').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
     914      else 
     915        $msg_error_Synchro = l10n('Register_FluxBB_Sync_DataUser').$msg_error_Synchro; 
     916 
     917   
     918      $query = " 
     919SELECT username, mail_address FROM ".USERS_TABLE." 
     920WHERE BINARY username <> BINARY 'guest' 
     921AND id not in ( 
     922  SELECT id_user_pwg FROM ".Register_FluxBB_ID_TABLE." 
     923  ) 
     924AND BINARY username not in ( 
     925  SELECT username FROM ".FluxBB_USERS_TABLE." 
     926  ) 
     927ORDER BY LOWER(username) 
     928;"; 
     929 
     930      $result = pwg_query($query); 
     931   
     932      while($row = mysql_fetch_array($result)) 
     933      { 
     934        $msg_error_PWG2FluxBB .= '<br/>'.l10n('Register_FluxBB_Add_User').stripslashes($row['username']).' ('.$row['mail_address'].')'; 
     935 
     936        $query = " 
     937SELECT id, username, password, mail_address  
     938FROM ".USERS_TABLE." 
     939WHERE BINARY username = BINARY '".$row['username']."' 
     940LIMIT 1 
     941;"; 
     942 
     943        $data = mysql_fetch_array(pwg_query($query)); 
     944       
     945        if (!empty($data)) 
     946          FluxBB_Adduser($data['id'], stripslashes($data['username']), $data['password'], $data['mail_address']);   
     947      } 
     948   
     949      if ($msg_error_PWG2FluxBB == '') 
     950        array_push($page['infos'], l10n('Register_FluxBB_Sync_PWG2FluxBB').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
     951      else 
     952        $msg_error_PWG2FluxBB = l10n('Register_FluxBB_Sync_PWG2FluxBB').$msg_error_PWG2FluxBB; 
     953     
     954   
     955      $query = " 
     956SELECT id, username, email FROM ".FluxBB_USERS_TABLE." 
     957WHERE BINARY username <> BINARY '".$conf_Register_FluxBB[2]."' 
     958AND id not in ( 
     959  SELECT id_user_FluxBB FROM ".Register_FluxBB_ID_TABLE." 
     960  ) 
     961AND BINARY username not in ( 
     962  SELECT username FROM ".USERS_TABLE." 
     963  ) 
     964ORDER BY LOWER(username) 
     965;"; 
     966 
     967      $result = pwg_query($query); 
     968   
     969      while($row = mysql_fetch_array($result)) 
     970      { 
     971        $msg_error_FluxBB2PWG .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')'; 
     972   
     973        if ( !is_adviser() ) 
     974        { 
     975          $msg_error_FluxBB2PWG .= ' <a href="'; 
     976       
     977          $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( 
     978            'action' => 'del_user', 
     979            'id' => $row['id'], 
     980          )); 
     981 
     982          $msg_error_FluxBB2PWG .= '" title="'.l10n('Register_FluxBB_Del_User').stripslashes($row['username']).'"'; 
     983 
     984          $msg_error_FluxBB2PWG .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
     985 
     986          $msg_error_FluxBB2PWG .= '><img src="'.Register_FluxBB_PATH.'/icon/user_delete.png" alt="'.l10n('Register_FluxBB_Del_User').stripslashes($row['username']).'" /></a>'; 
     987        } 
     988      } 
     989   
     990      if ($msg_error_FluxBB2PWG == '') 
     991        array_push($page['infos'], l10n('Register_FluxBB_Sync_FluxBB2PWG').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
     992      else 
     993        $msg_error_FluxBB2PWG = l10n('Register_FluxBB_Sync_FluxBB2PWG').$msg_error_FluxBB2PWG; 
     994    } 
    754995    else 
    755       $msg_error_Link_Break = l10n('Register_FluxBB_Sync_Link_Break').$msg_error_Link_Break; 
    756  
    757    
    758      
    759     $query = " 
    760       SELECT 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 
    761       FROM ".FluxBB_USERS_TABLE." AS bb  
    762       INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
    763         INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
    764       WHERE BINARY pwg.username <> BINARY bb.username 
    765     ;"; 
    766     $result = pwg_query($query); 
    767      
    768     while($row = mysql_fetch_array($result)) 
    769     { 
    770       $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Link_Del').$row['pwg_user'].' ('.$row['pwg_mail'].')'.' -- '.$row['bb_user'].' ('.$row['bb_mail'].')'; 
    771  
    772       $subquery = " 
    773                 DELETE FROM ".Register_FluxBB_ID_TABLE." 
    774                 WHERE id_user_pwg = ".$row['pwg_id']." 
    775                 AND id_user_FluxBB = ".$row['bb_id']." 
    776       ;"; 
    777       $subresult = pwg_query($subquery); 
    778     } 
    779  
    780  
    781     $query = " 
    782       SELECT COUNT(*) as nbr_dead 
    783       FROM ".Register_FluxBB_ID_TABLE." AS Link 
    784       WHERE id_user_FluxBB NOT IN ( 
    785         SELECT id 
    786         FROM ".FluxBB_USERS_TABLE." 
    787       ) 
    788       OR id_user_pwg NOT IN ( 
    789         SELECT id 
    790         FROM ".USERS_TABLE." 
    791       ) 
    792     ;"; 
    793     $Compteur = mysql_fetch_array(pwg_query($query)); 
    794      
    795     if ( !empty($Compteur) and $Compteur['nbr_dead'] > 0) 
    796     {  
    797       $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Link_Dead').$Compteur['nbr_dead']; 
    798      
    799       $query = " 
    800                 DELETE FROM ".Register_FluxBB_ID_TABLE." 
    801         WHERE id_user_FluxBB NOT IN ( 
    802           SELECT id 
    803           FROM ".FluxBB_USERS_TABLE." 
    804         ) 
    805         OR id_user_pwg NOT IN ( 
    806           SELECT id 
    807           FROM ".USERS_TABLE." 
    808         ) 
    809       ;"; 
    810       $result = pwg_query($query); 
    811     } 
    812      
    813        
    814     $query = " 
    815       SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.id AS bb_id 
    816       FROM ".FluxBB_USERS_TABLE." AS bb  
    817       INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = bb.id 
    818         INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
    819       GROUP BY link.id_user_pwg, link.id_user_FluxBB 
    820       HAVING COUNT(*) > 1 
    821     ;"; 
    822     $result = pwg_query($query); 
    823      
    824     while($row = mysql_fetch_array($result)) 
    825     { 
    826       $msg_error_Link_Bad .= '<br/>'.l10n('Register_FluxBB_Link_Dup').$row['nbr_dup'].' = '.$row['pwg_user'].' -- '.$row['bb_user'].')'; 
    827    
    828       FluxBB_Linkuser($row['pwg_id'], $row['bb_id']); 
    829     } 
    830  
    831     if ($msg_error_Link_Bad == '') 
    832       array_push($page['infos'], l10n('Register_FluxBB_Sync_Link_Bad').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
    833     else 
    834       $msg_error_Link_Bad = l10n('Register_FluxBB_Sync_Link_Bad').$msg_error_Link_Bad; 
    835        
    836    
    837      
    838     $query = " 
    839       SELECT 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 
    840       FROM ".FluxBB_USERS_TABLE." AS FluxBB  
    841       INNER JOIN ".Register_FluxBB_ID_TABLE." AS link ON link.id_user_FluxBB = FluxBB.id 
    842         INNER JOIN ".USERS_TABLE." as pwg ON link.id_user_pwg = pwg.id 
    843         AND BINARY pwg.username = BINARY FluxBB.username 
    844         ORDER BY LOWER(pwg.username) 
    845     ;"; 
    846     $result = pwg_query($query); 
    847      
    848     while($row = mysql_fetch_array($result)) 
    849     { 
    850       if ( ($row['pwg_pwd'] != $row['bb_pwd']) or ($row['pwg_eml'] != $row['bb_eml']) ) 
    851       { 
    852         $msg_error_Synchro .= '<br/>'.l10n('Register_FluxBB_Sync_User').$row['username']; 
    853    
    854         $query = " 
    855           SELECT id, username, password, mail_address  
    856                 FROM ".USERS_TABLE." 
    857                 WHERE BINARY id = '".$row['pwg_id']."' 
    858         ;"; 
    859         $data = mysql_fetch_array(pwg_query($query)); 
    860          
    861         if (!empty($data)) 
    862           FluxBB_Updateuser($data['id'], $data['username'], $data['password'], $data['mail_address']); 
    863       } 
    864     } 
    865    
    866     if ($msg_error_Synchro == '') 
    867       array_push($page['infos'], l10n('Register_FluxBB_Sync_DataUser').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
    868     else 
    869       $msg_error_Synchro = l10n('Register_FluxBB_Sync_DataUser').$msg_error_Synchro; 
    870  
    871    
    872    
    873     $query = " 
    874       SELECT username, mail_address FROM ".USERS_TABLE." 
    875       WHERE BINARY username <> BINARY 'guest' 
    876       AND id not in ( 
    877         SELECT id_user_pwg FROM ".Register_FluxBB_ID_TABLE." 
    878       ) 
    879       AND BINARY username not in ( 
    880         SELECT username FROM ".FluxBB_USERS_TABLE." 
    881       ) 
    882         ORDER BY LOWER(username) 
    883     ;"; 
    884     $result = pwg_query($query); 
    885    
    886     while($row = mysql_fetch_array($result)) 
    887     { 
    888       $msg_error_PWG2FluxBB .= '<br/>'.l10n('Register_FluxBB_Add_User').$row['username'].' ('.$row['mail_address'].')'; 
    889  
    890       $query = " 
    891         SELECT id, username, password, mail_address  
    892         FROM ".USERS_TABLE." 
    893         WHERE BINARY username = BINARY '".$row['username']."' 
    894         LIMIT 1 
    895       ;"; 
    896       $data = mysql_fetch_array(pwg_query($query)); 
    897        
    898       if (!empty($data)) 
    899         FluxBB_Adduser($data['id'], $data['username'], $data['password'], $data['mail_address']);   
    900     } 
    901    
    902     if ($msg_error_PWG2FluxBB == '') 
    903       array_push($page['infos'], l10n('Register_FluxBB_Sync_PWG2FluxBB').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
    904     else 
    905       $msg_error_PWG2FluxBB = l10n('Register_FluxBB_Sync_PWG2FluxBB').$msg_error_PWG2FluxBB; 
    906    
    907      
    908    
    909     $query = " 
    910       SELECT id, username, email FROM ".FluxBB_USERS_TABLE." 
    911       WHERE BINARY username <> BINARY '".$conf_Register_FluxBB[2]."' 
    912       AND id not in ( 
    913         SELECT id_user_FluxBB FROM ".Register_FluxBB_ID_TABLE." 
    914       ) 
    915       AND BINARY username not in ( 
    916         SELECT username FROM ".USERS_TABLE." 
    917       ) 
    918         ORDER BY LOWER(username) 
    919     ;"; 
    920     $result = pwg_query($query); 
    921    
    922     while($row = mysql_fetch_array($result)) 
    923     { 
    924       $msg_error_FluxBB2PWG .= '<br/>'.l10n('Register_FluxBB_Error_FluxBB2PWG').$row['username'].' ('.$row['email'].')'; 
    925    
    926       if ( !is_adviser() ) 
    927       { 
    928         $msg_error_FluxBB2PWG .= ' <a href="'; 
    929        
    930         $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( 
    931           'action' => 'del_user', 
    932           'id' => $row['id'], 
    933         )); 
    934         $msg_error_FluxBB2PWG .= '" title="'.l10n('Register_FluxBB_Del_User').$row['username'].'"'; 
    935         $msg_error_FluxBB2PWG .= $conf_Register_FluxBB[4]=='false' ?  ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 
    936         $msg_error_FluxBB2PWG .= '><img src="'.Register_FluxBB_PATH.'/icon/user_delete.png" alt="'.l10n('Register_FluxBB_Del_User').$row['username'].'" /></a>'; 
    937       } 
    938     } 
    939    
    940     if ($msg_error_FluxBB2PWG == '') 
    941       array_push($page['infos'], l10n('Register_FluxBB_Sync_FluxBB2PWG').'<br/>'.l10n('Register_FluxBB_Sync_OK')); 
    942     else 
    943       $msg_error_FluxBB2PWG = l10n('Register_FluxBB_Sync_FluxBB2PWG').$msg_error_FluxBB2PWG; 
    944   } 
    945   else 
    946     $errors[] = l10n('Register_FluxBB_Advise_Check_Dup'); 
    947  
    948  
    949  
    950   if ($msg_error_PWG_Dup <> '') 
    951     $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/>' ); 
    952    
    953   if ($msg_error_FluxBB_Dup <> '') 
    954     $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/>' ); 
    955  
    956   if ($msg_error_Link_Break <> '') 
    957     $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
    958  
    959   if ($msg_error_Link_Bad <> '') 
    960     $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
    961  
    962   if ($msg_error_Synchro <> '') 
    963     $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
    964  
    965   if ($msg_error_PWG2FluxBB <> '') 
    966     $errors[] = $msg_error_PWG2FluxBB . ( ($msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
    967  
    968   if ($msg_error_FluxBB2PWG <> '') 
    969     $errors[] = $msg_error_FluxBB2PWG; 
    970 } 
    971 else if ( isset($_POST['Audit'])) 
    972 { 
    973   Audit_PWG_FluxBB(); 
    974 } 
    975  
    976 $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/synchro.tpl'); 
    977 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');      
     996      $errors[] = l10n('Register_FluxBB_Advise_Check_Dup'); 
     997 
     998 
     999    if ($msg_error_PWG_Dup <> '') 
     1000      $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/>' ); 
     1001   
     1002    if ($msg_error_FluxBB_Dup <> '') 
     1003      $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/>' ); 
     1004 
     1005    if ($msg_error_Link_Break <> '') 
     1006      $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
     1007 
     1008    if ($msg_error_Link_Bad <> '') 
     1009      $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
     1010 
     1011    if ($msg_error_Synchro <> '') 
     1012      $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
     1013 
     1014    if ($msg_error_PWG2FluxBB <> '') 
     1015      $errors[] = $msg_error_PWG2FluxBB . ( ($msg_error_FluxBB2PWG == '') ? '' : '<br/><br/>' ); 
     1016 
     1017    if ($msg_error_FluxBB2PWG <> '') 
     1018      $errors[] = $msg_error_FluxBB2PWG; 
     1019  } 
     1020  else if ( isset($_POST['Audit'])) 
     1021  { 
     1022    Audit_PWG_FluxBB(); 
     1023  } 
     1024 
     1025  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/synchro.tpl'); 
     1026  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');    
    9781027 
    9791028        break; 
    9801029} 
    981  
    9821030?> 
  • extensions/Register_FluxBB/branches/2.1/admin/manage.tpl

    r3780 r4288  
    66</div> 
    77 
    8 <br/> 
     8<br> 
    99 
    1010<form method="post" action={$FluxBB_F_ACTION}> 
     
    1313    <div align="left">{'Register_FluxBB_Config_Disclaimer'|@translate}</div> 
    1414    <ul> 
    15         <li><label>{'Register_FluxBB_Prefix'|@translate}</label><br/> 
    16                 <input type="text" name="FluxBB_prefix" size="20" style="text-align: center;" value={$FluxBB_PREFIX} /><br/> 
     15        <li><label>{'Register_FluxBB_Prefix'|@translate}</label><br> 
     16                <input type="text" name="FluxBB_prefix" size="20" style="text-align: center;" value={$FluxBB_PREFIX}><br> 
    1717        </li> 
    18       <br/> 
    19         <li><label>{'Register_FluxBB_Admin'|@translate}</label><br/> 
    20                 <input type="text" name="FluxBB_admin" value={$FluxBB_ADMIN} size="20" style="text-align: center;"/><br/> 
    21                 <label>{'Register_FluxBB_User'|@translate}</label><br/> 
     18      <br> 
     19        <li><label>{'Register_FluxBB_Admin'|@translate}</label><br> 
     20                <input type="text" name="FluxBB_admin" value={$FluxBB_ADMIN} size="20" style="text-align: center;"><br> 
     21                <label>{'Register_FluxBB_User'|@translate}</label><br> 
    2222        </li> 
    23       <br/> 
    24         <li><label>{'Register_FluxBB_Guest'|@translate}</label><br/> 
    25                 <input type="text" name="FluxBB_guest" value={$FluxBB_GUEST} size="20" style="text-align: center;"/><br/> 
     23      <br> 
     24        <li><label>{'Register_FluxBB_Guest'|@translate}</label><br> 
     25                <input type="text" name="FluxBB_guest" value={$FluxBB_GUEST} size="20" style="text-align: center;"><br> 
    2626        </li> 
    27       <br/> 
    28         <li><label>{'Register_FluxBB_Del_Pt'|@translate}</label><br/> 
    29         <input type="radio" value="true" {$FluxBB_DEL_PT_TRUE} name="FluxBB_del_pt"/>{'Register_FluxBB_Del_Pt_true'|@translate}<br/> 
    30         <input type="radio" value="false" {$FluxBB_DEL_PT_FALSE} name="FluxBB_del_pt"/>{'Register_FluxBB_Del_Pt_false'|@translate}<br/> 
     27      <br> 
     28        <li><label>{'Register_FluxBB_Del_Pt'|@translate}</label><br> 
     29        <input type="radio" value="true" {$FluxBB_DEL_PT_TRUE} name="FluxBB_del_pt">{'Register_FluxBB_Del_Pt_true'|@translate}<br> 
     30        <input type="radio" value="false" {$FluxBB_DEL_PT_FALSE} name="FluxBB_del_pt">{'Register_FluxBB_Del_Pt_false'|@translate}<br> 
    3131        </li> 
    32       <br/> 
    33         <li><label>{'Register_FluxBB_Confirm'|@translate}</label><br/> 
    34         <input type="radio" value="true" {$FluxBB_CONFIRM_TRUE} name="FluxBB_confirm"/>{'Register_FluxBB_Confirm_true'|@translate}<br/> 
    35         <input type="radio" value="false" {$FluxBB_CONFIRM_FALSE} name="FluxBB_confirm"/>{'Register_FluxBB_Confirm_false'|@translate}<br/> 
     32      <br> 
     33        <li><label>{'Register_FluxBB_Confirm'|@translate}</label><br> 
     34        <input type="radio" value="true" {$FluxBB_CONFIRM_TRUE} name="FluxBB_confirm">{'Register_FluxBB_Confirm_true'|@translate}<br> 
     35        <input type="radio" value="false" {$FluxBB_CONFIRM_FALSE} name="FluxBB_confirm">{'Register_FluxBB_Confirm_false'|@translate}<br> 
    3636        </li> 
    37       <br/> 
    38         <li><label>{'Register_FluxBB_Details'|@translate}</label><br/> 
    39         <input type="radio" value="true" {$FluxBB_DETAILS_TRUE} name="FluxBB_details"/>{'Register_FluxBB_Details_true'|@translate}<br/> 
    40         <input type="radio" value="false" {$FluxBB_DETAILS_FALSE} name="FluxBB_details"/>{'Register_FluxBB_Details_false'|@translate}<br/> 
     37      <br> 
     38        <li><label>{'Register_FluxBB_Details'|@translate}</label><br> 
     39        <input type="radio" value="true" {$FluxBB_DETAILS_TRUE} name="FluxBB_details">{'Register_FluxBB_Details_true'|@translate}<br> 
     40        <input type="radio" value="false" {$FluxBB_DETAILS_FALSE} name="FluxBB_details">{'Register_FluxBB_Details_false'|@translate}<br> 
    4141        </li> 
    4242    </ul> 
    43     <br/> 
     43    <br> 
    4444        {'Register_FluxBB_No_Reg_advise'|@translate} 
    45     <br/> 
    46         <div align="center"><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED}/></div> 
     45    <br> 
     46        <div align="center"><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED}></div> 
    4747  </fieldset> 
    4848</form> 
  • extensions/Register_FluxBB/branches/2.1/admin/migration.tpl

    r3780 r4288  
    66</div> 
    77 
    8 <br/> 
     8<br> 
    99 
    1010<form method="post" action={$FluxBB_F_ACTION}> 
     
    1212        <legend>{'Register_FluxBB_Mig_Title'|@translate}</legend> 
    1313        <div align="left">{'Register_FluxBB_Mig_Text'|@translate}</div> 
    14     <br/> 
    15         <div align="center"><input onclick="return confirm('{'Are you sure?'|@translate}');" class="submit" type="submit" value="{'Register_FluxBB_Mig_Btn'|@translate}" name="Migration" {$TAG_INPUT_ENABLED} /></div> 
    16     <br/> 
     14    <br> 
     15        <div align="center"><input onclick="return confirm('{'Are you sure?'|@translate}');" class="submit" type="submit" value="{'Register_FluxBB_Mig_Btn'|@translate}" name="Migration" {$TAG_INPUT_ENABLED}></div> 
     16    <br> 
    1717        <div align="center">{'Register_FluxBB_Mig_Disclaimer'|@translate}</div> 
    1818  </fieldset> 
  • extensions/Register_FluxBB/branches/2.1/admin/synchro.tpl

    r3780 r4288  
    66</div> 
    77 
    8 <br/> 
     8<br> 
    99 
    1010<form method="post" action={$FluxBB_F_ACTION}> 
     
    1212        <legend>{'Register_FluxBB_Sync_Title'|@translate}</legend> 
    1313        <div align="left">{'Register_FluxBB_Sync_Text'|@translate}</div> 
    14     <br/> 
    15         <p><input {$FluxBB_CONFIRM_ENABLE} class="submit" type="submit" value="{'Register_FluxBB_Audit_Btn'|@translate}" name="Audit" /> <input onclick="return confirm('{'Are you sure?'|@translate}');" {$FluxBB_CONFIRM_ENABLE} class="submit" type="submit" value="{'Register_FluxBB_Sync_Btn'|@translate}" name="Synchro" {$TAG_INPUT_ENABLED} /></p> 
     14    <br> 
     15        <p><input {$FluxBB_CONFIRM_ENABLE} class="submit" type="submit" value="{'Register_FluxBB_Audit_Btn'|@translate}" name="Audit"> <input onclick="return confirm('{'Are you sure?'|@translate}');" {$FluxBB_CONFIRM_ENABLE} class="submit" type="submit" value="{'Register_FluxBB_Sync_Btn'|@translate}" name="Synchro" {$TAG_INPUT_ENABLED}></p> 
    1616  </fieldset> 
    1717</form> 
  • extensions/Register_FluxBB/branches/2.1/include/constants.php

    r3780 r4288  
    1515  define('FluxBB_SUBSCRIPTIONS_TABLE', $conf_Register_FluxBB[0].'subscriptions'); 
    1616} 
    17  
    1817?> 
  • extensions/Register_FluxBB/branches/2.1/include/functions_Register_FluxBB.inc.php

    r3780 r4288  
    33function FluxBB_Linkuser($pwg_id, $bb_id) 
    44{ 
    5         include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
    6         include_once (Register_FluxBB_PATH.'include/constants.php'); 
    7  
    8   $query = " 
    9     SELECT pwg.id as pwg_id, bb.id as bb_id 
    10         FROM ".USERS_TABLE." pwg, ".FluxBB_USERS_TABLE." bb 
    11         WHERE pwg.id = ".$pwg_id." 
    12         AND bb.id = ".$bb_id." 
    13         AND pwg.username = bb.username 
    14   ;"; 
     5  include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
     6  include_once (Register_FluxBB_PATH.'include/constants.php'); 
     7 
     8  $query = " 
     9SELECT pwg.id as pwg_id, bb.id as bb_id 
     10FROM ".USERS_TABLE." pwg, ".FluxBB_USERS_TABLE." bb 
     11WHERE pwg.id = ".$pwg_id." 
     12AND bb.id = ".$bb_id." 
     13AND pwg.username = bb.username 
     14;"; 
     15   
    1516  $data = mysql_fetch_array(pwg_query($query)); 
    1617   
     
    1819  { 
    1920    $subquery = " 
    20       DELETE FROM ".Register_FluxBB_ID_TABLE." 
    21       WHERE id_user_pwg = '".$pwg_id."' 
    22       OR id_user_FluxBB = '".$bb_id."' 
    23     ;"; 
    24     $subresult = pwg_query($subquery); 
    25  
    26     $subquery = " 
    27       INSERT INTO ".Register_FluxBB_ID_TABLE." 
    28       (id_user_pwg, id_user_FluxBB) 
    29       VALUES (".$pwg_id.", ".$bb_id.") 
    30     ;"; 
     21DELETE FROM ".Register_FluxBB_ID_TABLE." 
     22WHERE id_user_pwg = '".$pwg_id."' 
     23OR id_user_FluxBB = '".$bb_id."' 
     24;"; 
     25 
     26    $subresult = pwg_query($subquery); 
     27 
     28    $subquery = " 
     29INSERT INTO ".Register_FluxBB_ID_TABLE." 
     30  (id_user_pwg, id_user_FluxBB) 
     31VALUES (".$pwg_id.", ".$bb_id.") 
     32;"; 
     33 
    3134    $subresult = pwg_query($subquery); 
    3235  } 
     
    3740function FluxBB_Unlinkuser($bb_id) 
    3841{ 
    39         include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
    40         include_once (Register_FluxBB_PATH.'include/constants.php'); 
    41  
    42   $query = " 
    43                 DELETE FROM ".Register_FluxBB_ID_TABLE." 
    44                 WHERE id_user_FluxBB = ".$bb_id." 
    45   ;"; 
     42  include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
     43  include_once (Register_FluxBB_PATH.'include/constants.php'); 
     44 
     45  $query = " 
     46DELETE FROM ".Register_FluxBB_ID_TABLE." 
     47WHERE id_user_FluxBB = ".$bb_id." 
     48;"; 
     49 
    4650  $result = pwg_query($query); 
    4751} 
     
    5155function FluxBB_Adduser($pwg_id, $login, $password, $adresse_mail) 
    5256{ 
    53         include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
    54         include_once (Register_FluxBB_PATH.'include/constants.php'); 
     57  include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
     58  include_once (Register_FluxBB_PATH.'include/constants.php'); 
    5559 
    5660  global $conf; 
     
    6266 
    6367  $query = " 
    64     SELECT conf_value 
    65     FROM ".FluxBB_CONFIG_TABLE." 
    66     WHERE conf_name = 'o_default_user_group' 
    67   ;"; 
     68SELECT conf_value 
     69FROM ".FluxBB_CONFIG_TABLE." 
     70WHERE conf_name = 'o_default_user_group' 
     71;"; 
     72 
    6873  $o_default_user_group = mysql_fetch_array(pwg_query($query)); 
    6974   
    7075  $query = " 
    71     SELECT conf_value 
    72     FROM ".FluxBB_CONFIG_TABLE." 
    73     WHERE conf_name = 'o_server_timezone' 
    74   ;"; 
     76SELECT conf_value 
     77FROM ".FluxBB_CONFIG_TABLE." 
     78WHERE conf_name = 'o_server_timezone' 
     79;"; 
     80 
    7581  $o_server_timezone = mysql_fetch_array(pwg_query($query)); 
    7682   
    7783  $query = " 
    78     SELECT conf_value 
    79     FROM ".FluxBB_CONFIG_TABLE." 
    80     WHERE conf_name = 'o_default_lang' 
    81   ;"; 
     84SELECT conf_value 
     85FROM ".FluxBB_CONFIG_TABLE." 
     86WHERE conf_name = 'o_default_lang' 
     87;"; 
     88 
    8289  $o_default_lang = mysql_fetch_array(pwg_query($query)); 
    8390   
    8491  $query = " 
    85     SELECT conf_value 
    86     FROM ".FluxBB_CONFIG_TABLE." 
    87     WHERE conf_name = 'o_default_style' 
    88   ;"; 
     92SELECT conf_value 
     93FROM ".FluxBB_CONFIG_TABLE." 
     94WHERE conf_name = 'o_default_style' 
     95;"; 
     96 
    8997  $o_default_style = mysql_fetch_array(pwg_query($query)); 
    9098   
    91         $query = ' 
    92         INSERT INTO '.FluxBB_USERS_TABLE." ( 
    93       username,  
    94       ". ( isset($o_default_user_group['conf_value']) ? 'group_id' : '' ) .", 
    95       password,  
    96       email,  
    97       ". ( isset($o_server_timezone['conf_value']) ? 'timezone' : '' ) .", 
    98       ". ( isset($o_default_lang['conf_value']) ? 'language' : '' ) .", 
    99       ". ( isset($o_default_style['conf_value']) ? 'style' : '' ) .", 
    100       registered,  
    101       registration_ip,  
    102       last_visit 
    103     ) 
    104         VALUES( 
    105             '".$login."', 
    106       ". ( isset($o_default_user_group['conf_value']) ? "'".$o_default_user_group['conf_value']."'" : '' ) .", 
    107         '".$password."',  
    108             '".$adresse_mail."', 
    109       ". ( isset($o_server_timezone['conf_value']) ? "'".$o_server_timezone['conf_value']."'" : '' ) .", 
    110       ". ( isset($o_default_lang['conf_value']) ? "'".$o_default_lang['conf_value']."'" : '' ) .", 
    111       ". ( isset($o_default_style['conf_value']) ? "'".$o_default_style['conf_value']."'" : '' ) .", 
    112       '".$registred."', 
    113       '".$registred_ip."', 
    114       '".$registred."' 
    115     ) 
    116   ;"; 
    117         $result = pwg_query($query); 
     99  $query = ' 
     100INSERT INTO '.FluxBB_USERS_TABLE." ( 
     101  username,  
     102  ". ( isset($o_default_user_group['conf_value']) ? 'group_id' : '' ) .", 
     103  password,  
     104  email,  
     105  ". ( isset($o_server_timezone['conf_value']) ? 'timezone' : '' ) .", 
     106  ". ( isset($o_default_lang['conf_value']) ? 'language' : '' ) .", 
     107  ". ( isset($o_default_style['conf_value']) ? 'style' : '' ) .", 
     108  registered,  
     109  registration_ip,  
     110  last_visit 
     111  ) 
     112VALUES( 
     113  '".mysql_real_escape_string($login)."', 
     114  ". ( isset($o_default_user_group['conf_value']) ? "'".$o_default_user_group['conf_value']."'" : '' ) .", 
     115  '".$password."',  
     116        '".$adresse_mail."', 
     117  ". ( isset($o_server_timezone['conf_value']) ? "'".$o_server_timezone['conf_value']."'" : '' ) .", 
     118  ". ( isset($o_default_lang['conf_value']) ? "'".$o_default_lang['conf_value']."'" : '' ) .", 
     119  ". ( isset($o_default_style['conf_value']) ? "'".$o_default_style['conf_value']."'" : '' ) .", 
     120  '".$registred."', 
     121  '".$registred_ip."', 
     122  '".$registred."' 
     123  ) 
     124;"; 
     125 
     126  $result = pwg_query($query); 
    118127 
    119128  $bb_id = mysql_insert_id(); 
     
    126135function FluxBB_Searchuser($id_user_pwg) 
    127136{ 
    128         include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
    129         include_once (Register_FluxBB_PATH.'include/constants.php'); 
    130  
    131   $query = " 
    132     SELECT id_user_FluxBB, id_user_pwg FROM ".Register_FluxBB_ID_TABLE." 
    133     WHERE id_user_pwg = ".$id_user_pwg." 
    134     LIMIT 1 
    135   ;"; 
     137  include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
     138  include_once (Register_FluxBB_PATH.'include/constants.php'); 
     139 
     140  $query = " 
     141SELECT id_user_FluxBB, id_user_pwg FROM ".Register_FluxBB_ID_TABLE." 
     142WHERE id_user_pwg = ".$id_user_pwg." 
     143LIMIT 1 
     144;"; 
     145 
    136146  $data = mysql_fetch_array(pwg_query($query)); 
    137147   
     
    140150  else 
    141151    return '0';   
    142  
    143152} 
    144153 
     
    147156function FluxBB_Deluser($id_user_FluxBB, $SuppTopicsPosts) 
    148157{ 
    149         include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
    150         include_once (Register_FluxBB_PATH.'include/constants.php'); 
     158  include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
     159  include_once (Register_FluxBB_PATH.'include/constants.php'); 
    151160 
    152161  global $conf; 
     
    155164 
    156165  $query0 = " 
    157                 SELECT username, id FROM ".FluxBB_USERS_TABLE." 
    158                 WHERE id = ".$id_user_FluxBB." 
    159     LIMIT 1 
    160   ;"; 
     166SELECT username, id FROM ".FluxBB_USERS_TABLE." 
     167WHERE id = ".$id_user_FluxBB." 
     168LIMIT 1 
     169;"; 
     170 
    161171  $data0 = mysql_fetch_array(pwg_query($query0)); 
    162172 
     
    166176    // Suppression des posts de cet utilisateur 
    167177    $subquery = " 
    168                         DELETE FROM ".FluxBB_POSTS_TABLE." 
    169                         WHERE poster_id = ".$id_user_FluxBB." 
    170                 ;"; 
     178DELETE FROM ".FluxBB_POSTS_TABLE." 
     179WHERE poster_id = ".$id_user_FluxBB." 
     180;"; 
     181 
    171182    $subresult = pwg_query($subquery); 
    172183 
    173184    // Suppression des topics de cet utilisateur 
    174185    $subquery = " 
    175                         DELETE FROM ".FluxBB_TOPICS_TABLE." 
    176                         WHERE BINARY poster = BINARY '".$data0['username']."' 
    177                 ;"; 
     186DELETE FROM ".FluxBB_TOPICS_TABLE." 
     187WHERE BINARY poster = BINARY '".mysql_real_escape_string($data0['username'])."' 
     188;"; 
     189 
    178190    $subresult = pwg_query($subquery); 
    179191  } 
     
    181193  // Suppression des abonnements de l'utilisateur 
    182194  $subquery = " 
    183     DELETE FROM ".FluxBB_SUBSCRIPTIONS_TABLE." 
    184                 WHERE user_id = ".$id_user_FluxBB." 
    185         ;"; 
     195DELETE FROM ".FluxBB_SUBSCRIPTIONS_TABLE." 
     196WHERE user_id = ".$id_user_FluxBB." 
     197;"; 
     198 
    186199  $subresult = pwg_query($subquery); 
    187200   
    188201  // Suppression du compte utilisateur 
    189202  $subquery = " 
    190         DELETE FROM ".FluxBB_USERS_TABLE." 
    191                 WHERE id = ".$id_user_FluxBB." 
    192         ;"; 
     203DELETE FROM ".FluxBB_USERS_TABLE." 
     204WHERE id = ".$id_user_FluxBB." 
     205;"; 
     206 
    193207  $subresult = pwg_query($subquery); 
    194208 
     
    200214function FluxBB_Updateuser($pwg_id, $username, $password, $adresse_mail) 
    201215{ 
    202         include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
    203         include_once (Register_FluxBB_PATH.'include/constants.php'); 
    204         include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); 
    205  
    206   $query = " 
    207     SELECT id_user_FluxBB as FluxBB_id 
    208     FROM ".Register_FluxBB_ID_TABLE." 
    209     WHERE id_user_pwg = ".$pwg_id." 
    210   ;"; 
     216  include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 
     217  include_once (Register_FluxBB_PATH.'include/constants.php'); 
     218  include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); 
     219 
     220  $query = " 
     221SELECT id_user_FluxBB as FluxBB_id 
     222FROM ".Register_FluxBB_ID_TABLE." 
     223WHERE id_user_pwg = ".$pwg_id." 
     224;"; 
     225 
    211226  $row = mysql_fetch_array(pwg_query($query)); 
    212227 
     
    214229  { 
    215230    $query = " 
    216       UPDATE ".FluxBB_USERS_TABLE." 
    217       SET username = '".$username."', email = '".$adresse_mail."', password = '".$password."'  
    218       WHERE id = ".$row['FluxBB_id']." 
    219     ;"; 
    220      
     231UPDATE ".FluxBB_USERS_TABLE." 
     232SET username = '".mysql_real_escape_string($username)."', email = '".$adresse_mail."', password = '".$password."'  
     233WHERE id = ".$row['FluxBB_id']." 
     234;"; 
     235    
    221236    $result = pwg_query($query); 
    222237       
     
    226241  { 
    227242    $query = " 
    228       SELECT id as FluxBB_id 
    229       FROM ".FluxBB_USERS_TABLE." 
    230       WHERE BINARY username = BINARY '".$username."' 
    231     ;"; 
     243SELECT id as FluxBB_id 
     244FROM ".FluxBB_USERS_TABLE." 
     245WHERE BINARY username = BINARY '".mysql_real_escape_string($username)."' 
     246;"; 
     247 
    232248    $row = mysql_fetch_array(pwg_query($query)); 
    233249   
     
    235251    { 
    236252      $query = " 
    237         UPDATE ".FluxBB_USERS_TABLE." 
    238         SET username = '".$username."', email = '".$adresse_mail."', password = '".$password."'  
    239         WHERE id = ".$row['FluxBB_id']." 
    240       ;"; 
    241        
     253UPDATE ".FluxBB_USERS_TABLE." 
     254SET username = '".mysql_real_escape_string($username)."', email = '".$adresse_mail."', password = '".$password."'  
     255WHERE id = ".$row['FluxBB_id']." 
     256;"; 
     257      
    242258      $result = pwg_query($query); 
    243259       
     
    246262  } 
    247263} 
    248  
    249  
    250264?> 
  • extensions/Register_FluxBB/branches/2.1/main.inc.php

    r3780 r4288  
    22/* 
    33Plugin Name: Register FluxBB 
    4 Version: 2.1.2 
     4Version: 2.1.3 
    55Description: Link user registration from Piwigo to FluxBB forum (registration, password changing, deletion) - Original Nicco's NBC_LinkUser2PunBB plugin upgraded to Piwigo / Liez l'inscription des utilisateurs de Piwigo avec votre forum FluxBB - Portage du plugin NBC_LinkUser2PunBB de Nicco vers Piwigo 
    66Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=252 
     
    1919:: HISTORY 
    2020 
    21 2.0.0b                  - 23/11/08  - Initial release. Basic changes to be available for Piwigo 2.0RC4 
     212.0.0b          - 23/11/08  - Initial release. Basic changes to be available for Piwigo 2.0RC4 
    2222 
    23 2.0.1b                  - 24/11/08  - Small bug correction on submit button display 
     232.0.1b          - 24/11/08  - Small bug correction on submit button display 
    2424 
    25252.0.2                   - 19/02/09      - Language pack correction 
    2626 
    27272.1.0                   - 25/04/09  - Admin panel with tabsheets 
    28                                                         - Radio buttons functionnalities corrections (now radio buttons show the configuration saved in database) 
    29                                                         - Language files (fr - en) improvement 
     28                      - Radio buttons functionnalities corrections (now radio buttons show the configuration saved in database) 
     29                      - Language files (fr - en) improvement 
    3030 
    31312.1.1                   - 30/04/09      - Bug fixed on profile update 
    3232 
    33332.1.2                   - 22/08/09      - Compatibility bug fixed when used with DynamicRecentPeriod plugin 
     34 
     352.1.3     - 16/11/09  - Using sha1 hash instead of md5 for password hashing in FluxBB 
     36                      - Escaping all characters in login names and be able to retreive them without slashes - FluxBB does not allow this so Piwigo's user names with escaped characters will not been escaped in FluxBB (ie : "it's" in Piwigo will be "It\'s" in FluxBB) 
     37                      - Code refactoring 
     38                      - Full HTML 4.0 for tpl 
    3439 
    3540-------------------------------------------------------------------------------- 
     
    5257{ 
    5358  array_push($menu, array( 
    54       'NAME' => 'Register FluxBB', 
    55       'URL'  => get_admin_plugin_menu_link(Register_FluxBB_PATH.'admin/Register_FluxBB_admin.php'))); 
    56       return $menu; 
     59    'NAME' => 'Register FluxBB', 
     60    'URL'  => get_admin_plugin_menu_link(Register_FluxBB_PATH.'admin/Register_FluxBB_admin.php'))); 
     61  return $menu; 
    5762} 
    5863 
     
    6368function Register_FluxBB_Adduser($register_user) 
    6469{ 
    65         global $conf; 
     70  global $conf; 
    6671         
    6772  include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); 
    6873 
    69   FluxBB_Adduser($register_user['id'], $register_user['username'], $conf['pass_convert']($_POST['password']), $register_user['email']); 
     74  // Warning : FluxBB uses Sha1 hash instead of md5 for Piwigo ! 
     75  FluxBB_Adduser($register_user['id'], $register_user['username'], sha1($_POST['password']), $register_user['email']); 
    7076} 
    7177 
     
    7682function Register_FluxBB_Deluser($user_id) 
    7783{ 
    78         include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); 
     84  include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); 
    7985 
    8086  FluxBB_Deluser( FluxBB_Searchuser($user_id), true ); 
     
    99105      $int_pattern = '/^\d+$/'; 
    100106      if (empty($_POST['nb_image_line']) 
    101           or (!preg_match($int_pattern, $_POST['nb_image_line']))) 
     107        or (!preg_match($int_pattern, $_POST['nb_image_line']))) 
    102108      { 
    103109        $errors[] = l10n('nb_image_line_error'); 
     
    105111     
    106112      if (empty($_POST['nb_line_page']) 
    107           or (!preg_match($int_pattern, $_POST['nb_line_page']))) 
     113        or (!preg_match($int_pattern, $_POST['nb_line_page']))) 
    108114      { 
    109115        $errors[] = l10n('nb_line_page_error'); 
     
    111117     
    112118      if ($_POST['maxwidth'] != '' 
    113           and (!preg_match($int_pattern, $_POST['maxwidth']) 
    114                or $_POST['maxwidth'] < 50)) 
     119        and (!preg_match($int_pattern, $_POST['maxwidth']) 
     120        or $_POST['maxwidth'] < 50)) 
    115121      { 
    116122        $errors[] = l10n('maxwidth_error'); 
    117123      } 
     124 
    118125      if ($_POST['maxheight'] 
    119            and (!preg_match($int_pattern, $_POST['maxheight']) 
    120                  or $_POST['maxheight'] < 50)) 
     126        and (!preg_match($int_pattern, $_POST['maxheight']) 
     127        or $_POST['maxheight'] < 50)) 
    121128      { 
    122129        $errors[] = l10n('maxheight_error'); 
    123130      } 
    124         // periods must be integer values, they represents number of days 
    125         /* Commented to fix compatibility problem with Dynamic Recent Period Plugin */ 
    126         /* This don't impact the plugin functionnalities */ 
    127         /*if (!preg_match($int_pattern, $_POST['recent_period']) 
    128             or $_POST['recent_period'] <= 0) 
    129         { 
    130           $errors[] = l10n('periods_error') ; 
    131         }*/ 
    132      
     131 
    133132      if (isset($_POST['mail_address'])) 
    134133      { 
     
    151150        {// changing password requires old password 
    152151          $query = ' 
    153             SELECT '.$conf['user_fields']['password'].' AS password 
    154             FROM '.USERS_TABLE.' 
    155             WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' 
    156           ;'; 
     152SELECT '.$conf['user_fields']['password'].' AS password 
     153FROM '.USERS_TABLE.' 
     154WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' 
     155;'; 
     156 
    157157          list($current_password) = mysql_fetch_row(pwg_query($query)); 
    158158       
     
    166166      if (count($errors) == 0) 
    167167      { 
    168         include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); 
     168        include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); 
    169169       
    170170        $query = ' 
    171           SELECT '.$conf['user_fields']['username'].' AS username 
    172           FROM '.USERS_TABLE.' 
    173           WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' 
    174         ;'; 
     171SELECT '.$conf['user_fields']['username'].' AS username 
     172FROM '.USERS_TABLE.' 
     173WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' 
     174;'; 
     175 
    175176        list($username) = mysql_fetch_row(pwg_query($query)); 
    176177 
    177         FluxBB_Updateuser($user['id'], $username, $conf['pass_convert']($_POST['use_new_pwd']), $_POST['mail_address']); 
     178        FluxBB_Updateuser($user['id'], stripslashes($username), sha1($_POST['use_new_pwd']), $_POST['mail_address']); 
    178179      } 
    179180    } 
    180181  } 
    181182} 
    182  
    183183?> 
  • extensions/Register_FluxBB/branches/2.1/maintain.inc.php

    r3780 r4288  
    1717 
    1818  $q = ' 
    19     INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 
    20     VALUES ("Register_FluxBB","FluxBB_;PhpWebGallery;Guest;false;false;true","Parametres Register_FluxBB") 
    21   ;'; 
     19INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 
     20VALUES ("Register_FluxBB","FluxBB_;PhpWebGallery;Guest;false;false;true","Parametres Register_FluxBB") 
     21;'; 
    2222     
    2323  pwg_query($q); 
    2424   
    25         $q = " 
    26     CREATE TABLE IF NOT EXISTS ".Register_FluxBB_ID_TABLE." ( 
    27       id_user_pwg smallint(5) NOT NULL default '0', 
    28       id_user_FluxBB int(10) NOT NULL default '0', 
    29       PRIMARY KEY  (id_user_pwg), 
    30       KEY id_user_pwg (id_user_pwg, id_user_FluxBB) 
    31     ) 
    32   ;"; 
     25  $q = " 
     26CREATE TABLE IF NOT EXISTS ".Register_FluxBB_ID_TABLE." ( 
     27  id_user_pwg smallint(5) NOT NULL default '0', 
     28  id_user_FluxBB int(10) NOT NULL default '0', 
     29PRIMARY KEY  (id_user_pwg), 
     30  KEY id_user_pwg (id_user_pwg, id_user_FluxBB) 
     31) 
     32;"; 
    3333 
    3434  pwg_query($q); 
     
    4848  { 
    4949    $q = ' 
    50       DELETE FROM '.CONFIG_TABLE.' 
    51       WHERE param="Register_FluxBB" LIMIT 1 
    52     ;'; 
     50DELETE FROM '.CONFIG_TABLE.' 
     51WHERE param="Register_FluxBB" LIMIT 1 
     52;'; 
    5353 
    5454    pwg_query($q); 
     
    5959 
    6060} 
    61  
    6261?> 
Note: See TracChangeset for help on using the changeset viewer.