'Register FluxBB', 'URL' => get_admin_plugin_menu_link(Register_FluxBB_PATH.'admin/Register_FluxBB_admin.php'))); return $menu; } /* user creation*/ add_event_handler('register_user', 'Register_FluxBB_Adduser'); function Register_FluxBB_Adduser($register_user) { global $conf; include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); // Warning : FluxBB uses Sha1 hash instead of md5 for Piwigo ! FluxBB_Adduser($register_user['id'], $register_user['username'], sha1($_POST['password']), $register_user['email']); } /* user deletion */ add_event_handler('delete_user', 'Register_FluxBB_Deluser'); function Register_FluxBB_Deluser($user_id) { include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); FluxBB_Deluser( FluxBB_Searchuser($user_id), true ); } add_event_handler('init', 'Register_FluxBB_InitPage'); function Register_FluxBB_InitPage() { global $conf, $user ; include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); /* user update */ if (script_basename() == 'profile') { if (isset($_POST['validate'])) { $errors = array(); $int_pattern = '/^\d+$/'; if (empty($_POST['nb_image_line']) or (!preg_match($int_pattern, $_POST['nb_image_line']))) { $errors[] = l10n('nb_image_line_error'); } if (empty($_POST['nb_line_page']) or (!preg_match($int_pattern, $_POST['nb_line_page']))) { $errors[] = l10n('nb_line_page_error'); } if ($_POST['maxwidth'] != '' and (!preg_match($int_pattern, $_POST['maxwidth']) or $_POST['maxwidth'] < 50)) { $errors[] = l10n('maxwidth_error'); } if ($_POST['maxheight'] and (!preg_match($int_pattern, $_POST['maxheight']) or $_POST['maxheight'] < 50)) { $errors[] = l10n('maxheight_error'); } if (isset($_POST['mail_address'])) { $mail_error = validate_mail_address($user['id'],$_POST['mail_address']); if (!empty($mail_error)) { $errors[] = $mail_error; } } if (!empty($_POST['use_new_pwd'])) { // password must be the same as its confirmation if ($_POST['use_new_pwd'] != $_POST['passwordConf']) { $errors[] = l10n('New password confirmation does not correspond'); } if ( !defined('IN_ADMIN') ) {// changing password requires old password $query = ' SELECT '.$conf['user_fields']['password'].' AS password FROM '.USERS_TABLE.' WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' ;'; list($current_password) = mysql_fetch_row(pwg_query($query)); if ($conf['pass_convert']($_POST['password']) != $current_password) { $errors[] = l10n('Current password is wrong'); } } } if (count($errors) == 0) { include_once (Register_FluxBB_PATH.'include/functions_Register_FluxBB.inc.php'); $query = ' SELECT '.$conf['user_fields']['username'].' AS username FROM '.USERS_TABLE.' WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' ;'; list($username) = mysql_fetch_row(pwg_query($query)); FluxBB_Updateuser($user['id'], stripslashes($username), sha1($_POST['use_new_pwd']), $_POST['mail_address']); } } } } ?>