Ignore:
Timestamp:
Dec 2, 2010, 10:36:33 PM (13 years ago)
Author:
Eric
Message:

Merge from trunk to branch 2.3

Location:
extensions/Register_FluxBB/branches/2.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/Register_FluxBB/branches/2.3/admin/template/info.tpl

    r5606 r7983  
    55</div>
    66
    7 <div align="left" style="margin-left: 1em; margin-right: 1em;">{'Disclaimer'|@translate}</div>
     7<div style="text-align: left; margin-left: 1em; margin-right: 1em;">{'Disclaimer'|@translate}</div>
  • extensions/Register_FluxBB/branches/2.3/include/functions.inc.php

    r6815 r7983  
    11<?php
    22
    3   include_once (PHPWG_ROOT_PATH.'/include/constants.php');
    4   include_once (REGFLUXBB_PATH.'include/constants.php');
     3include_once (PHPWG_ROOT_PATH.'/include/constants.php');
     4include_once (REGFLUXBB_PATH.'include/constants.php');
     5
     6
     7function Register_FluxBB_admin_menu($menu)
     8{
     9  array_push($menu, array(
     10    'NAME' => 'Register FluxBB',
     11    'URL'  => get_admin_plugin_menu_link(REGFLUXBB_PATH.'admin/admin.php')));
     12  return $menu;
     13}
     14
     15
     16function Register_FluxBB_Adduser($register_user)
     17{
     18  global $errors, $conf;
     19       
     20  // Exclusion of Adult_Content users
     21  if ($register_user['username'] != "16" and $register_user['username'] != "18")
     22  {
     23    // Warning : FluxBB uses Sha1 hash instead of md5 for Piwigo!
     24    FluxBB_Adduser($register_user['id'], $register_user['username'], sha1($_POST['password']), $register_user['email']);
     25  }
     26}
     27
     28
     29function Register_FluxBB_Deluser($user_id)
     30{
     31  FluxBB_Deluser(FluxBB_Searchuser($user_id), true);
     32}
     33
     34
     35function Register_FluxBB_InitPage()
     36{
     37  global $conf, $user;
     38
     39  if (isset($_POST['validate']) and !is_admin())
     40  {
     41    if (!empty($_POST['use_new_pwd']))
     42    {
     43      $query = '
     44SELECT '.$conf['user_fields']['username'].' AS username
     45FROM '.USERS_TABLE.'
     46WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
     47;';
     48
     49      list($username) = pwg_db_fetch_row(pwg_query($query));
     50
     51      FluxBB_Updateuser($user['id'], stripslashes($username), sha1($_POST['use_new_pwd']), $_POST['mail_address']);
     52    }
     53  }
     54}
     55
     56
     57function UAM_Bridge()
     58{
     59  global $conf, $user;
     60 
     61  $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
     62 
     63  // Check if UAM is installed and if bridge is set - Exception for admins and webmasters
     64  $query ='
     65SELECT user_id, status
     66FROM '.USER_INFOS_TABLE.'
     67WHERE user_id = '.$user['id'].'
     68;';
     69  $data = pwg_db_fetch_assoc(pwg_query($query));
     70 
     71  if ($data['status'] <> "admin" and $data['status'] <> "webmaster")
     72  {
     73    if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB[6]) and $conf_Register_FluxBB[6] == 'true')
     74    {
     75      $conf_UAM = unserialize($conf['UserAdvManager']);
     76   
     77      // Getting unvalidated users group else Piwigo's default group
     78      if (isset($conf_UAM[2]) and $conf_UAM[2] != '-1')
     79      {
     80        $Waitingroup = $conf_UAM[2];
     81      }
     82      else
     83      {
     84        $query = '
     85SELECT id
     86FROM '.GROUPS_TABLE.'
     87WHERE is_default = "true"
     88LIMIT 1
     89;';
     90        $data = pwg_db_fetch_assoc(pwg_query($query));
     91        $Waitingroup = $data['id'];
     92      }
     93   
     94      // check if logged in user is in a Piwigo's validated or unvalidated users group
     95      $query = '
     96SELECT *
     97FROM '.USER_GROUP_TABLE.'
     98WHERE user_id = '.$user['id'].'
     99AND group_id = '.$Waitingroup.'
     100;';
     101      $count = pwg_db_num_rows(pwg_query($query));
     102
     103      // Check if logged in user is in a FluxBB's unvalidated group
     104      $query = "
     105SELECT group_id
     106FROM ".FluxBB_USERS_TABLE."
     107WHERE id = ".FluxBB_Searchuser($user['id'])."
     108;";
     109
     110      $data = pwg_db_fetch_assoc(pwg_query($query));
     111
     112      // Logged in user switch to the default FluxBB's group if he'is validated
     113      if ($count == 0 and $data['group_id'] = $conf_Register_FluxBB[7])
     114      {
     115        $query = "
     116SELECT conf_value
     117FROM ".FluxBB_CONFIG_TABLE."
     118WHERE conf_name = 'o_default_user_group'
     119;";
     120
     121        $o_default_user_group = pwg_db_fetch_assoc(pwg_query($query));
     122     
     123        $query = "
     124UPDATE ".FluxBB_USERS_TABLE."
     125SET group_id = ".$o_default_user_group['conf_value']."
     126WHERE id = ".FluxBB_Searchuser($user['id'])."
     127;";
     128        pwg_query($query);
     129      }
     130    }
     131  }
     132}
     133
     134
     135function Register_FluxBB_RegistrationCheck($err, $register_user)
     136{
     137  global $errors, $conf;
     138 
     139  //Because FluxBB is case insensitive on login name, we have to check if a similar login already exists in FluxBB's user table
     140  // If "test" user already exists, "TEST" or "Test" (and so on...) can't register
     141  $query = "
     142SELECT username
     143  FROM ".FluxBB_USERS_TABLE."
     144WHERE LOWER(".stripslashes('username').") = '".strtolower($register_user['username'])."'
     145;";
     146
     147    $count = pwg_db_num_rows(pwg_query($query));
     148
     149    if ($count > 0)
     150    {
     151      return l10n('this login is already used');
     152    }
     153}
     154
    5155
    6156function FluxBB_Linkuser($pwg_id, $bb_id)
     
    52202function FluxBB_Adduser($pwg_id, $login, $password, $adresse_mail)
    53203{
    54   global $conf;
     204  global $errors, $conf;
    55205
    56206  $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
     
    118268
    119269  $o_default_style = pwg_db_fetch_assoc(pwg_query($query));
    120  
    121   $query = '
    122 INSERT INTO '.FluxBB_USERS_TABLE." (
     270
     271  $query = "
     272INSERT INTO ".FluxBB_USERS_TABLE." (
    123273  username,
    124274  ". ( isset($o_default_user_group['conf_value']) ? 'group_id' : '' ) .",
     
    187337  $data0 = pwg_db_fetch_assoc(pwg_query($query0));
    188338
    189   // Si égale à VRAI, suppression de tous les posts et topics
     339  // If True, delete related topics and posts
    190340  if ($SuppTopicsPosts and $conf_Register_FluxBB[3])
    191341  {
    192     // Suppression des posts de cet utilisateur
     342    // Delete posts and topics of this user
    193343    $subquery = "
    194344DELETE FROM ".FluxBB_POSTS_TABLE."
     
    198348    $subresult = pwg_query($subquery);
    199349
    200     // Suppression des topics de cet utilisateur
     350    // Delete topics of this user
    201351    $subquery = "
    202352DELETE FROM ".FluxBB_TOPICS_TABLE."
     
    207357  }
    208358
    209   // Suppression des abonnements de l'utilisateur
     359  // Delete user's subscriptions
    210360  $subquery = "
    211361DELETE FROM ".FluxBB_SUBSCRIPTIONS_TABLE."
     
    215365  $subresult = pwg_query($subquery);
    216366 
    217   // Suppression du compte utilisateur
     367  // Delete user's account
    218368  $subquery = "
    219369DELETE FROM ".FluxBB_USERS_TABLE."
  • extensions/Register_FluxBB/branches/2.3/language/de_DE/plugin.lang.php

    r6899 r7983  
    66
    77$lang['Title'] = 'Register FluxBB';
    8 $lang['Disclaimer'] = '
    9   *** Befolgen Sie bitte die folgenden zwei Schritte, um zu beginnen ***<br>
    10   Step 1 : Konfigurieren Sie den Plugin für den Zugriff auf FluxBB.<br>
    11   Step 2 : Migrieren Sie die Benutzerkonten von Piwigo nach FluxBB.<br><br>
    12   Wenn dies erfolgt ist arbeitet der Plugin voll funktionstüchtig und Sie müssen diese Seiten nicht mehr aufsuchen.<br><br>
    13   *** Für die Wartung bereits bestehender Verbindungen ***<br>
    14   Wartung: : Tabellensynchronisation (im Fall des Hinzufügens, Aktualisierens oder Löschens eines Users) erlaubt Ihnen, Passwörter und e-mail Adressen auf den neuesten Stand zu bringen und unerwünschte User zu erkennen (Dies sollten Sie jedoch im Normalfall nicht benötigen).<br><br>
    15   <div class="warning">Warnung !! Aus Sicherheitsgründen sollten Sie ein Backup Ihrer Datenbank anfertigen (Speziell die ###_user Tabellen).</div>';
    168
    179$lang['Config_Title'] = 'Pluginkonfiguration';
     
    162154/*TODO*/$lang['error_config_guest'] = 'ERROR : The name of the FluxBB\'s guest account is wrong!';
    163155// --------- End: New or revised $lang ---- from version 2.3.3
     156
     157// --------- Starting below: New or revised $lang ---- from version 2.3.5
     158$lang['Disclaimer'] = '
     159  *** Befolgen Sie bitte die folgenden zwei Schritte, um zu beginnen ***<br>
     160  Step 1 : Konfigurieren Sie den Plugin für den Zugriff auf FluxBB.<br>
     161  Step 2 : Migrieren Sie die Benutzerkonten von Piwigo nach FluxBB.<br><br>
     162  Wenn dies erfolgt ist arbeitet der Plugin voll funktionstüchtig und Sie müssen diese Seiten nicht mehr aufsuchen.<br><br>
     163  *** Für die Wartung bereits bestehender Verbindungen ***<br>
     164  Wartung: : Tabellensynchronisation (im Fall des Hinzufügens, Aktualisierens oder Löschens eines Users) erlaubt Ihnen, Passwörter und e-mail Adressen auf den neuesten Stand zu bringen und unerwünschte User zu erkennen (Dies sollten Sie jedoch im Normalfall nicht benötigen).<br><br>
     165  <div class="warning">Warnung !! Aus Sicherheitsgründen sollten Sie ein Backup Ihrer Datenbank anfertigen (Speziell die ###_user Tabellen).</div>
     166<br><br>
     167  <div class="warning">Wichtig zu wissen:<br>
     168  Standardmäßig ist <b>FluxBB</b> Fall <u>unempfindlich</u> für Benutzernamen. Das heißt, wenn ein Benutzer namens "test" ist bereits registriert, andere Einträge wie "Test" oder "TEST" oder "TEst" (etc. ..) werden abgelehnt.<br><br>
     169  Standardmäßig ist <b>Piwigo</b> arbeitet in umgekehrter und ist daher bei Fall <u>empfindlich</u> für Logins ("test" wird ein anderer Benutzer von "TEST" oder "TEst", etc. ...) werden<br>
     170  Um Probleme zu vermeiden (auch wenn Piwigo Verhalten leicht verändert werden kann - siehe Konfigurationsmöglichkeiten), wird Register_FluxBB Verknüpfung der beiden Anwendungen als FluxBB: Fall <u>unempfindlich</u> für Logins.<br><br></div>';
     171// --------- End: New or revised $lang ---- from version 2.3.5
    164172?>
  • extensions/Register_FluxBB/branches/2.3/language/en_UK/plugin.lang.php

    r6899 r7983  
    66
    77$lang['Title'] = 'Register FluxBB';
    8 $lang['Disclaimer'] = '
    9   *** To begin, follow this 2 steps ***<br>
    10   Step 1 : Set plugin with the parameters of FluxBB.<br>
    11   Step 2 : Migrate user accounts from Piwigo to FluxBB.<br><br>
    12   After these 2 main steps, the plugin is fully functional and you will not have to return to this pages.<br><br>
    13   *** For the maintenance of already active connections ***<br>
    14   Maintenance : Synchronize tables (in case an addition, an update or a user deletion mismatched) allows to update passwords and email addresses and see users intruder (But you should not need to use ).<br><br>
    15   <div class="warning">WARNING !! For safety, consider making a backup of your database, especially ###_user tables before any action.</div>';
    168
    179$lang['Config_Title'] = 'Plugin setup';
     
    136128  <br>';
    137129$lang['About_Reg'] = 'About the registration of users on the forum FluxBB';
    138 $lang['Bridge_UAM'] = 'Validation d\'accès au forum via le plugin UserAdvManager (UAM): Activez ici le pont entre les deux plugins qui vous permettra d\'interdir l\'accès à votre forum FluxBB tant que l\'utilisateur n\'a pas validé son inscription à la galerie (la fonction correspondante doit être active sur UAM). Access validation to the forum via UserAdvManager (UAM) plugin: Turn the bridge on between the two plugins that will allow you to prohibit the access to your FluxBB forum until the user has not validated its registration in the gallery (the function must be active on UAM).';
     130$lang['Bridge_UAM'] = 'Access validation to the forum via UserAdvManager (UAM) plugin: Turn the bridge on between the two plugins that will allow you to prohibit the access to your FluxBB forum until the user has not validated its registration in the gallery (the function must be active on UAM).';
    139131$lang['Bridge_UAM_true'] = ' --> Enable bridge Register_FluxBB / UAM';
    140132$lang['Bridge_UAM_false'] = ' --> Disable bridge Register_FluxBB / UAM (default)';
    141 $lang['FluxBB_Group'] = 'Précisez ici l\'ID du <b>groupe FluxBB</b> dans lequel les utilisateurs non validé doivent se trouver (à créer au préalable dans FluxBB). Pour être efficace, ce groupe ne doit avoir aucune permission sur le forum (voir à la fin de cette page pour les détails d\'utilisation de cette option).Specify the ID of <b>FluxBB\' group</b> in which non validated users must be (to be created in advance in FluxBB). To be effective, this group should have no permission on the forum (see the end of this page for details on using this option).';
     133$lang['FluxBB_Group'] = 'Specify the ID of <b>FluxBB\' group</b> in which non validated users must be (to be created in advance in FluxBB). To be effective, this group should have no permission on the forum (see the end of this page for details on using this option).';
    142134$lang['About_Bridge'] = 'About Register_FluxBB / UAM bridge';
    143 $lang['UAM_Bridge_advice'] = 'The UserAdvManager plugin allows forcing new registrants to confirm their registration before allowing them to access the entire gallery. The joint use of this plugin with Register_FluxBB can do the same on the forum linked: Registrants can not post until they have validated their registration in the gallery. <br>
     135$lang['UAM_Bridge_advice'] = 'The UserAdvManager plugin allows forcing new registrants to confirm their registration before allowing them to access the entire gallery. The joint use of this plugin with Register_FluxBB can do the same on the linked forum: Registrants can not post until they have validated their registration in the gallery. <br>
    144136Here is the general procedure to apply:
    145137<br>
     
    162154$lang['error_config_guest'] = 'ERROR : The name of the FluxBB\'s guest account is wrong!';
    163155// --------- End: New or revised $lang ---- from version 2.3.3
     156
     157// --------- Starting below: New or revised $lang ---- from version 2.3.5
     158$lang['Disclaimer'] = '
     159  *** To begin, follow this 2 steps ***<br>
     160  Step 1 : Set plugin with the parameters of FluxBB.<br>
     161  Step 2 : Migrate user accounts from Piwigo to FluxBB.<br><br>
     162  After these 2 main steps, the plugin is fully functional and you will not have to return to this pages.<br><br>
     163  *** For the maintenance of already active connections ***<br>
     164  Maintenance : Synchronize tables (in case an addition, an update or a user deletion mismatched) allows to update passwords and email addresses and see users intruder (But you should not need to use ).<br><br>
     165  <div class="warning">WARNING !! For safety, consider making a backup of your database, especially ###_user tables before any action.</div>
     166<br><br>
     167  <div class="warning">Important to know:<br>
     168  By default, <b>FluxBB</b> is case <u>insensitive</u> on usernames. That is, if a user called "test" is already registered, other entries like "Test" or "TEST" or "TEst" (etc. ..) will be rejected.<br><br>
     169  By default, <b>Piwigo</b> works in reverse and is therefore case <u>sensitive</u> on logins ("test" will be a different user of "Test" or "TEST", etc. ...).<br>
     170  To avoid problems (even if Piwigo\'s behavior can be easily changed - See configuration options), Register_FluxBB will link the two applications as FluxBB: Being case <u>insensitive</u> for logins.<br><br></div>';
     171// --------- End: New or revised $lang ---- from version 2.3.5
    164172?>
  • extensions/Register_FluxBB/branches/2.3/language/fr_FR/plugin.lang.php

    r6899 r7983  
    66
    77$lang['Title'] = 'Register FluxBB';
    8 $lang['Disclaimer'] = '
    9   *** Pour débuter, 2 étapes à suivre ***<br>
    10   1ère étape : Configurer les paramètres du plugin avec les paramètres de FluxBB.<br>
    11   2ème étape : Migrer les comptes utilisateurs de Piwigo vers FluxBB.<br><br>
    12   A l\'issue des 2 étapes principales, le plugin sera pleinement fonctionnel et vous n\'aurez plus à revenir sur cette page.<br><br>
    13   *** Pour maintenir les liaisons déjà actives ***<br>
    14   Maintenance : Synchroniser les tables (dans le cas où un ajout, une mise à jour ou une suppression d\'utilisateur s\'est mal déroulée) permet de remettre à jour mots de passe et adresses email et voir les utilisateurs intrus (Mais vous ne devriez pas avoir à l\'utiliser).<br><br>
    15   <div class="warning">Pensez faire une sauvegarde de votre base et spécialement de vos tables ###_USERS avant toutes actions par mesure de sécurité.</div>';
    168
    179$lang['Config_Title'] = 'Configuration du plugin';
     
    163155$lang['error_config_guest'] = 'ERREUR : Le nom du compte visiteur (guest) de FluxBB est incorrect !';
    164156// --------- End: New or revised $lang ---- from version 2.3.3
     157
     158// --------- Starting below: New or revised $lang ---- from version 2.3.5
     159$lang['Disclaimer'] = '
     160  *** Pour débuter, 2 étapes à suivre ***<br>
     161  1ère étape : Configurer les paramètres du plugin avec les paramètres de FluxBB.<br>
     162  2ème étape : Migrer les comptes utilisateurs de Piwigo vers FluxBB.<br><br>
     163  A l\'issue des 2 étapes principales, le plugin sera pleinement fonctionnel et vous n\'aurez plus à revenir sur cette page.<br><br>
     164  *** Pour maintenir les liaisons déjà actives ***<br>
     165  Maintenance : Synchroniser les tables (dans le cas où un ajout, une mise à jour ou une suppression d\'utilisateur s\'est mal déroulée) permet de remettre à jour mots de passe et adresses email et voir les utilisateurs intrus (Mais vous ne devriez pas avoir à l\'utiliser).<br><br>
     166  <div class="warning">Pensez faire une sauvegarde de votre base et spécialement de vos tables ###_USERS avant toutes actions par mesure de sécurité.</div>
     167<br><br>
     168  <div class="warning">A savoir :<br>
     169  Par défaut, <b>FluxBB</b> est <u>insensible</u> à la casse sur les noms d\'utilisateurs. C\'est à dire que si un utilisateur "test" est déjà inscrit, d\'autres inscriptions avec, par exemple, "Test" ou "TEST" ou "TEst" (etc...) seront refusées.<br><br>
     170  Par défaut, <b>Piwigo</b> fonctionne de manière inverse et est donc <u>sensible</u> à la casse sur les logins ("test" sera un utilisateur différent de "Test" etc...).<br><br>
     171  Afin d\'éviter des erreurs (même si le comportement de Piwigo peut-être facilement changé - Voir les options de configuration), Register_FluxBB fera le lien entre les deux applications à la manière de FluxBB : En étant <u>insensible</u> à la casse pour les logins.<br><br></div>';
     172// --------- End: New or revised $lang ---- from version 2.3.5
    165173?>
  • extensions/Register_FluxBB/branches/2.3/main.inc.php

    r7002 r7983  
    22/*
    33Plugin Name: Register FluxBB
    4 Version: 2.3.4
     4Version: 2.3.5
    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
     
    6666
    67672.3.4     - 22/09/10  - Compatibility with Plugin Adult_Content
     68
     692.3.5     - 02/12/10  - Bug 2047 fixed : Check case sensitivity for logins in FluxBB's user table
     70                      - Code refactory and optimization
    6871--------------------------------------------------------------------------------
    6972*/
     
    8588add_event_handler('get_admin_plugin_menu_links', 'Register_FluxBB_admin_menu');
    8689
    87 function Register_FluxBB_admin_menu($menu)
    88 {
    89   array_push($menu, array(
    90     'NAME' => 'Register FluxBB',
    91     'URL'  => get_admin_plugin_menu_link(REGFLUXBB_PATH.'admin/admin.php')));
    92   return $menu;
    93 }
    94 
    9590
    9691/* user creation*/
    9792add_event_handler('register_user', 'Register_FluxBB_Adduser');
    9893
    99 function Register_FluxBB_Adduser($register_user)
    100 {
    101   global $conf;
    102        
    103   // Exclusion of Adult_Content users
    104   if ($register_user['username'] != "16" and $register_user['username'] != "18")
    105   {
    106     include_once (REGFLUXBB_PATH.'include/functions.inc.php');
    10794
    108     // Warning : FluxBB uses Sha1 hash instead of md5 for Piwigo!
    109     FluxBB_Adduser($register_user['id'], $register_user['username'], sha1($_POST['password']), $register_user['email']);
    110   }
    111 }
     95// Check users registration
     96add_event_handler('register_user_check', 'Register_FluxBB_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    11297
    11398
    11499/* user deletion */
    115100add_event_handler('delete_user', 'Register_FluxBB_Deluser');
    116 
    117 function Register_FluxBB_Deluser($user_id)
    118 {
    119   include_once (REGFLUXBB_PATH.'include/functions.inc.php');
    120 
    121   FluxBB_Deluser( FluxBB_Searchuser($user_id), true );
    122 }
    123101
    124102
     
    127105{
    128106  add_event_handler('loc_begin_profile', 'Register_FluxBB_InitPage', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    129 
    130   function Register_FluxBB_InitPage()
    131   {
    132     global $conf, $user;
    133     include_once (REGFLUXBB_PATH.'include/functions.inc.php');
    134    
    135     if (isset($_POST['validate']) and !is_admin())
    136     {
    137     if (!empty($_POST['use_new_pwd']))
    138       {
    139       $query = '
    140 SELECT '.$conf['user_fields']['username'].' AS username
    141 FROM '.USERS_TABLE.'
    142 WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\'
    143 ;';
    144 
    145       list($username) = pwg_db_fetch_row(pwg_query($query));
    146 
    147       FluxBB_Updateuser($user['id'], stripslashes($username), sha1($_POST['use_new_pwd']), $_POST['mail_address']);
    148       }
    149     }
    150   }
    151107}
    152108
     
    155111add_event_handler('login_success', 'UAM_Bridge', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    156112
    157 function UAM_Bridge()
    158 {
    159   global $conf, $user;
    160  
    161   $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
    162  
    163   // Check if UAM is installed and if bridge is set - Exception for admins and webmasters
    164   $query ='
    165 SELECT user_id, status
    166 FROM '.USER_INFOS_TABLE.'
    167 WHERE user_id = '.$user['id'].'
    168 ;';
    169   $data = pwg_db_fetch_assoc(pwg_query($query));
    170  
    171   if ($data['status'] <> "admin" and $data['status'] <> "webmaster")
    172   {
    173     if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB[6]) and $conf_Register_FluxBB[6] == 'true')
    174     {
    175       $conf_UAM = unserialize($conf['UserAdvManager']);
    176    
    177       // Getting unvalidated users group else Piwigo's default group
    178       if (isset($conf_UAM[2]) and $conf_UAM[2] != '-1')
    179       {
    180         $Waitingroup = $conf_UAM[2];
    181       }
    182       else
    183       {
    184         $query = '
    185 SELECT id
    186 FROM '.GROUPS_TABLE.'
    187 WHERE is_default = "true"
    188 LIMIT 1
    189 ;';
    190         $data = pwg_db_fetch_assoc(pwg_query($query));
    191         $Waitingroup = $data['id'];
    192       }
    193    
    194       // check if logged in user is in a Piwigo's validated or unvalidated users group
    195       $query = '
    196 SELECT *
    197 FROM '.USER_GROUP_TABLE.'
    198 WHERE user_id = '.$user['id'].'
    199 AND group_id = '.$Waitingroup.'
    200 ;';
    201       $count = pwg_db_num_rows(pwg_query($query));
    202 
    203       // Check if logged in user is in a FluxBB's unvalidated group
    204       $query = "
    205 SELECT group_id
    206 FROM ".FluxBB_USERS_TABLE."
    207 WHERE id = ".FluxBB_Searchuser($user['id'])."
    208 ;";
    209 
    210       $data = pwg_db_fetch_assoc(pwg_query($query));
    211 
    212       // Logged in user switch to the default FluxBB's group if he'is validated
    213       if ($count == 0 and $data['group_id'] = $conf_Register_FluxBB[7])
    214       {
    215         $query = "
    216 SELECT conf_value
    217 FROM ".FluxBB_CONFIG_TABLE."
    218 WHERE conf_name = 'o_default_user_group'
    219 ;";
    220 
    221         $o_default_user_group = pwg_db_fetch_assoc(pwg_query($query));
    222      
    223         $query = "
    224 UPDATE ".FluxBB_USERS_TABLE."
    225 SET group_id = ".$o_default_user_group['conf_value']."
    226 WHERE id = ".FluxBB_Searchuser($user['id'])."
    227 ;";
    228         pwg_query($query);
    229       }
    230     }
    231   }
    232 }
    233113?>
Note: See TracChangeset for help on using the changeset viewer.