Changeset 22204
- Timestamp:
- Apr 14, 2013, 4:11:39 PM (11 years ago)
- Location:
- extensions/Register_FluxBB
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Register_FluxBB/admin/admin.php
r22092 r22204 142 142 if ( isset($_POST['Synchro'])) 143 143 { 144 $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__);145 146 144 $msg_error_PWG_Dup = ''; 147 145 $msg_error_FluxBB_Dup = ''; … … 199 197 $msg_error_FluxBB_Dup .= ' <a href="'; 200 198 201 $msg_error_FluxBB_Dup .= add_url_params( $page_Register_FluxBB_admin, array(199 $msg_error_FluxBB_Dup .= add_url_params(REGFLUXBB_ADMIN, array( 202 200 'action' => 'del_user', 203 201 'id' => $subrow['id'], … … 428 426 $msg_error_FluxBB2PWG .= '<br>'.l10n('Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')'; 429 427 $msg_error_FluxBB2PWG .= ' <a href="'; 430 $msg_error_FluxBB2PWG .= add_url_params( $page_Register_FluxBB_admin, array(428 $msg_error_FluxBB2PWG .= add_url_params(REGFLUXBB_ADMIN, array( 431 429 'action' => 'del_user', 432 430 'id' => $row['id'], … … 481 479 { 482 480 global $page, $conf, $errors; 483 484 $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__);485 481 486 482 $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); … … 509 505 $msg_error_PWG_Dup .= '<br>'.l10n('Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); 510 506 507 // Display OK message or build errors 511 508 if ($msg_error_PWG_Dup == '') 512 509 array_push($page['infos'], l10n('Audit_PWG_Dup').'<br>'.l10n('Audit_OK')); 513 510 else 514 511 $msg_error_PWG_Dup = l10n('Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Advise_PWG_Dup'); 515 512 516 513 517 514 // Check duplicate accounts in FluxBB users table … … 539 536 { 540 537 $msg_error_FluxBB_Dup .= '<br>id:'.$subrow['id'].'='.stripslashes($subrow['username']).' ('.$subrow['email'].')'; 541 538 539 // Action : Delete duplicate user from FluxBB 542 540 $msg_error_FluxBB_Dup .= ' <a href="'; 543 544 $msg_error_FluxBB_Dup .= add_url_params($page_Register_FluxBB_admin, array( 541 $msg_error_FluxBB_Dup .= add_url_params(REGFLUXBB_ADMIN, array( 545 542 'action' => 'del_user', 546 543 'id' => $subrow['id'], 547 544 )); 548 549 545 $msg_error_FluxBB_Dup .= '" title="'.l10n('Del_User').stripslashes($subrow['username']).'"'; 550 551 546 $msg_error_FluxBB_Dup .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 552 553 547 $msg_error_FluxBB_Dup .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').$subrow['username'].'" /></a>'; 554 548 } 555 549 } 556 550 551 // Display OK message or build errors 557 552 if ($msg_error_FluxBB_Dup == '') 558 553 array_push($page['infos'], l10n('Audit_FluxBB_Dup').'<br>'.l10n('Audit_OK')); … … 587 582 $msg_error_Link_Break .= '<br>'.l10n('Error_Link_Break').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'; 588 583 584 // Action : Create new link 589 585 $msg_error_Link_Break .= ' <a href="'; 590 591 $msg_error_Link_Break .= add_url_params($page_Register_FluxBB_admin, array( 586 $msg_error_Link_Break .= add_url_params(REGFLUXBB_ADMIN, array( 592 587 'action' => 'new_link', 593 588 'pwg_id' => $row['pwg_id'], 594 589 'bb_id' => $row['bb_id'], 595 590 )); 596 597 591 $msg_error_Link_Break .= '" title="'.l10n('New_Link').stripslashes($row['pwg_user']).'"'; 598 599 592 $msg_error_Link_Break .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 600 601 593 $msg_error_Link_Break .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_break.png" alt="'.l10n('New_Link').stripslashes($row['pwg_user']).'" /></a>'; 602 594 } 603 595 596 // Display OK message or build errors 604 597 if ($msg_error_Link_Break == '') 605 598 array_push($page['infos'], l10n('Audit_Link_Break').'<br>'.l10n('Audit_OK')); … … 625 618 $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')'; 626 619 620 // Action : Delete obsolete links 627 621 $msg_error_Link_Bad .= ' <a href="'; 628 629 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 622 $msg_error_Link_Bad .= add_url_params(REGFLUXBB_ADMIN, array( 630 623 'action' => 'link_del', 631 624 'pwg_id' => $row['pwg_id'], 632 625 'bb_id' => $row['bb_id'], 633 626 )); 634 635 627 $msg_error_Link_Bad .= '" title="'.l10n('Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; 636 637 628 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 638 639 629 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_delete.png" alt="'.l10n('Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>'; 640 630 631 // Action : Synch users data 641 632 $msg_error_Link_Bad .= ' -- <a href="'; 642 643 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 633 $msg_error_Link_Bad .= add_url_params(REGFLUXBB_ADMIN, array( 644 634 'action' => 'sync_user', 645 635 'username' => stripslashes($row['pwg_user']), 646 636 )); 647 648 637 $msg_error_Link_Bad .= '" title="'.l10n('Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'"'; 649 650 638 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 651 652 639 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/arrow_switch.png" alt="'.l10n('Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'" /></a>'; 653 640 } … … 675 662 $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dead').$Compteur['nbr_dead']; 676 663 664 // Action : Repair dead links 677 665 $msg_error_Link_Bad .= ' <a href="'; 678 679 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 666 $msg_error_Link_Bad .= add_url_params(REGFLUXBB_ADMIN, array( 680 667 'action' => 'link_dead', 681 668 )); 682 683 669 $msg_error_Link_Bad .= '" title="'.l10n('Link_Dead').$Compteur['nbr_dead'].'"'; 684 685 670 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 686 687 671 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_delete.png" alt="'.l10n('Link_Dead').$Compteur['nbr_dead'].'" /></a>'; 688 672 } … … 707 691 $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')'; 708 692 693 // Action : Repair links 709 694 $msg_error_Link_Bad .= ' <a href="'; 710 711 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 695 $msg_error_Link_Bad .= add_url_params(REGFLUXBB_ADMIN, array( 712 696 'action' => 'new_link', 713 697 'pwg_id' => $row['pwg_id'], 714 698 'bb_id' => $row['bb_id'], 715 699 )); 716 717 700 $msg_error_Link_Bad .= '" title="'.l10n('Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; 718 719 701 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 720 721 702 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_error.png" alt="'.l10n('Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>'; 722 703 } 723 704 705 // Display OK message or build errors 724 706 if ($msg_error_Link_Bad == '') 725 707 array_push($page['infos'], l10n('Audit_Link_Bad').'<br>'.l10n('Audit_OK')); … … 746 728 if (($row['pwg_eml'] != $row['bb_eml']) or Reg_FluxBB_PwdSynch($row['pwg_id'])) 747 729 { 748 if ($row['pwg_eml'] != $row['bb_eml'] and Reg_FluxBB_PwdSynch($row['pwg_id'])) 730 if ($row['pwg_eml'] != $row['bb_eml'] and Reg_FluxBB_PwdSynch($row['pwg_id'])) // If passwords are synch 749 731 { 750 732 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']); 751 733 734 // Action : Synch users data from Piwigo to FluxBB 752 735 $msg_error_Synchro .= ' <a href="'; 753 754 $msg_error_Synchro .= add_url_params($page_Register_FluxBB_admin, array( 736 $msg_error_Synchro .= add_url_params(REGFLUXBB_ADMIN, array( 755 737 'action' => 'sync_user', 756 738 'username' => stripslashes($row['username']), 757 739 )); 758 759 740 $msg_error_Synchro .= '" title="'.l10n('Sync_User').stripslashes($row['username']).'"'; 760 761 741 $msg_error_Synchro .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 762 763 742 $msg_error_Synchro .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_refresh.png" alt="'.l10n('Sync_User').stripslashes($row['username']).'" /></a>'; 764 743 … … 767 746 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Pswd'); 768 747 } 769 elseif ($row['pwg_eml'] != $row['bb_eml'] and !Reg_FluxBB_PwdSynch($row['pwg_id'])) 748 elseif ($row['pwg_eml'] != $row['bb_eml'] and !Reg_FluxBB_PwdSynch($row['pwg_id'])) // If passwords are NOT synch 770 749 { 771 750 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']); 772 751 752 // Action : Synch users data from Piwigo to FluxBB 773 753 $msg_error_Synchro .= ' <a href="'; 774 775 $msg_error_Synchro .= add_url_params($page_Register_FluxBB_admin, array( 754 $msg_error_Synchro .= add_url_params(REGFLUXBB_ADMIN, array( 776 755 'action' => 'sync_user', 777 756 'username' => stripslashes($row['username']), 778 757 )); 779 780 758 $msg_error_Synchro .= '" title="'.l10n('Sync_User').stripslashes($row['username']).'"'; 781 782 759 $msg_error_Synchro .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 783 784 760 $msg_error_Synchro .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_refresh.png" alt="'.l10n('Sync_User').stripslashes($row['username']).'" /></a>'; 785 761 … … 789 765 { 790 766 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']); 791 792 767 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Pswd'); 793 768 } … … 797 772 } 798 773 774 // Display OK message or build errors 799 775 if ($msg_error_Synchro <> '') 800 776 $msg_error_Synchro = l10n('Audit_Synchro').$msg_error_Synchro; … … 807 783 808 784 785 // Check Piwigo accounts not in FluxBB 786 // ----------------------------------- 809 787 $query = ' 810 788 SELECT username, mail_address FROM '.USERS_TABLE.' … … 826 804 $msg_error_PWG2FluxBB .= '<br>'.l10n('Error_PWG2FluxBB').stripslashes($row['username']).' ('.$row['mail_address'].')'; 827 805 806 // Action : Add user to FluxBB 828 807 $msg_error_PWG2FluxBB .= ' <a href="'; 829 830 $msg_error_PWG2FluxBB .= add_url_params($page_Register_FluxBB_admin, array( 808 $msg_error_PWG2FluxBB .= add_url_params(REGFLUXBB_ADMIN, array( 831 809 'action' => 'add_user', 832 810 'username' => stripslashes($row['username']), 833 811 )); 834 835 812 $msg_error_PWG2FluxBB .= '" title="'.l10n('Add_User').stripslashes($row['username']).'" '; 836 837 813 $msg_error_PWG2FluxBB .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 838 839 814 $msg_error_PWG2FluxBB .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_add.png" alt="'.l10n('Add_User').stripslashes($row['username']).'" /></a>'; 840 815 } 841 816 817 // Display OK message or build errors 842 818 if ($msg_error_PWG2FluxBB == '') 843 819 array_push($page['infos'], l10n('Audit_PWG2FluxBB').'<br>'.l10n('Audit_OK')); … … 846 822 847 823 824 // Check FluxBB accounts not in Piwigo 825 // ----------------------------------- 848 826 $query = ' 849 827 SELECT id, username, email FROM '.FluxBB_USERS_TABLE.' … … 864 842 $msg_error_FluxBB2PWG .= '<br>'.l10n('Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')'; 865 843 844 // Action : Delete user from FluxBB 866 845 $msg_error_FluxBB2PWG .= ' <a href="'; 867 868 $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( 846 $msg_error_FluxBB2PWG .= add_url_params(REGFLUXBB_ADMIN, array( 869 847 'action' => 'del_user', 870 848 'id' => $row['id'], 871 849 )); 872 873 850 $msg_error_FluxBB2PWG .= '" title="'.l10n('Del_User').stripslashes($row['username']).'"'; 874 875 851 $msg_error_FluxBB2PWG .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 876 877 852 $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>'; 878 853 854 // Action : Add user from FluxBB to Piwigo 879 855 $msg_error_FluxBB2PWG .= ' <a href="'; 880 881 $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( 856 $msg_error_FluxBB2PWG .= add_url_params(REGFLUXBB_ADMIN, array( 882 857 'action' => 'add2pwg', 883 858 'id' => $row['id'], … … 893 868 } 894 869 870 // Display OK message or build errors 895 871 if ($msg_error_FluxBB2PWG == '') 896 872 array_push($page['infos'], l10n('Audit_FluxBB2PWG').'<br>'.l10n('Audit_OK')); … … 933 909 // | Audit actions process | 934 910 // +-----------------------------------------------------------------------+ 911 912 // Action : Delete dead link 913 // ------------------------- 935 914 if (isset($_GET['action']) and ($_GET['action']=='link_dead')) 936 915 { … … 951 930 Audit_PWG_FluxBB(); 952 931 } 932 // Action : Delete duplicate link 933 // ------------------------------ 953 934 else if (isset($_GET['action']) and ($_GET['action']=='link_del') and isset($_GET['pwg_id']) and isset($_GET['bb_id'])) 954 935 { … … 963 944 Audit_PWG_FluxBB(); 964 945 } 946 // Action : Rebuild link 947 // --------------------- 965 948 else if (isset($_GET['action']) and ($_GET['action']=='new_link') and isset($_GET['pwg_id']) and isset($_GET['bb_id'])) 966 949 { … … 969 952 Audit_PWG_FluxBB(); 970 953 } 954 // Action : Synch users data 955 // ------------------------- 971 956 else if (isset($_GET['action']) and ($_GET['action']=='sync_user') and isset($_GET['username'])) 972 957 { … … 988 973 Audit_PWG_FluxBB(); 989 974 } 975 // Action : Add user to FluxBB 976 // --------------------------- 990 977 else if (isset($_GET['action']) and ($_GET['action']=='add_user') and isset($_GET['username'])) 991 978 { … … 1005 992 Audit_PWG_FluxBB(); 1006 993 } 994 // Action : Delete user 995 // -------------------- 1007 996 else if (isset($_GET['action']) and ($_GET['action']=='del_user') and isset($_GET['id'])) 1008 997 { … … 1011 1000 Audit_PWG_FluxBB(); 1012 1001 } 1002 // Action : Add user to Piwigo 1003 // --------------------------- 1013 1004 else if (isset($_GET['action']) and ($_GET['action']=='add2pwg') and isset($_GET['id']) and isset($_GET['username']) and isset($_GET['email'])) 1014 1005 { 1015 $error = Synch_Piwigo_Adduser($_GET['id'], $_GET['username'], $_GET['email']); 1016 1017 if (!$error) 1018 Audit_PWG_FluxBB(); 1006 $emails_to_create = array(); 1007 $emails_rejected = array(); 1008 $emails_already_exist = array(); 1009 $emails_created = array(); 1010 $emails_on_error = array(); 1011 1012 $email = trim($_GET['email']); 1013 $username = $_GET['username']; 1014 $fluxbb_id = $_GET['id']; 1015 1016 // this test requires PHP 5.2+ 1017 if (filter_var($email, FILTER_VALIDATE_EMAIL) !== false) 1018 { 1019 $emails_to_check[] = $email; 1020 1021 if (!get_userid_by_email($email)) 1022 { 1023 $emails_to_create[] = $email; 1024 } 1025 else 1026 { 1027 $emails_existing[] = $email; 1028 } 1029 } 1030 elseif (!empty($email)) 1031 { 1032 $emails_rejected[] = $email; 1033 } 1034 1035 // find a password 1036 $password = generate_key(8); 1037 1038 $Piwigo_Adduser_Errors = Synch_Piwigo_Adduser($fluxbb_id, $username, $password, $email); 1039 1040 if (!empty($Piwigo_Adduser_Errors)) 1041 { 1042 $emails_on_error[] = $email; 1043 } 1019 1044 else 1020 $template->append('errors', l10n('RegFluxBB_Email_or_Username_already_exist')); 1045 { 1046 $emails_created[] = $email; 1047 } 1048 1049 $emails_for_form = array(); 1050 1051 if (!empty($emails_created)) 1052 { 1053 array_push( 1054 $page['infos'], 1055 sprintf( 1056 l10n('%d users registered'), 1057 count($emails_created) 1058 ) 1059 ); 1060 } 1061 1062 if (!empty($emails_on_error)) 1063 { 1064 array_push( 1065 $page['errors'], 1066 sprintf( 1067 l10n('%d registrations on error: %s'), 1068 count($emails_on_error), 1069 implode(', ', $emails_on_error) 1070 ) 1071 ); 1072 1073 $emails_for_form = array_merge($emails_for_form, $emails_on_error); 1074 } 1075 1076 if (!empty($emails_rejected)) 1077 { 1078 array_push( 1079 $page['errors'], 1080 sprintf( 1081 l10n('%d email addresses rejected: %s'), 1082 count($emails_rejected), 1083 implode(', ', $emails_rejected) 1084 ) 1085 ); 1086 1087 $emails_for_form = array_merge($emails_for_form, $emails_rejected); 1088 } 1089 1090 if (!empty($emails_existing)) 1091 { 1092 array_push( 1093 $page['warnings'], 1094 sprintf( 1095 l10n('%d email addresses already exist: %s'), 1096 count($emails_existing), 1097 implode(', ', $emails_existing) 1098 ) 1099 ); 1100 } 1021 1101 } 1022 1102 -
extensions/Register_FluxBB/changelog.txt.php
r22092 r22204 130 130 2.5.8 - Add accounts synchronization from FluxBB to Piwigo 131 131 - Bug fixed : Missing function in audit 132 133 2.5.9 - Bug fixed : Adding accounts from FluxBB to Piwigo was not working 134 // TODO: Compatibility with user_mass_register 132 135 */ 133 136 ?> -
extensions/Register_FluxBB/include/functions.inc.php
r22092 r22204 3 3 include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 4 4 include_once (REGFLUXBB_PATH.'include/constants.php'); 5 6 7 function Register_FluxBB_admin_menu($menu)8 {9 array_push($menu, array(10 'NAME' => 'Register FluxBB',11 'URL' => get_root_url().'admin.php?page=plugin-'.basename(REGFLUXBB_PATH)12 )13 );14 return $menu;15 }16 5 17 6 … … 65 54 66 55 /** 67 * Checks special users exclusion bef aore add new registered user in FluxBB user table56 * Checks special users exclusion before add new registered user in FluxBB user table 68 57 */ 69 58 function Register_FluxBB_Adduser($register_user) 70 59 { 71 60 global $errors, $conf; 72 73 // Exclusion of Adult_Content users 74 if ($register_user['username'] != "16" and $register_user['username'] != "18" )61 62 // Exclusion of Adult_Content users - //Todo: Compatibility with user_mass_register plugin 63 if ($register_user['username'] != "16" and $register_user['username'] != "18" /*and strpos(@$_GET['page'],'user_mass_register') === false*/) 75 64 { 76 65 FluxBB_Adduser($register_user['id'], $register_user['username'], sha1($_POST['password']), $register_user['email']); 77 66 } 67 /*elseif ($register_user['username'] != "16" and $register_user['username'] != "18" and strpos(@$_GET['page'],'user_mass_register') !== false) 68 { 69 //include_once(PHPWG_ROOT_PATH.'plugins/user_mass_register/admin.php'); 70 //FluxBB_Adduser($register_user['id'],$login, $password, $email); 71 }*/ 78 72 } 79 73 … … 643 637 * To solve password synch problem, passwords are reset to NULL to force users to get a new password on their profile page 644 638 * 645 * @return : $error 646 */ 647 function Synch_Piwigo_Adduser($fluxbb_id, $username, $email) 639 * Based on user_mass_register plugin (thx to plg!) 640 * 641 * @return : $errors 642 */ 643 function Synch_Piwigo_Adduser($fluxbb_id, $username, $password, $email) 648 644 { 649 645 global $conf; 650 646 load_language('plugin.lang', REGFLUXBB_PATH); 651 647 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)) 648 $errors = register_user($username, $password, $email, false); 649 650 if (empty($errors)) 660 651 { 661 652 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 662 653 663 654 $keyargs_content = array( 664 get_l10n_args('Hello %s,', $ login),655 get_l10n_args('Hello %s,', $username), 665 656 get_l10n_args('To synchronize your forum access with the gallery you have been registered at %s!', $conf['gallery_title']), 666 657 get_l10n_args('', ''), 667 658 get_l10n_args('Here are your connection settings', ''), 668 get_l10n_args('Username: %s', $ login),659 get_l10n_args('Username: %s', $username), 669 660 get_l10n_args('Password: %s', $password), 670 get_l10n_args('Email: %s', $ mail_address),661 get_l10n_args('Email: %s', $email), 671 662 get_l10n_args('', ''), 672 663 get_l10n_args('Please change your password at your first connexion on the gallery', ''), … … 676 667 677 668 pwg_mail( 678 $ mail_address,669 $email, 679 670 array( 680 671 'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'), … … 687 678 688 679 FluxBB_Linkuser($pwg_id, $fluxbb_id, "NOK"); 689 690 $error = false;691 680 } 692 } 693 else $error = true; 694 695 return $error; 681 682 return $errors; 696 683 } 697 684 -
extensions/Register_FluxBB/main.inc.php
r22091 r22204 11 11 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 12 12 13 if (!defined('REGFLUXBB_PATH')) define('REGFLUXBB_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 13 // +-----------------------------------------------------------------------+ 14 // | Define plugin constants | 15 // +-----------------------------------------------------------------------+ 16 17 defined('REGFLUXBB_ID') or define('REGFLUXBB_ID', basename(dirname(__FILE__))); 18 define('REGFLUXBB_PATH' , PHPWG_PLUGINS_PATH . REGFLUXBB_ID . '/'); 19 define('REGFLUXBB_ADMIN', get_root_url() . 'admin.php?page=plugin-' . REGFLUXBB_ID); 14 20 15 21 include_once (REGFLUXBB_PATH.'include/constants.php'); … … 18 24 load_language('plugin.lang', REGFLUXBB_PATH); 19 25 20 / * plugin administration */26 // admin plugins menu link 21 27 add_event_handler('get_admin_plugin_menu_links', 'Register_FluxBB_admin_menu'); 22 28 29 /** 30 * admin plugins menu link 31 */ 32 function Register_FluxBB_admin_menu($menu) 33 { 34 array_push( 35 $menu, 36 array( 37 'NAME' => 'Register FluxBB', 38 'URL' => REGFLUXBB_ADMIN, 39 ) 40 ); 23 41 24 /* user creation*/ 25 add_event_handler('register_user', 'Register_FluxBB_Adduser'); 42 return $menu; 43 } 44 45 46 /* user creation */ 47 if (strpos(@$_GET['page'],'Register_FluxBB') === false) // Exclude user creation from plugin panel to make FluxBB2Piwigo synch available 48 { 49 add_event_handler('register_user', 'Register_FluxBB_Adduser', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 50 } 26 51 27 52 28 53 // Check users registration 29 add_event_handler('register_user_check', 'Register_FluxBB_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 54 if (strpos(@$_GET['page'],'Register_FluxBB') === false) // Exclude user creation from plugin panel to make FluxBB2Piwigo synch available 55 { 56 add_event_handler('register_user_check', 'Register_FluxBB_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 57 } 30 58 31 59
Note: See TracChangeset
for help on using the changeset viewer.