Changeset 22092 for extensions/Register_FluxBB
- Timestamp:
- Apr 9, 2013, 6:46:57 PM (11 years ago)
- Location:
- extensions/Register_FluxBB
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Register_FluxBB/admin/admin.php
r22091 r22092 876 876 877 877 $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>'; 878 879 $msg_error_FluxBB2PWG .= ' <a href="'; 880 881 $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( 882 'action' => 'add2pwg', 883 'id' => $row['id'], 884 'username' => $row['username'], 885 'email' => $row['email'], 886 )); 887 888 $msg_error_FluxBB2PWG .= '" title="'.l10n('Add_User2pwg').stripslashes($row['username']).'"'; 889 890 $msg_error_FluxBB2PWG .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 891 892 $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_add.png" alt="'.l10n('Add_User2pwg').stripslashes($row['username']).'" /></a>'; 878 893 } 879 894 … … 995 1010 996 1011 Audit_PWG_FluxBB(); 1012 } 1013 else if (isset($_GET['action']) and ($_GET['action']=='add2pwg') and isset($_GET['id']) and isset($_GET['username']) and isset($_GET['email'])) 1014 { 1015 $error = Synch_Piwigo_Adduser($_GET['id'], $_GET['username'], $_GET['email']); 1016 1017 if (!$error) 1018 Audit_PWG_FluxBB(); 1019 else 1020 $template->append('errors', l10n('RegFluxBB_Email_or_Username_already_exist')); 997 1021 } 998 1022 -
extensions/Register_FluxBB/changelog.txt.php
r22091 r22092 125 125 126 126 2.5.6 - Bug fixed : Message for password change request not displayed on profile page 127 128 2.5.7 - Rebuild of previous version due to file corruption 129 130 2.5.8 - Add accounts synchronization from FluxBB to Piwigo 131 - Bug fixed : Missing function in audit 127 132 */ 128 133 ?> -
extensions/Register_FluxBB/include/functions.inc.php
r22091 r22092 640 640 641 641 /** 642 * Add new registered user in Piwigo users table from audit/synch action 643 * To solve password synch problem, passwords are reset to NULL to force users to get a new password on their profile page 644 * 645 * @return : $error 646 */ 647 function Synch_Piwigo_Adduser($fluxbb_id, $username, $email) 648 { 649 global $conf; 650 load_language('plugin.lang', REGFLUXBB_PATH); 651 652 if (!get_userid_by_email($email) and !get_userid($username)) 653 { 654 // find a password 655 $password = generate_key(8); 656 657 $error = register_user($username, $password, $email, false); 658 659 if (empty($error)) 660 { 661 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 662 663 $keyargs_content = array( 664 get_l10n_args('Hello %s,', $login), 665 get_l10n_args('To synchronize your forum access with the gallery you have been registered at %s!', $conf['gallery_title']), 666 get_l10n_args('', ''), 667 get_l10n_args('Here are your connection settings', ''), 668 get_l10n_args('Username: %s', $login), 669 get_l10n_args('Password: %s', $password), 670 get_l10n_args('Email: %s', $mail_address), 671 get_l10n_args('', ''), 672 get_l10n_args('Please change your password at your first connexion on the gallery', ''), 673 get_l10n_args('', ''), 674 get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()), 675 ); 676 677 pwg_mail( 678 $mail_address, 679 array( 680 'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'), 681 'content' => l10n_args($keyargs_content), 682 'content_format' => 'text/plain', 683 ) 684 ); 685 686 $pwg_id = get_userid($username); 687 688 FluxBB_Linkuser($pwg_id, $fluxbb_id, "NOK"); 689 690 $error = false; 691 } 692 } 693 else $error = true; 694 695 return $error; 696 } 697 698 699 /** 700 * Update user information in FluxBB users table from audit/synch action 701 * Standard FluxBB_Updateuser() function is not used because of existing password mismatch 702 * To solve password synch problem, passwords are reset to NULL to force users to get a new password by using "forgotten password" function 703 */ 704 function Synch_FluxBB_Updateuser($pwg_id, $username, $adresse_mail) 705 { 706 global $conf; 707 708 include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); 709 $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); 710 $password = NULL; 711 712 // Select users to update in ID link table 713 $query = ' 714 SELECT id_user_FluxBB as FluxBB_id 715 FROM '.Register_FluxBB_ID_TABLE.' 716 WHERE id_user_pwg = '.$pwg_id.' 717 ;'; 718 719 $row = pwg_db_fetch_assoc(pwg_query($query)); 720 721 if (!empty($row)) 722 { 723 $query = ' 724 UPDATE '.FluxBB_USERS_TABLE.' 725 SET username = "'.pwg_db_real_escape_string($username).'", email = "'.$adresse_mail.'", password = "'.$password.'" 726 WHERE id = '.$row['FluxBB_id'].' 727 AND "'.pwg_db_real_escape_string($username).'" NOT IN ("18","16") 728 AND "'.pwg_db_real_escape_string($username).'" <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" 729 ;'; 730 731 pwg_query($query); 732 733 FluxBB_Linkuser($pwg_id, $row['FluxBB_id'], "NOK"); 734 } 735 else 736 { 737 $query = ' 738 SELECT id as FluxBB_id 739 FROM '.FluxBB_USERS_TABLE.' 740 WHERE BINARY username = BINARY "'.pwg_db_real_escape_string($username).'" 741 AND "'.pwg_db_real_escape_string($username).'" <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" 742 ;'; 743 744 $row = pwg_db_fetch_assoc(pwg_query($query)); 745 746 if (!empty($row)) 747 { 748 $query = ' 749 UPDATE '.FluxBB_USERS_TABLE.' 750 SET username = "'.pwg_db_real_escape_string($username).'", email = "'.$adresse_mail.'", password = "'.$password.'" 751 WHERE id = '.$row['FluxBB_id'].' 752 AND "'.pwg_db_real_escape_string($username).'" NOT IN ("18","16") 753 AND "'.pwg_db_real_escape_string($username).'" <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" 754 ;'; 755 756 pwg_query($query); 757 758 FluxBB_Linkuser($pwg_id, $row['FluxBB_id'], "NOK"); 759 } 760 } 761 } 762 763 764 /** 765 * Reg_FluxBB_PwdSynch 766 * Checks if a password needs to be resynch between Piwigo and FluxBB 767 * 768 * @uid : the user id 769 * 770 * @returns : true if the password is NOT synchronized (NOK) else false 771 * 772 */ 773 function Reg_FluxBB_PwdSynch($uid) 774 { 775 $query = ' 776 SELECT PwdSynch 777 FROM '.Register_FluxBB_ID_TABLE.' 778 WHERE id_user_pwg='.$uid.' 779 ;'; 780 781 $result = pwg_db_fetch_assoc(pwg_query($query)); 782 783 if($result['PwdSynch'] == "NOK" or is_null($result['PwdSynch'])) 784 { 785 return true; 786 } 787 else return false; 788 } 789 790 791 /** 642 792 * Search linked users 643 793 */ -
extensions/Register_FluxBB/language/en_UK/plugin.lang.php
r22091 r22092 156 156 157 157 $lang['RegFluxBB_Password_Reset_Msg'] = 'Please, update your password for synchronization with the forum. Then you will be able to connect to the forum with the same account as the gallery.'; 158 159 $lang['Add_User2pwg'] = 'Adding in Piwigo of account: '; 160 $lang['RegFluxBB_Email_or_Username_already_exist'] = 'Synchronization from FluxBB to Piwigo stopped : Target email or username already exists in Piwigo users table.'; 161 $lang['To synchronize your forum access with the gallery you have been registered at %s!'] = 'To synchronize your forum access with the gallery you have been registered at %s!'; 162 $lang['Please change your password at your first connexion on the gallery'] = 'Please change your password at your first connexion on the gallery to end the data synchronization'; 158 163 ?> -
extensions/Register_FluxBB/language/fr_FR/plugin.lang.php
r22091 r22092 157 157 $lang['RegFluxBB_Password_Reset_Msg'] = 'Veuillez modifier votre mot de passe pour synchronisation avec l\'accès au forum. Vous pourrez alors vous connecter au forum avec le même compte que pour la galerie.'; 158 158 159 $lang['Add_User2pwg'] = 'Ajout dans Piwigo du compte : '; 160 $lang['RegFluxBB_Email_or_Username_already_exist'] = 'Synchronisation de FluxBB vers Piwigo suspendue : L\'email ou le nom d\'utilisateur cible existe déjà dans la table des utilisateurs de Piwigo.'; 161 $lang['To synchronize your forum access with the gallery you have been registered at %s!'] = 'Afin de synchroniser votre compte d\'accès au forum avec la galerie, vous avez été inscrit sur %s!'; 162 $lang['Please change your password at your first connexion on the gallery'] = 'Merci de bien vouloir modifier votre mot de passe lors de votre première connexion à la galerie pour terminer la synchronisation des données.'; 159 163 ?>
Note: See TracChangeset
for help on using the changeset viewer.