Ignore:
Timestamp:
May 3, 2012, 9:51:12 PM (12 years ago)
Author:
Eric
Message:

Bug 2623 fixed - Ability to customize email subjects (confirmation, information and ghostTracker email)

File:
1 edited

Legend:

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

    r14651 r14729  
    856856  {
    857857    // Management of Extension flags ([mygallery], [myurl])
    858     //$patterns[] = '#\[username\]#i';
    859     //$replacements[] = stripslashes($row['username']);
    860858    $patterns[] = '#\[mygallery\]#i';
    861859    $replacements[] = $conf['gallery_title'];
     
    885883        $infos1_perso = "";
    886884  $infos2_perso = "";
     885  $subject = "";
    887886
    888887// We have to get the user's language in database
     
    916915  {
    917916    case 1: // Confirmation email on user registration - Without information email (already managed by Piwigo)
    918       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Add of %s', stripslashes($username)));
     917      if (isset($conf_UAM[41]) and $conf_UAM[41] <> '')
     918      {
     919        // Management of Extension flags ([username], [mygallery])
     920        // -------------------------------------------------------
     921        $patterns[] = '#\[username\]#i';
     922        $replacements[] = $username;
     923        $patterns[] = '#\[mygallery\]#i';
     924        $replacements[] = $conf['gallery_title'];
     925   
     926        if (function_exists('get_user_language_desc'))
     927        {
     928          $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[41]))."\n\n";
     929        }
     930        else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[41]))."\n\n";
     931      }
    919932
    920933      break;
    921934     
    922935    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)));
     936      if (isset($conf_UAM[41]) and $conf_UAM[41] <> '')
     937      {
     938        // Management of Extension flags ([username], [mygallery])
     939        // -------------------------------------------------------
     940        $patterns[] = '#\[username\]#i';
     941        $replacements[] = $username;
     942        $patterns[] = '#\[mygallery\]#i';
     943        $replacements[] = $conf['gallery_title'];
     944   
     945        if (function_exists('get_user_language_desc'))
     946        {
     947          $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[41]))."\n\n";
     948        }
     949        else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[41]))."\n\n";
     950      }
     951
    924952      $password = $password <> '' ? $password : l10n('UAM_empty_pwd');
    925953
     
    968996       
    969997    case 3: // Only information email send to user if checked
    970       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Update of %s', stripslashes($username)));
     998      if (isset($conf_UAM[43]) and $conf_UAM[43] <> '')
     999      {
     1000        // Management of Extension flags ([username], [mygallery])
     1001        // -------------------------------------------------------
     1002        $patterns[] = '#\[username\]#i';
     1003        $replacements[] = $username;
     1004        $patterns[] = '#\[mygallery\]#i';
     1005        $replacements[] = $conf['gallery_title'];
     1006   
     1007        if (function_exists('get_user_language_desc'))
     1008        {
     1009          $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[43]))."\n\n";
     1010        }
     1011        else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[43]))."\n\n";
     1012      }
     1013
    9711014      $password = $password <> '' ? $password : l10n('UAM_no_update_pwd');
    9721015
     
    10701113{
    10711114  global $conf;
     1115 
     1116  $subject = "";
    10721117
    10731118  $conf_UAM = unserialize($conf['UserAdvManager']);
     
    10961141  {
    10971142    case 1: //Generating email content for remind with a new key
    1098       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_with_key_of_%s', $username));
     1143      if (isset($conf_UAM[42]) and $conf_UAM[42] <> '')
     1144      {
     1145        // Management of Extension flags ([username], [mygallery])
     1146        // -------------------------------------------------------
     1147        $patterns[] = '#\[username\]#i';
     1148        $replacements[] = $username;
     1149        $patterns[] = '#\[mygallery\]#i';
     1150        $replacements[] = $conf['gallery_title'];
     1151   
     1152        if (function_exists('get_user_language_desc'))
     1153        {
     1154          $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
     1155        }
     1156        else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
     1157      }
    10991158     
    11001159      if (isset($conf_UAM_ConfirmMail[2]) and $conf_UAM_ConfirmMail[2] <> '' and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and $confirm)
     
    11401199     
    11411200    case 2: //Generating email content for remind without a new key
    1142       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Reminder_without_key_of_%s',$username));
     1201      if (isset($conf_UAM[42]) and $conf_UAM[42] <> '')
     1202      {
     1203        // Management of Extension flags ([username], [mygallery])
     1204        // -------------------------------------------------------
     1205        $patterns[] = '#\[username\]#i';
     1206        $replacements[] = $username;
     1207        $patterns[] = '#\[mygallery\]#i';
     1208        $replacements[] = $conf['gallery_title'];
     1209   
     1210        if (function_exists('get_user_language_desc'))
     1211        {
     1212          $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
     1213        }
     1214        else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[42]))."\n\n";
     1215      }
    11431216     
    11441217      if (isset($conf_UAM_ConfirmMail[4]) and $conf_UAM_ConfirmMail[4] <> '' and isset($conf_UAM_ConfirmMail[3]) and $conf_UAM_ConfirmMail[3] == 'true' and !$confirm)
     
    12001273
    12011274  $conf_UAM = unserialize($conf['UserAdvManager']);
     1275  $subject = "";
    12021276 
    12031277        include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    1204  
    1205         $infos1_perso = "";
    12061278
    12071279// We have to get the user's language in database
     
    12201292   
    12211293  load_language('plugin.lang', UAM_PATH);
    1222  
    1223   $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Ghost_reminder_of_%s', $username));     
     1294
     1295  if (isset($conf_UAM[45]) and $conf_UAM[45] <> '')
     1296  {
     1297    // Management of Extension flags ([username], [mygallery])
     1298    // -------------------------------------------------------
     1299    $patterns[] = '#\[username\]#i';
     1300    $replacements[] = $username;
     1301    $patterns[] = '#\[mygallery\]#i';
     1302    $replacements[] = $conf['gallery_title'];
     1303
     1304    if (function_exists('get_user_language_desc'))
     1305    {
     1306      $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[45]))."\n\n";
     1307    }
     1308    else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[45]))."\n\n";
     1309  }
    12241310
    12251311  if (isset($conf_UAM[17]) and $conf_UAM[17] <> '' and isset($conf_UAM[15]) and $conf_UAM[15] == 'true')
     
    12741360 
    12751361        $custom_txt = "";
     1362  $subject = "";
    12761363
    12771364// We have to get the user's language in database
     
    13021389  }
    13031390
    1304   $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Demotion of %s', stripslashes($username)));
     1391  if (isset($conf_UAM[44]) and $conf_UAM[44] <> '')
     1392  {
     1393    // Management of Extension flags ([username], [mygallery])
     1394    // -------------------------------------------------------
     1395    $patterns[] = '#\[username\]#i';
     1396    $replacements[] = $username;
     1397    $patterns[] = '#\[mygallery\]#i';
     1398    $replacements[] = $conf['gallery_title'];
     1399
     1400    if (function_exists('get_user_language_desc'))
     1401    {
     1402      $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[44]))."\n\n";
     1403    }
     1404    else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[44]))."\n\n";
     1405  }
    13051406     
    13061407  if (isset($conf_UAM[24]) and $conf_UAM[24] <> '')
     
    13641465 
    13651466        $custom_txt = "";
     1467  $subject = "";
    13661468
    13671469// We have to get the user's language in database
     
    14011503  $result = pwg_db_fetch_assoc(pwg_query($query));
    14021504
    1403   $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('UAM_Validation of %s', stripslashes($result['username'])));
     1505  if (isset($conf_UAM[46]) and $conf_UAM[46] <> '')
     1506  {
     1507    // Management of Extension flags ([username], [mygallery])
     1508    // -------------------------------------------------------
     1509    $patterns[] = '#\[username\]#i';
     1510    $replacements[] = $username;
     1511    $patterns[] = '#\[mygallery\]#i';
     1512    $replacements[] = $conf['gallery_title'];
     1513
     1514    if (function_exists('get_user_language_desc'))
     1515    {
     1516      $subject = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM[46]))."\n\n";
     1517    }
     1518    else $subject = l10n(preg_replace($patterns, $replacements, $conf_UAM[46]))."\n\n";
     1519  }
    14041520     
    14051521  if (isset($conf_UAM[27]) and $conf_UAM[27] <> '')
Note: See TracChangeset for help on using the changeset viewer.