Changeset 26914
- Timestamp:
- Jan 22, 2014, 11:35:07 PM (10 years ago)
- Location:
- extensions/UserAdvManager/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserAdvManager/trunk/admin/UAM_admin.php
r25745 r26914 169 169 $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); 170 170 171 if (((isset($conf_UAM[' 1']) and ($conf_UAM['1'] == 'false' or $conf_UAM['1'] == 'local')) or ($_POST['UAM_Confirm_Mail'] == 'false' or $_POST['UAM_Confirm_Mail'] == 'local')) and $_POST['UAM_GTAutoMail'] == 'true')171 if (((isset($conf_UAM['CONFIRM_MAIL']) and ($conf_UAM['CONFIRM_MAIL'] == 'false' or $conf_UAM['CONFIRM_MAIL'] == 'local')) or ($_POST['UAM_Confirm_Mail'] == 'false' or $_POST['UAM_Confirm_Mail'] == 'local')) and $_POST['UAM_GTAutoMail'] == 'true') 172 172 { 173 173 $newvalue = 'false'; -
extensions/UserAdvManager/trunk/include/functions.inc.php
r26077 r26914 287 287 } 288 288 289 $typemail = 3; // Only information email send to user on user profile update if checked290 291 if (!empty($_POST['use_new_pwd']))292 {293 $typemail = 2; // Confirmation email on user profile update - With information email294 }295 296 289 // Sending registration confirmation by email 297 290 // ------------------------------------------ … … 310 303 list($current_email) = pwg_db_fetch_row(pwg_query($query)); 311 304 312 // This is to se nd a new validation key313 // ------------------------------------ 314 if ($_POST['mail_address'] != $current_email and (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'true'))305 // This is to set the user to "waiting" group or status until validation 306 // --------------------------------------------------------------------- 307 if ($_POST['mail_address'] != $current_email and (isset($conf_UAM['CONFIRM_MAIL']) and ($conf_UAM['CONFIRM_MAIL'] == 'true' or $conf_UAM['CONFIRM_MAIL'] == 'local'))) 315 308 { 316 309 SetPermission($user['id']);// Set to "waiting" group or status until user validation … … 318 311 $confirm_mail_need = true; 319 312 } 320 321 // This is to set the user to "waiting" group or status until admin validation 322 // --------------------------------------------------------------------------- 323 elseif ($_POST['mail_address'] != $current_email and (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local')) 313 else 324 314 { 325 SetPermission($user['id']);// Set to "waiting" group or status until admin validation326 SetUnvalidated($user['id']); // Set UAM_validated field to false in #_users table327 315 $confirm_mail_need = false; 328 } 329 } 330 331 if (((!empty($_POST['use_new_pwd']) and (isset($conf_UAM['MAIL_INFO']) and $conf_UAM['MAIL_INFO'] == 'true')) or $confirm_mail_need)) 316 } 317 } 318 319 $typemail = 2; 320 321 // Send email 322 if ((isset($conf_UAM['MAIL_INFO']) and $conf_UAM['MAIL_INFO'] == 'true') or $confirm_mail_need) 332 323 { 333 324 $query = ' … … 338 329 339 330 list($username) = pwg_db_fetch_row(pwg_query($query)); 331 340 332 SendMail2User($typemail, $user['id'], $username, $_POST['use_new_pwd'], $_POST['mail_address'], $confirm_mail_need); 341 333 } … … 1109 1101 break; 1110 1102 1111 case 2: // Confirmation email on user profile update - With information email if modification done in user profile1112 if (isset($conf_UAM[' CONFIRMMAIL_SUBJECT']) and !empty($conf_UAM['CONFIRMMAIL_SUBJECT']))1103 case 2: // Confirmation email on user profile update - Information email if modification done in user profile 1104 if (isset($conf_UAM['INFOMAIL_SUBJECT']) and !empty($conf_UAM['INFOMAIL_SUBJECT'])) 1113 1105 { 1114 1106 // Management of Extension flags ([username], [mygallery]) … … 1121 1113 if (function_exists('get_user_language_desc')) 1122 1114 { 1123 $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[' CONFIRMMAIL_SUBJECT']))."\n\n";1115 $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM['INFOMAIL_SUBJECT']))."\n\n"; 1124 1116 } 1125 else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[' CONFIRMMAIL_SUBJECT']))."\n\n";1126 } 1127 1128 $password = !empty($password) ? $password : l10n('UAM_ empty_pwd');1117 else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM['INFOMAIL_SUBJECT']))."\n\n"; 1118 } 1119 1120 $password = !empty($password) ? $password : l10n('UAM_no_update_pwd'); 1129 1121 1130 1122 if (isset($conf_UAM['MAILINFO_TEXT']) and !empty($conf_UAM['MAILINFO_TEXT'])) … … 1170 1162 1171 1163 break; 1172 1173 case 3: // Only information email send to user if checked1174 if (isset($conf_UAM['INFOMAIL_SUBJECT']) and !empty($conf_UAM['INFOMAIL_SUBJECT']))1175 {1176 // Management of Extension flags ([username], [mygallery])1177 // -------------------------------------------------------1178 $patterns[] = '#\[username\]#i';1179 $replacements[] = $username;1180 $patterns[] = '#\[mygallery\]#i';1181 $replacements[] = $conf['gallery_title'];1182 1183 if (function_exists('get_user_language_desc'))1184 {1185 $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM['INFOMAIL_SUBJECT']))."\n\n";1186 }1187 else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM['INFOMAIL_SUBJECT']))."\n\n";1188 }1189 1190 $password = !empty($password) ? $password : l10n('UAM_no_update_pwd');1191 1192 if (isset($conf_UAM['MAILINFO_TEXT']) and !empty($conf_UAM['MAILINFO_TEXT']))1193 {1194 // Management of Extension flags ([username], [mygallery], [myurl])1195 // ----------------------------------------------------------------1196 $patterns[] = '#\[username\]#i';1197 $replacements[] = $username;1198 $patterns[] = '#\[mygallery\]#i';1199 $replacements[] = $conf['gallery_title'];1200 $patterns[] = '#\[myurl\]#i';1201 $replacements[] = get_gallery_home_url();1202 1203 if (function_exists('get_user_language_desc'))1204 {1205 $infos1_perso = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM['MAILINFO_TEXT']))."\n\n";1206 }1207 else $infos1_perso = l10n(preg_replace($patterns, $replacements, $conf_UAM['MAILINFO_TEXT']))."\n\n";1208 }1209 1210 if (isset($conf_UAM['MAIL_INFO']) and $conf_UAM['MAIL_INFO'] == 'true')1211 {1212 if (isset($conf_UAM['HIDEPASSW']) and $conf_UAM['HIDEPASSW'] == 'true') // Allow display of clear password in email1213 {1214 $infos1 = array(1215 get_l10n_args('UAM_infos_mail %s', stripslashes($username)),1216 get_l10n_args('UAM_User: %s', stripslashes($username)),1217 get_l10n_args('UAM_Password: %s', $password),1218 get_l10n_args('Email: %s', $email),1219 get_l10n_args('', ''),1220 );1221 }1222 else // Do not allow display of clear password in email1223 {1224 $infos1 = array(1225 get_l10n_args('UAM_infos_mail %s', stripslashes($username)),1226 get_l10n_args('UAM_User: %s', stripslashes($username)),1227 get_l10n_args('Email: %s', $email),1228 get_l10n_args('', ''),1229 );1230 }1231 }1232 1233 break;1234 1164 } 1235 1165 … … 1266 1196 } 1267 1197 1198 1268 1199 // Sending the email with subject and contents 1269 1200 // ------------------------------------------- 1270 if ((isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local') and $confirm) 1271 { 1201 1202 if ((isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local') and $confirm) // Confirmation email send to admins 1203 { 1272 1204 switch_lang_to(get_default_language()); 1273 1205 1274 1275 $subject= get_l10n_args('UAM_Subject admin validation for %s',$username);1276 1277 $content= array(1278 1279 get_l10n_args('', ''),1280 get_l10n_args('UAM_Link: %s', AddConfirmMail($id, $email)),1206 load_language('plugin.lang', UAM_PATH); 1207 $subject_admin = get_l10n_args('UAM_Subject admin validation for %s',$username); 1208 1209 $content_admin = array( 1210 get_l10n_args('UAM_Manual_validation_needed_for %s', stripslashes($username)), 1211 get_l10n_args('', ''), 1212 get_l10n_args('UAM_Link: %s', AddConfirmMail($id, $email)), 1281 1213 ); 1282 1214 1283 //UAM_mail_notification_admins($subject, $content); 1284 pwg_mail_notification_admins($subject, $content, true); 1285 } 1286 elseif ((isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'true') and $confirm) 1215 pwg_mail_notification_admins($subject_admin, $content_admin, true); 1216 } 1217 1218 1219 if (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'true' and $confirm) // Confirmation email send to users 1287 1220 { 1288 1221 // Adding gallery URL at the end of the email 1289 1222 if (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'true') 1290 1223 { 1291 $content = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url();1224 $content_confirmation = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(); 1292 1225 1293 1226 pwg_mail( … … 1297 1230 ), 1298 1231 array( 1299 'content' => $content ,1232 'content' => $content_confirmation, 1300 1233 'content_format' => 'text/plain', 1301 1234 'subject' => $subject, … … 1306 1239 elseif (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'false') 1307 1240 { 1308 $content = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "");1241 $content_confirmation = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""); 1309 1242 1310 1243 pwg_mail( … … 1314 1247 ), 1315 1248 array( 1316 'content' => $content ,1249 'content' => $content_confirmation, 1317 1250 'content_format' => 'text/plain', 1318 1251 'subject' => $subject, … … 1323 1256 else 1324 1257 { 1325 $content = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "");1258 $content_confirmation = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""); 1326 1259 1327 1260 pwg_mail( … … 1331 1264 ), 1332 1265 array( 1333 'content' => $content, 1266 'content' => $content_confirmation, 1267 'content_format' => 'text/plain', 1268 'subject' => $subject, 1269 ) 1270 ); 1271 } 1272 } 1273 1274 1275 if (isset($conf_UAM['MAIL_INFO']) and $conf_UAM['MAIL_INFO'] == 'true') // Information email send to users 1276 { 1277 // Adding gallery URL at the end of the email 1278 if (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'true') 1279 { 1280 $content_info = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(); 1281 1282 pwg_mail( 1283 array( 1284 'name' => stripslashes($username), 1285 'email' => $email, 1286 ), 1287 array( 1288 'content' => $content_info, 1289 'content_format' => 'text/plain', 1290 'subject' => $subject, 1291 ) 1292 ); 1293 } 1294 // Do not add gallery URL at the end of the email 1295 elseif (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'false') 1296 { 1297 $content_info = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""); 1298 1299 pwg_mail( 1300 array( 1301 'name' => stripslashes($username), 1302 'email' => $email, 1303 ), 1304 array( 1305 'content' => $content_info, 1306 'content_format' => 'text/plain', 1307 'subject' => $subject, 1308 ) 1309 ); 1310 } 1311 // By default do not add gallery URL at the end of the email 1312 else 1313 { 1314 $content_info = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""); 1315 1316 pwg_mail( 1317 array( 1318 'name' => stripslashes($username), 1319 'email' => $email, 1320 ), 1321 array( 1322 'content' => $content_info, 1334 1323 'content_format' => 'text/plain', 1335 1324 'subject' => $subject,
Note: See TracChangeset
for help on using the changeset viewer.