Changeset 7983 for extensions/Register_FluxBB/branches/2.3/main.inc.php
- Timestamp:
- Dec 2, 2010, 10:36:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Register_FluxBB/branches/2.3/main.inc.php
r7002 r7983 2 2 /* 3 3 Plugin Name: Register FluxBB 4 Version: 2.3. 44 Version: 2.3.5 5 5 Description: 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 6 6 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=252 … … 66 66 67 67 2.3.4 - 22/09/10 - Compatibility with Plugin Adult_Content 68 69 2.3.5 - 02/12/10 - Bug 2047 fixed : Check case sensitivity for logins in FluxBB's user table 70 - Code refactory and optimization 68 71 -------------------------------------------------------------------------------- 69 72 */ … … 85 88 add_event_handler('get_admin_plugin_menu_links', 'Register_FluxBB_admin_menu'); 86 89 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 95 90 96 91 /* user creation*/ 97 92 add_event_handler('register_user', 'Register_FluxBB_Adduser'); 98 93 99 function Register_FluxBB_Adduser($register_user)100 {101 global $conf;102 103 // Exclusion of Adult_Content users104 if ($register_user['username'] != "16" and $register_user['username'] != "18")105 {106 include_once (REGFLUXBB_PATH.'include/functions.inc.php');107 94 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 96 add_event_handler('register_user_check', 'Register_FluxBB_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 112 97 113 98 114 99 /* user deletion */ 115 100 add_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 }123 101 124 102 … … 127 105 { 128 106 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 username141 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 }151 107 } 152 108 … … 155 111 add_event_handler('login_success', 'UAM_Bridge', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 156 112 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 webmasters164 $query ='165 SELECT user_id, status166 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 group178 if (isset($conf_UAM[2]) and $conf_UAM[2] != '-1')179 {180 $Waitingroup = $conf_UAM[2];181 }182 else183 {184 $query = '185 SELECT id186 FROM '.GROUPS_TABLE.'187 WHERE is_default = "true"188 LIMIT 1189 ;';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 group195 $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 group204 $query = "205 SELECT group_id206 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 validated213 if ($count == 0 and $data['group_id'] = $conf_Register_FluxBB[7])214 {215 $query = "216 SELECT conf_value217 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 }233 113 ?>
Note: See TracChangeset
for help on using the changeset viewer.