Changeset 6826 for extensions
- Timestamp:
- Aug 31, 2010, 7:15:20 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Register_FluxBB/trunk/main.inc.php
r6815 r6826 2 2 /* 3 3 Plugin Name: Register FluxBB 4 Version: 2.3. 04 Version: 2.3.1 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 … … 55 55 2.2.4 - 22/08/10 - Bug 1812 fixed : Compliance with FluxBB 1.4 56 56 57 2.3.0 - 01/09/10 - Bug 1434 fixed : Bridge between Register_FluxBB and UserAdvManager for new users validation 57 2.3.0 - 28/08/10 - Bug 1434 fixed : Bridge between Register_FluxBB and UserAdvManager for new users validation 58 59 2.3.1 - 31/08/10 - Bug 1825 fixed : Password corruption after Piwigo's profile page visit 58 60 -------------------------------------------------------------------------------- 59 61 */ … … 109 111 110 112 111 112 add_event_handler('init', 'Register_FluxBB_InitPage'); 113 114 function Register_FluxBB_InitPage() 115 { 116 global $conf, $user ; 117 include_once (REGFLUXBB_PATH.'include/functions.inc.php'); 118 119 /* user update */ 120 if (script_basename() == 'profile') 113 /* Profile management */ 114 if (script_basename() == 'profile') 115 { 116 add_event_handler('loc_begin_profile', 'Register_FluxBB_InitPage', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 117 118 function Register_FluxBB_InitPage() 121 119 { 122 if (isset($_POST['validate'])) 123 { 124 $errors = array(); 125 126 $int_pattern = '/^\d+$/'; 127 if (empty($_POST['nb_image_line']) 128 or (!preg_match($int_pattern, $_POST['nb_image_line']))) 120 global $conf, $user; 121 include_once (REGFLUXBB_PATH.'include/functions.inc.php'); 122 123 if (isset($_POST['validate']) and !is_admin()) 124 { 125 if (!empty($_POST['use_new_pwd'])) 129 126 { 130 $errors[] = l10n('nb_image_line_error'); 131 } 132 133 if (empty($_POST['nb_line_page']) 134 or (!preg_match($int_pattern, $_POST['nb_line_page']))) 135 { 136 $errors[] = l10n('nb_line_page_error'); 137 } 138 139 if ($_POST['maxwidth'] != '' 140 and (!preg_match($int_pattern, $_POST['maxwidth']) 141 or $_POST['maxwidth'] < 50)) 142 { 143 $errors[] = l10n('maxwidth_error'); 144 } 145 146 if ($_POST['maxheight'] 147 and (!preg_match($int_pattern, $_POST['maxheight']) 148 or $_POST['maxheight'] < 50)) 149 { 150 $errors[] = l10n('maxheight_error'); 151 } 152 153 if (isset($_POST['mail_address'])) 154 { 155 $mail_error = validate_mail_address($user['id'],$_POST['mail_address']); 156 if (!empty($mail_error)) 157 { 158 $errors[] = $mail_error; 159 } 160 } 161 162 if (!empty($_POST['use_new_pwd'])) 163 { 164 // password must be the same as its confirmation 165 if ($_POST['use_new_pwd'] != $_POST['passwordConf']) 166 { 167 $errors[] = l10n('New password confirmation does not correspond'); 168 } 169 170 if ( !defined('IN_ADMIN') ) 171 {// changing password requires old password 172 $query = ' 173 SELECT '.$conf['user_fields']['password'].' AS password 174 FROM '.USERS_TABLE.' 175 WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' 176 ;'; 177 178 list($current_password) = pwg_db_fetch_row(pwg_query($query)); 179 180 if ($conf['pass_convert']($_POST['password']) != $current_password) 181 { 182 $errors[] = l10n('Current password is wrong'); 183 } 184 } 185 } 186 187 if (count($errors) == 0) 188 { 189 include_once (REGFLUXBB_PATH.'include/functions.inc.php'); 190 191 $query = ' 127 $query = ' 192 128 SELECT '.$conf['user_fields']['username'].' AS username 193 129 FROM '.USERS_TABLE.' … … 195 131 ;'; 196 132 197 198 199 133 list($username) = pwg_db_fetch_row(pwg_query($query)); 134 135 FluxBB_Updateuser($user['id'], stripslashes($username), sha1($_POST['use_new_pwd']), $_POST['mail_address']); 200 136 } 201 137 } … … 205 141 206 142 /* Access validation in FluxBB when validated in Piwigo through UAM plugin */ 207 add_event_handler('login_success', 'UAM_Bridge' );143 add_event_handler('login_success', 'UAM_Bridge', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 208 144 209 145 function UAM_Bridge()
Note: See TracChangeset
for help on using the changeset viewer.