Ignore:
Timestamp:
Apr 24, 2012, 9:18:13 PM (12 years ago)
Author:
Eric
Message:

Bug 2571 fixed - Piwigo 2.4 compliance : Information email removed on user registration because already managed by Piwigo
Bug 2619 fixed - Confirmation email when registered user changes his email was not sent and user not demoted

Merging from trunk to branch 2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserAdvManager/branches/2.40/include/functions.inc.php

    r13842 r14366  
    101101  {
    102102    $passwd = (isset($_POST['password'])) ? $_POST['password'] : '';
    103    
    104     if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
    105     {
    106       // This is to send an information email and set user to "waiting" group or status until admin validation
    107       // -----------------------------------------------------------------------------------------------------
    108       SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
     103
     104    if (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')
     105    {
     106      // This is to set user to "waiting" group or status and without ConfirMail until admin validation
     107      // ----------------------------------------------------------------------------------------------
    109108      SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation
    110     }
    111     elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
    112     {
    113       // This is to set user to "waiting" group or status until admin validation
    114       // -----------------------------------------------------------------------
    115       SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation
    116     }
    117     elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'false'))
    118     {
    119       // This is to send an information email without validation key
    120       // -----------------------------------------------------------
    121       SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false);
    122109    }
    123110    // Sending registration confirmation by email
    124111    // ------------------------------------------
    125     elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true' or $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
     112    elseif (isset($conf_UAM[1]) and $conf_UAM[1] == 'true')
    126113    {
    127114      if (is_admin() and isset($conf_UAM[19]) and $conf_UAM[19] == 'true')
     
    298285    }
    299286
    300     $typemail = 3;
     287    $typemail = 3; // Only information email send to user on user profile update if checked
    301288
    302289    if (!empty($_POST['use_new_pwd']))
    303290    {
    304       $typemail = 2;
     291      $typemail = 2; // Confirmation email on user profile update - With information email if checked
    305292
    306293      // Password enforcement control
     
    322309    // Sending registration confirmation by email
    323310    // ------------------------------------------
    324     if ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
     311    if (/*(isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or */(isset($conf_UAM[1]) and $conf_UAM[1] == 'true') or (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
    325312    {
    326313      $confirm_mail_need = false;
     
    339326        // ------------------------------------
    340327        if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'true'))
    341        
     328        {
     329          SetPermission($user['id']);// Set to "waiting" group or status until user validation
    342330          $confirm_mail_need = true;
     331        }
    343332
    344333        // This is to set the user to "waiting" group or status until admin validation
    345334        // ---------------------------------------------------------------------------
    346         if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
    347        
     335        elseif ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local'))
     336        {
    348337          SetPermission($user['id']);// Set to "waiting" group or status until admin validation
    349338          $confirm_mail_need = false;
     339        }       
    350340      }
    351341       
    352       if ((!empty($_POST['use_new_pwd']) and (isset($conf_UAM[0]) and $conf_UAM[0] == 'true') or $confirm_mail_need))
     342      if (((!empty($_POST['use_new_pwd']) and (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')) or $confirm_mail_need))
    353343      {
    354344        $query = '
     
    925915  switch($typemail)
    926916  {
    927     case 1:
     917    case 1: // Confirmation email on user registration - Without information email (already managed by Piwigo)
    928918      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Add of %s', stripslashes($username)));
     919
     920      break;
     921     
     922    case 2: // Confirmation email on user profile update - With information email if checked
     923      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
    929924      $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
    930      
     925
    931926      if (isset($conf_UAM[8]) and $conf_UAM[8] <> '')
    932927      {
     
    946941        else $infos1_perso = l10n(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n";
    947942      }
    948      
    949       break;
    950      
    951     case 2:
    952       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
    953       $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
     943
     944      if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
     945      {
     946        if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
     947        {
     948          $infos1 = array(
     949            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
     950            get_l10n_args('UAM_User: %s', stripslashes($username)),
     951            get_l10n_args('UAM_Password: %s', $password),
     952            get_l10n_args('Email: %s', $email),
     953            get_l10n_args('', ''),
     954          );
     955        }
     956        else // Do not allow display of clear password in email
     957        {
     958          $infos1 = array(
     959            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
     960            get_l10n_args('UAM_User: %s', stripslashes($username)),
     961            get_l10n_args('Email: %s', $email),
     962            get_l10n_args('', ''),
     963          );
     964        }
     965      }
    954966
    955967      break;
    956968       
    957     case 3:
     969    case 3: // Only information email send to user if checked
    958970      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
    959971      $password = $password <> '' ? $password : l10n('UAM_no_update_pwd');
    960972
     973      if (isset($conf_UAM[8]) and $conf_UAM[8] <> '')
     974      {
     975        // Management of Extension flags ([username], [mygallery], [myurl])
     976        // ----------------------------------------------------------------
     977        $patterns[] = '#\[username\]#i';
     978        $replacements[] = $username;
     979        $patterns[] = '#\[mygallery\]#i';
     980        $replacements[] = $conf['gallery_title'];
     981        $patterns[] = '#\[myurl\]#i';
     982        $replacements[] = $conf['gallery_url'];
     983   
     984        if (function_exists('get_user_language_desc'))
     985        {
     986          $infos1_perso = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n";
     987        }
     988        else $infos1_perso = l10n(preg_replace($patterns, $replacements, $conf_UAM[8]))."\n\n";
     989      }
     990
     991      if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
     992      {
     993        if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
     994        {
     995          $infos1 = array(
     996            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
     997            get_l10n_args('UAM_User: %s', stripslashes($username)),
     998            get_l10n_args('UAM_Password: %s', $password),
     999            get_l10n_args('Email: %s', $email),
     1000            get_l10n_args('', ''),
     1001          );
     1002        }
     1003        else // Do not allow display of clear password in email
     1004        {
     1005          $infos1 = array(
     1006            get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
     1007            get_l10n_args('UAM_User: %s', stripslashes($username)),
     1008            get_l10n_args('Email: %s', $email),
     1009            get_l10n_args('', ''),
     1010          );
     1011        }
     1012      }
     1013
    9611014      break;
    962   }
    963 
    964   if (isset($conf_UAM[0]) and $conf_UAM[0] == 'true')
    965   {
    966     if (isset($conf_UAM[34]) and $conf_UAM[34] == 'true') // Allow display of clear password in email
    967     {
    968       $infos1 = array(
    969         get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
    970         get_l10n_args('UAM_User: %s', stripslashes($username)),
    971         get_l10n_args('UAM_Password: %s', $password),
    972         get_l10n_args('Email: %s', $email),
    973         get_l10n_args('', ''),
    974       );
    975     }
    976     else // Do not allow display of clear password in email
    977     {
    978       $infos1 = array(
    979         get_l10n_args('UAM_infos_mail %s', stripslashes($username)),
    980         get_l10n_args('UAM_User: %s', stripslashes($username)),
    981         get_l10n_args('Email: %s', $email),
    982         get_l10n_args('', ''),
    983       );
    984     }
    9851015  }
    9861016
     
    10181048  }
    10191049
    1020 // ********************************************************
    1021 // **** Pending code since to find how to make it work ****
    1022 // ********************************************************
    1023 // Testing if FCK Editor is used. Then decoding htmlchars to avoid problems with pwg_mail()
    1024 /*$areas = array();
    1025 array_push( $areas,'UAM_MailInfo_Text','UAM_ConfirmMail_Text');
    1026 
    1027 if (function_exists('set_fckeditor_instance'))
    1028 {
    1029   $fcke_config = unserialize($conf['FCKEditor']);
    1030   foreach($areas as $area)
    1031   {
    1032     if (isset($fcke_config['UAM_MailInfo_Text']) and $fcke_config['UAM_MailInfo_Text'] = true)
    1033     {
    1034       $infos1_perso = html_entity_decode($infos1_perso,ENT_QUOTES,UTF-8);
    1035     }
    1036    
    1037     if (isset($fcke_config['UAM_ConfirmMail_Text']) and $fcke_config['UAM_ConfirmMail_Text'] = true)
    1038     {
    1039       $infos2_perso = html_entity_decode($infos2_perso,ENT_QUOTES,UTF-8);
    1040     }
    1041   }
    1042 }*/
    1043 
    1044 
    10451050// Sending the email with subject and contents
    10461051// -------------------------------------------
     
    10901095  switch($typemail)
    10911096  {
    1092     case 1:
     1097    case 1: //Generating email content for remind with a new key
    10931098      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_with_key_of_%s', $username));
    10941099     
     
    11341139                break;
    11351140     
    1136     case 2:
     1141    case 2: //Generating email content for remind without a new key
    11371142      $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_without_key_of_%s',$username));
    11381143     
Note: See TracChangeset for help on using the changeset viewer.