Changeset 21084 for extensions/UserAdvManager/trunk
- Timestamp:
- Mar 1, 2013, 2:19:59 PM (12 years ago)
- Location:
- extensions/UserAdvManager/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserAdvManager/trunk/changelog.txt.php
r21075 r21084 378 378 -- 2.50.0 : Compliance with Piwigo 2.5 379 379 Bug 2764 fixed - Code refactory : Change config variables to assoc array and $_POST vars control before writing conf in database - Thx to flop25 for his advices ;-) 380 Bug 2829 fixed - Workflow refactory if confirmation of registrations are done by admins : 381 - Admins add manually user *and* confirmation of registration for admins is set to OFF -> new added users are considered automatically as validated. 382 - Admins add manually user *and* confirmation of registration for admins is set to ON -> new added users receive the confirmation email. 383 - Finally, if a user registers himself, admins receive the validation link. 380 384 Update fr_FR 381 385 Update de_DE, thanks to : stephy -
extensions/UserAdvManager/trunk/include/functions.inc.php
r21075 r21084 137 137 $passwd = (isset($_POST['password'])) ? $_POST['password'] : ''; 138 138 139 // No validation needed when admins add users - users are considered as valid by default 140 // ------------------------------------------------------------------------------------- 141 //Bug 2829 fix not working - if (isset($page['page']) and ($page['page'] != 'user_list')) 142 //{ 143 if (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local') 144 { 145 // This is to set user to "waiting" group or status and without ConfirMail until admin validation 146 // ---------------------------------------------------------------------------------------------- 147 SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation 148 149 // This is to set UAM_validated field to false in #_users table - Usefull if no "waiting" group or status is set 150 // ------------------------------------------------------------------------------------------------------------- 151 SetUnvalidated($register_user['id']); 152 153 // This is to send the validation key by email to admins for their manual validation without having to connect the gallery 154 // ----------------------------------------------------------------------------------------------------------------------- 139 // -------------------------------------------------------------------------------------------------------------------- 140 // Workflow when admins have to validate registrations (CONFIRM_MAIL = local) 141 // No validation needed when admins add users if ADMINCONFMAIL is set to OFF - users are considered as valid by default 142 // Else a notification email with validation link is send to admins 143 // Finally when a user registers himself, a notification email with validation link is send to admins 144 // -------------------------------------------------------------------------------------------------------------------- 145 if (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local') 146 { 147 if (is_admin() and isset($conf_UAM['ADMINCONFMAIL']) and $conf_UAM['ADMINCONFMAIL'] == 'true') 148 { 149 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 150 } 151 elseif (is_admin() and isset($conf_UAM['ADMINCONFMAIL']) and $conf_UAM['ADMINCONFMAIL'] == 'false') 152 { 153 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false); 154 } 155 elseif (!is_admin()) 156 { 155 157 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 156 158 } 157 // Sending registration confirmation by email 158 // ------------------------------------------ 159 elseif (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'true') 160 { 161 if (is_admin() and isset($conf_UAM['ADMINCONFMAIL']) and $conf_UAM['ADMINCONFMAIL'] == 'true') 162 { 163 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 164 } 165 elseif (is_admin() and isset($conf_UAM['ADMINCONFMAIL']) and $conf_UAM['ADMINCONFMAIL'] == 'false') 166 { 167 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false); 168 } 169 elseif (!is_admin()) 170 { 171 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 172 } 173 } 174 //} 159 } 160 // -------------------------------------------------------------------------------------------------------------------- 161 // Workflow when users have to validate their registration (CONFIRM_MAIL = true) 162 // No validation needed when admins add users if ADMINCONFMAIL is set to OFF - users are considered as valid by default 163 // Else an email with validation link is send to user 164 // Finally when a user registers himself, an email with validation link is send to him 165 // -------------------------------------------------------------------------------------------------------------------- 166 elseif (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'true') 167 { 168 if (is_admin() and isset($conf_UAM['ADMINCONFMAIL']) and $conf_UAM['ADMINCONFMAIL'] == 'true') 169 { 170 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 171 } 172 elseif (is_admin() and isset($conf_UAM['ADMINCONFMAIL']) and $conf_UAM['ADMINCONFMAIL'] == 'false') 173 { 174 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false); 175 } 176 elseif (!is_admin()) 177 { 178 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], true); 179 } 180 } 175 181 } 176 182 } … … 1305 1311 } 1306 1312 1307 if ( isset($conf_UAM['CONFIRM_MAIL']) and ($conf_UAM['CONFIRM_MAIL'] == 'true' or $conf_UAM['CONFIRM_MAIL'] == 'local')and $confirm) // Add confirmation link ?1313 if ((isset($conf_UAM['CONFIRM_MAIL']) and ($conf_UAM['CONFIRM_MAIL'] == 'true' or $conf_UAM['CONFIRM_MAIL'] == 'local')) and $confirm) // Add confirmation link ? 1308 1314 { 1309 1315 $infos2 = array( … … 1339 1345 // Sending the email with subject and contents 1340 1346 // ------------------------------------------- 1341 if (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local')1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 else1357 1358 1359 1360 1361 1362 1347 if ((isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local') and $confirm) 1348 { 1349 switch_lang_to(get_default_language()); 1350 1351 load_language('plugin.lang', UAM_PATH); 1352 $subject = get_l10n_args('UAM_Subject admin validation for %s',$username); 1353 1354 $content = array( 1355 get_l10n_args('UAM_Manual_validation_needed_for %s', stripslashes($username)), 1356 get_l10n_args('', ''), 1357 get_l10n_args('UAM_Link: %s', AddConfirmMail($id, $email)), 1358 ); 1359 1360 UAM_mail_notification_admins($subject, $content); 1361 } 1362 elseif ((isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'true') and $confirm) 1363 { 1364 pwg_mail($email, array( 1365 'subject' => $subject, 1366 'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(), 1367 )); 1368 } 1363 1369 // Switching back to default language 1364 1370 // ---------------------------------- … … 1392 1398 $query = ' 1393 1399 SELECT 1394 u. '.$conf['user_fields']['username'].'AS username,1395 u. '.$conf['user_fields']['email'].'AS mail_address1400 u.username AS username, 1401 u.mail_address AS mail_address 1396 1402 FROM '.USERS_TABLE.' AS u 1397 JOIN '.USER_INFOS_TABLE.' AS i ON i.user_id = u.'.$conf['user_fields']['id'].'1403 JOIN '.USER_INFOS_TABLE.' AS i ON i.user_id = id 1398 1404 WHERE i.status in (\'webmaster\', \'admin\') 1399 AND '.$conf['user_fields']['email'].'IS NOT NULL1400 AND i.user_id <> '.$user['id'].'1405 AND mail_address IS NOT NULL 1406 AND i.user_id = id 1401 1407 ORDER BY username 1402 1408 ;'; … … 1930 1936 if (isset($Confirm_Mail_ID)) 1931 1937 { 1932 $query = ' 1933 SELECT status 1934 FROM '.USER_INFOS_TABLE.' 1935 WHERE user_id = '.$user_id.' 1936 ;'; 1937 list($status) = pwg_db_fetch_row(pwg_query($query)); 1938 1939 $query = ' 1940 INSERT INTO '.USER_CONFIRM_MAIL_TABLE.' 1941 (id, user_id, mail_address, status, date_check) 1942 VALUES 1943 ("'.$Confirm_Mail_ID.'", '.$user_id.', "'.$email.'", "'.$status.'", null) 1944 ;'; 1945 1946 pwg_query($query); 1947 1948 // Delete user from all groups 1949 // --------------------------- 1950 $query = ' 1951 DELETE FROM '.USER_GROUP_TABLE.' 1952 WHERE user_id = '.$user_id.' 1953 AND ( 1954 group_id = '.$conf_UAM['NO_CONFIRM_GROUP'].' 1955 OR 1956 group_id = '.$conf_UAM['VALIDATED_GROUP'].' 1957 ) 1958 ;'; 1959 1960 pwg_query($query); 1961 1962 // Set user unvalidated status 1963 // --------------------------- 1964 if (!is_admin() and $conf_UAM['NO_CONFIRM_STATUS'] <> -1) 1965 { 1966 $query = ' 1967 UPDATE '.USER_INFOS_TABLE.' 1968 SET status = "'.$conf_UAM['NO_CONFIRM_STATUS'].'" 1969 WHERE user_id = '.$user_id.' 1970 ;'; 1971 1972 pwg_query($query); 1973 } 1974 1975 // Set user unvalidated group 1976 // -------------------------- 1977 if (!is_admin() and $conf_UAM['NO_CONFIRM_GROUP'] <> -1) 1978 { 1979 $query = ' 1980 INSERT INTO '.USER_GROUP_TABLE.' 1981 (user_id, group_id) 1982 VALUES 1983 ('.$user_id.', '.$conf_UAM['NO_CONFIRM_GROUP'].') 1984 ;'; 1985 1986 pwg_query($query); 1987 } 1988 1989 // Set user unvalidated privacy level 1990 // ---------------------------------- 1991 if (!is_admin() and $conf_UAM['NO_VALID_LEVEL'] <> -1) 1992 { 1993 $query = ' 1994 UPDATE '.USER_INFOS_TABLE.' 1995 SET level = "'.$conf_UAM['NO_VALID_LEVEL'].'" 1996 WHERE user_id = '.$user_id.' 1997 ;'; 1998 1999 pwg_query($query); 2000 } 1938 // Set user permissions 1939 // -------------------- 1940 SetPermission($user_id); 2001 1941 2002 1942 // Set UAM_validated field to false in #_users table … … 2004 1944 SetUnvalidated($user_id); 2005 1945 2006 if ( $conf['guest_access'])1946 if ($conf['guest_access']) 2007 1947 { 2008 1948 return(get_absolute_root_url().'?key='.$Confirm_Mail_ID.'&userid='.$user_id); … … 2043 1983 pwg_query($query); 2044 1984 2045 if ( !is_admin() and$conf_UAM['NO_CONFIRM_STATUS'] <> -1) // Set status1985 if ($conf_UAM['NO_CONFIRM_STATUS'] <> -1) // Set status 2046 1986 { 2047 1987 $query = ' … … 2054 1994 } 2055 1995 2056 if ( !is_admin() and$conf_UAM['NO_CONFIRM_GROUP'] <> -1) // Set group1996 if ($conf_UAM['NO_CONFIRM_GROUP'] <> -1) // Set group 2057 1997 { 2058 1998 $query = ' … … 2066 2006 } 2067 2007 2068 if ( !is_admin() and$conf_UAM['NO_VALID_LEVEL'] <> -1) // Set privacy level2008 if ($conf_UAM['NO_VALID_LEVEL'] <> -1) // Set privacy level 2069 2009 { 2070 2010 $query = '
Note: See TracChangeset
for help on using the changeset viewer.